@opentelemetry/tracing
Advanced tools
Comparing version 0.10.3-alpha.34 to 0.10.3-alpha.35
@@ -44,2 +44,3 @@ import * as api from '@opentelemetry/api'; | ||
isRecording(): boolean; | ||
recordException(exception: api.Exception, time?: api.TimeInput): void; | ||
get duration(): api.HrTime; | ||
@@ -46,0 +47,0 @@ get ended(): boolean; |
@@ -21,2 +21,3 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
/** | ||
@@ -131,2 +132,30 @@ * This class represents a span. | ||
} | ||
recordException(exception, time = core_1.hrTime()) { | ||
const attributes = {}; | ||
if (typeof exception === 'string') { | ||
attributes[semantic_conventions_1.ExceptionAttribute.MESSAGE] = exception; | ||
} | ||
else if (exception) { | ||
if (exception.code) { | ||
attributes[semantic_conventions_1.ExceptionAttribute.TYPE] = exception.code; | ||
} | ||
else if (exception.name) { | ||
attributes[semantic_conventions_1.ExceptionAttribute.TYPE] = exception.name; | ||
} | ||
if (exception.message) { | ||
attributes[semantic_conventions_1.ExceptionAttribute.MESSAGE] = exception.message; | ||
} | ||
if (exception.stack) { | ||
attributes[semantic_conventions_1.ExceptionAttribute.STACKTRACE] = exception.stack; | ||
} | ||
} | ||
// these are minimum requirements from spec | ||
if (attributes[semantic_conventions_1.ExceptionAttribute.TYPE] || | ||
attributes[semantic_conventions_1.ExceptionAttribute.MESSAGE]) { | ||
this.addEvent(semantic_conventions_1.ExceptionEventName, attributes, time); | ||
} | ||
else { | ||
this._logger.warn(`Failed to record an exception ${exception}`); | ||
} | ||
} | ||
get duration() { | ||
@@ -133,0 +162,0 @@ return this._duration; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.10.3-alpha.34+fb06b5b"; | ||
export declare const VERSION = "0.10.3-alpha.35+2ee9f1a"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.10.3-alpha.34+fb06b5b'; | ||
exports.VERSION = '0.10.3-alpha.35+2ee9f1a'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/tracing", | ||
"version": "0.10.3-alpha.34+fb06b5b", | ||
"version": "0.10.3-alpha.35+2ee9f1a", | ||
"description": "OpenTelemetry Tracing", | ||
@@ -77,8 +77,9 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.10.3-alpha.34+fb06b5b", | ||
"@opentelemetry/api": "^0.10.3-alpha.35+2ee9f1a", | ||
"@opentelemetry/context-base": "^0.10.2", | ||
"@opentelemetry/core": "^0.10.3-alpha.34+fb06b5b", | ||
"@opentelemetry/resources": "^0.10.3-alpha.34+fb06b5b" | ||
"@opentelemetry/core": "^0.10.3-alpha.35+2ee9f1a", | ||
"@opentelemetry/resources": "^0.10.3-alpha.35+2ee9f1a", | ||
"@opentelemetry/semantic-conventions": "^0.10.3-alpha.35+2ee9f1a" | ||
}, | ||
"gitHead": "fb06b5bb1142286acf5b326925f3af3353aa9d90" | ||
"gitHead": "2ee9f1aaf7b61c4b4ae6b748f0a07f8fc708f07e" | ||
} |
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
89033
1378
5