@instana/core
Advanced tools
Comparing version 2.25.1 to 2.25.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.25.2](https://github.com/instana/nodejs/compare/v2.25.1...v2.25.2) (2023-06-22) | ||
### Bug Fixes | ||
* **sdk:** do not overwrite span.ec after it has been set via the SDK ([4283cdf](https://github.com/instana/nodejs/commit/4283cdf962505d5471d3b849137f36a7134ae740)) | ||
## [2.25.1](https://github.com/instana/nodejs/compare/v2.25.0...v2.25.1) (2023-06-19) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@instana/core", | ||
"version": "2.25.1", | ||
"version": "2.25.2", | ||
"description": "Core library for Instana's Node.js packages", | ||
@@ -143,3 +143,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "70cd4c4260eb2d14506533305c427b3f839c97f8" | ||
"gitHead": "75ea06746e1c37f284a91fe40366b851c9f8452d" | ||
} |
@@ -65,2 +65,4 @@ /* | ||
* @property {number} [ec] error count | ||
* @property {number} [_ec] internal property for error count | ||
* @property {boolean} [ecHasBeenSetManually] whether the error count has been set manually via the SDK | ||
* @property {number} [ts] timestamp | ||
@@ -105,3 +107,28 @@ * @property {number} [d] duration | ||
} | ||
this.ec = 0; | ||
// The property span.ec is defined with a getter/setter instead of being a plain property. We need to be able to | ||
// prohibit overwriting span.ec from auto-tracing instrumentations after it has been set manually via the | ||
// SDK (spanHandle.markAsErroneous). | ||
Object.defineProperty(this, '_ec', { | ||
value: 0, | ||
writable: true, | ||
enumerable: false | ||
}); | ||
Object.defineProperty(this, 'ec', { | ||
get() { | ||
return this._ec; | ||
}, | ||
set(value) { | ||
if (!this.ecHasBeenSetManually) { | ||
this._ec = value; | ||
} | ||
}, | ||
enumerable: true | ||
}); | ||
Object.defineProperty(this, 'ecHasBeenSetManually', { | ||
value: false, | ||
writable: true, | ||
enumerable: false | ||
}); | ||
this.ts = Date.now(); | ||
@@ -108,0 +135,0 @@ this.d = 0; |
@@ -173,2 +173,9 @@ /* | ||
function finishSpan() { | ||
if (span.transmitted) { | ||
// We listen to multiple events like aborted, finish and close. In some scenarios, finishSpan will be called | ||
// multiple times. However, if the span has already been transmitted to the agent, we do not need to do | ||
// anything here, it has been taken care of by an earlier invocation of finishSpan. | ||
return; | ||
} | ||
// Always capture duration and HTTP response details, no matter if a higher level instrumentation | ||
@@ -175,0 +182,0 @@ // (like graphql.server) has modified the span or not. |
@@ -26,2 +26,1 @@ /* | ||
}; | ||
//# sourceMappingURL=invalid-span-constants.js.map |
@@ -25,2 +25,1 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
})((TraceFlags = exports.TraceFlags || (exports.TraceFlags = {}))); | ||
//# sourceMappingURL=trace_flags.js.map |
@@ -225,3 +225,7 @@ /* | ||
) { | ||
this.span.ec = 1; | ||
// We deliberately write directly to the protected property span._ec instead of span.ec here to circumvent the write | ||
// protection established by ecHasBeenSetManually. A direct manual write via the SDK always has priority over anything | ||
// else that has potentially written before (even other earlier markAsErroneous/markAsNonErroneous calls). | ||
this.span._ec = 1; | ||
this.span.ecHasBeenSetManually = true; | ||
this._annotateErrorMessage(errorMessage, errorMessagePath); | ||
@@ -238,3 +242,8 @@ }; | ||
SpanHandle.prototype.markAsNonErroneous = function markAsNonErroneous(errorMessagePath) { | ||
this.span.ec = 0; | ||
// We deliberately write directly to the protected property span._ec instead of span.ec here to circumvent the write | ||
// protection established by ecHasBeenSetManually. A direct manual write via the SDK always has priority over anything | ||
// else that has potentially written before (even other earlier markAsErroneous/markAsNonErroneous calls). | ||
this.span._ec = 0; | ||
this.span.ecHasBeenSetManually = true; | ||
// reset the error message as well | ||
@@ -241,0 +250,0 @@ this._annotateErrorMessage(undefined, errorMessagePath); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
751007
19700