@opentelemetry/api
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -50,4 +50,7 @@ /* | ||
TraceAPI.prototype.setGlobalTracerProvider = function (provider) { | ||
this._proxyTracerProvider.setDelegate(provider); | ||
return registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance()); | ||
var success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance()); | ||
if (success) { | ||
this._proxyTracerProvider.setDelegate(provider); | ||
} | ||
return success; | ||
}; | ||
@@ -54,0 +57,0 @@ /** |
@@ -17,3 +17,3 @@ /* | ||
import { VERSION } from '../version'; | ||
var re = /^(\d+)\.(\d+)\.(\d+)(?:-(.*))?$/; | ||
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/; | ||
/** | ||
@@ -47,3 +47,10 @@ * Create a function to test an API version to see if it is compatible with the provided ownVersion. | ||
patch: +myVersionMatch[3], | ||
prerelease: myVersionMatch[4], | ||
}; | ||
// if ownVersion has a prerelease tag, versions must match exactly | ||
if (ownVersionParsed.prerelease != null) { | ||
return function isExactmatch(globalVersion) { | ||
return globalVersion === ownVersion; | ||
}; | ||
} | ||
function _reject(v) { | ||
@@ -74,3 +81,8 @@ rejectedVersions.add(v); | ||
patch: +globalVersionMatch[3], | ||
prerelease: globalVersionMatch[4], | ||
}; | ||
// if globalVersion has a prerelease tag, versions must match exactly | ||
if (globalVersionParsed.prerelease != null) { | ||
return _reject(globalVersion); | ||
} | ||
// major versions must match | ||
@@ -77,0 +89,0 @@ if (ownVersionParsed.major !== globalVersionParsed.major) { |
@@ -17,2 +17,3 @@ /* | ||
import { NoopTracer } from './NoopTracer'; | ||
var NOOP_TRACER = new NoopTracer(); | ||
/** | ||
@@ -44,3 +45,3 @@ * Proxy tracer provided by the proxy tracer provider | ||
if (!tracer) { | ||
return new NoopTracer(); | ||
return NOOP_TRACER; | ||
} | ||
@@ -47,0 +48,0 @@ this._delegate = tracer; |
@@ -35,32 +35,33 @@ import { Context } from '../context/types'; | ||
* @example | ||
* const something = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* span.setStatus({code: SpanStatusCode.OK}); | ||
* return something; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } finally { | ||
* span.end(); | ||
* } | ||
* }); | ||
* const something = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* span.setStatus({code: SpanStatusCode.OK}); | ||
* return something; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } finally { | ||
* span.end(); | ||
* } | ||
* }); | ||
* | ||
* @example | ||
* const span = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* return span; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } | ||
* }); | ||
* do some more work | ||
* span.end(); | ||
* const span = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* return span; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } | ||
* }); | ||
* do some more work | ||
* span.end(); | ||
*/ | ||
@@ -67,0 +68,0 @@ startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.1"; | ||
export declare const VERSION = "1.0.2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '1.0.1'; | ||
export var VERSION = '1.0.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -53,4 +53,7 @@ "use strict"; | ||
TraceAPI.prototype.setGlobalTracerProvider = function (provider) { | ||
this._proxyTracerProvider.setDelegate(provider); | ||
return global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance()); | ||
var success = global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance()); | ||
if (success) { | ||
this._proxyTracerProvider.setDelegate(provider); | ||
} | ||
return success; | ||
}; | ||
@@ -57,0 +60,0 @@ /** |
@@ -20,3 +20,3 @@ "use strict"; | ||
var version_1 = require("../version"); | ||
var re = /^(\d+)\.(\d+)\.(\d+)(?:-(.*))?$/; | ||
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/; | ||
/** | ||
@@ -50,3 +50,10 @@ * Create a function to test an API version to see if it is compatible with the provided ownVersion. | ||
patch: +myVersionMatch[3], | ||
prerelease: myVersionMatch[4], | ||
}; | ||
// if ownVersion has a prerelease tag, versions must match exactly | ||
if (ownVersionParsed.prerelease != null) { | ||
return function isExactmatch(globalVersion) { | ||
return globalVersion === ownVersion; | ||
}; | ||
} | ||
function _reject(v) { | ||
@@ -77,3 +84,8 @@ rejectedVersions.add(v); | ||
patch: +globalVersionMatch[3], | ||
prerelease: globalVersionMatch[4], | ||
}; | ||
// if globalVersion has a prerelease tag, versions must match exactly | ||
if (globalVersionParsed.prerelease != null) { | ||
return _reject(globalVersion); | ||
} | ||
// major versions must match | ||
@@ -80,0 +92,0 @@ if (ownVersionParsed.major !== globalVersionParsed.major) { |
@@ -20,2 +20,3 @@ "use strict"; | ||
var NoopTracer_1 = require("./NoopTracer"); | ||
var NOOP_TRACER = new NoopTracer_1.NoopTracer(); | ||
/** | ||
@@ -47,3 +48,3 @@ * Proxy tracer provided by the proxy tracer provider | ||
if (!tracer) { | ||
return new NoopTracer_1.NoopTracer(); | ||
return NOOP_TRACER; | ||
} | ||
@@ -50,0 +51,0 @@ this._delegate = tracer; |
@@ -35,32 +35,33 @@ import { Context } from '../context/types'; | ||
* @example | ||
* const something = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* span.setStatus({code: SpanStatusCode.OK}); | ||
* return something; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } finally { | ||
* span.end(); | ||
* } | ||
* }); | ||
* const something = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* span.setStatus({code: SpanStatusCode.OK}); | ||
* return something; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } finally { | ||
* span.end(); | ||
* } | ||
* }); | ||
* | ||
* @example | ||
* const span = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* return span; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } | ||
* }); | ||
* do some more work | ||
* span.end(); | ||
* const span = tracer.startActiveSpan('op', span => { | ||
* try { | ||
* do some work | ||
* return span; | ||
* } catch (err) { | ||
* span.setStatus({ | ||
* code: SpanStatusCode.ERROR, | ||
* message: err.message, | ||
* }); | ||
* throw err; | ||
* } | ||
* }); | ||
* do some more work | ||
* span.end(); | ||
*/ | ||
@@ -67,0 +68,0 @@ startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.1"; | ||
export declare const VERSION = "1.0.2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '1.0.1'; | ||
exports.VERSION = '1.0.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,2 +5,27 @@ # CHANGELOG | ||
## 1.0.2 | ||
### :bug: Bug Fix | ||
* [#105](https://github.com/open-telemetry/opentelemetry-js-api/pull/105) fix: set delegate after successful registration ([@Flarna](https://github.com/Flarna)) | ||
* [#94](https://github.com/open-telemetry/opentelemetry-js-api/pull/94) fix: enforce strict equality on prerelease versions ([@dyladan](https://github.com/dyladan)) | ||
### :memo: Documentation | ||
* [#106](https://github.com/open-telemetry/opentelemetry-js-api/pull/106) docs: fix crash in README example ([@trentm](https://github.com/trentm)) | ||
* [#101](https://github.com/open-telemetry/opentelemetry-js-api/pull/101) docs: Format example for tracer.startActiveSpan ([@ad-m](https://github.com/ad-m)) | ||
* [#99](https://github.com/open-telemetry/opentelemetry-js-api/pull/99) chore: fix link to API docs ([@dyladan](https://github.com/dyladan)) | ||
### :house: Internal | ||
* [#109](https://github.com/open-telemetry/opentelemetry-js-api/pull/109) internal: add missing approvers from core ([@dyladan](https://github.com/dyladan)) | ||
* [#103](https://github.com/open-telemetry/opentelemetry-js-api/pull/103) chore: reuse NoopTracer in ProxyTracer ([@Flarna](https://github.com/Flarna)) | ||
### Committers: 4 | ||
* Adam Dobrawy ([@ad-m](https://github.com/ad-m)) | ||
* Daniel Dyla ([@dyladan](https://github.com/dyladan)) | ||
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna)) | ||
* Trent Mick ([@trentm](https://github.com/trentm)) | ||
## 1.0.1 | ||
@@ -7,0 +32,0 @@ |
{ | ||
"name": "@opentelemetry/api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Public API for OpenTelemetry", | ||
@@ -59,9 +59,9 @@ "main": "build/src/index.js", | ||
"@types/mocha": "8.2.2", | ||
"@types/node": "14.17.1", | ||
"@types/node": "14.17.4", | ||
"@types/sinon": "10.0.2", | ||
"@types/webpack-env": "1.16.0", | ||
"@typescript-eslint/eslint-plugin": "4.26.0", | ||
"@typescript-eslint/parser": "4.26.0", | ||
"@typescript-eslint/eslint-plugin": "4.28.1", | ||
"@typescript-eslint/parser": "4.28.1", | ||
"codecov": "3.8.2", | ||
"eslint": "7.28.0", | ||
"eslint": "7.30.0", | ||
"eslint-plugin-header": "3.1.1", | ||
@@ -85,6 +85,6 @@ "eslint-plugin-import": "2.23.4", | ||
"ts-mocha": "8.0.0", | ||
"typedoc": "0.21.0-beta.1", | ||
"typescript": "4.3.2", | ||
"typedoc": "0.21.2", | ||
"typescript": "4.3.5", | ||
"webpack": "4.46.0" | ||
} | ||
} |
@@ -5,3 +5,3 @@ | ||
<strong> | ||
<a href="https://open-telemetry.github.io/opentelemetry-js">API Documentation<a/> | ||
<a href="https://open-telemetry.github.io/opentelemetry-js-api">API Documentation<a/> | ||
• | ||
@@ -91,3 +91,2 @@ <a href="https://github.com/open-telemetry/opentelemetry-js/discussions">Getting In Touch (GitHub Discussions)<a/> | ||
span.end(); | ||
return output; | ||
} | ||
@@ -94,0 +93,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
369470
6751
147