@appsignal/nodejs
Advanced tools
Comparing version 1.0.5 to 1.1.0
# Changelog | ||
## 1.1.0 | ||
- Fix memory leak when creating child spans by passing around span reference instead of id strings (#351) | ||
- Pass options to child span via `span.child()` helper by adding optional `options` argument | ||
- Bumped agent to 1332013 | ||
- Dependency bumps | ||
## 1.0.5 | ||
@@ -4,0 +10,0 @@ - Allow spans to be created with a startTime (#340) |
@@ -16,3 +16,3 @@ import { NodeClient, Metrics, Plugin, Tracer } from "@appsignal/types"; | ||
#private; | ||
readonly VERSION = "1.0.5"; | ||
readonly VERSION = "1.1.0"; | ||
config: Configuration; | ||
@@ -19,0 +19,0 @@ agent: Agent; |
@@ -12,3 +12,3 @@ import { NodeSpan, NodeSpanOptions, SpanContext, HashMap, HashMapValue } from "@appsignal/types"; | ||
export declare class BaseSpan implements NodeSpan { | ||
protected _ref: any; | ||
protected _ref: unknown; | ||
/** | ||
@@ -23,5 +23,13 @@ * The current ID of the trace. | ||
/** | ||
* The pointer to the span. This is used by the agent to locate the span | ||
* when passed by the extension. | ||
* | ||
* Note that although this property is public, it should not be accessed or | ||
* mutated. | ||
*/ | ||
ref(): unknown; | ||
/** | ||
* Returns a new `Span` object that is a child of the current `Span`. | ||
*/ | ||
child(): ChildSpan; | ||
child(options?: Partial<NodeSpanOptions>): ChildSpan; | ||
/** | ||
@@ -28,0 +36,0 @@ * Sets arbitrary data on the current `Span`. |
@@ -30,7 +30,16 @@ "use strict"; | ||
/** | ||
* The pointer to the span. This is used by the agent to locate the span | ||
* when passed by the extension. | ||
* | ||
* Note that although this property is public, it should not be accessed or | ||
* mutated. | ||
*/ | ||
ref() { | ||
return this._ref; | ||
} | ||
/** | ||
* Returns a new `Span` object that is a child of the current `Span`. | ||
*/ | ||
child() { | ||
const { traceId, spanId } = this; | ||
return new ChildSpan({ traceId, spanId }); | ||
child(options) { | ||
return new ChildSpan(this, options); | ||
} | ||
@@ -153,10 +162,16 @@ /** | ||
class ChildSpan extends BaseSpan { | ||
constructor({ traceId, spanId }, { startTime } = {}) { | ||
constructor(spanOrContext, { startTime } = {}) { | ||
super(); | ||
if (startTime) { | ||
const { sec, nsec } = utils_1.getAgentTimestamps(startTime); | ||
this._ref = extension_1.span.createChildSpanWithTimestamp(traceId, spanId, sec, nsec); | ||
if (spanOrContext instanceof BaseSpan) { | ||
if (startTime) { | ||
const { sec, nsec } = utils_1.getAgentTimestamps(startTime); | ||
this._ref = extension_1.span.createChildSpanWithTimestamp(spanOrContext.ref(), sec, nsec); | ||
} | ||
else { | ||
this._ref = extension_1.span.createChildSpan(spanOrContext.ref()); | ||
} | ||
} | ||
else { | ||
this._ref = extension_1.span.createChildSpan(traceId, spanId); | ||
const { traceId, spanId } = spanOrContext; | ||
this._ref = extension_1.span.createSpanFromTraceparent(`00-${traceId}-${spanId}-00`); | ||
} | ||
@@ -163,0 +178,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.5"; | ||
export declare const AGENT_VERSION = "c55fb2c"; | ||
export declare const VERSION = "1.1.0"; | ||
export declare const AGENT_VERSION = "1332013"; |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Do not touch this file, auto-generated by scripts/create-versionfile | ||
exports.VERSION = "1.0.5"; | ||
exports.AGENT_VERSION = "c55fb2c"; | ||
exports.VERSION = "1.1.0"; | ||
exports.AGENT_VERSION = "1332013"; |
{ | ||
"name": "@appsignal/nodejs", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"main": "dist/index", | ||
@@ -12,3 +12,3 @@ "types": "dist/index", | ||
"@appsignal/core": "^1.1.3", | ||
"@appsignal/types": "^2.0.1", | ||
"@appsignal/types": "^2.0.2", | ||
"require-in-the-middle": "^5.0.3", | ||
@@ -20,3 +20,3 @@ "semver": "^7.3.4", | ||
"optionalDependencies": { | ||
"@appsignal/nodejs-ext": "^1.0.5" | ||
"@appsignal/nodejs-ext": "^1.1.0" | ||
}, | ||
@@ -40,3 +40,3 @@ "scripts": { | ||
}, | ||
"gitHead": "9dbc7e6c8d7dc98f006a9056f8486c6749e01209" | ||
"gitHead": "72fc187fe60841e9b789162ce14716454b54b375" | ||
} |
325049
2676
Updated@appsignal/types@^2.0.2