@opentelemetry/tracing
Advanced tools
Comparing version 0.11.0 to 0.11.1-alpha.15
@@ -33,5 +33,5 @@ import * as api from '@opentelemetry/api'; | ||
register(config?: SDKRegistrationConfig): void; | ||
shutdown(cb?: () => void): void; | ||
shutdown(): Promise<void>; | ||
private _shutdownActiveProcessor; | ||
} | ||
//# sourceMappingURL=BasicTracerProvider.d.ts.map |
@@ -84,4 +84,3 @@ "use strict"; | ||
} | ||
shutdown(cb = () => { }) { | ||
this.activeSpanProcessor.shutdown(cb); | ||
shutdown() { | ||
if (this._cleanNotifyOnGlobalShutdown) { | ||
@@ -91,5 +90,6 @@ this._cleanNotifyOnGlobalShutdown(); | ||
} | ||
return this.activeSpanProcessor.shutdown(); | ||
} | ||
_shutdownActiveProcessor() { | ||
this.activeSpanProcessor.shutdown(); | ||
return this.activeSpanProcessor.shutdown(); | ||
} | ||
@@ -96,0 +96,0 @@ } |
@@ -16,7 +16,8 @@ import { SpanProcessor } from '../SpanProcessor'; | ||
private _isShutdown; | ||
private _shuttingDownPromise; | ||
constructor(_exporter: SpanExporter, config?: BufferConfig); | ||
forceFlush(cb?: () => void): void; | ||
forceFlush(): Promise<void>; | ||
onStart(span: ReadableSpan): void; | ||
onEnd(span: ReadableSpan): void; | ||
shutdown(cb?: () => void): void; | ||
shutdown(): Promise<void>; | ||
/** Add a span in the buffer. */ | ||
@@ -23,0 +24,0 @@ private _addToBuffer; |
@@ -32,2 +32,3 @@ "use strict"; | ||
this._isShutdown = false; | ||
this._shuttingDownPromise = Promise.resolve(); | ||
this._bufferSize = | ||
@@ -40,8 +41,7 @@ config && config.bufferSize ? config.bufferSize : DEFAULT_BUFFER_SIZE; | ||
} | ||
forceFlush(cb = () => { }) { | ||
forceFlush() { | ||
if (this._isShutdown) { | ||
setTimeout(cb, 0); | ||
return; | ||
return this._shuttingDownPromise; | ||
} | ||
this._flush(cb); | ||
return this._flush(); | ||
} | ||
@@ -56,10 +56,21 @@ // does nothing. | ||
} | ||
shutdown(cb = () => { }) { | ||
shutdown() { | ||
if (this._isShutdown) { | ||
setTimeout(cb, 0); | ||
return; | ||
return this._shuttingDownPromise; | ||
} | ||
this.forceFlush(cb); | ||
this._isShutdown = true; | ||
this._exporter.shutdown(); | ||
this._shuttingDownPromise = new Promise((resolve, reject) => { | ||
Promise.resolve() | ||
.then(() => { | ||
return this._flush(); | ||
}) | ||
.then(() => { | ||
return this._exporter.shutdown(); | ||
}) | ||
.then(resolve) | ||
.catch(e => { | ||
reject(e); | ||
}); | ||
}); | ||
return this._shuttingDownPromise; | ||
} | ||
@@ -75,13 +86,21 @@ /** Add a span in the buffer. */ | ||
/** Send the span data list to exporter */ | ||
_flush(cb = () => { }) { | ||
_flush() { | ||
this._clearTimer(); | ||
if (this._finishedSpans.length === 0) { | ||
setTimeout(cb, 0); | ||
return; | ||
return Promise.resolve(); | ||
} | ||
// prevent downstream exporter calls from generating spans | ||
api_1.context.with(core_1.suppressInstrumentation(api_1.context.active()), () => { | ||
this._exporter.export(this._finishedSpans, cb); | ||
return new Promise((resolve, reject) => { | ||
// prevent downstream exporter calls from generating spans | ||
api_1.context.with(core_1.suppressInstrumentation(api_1.context.active()), () => { | ||
this._exporter.export(this._finishedSpans, result => { | ||
this._finishedSpans = []; | ||
if (result === core_1.ExportResult.SUCCESS) { | ||
resolve(); | ||
} | ||
else { | ||
reject(result); | ||
} | ||
}); | ||
}); | ||
}); | ||
this._finishedSpans = []; | ||
} | ||
@@ -92,3 +111,3 @@ _maybeStartTimer() { | ||
this._timer = setTimeout(() => { | ||
this._flush(); | ||
this._flush().catch(); | ||
}, this._bufferTimeout); | ||
@@ -95,0 +114,0 @@ core_1.unrefTimer(this._timer); |
@@ -18,3 +18,3 @@ import { SpanExporter } from './SpanExporter'; | ||
*/ | ||
shutdown(): void; | ||
shutdown(): Promise<void>; | ||
/** | ||
@@ -21,0 +21,0 @@ * converts span info into more readable format |
@@ -37,3 +37,4 @@ "use strict"; | ||
shutdown() { | ||
return this._sendSpans([]); | ||
this._sendSpans([]); | ||
return Promise.resolve(); | ||
} | ||
@@ -40,0 +41,0 @@ /** |
@@ -17,3 +17,3 @@ import { SpanExporter } from './SpanExporter'; | ||
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void; | ||
shutdown(): void; | ||
shutdown(): Promise<void>; | ||
reset(): void; | ||
@@ -20,0 +20,0 @@ getFinishedSpans(): ReadableSpan[]; |
@@ -43,2 +43,3 @@ "use strict"; | ||
this._finishedSpans = []; | ||
return Promise.resolve(); | ||
} | ||
@@ -45,0 +46,0 @@ reset() { |
@@ -14,7 +14,8 @@ import { SpanProcessor } from '../SpanProcessor'; | ||
private _isShutdown; | ||
forceFlush(cb?: () => void): void; | ||
private _shuttingDownPromise; | ||
forceFlush(): Promise<void>; | ||
onStart(span: ReadableSpan): void; | ||
onEnd(span: ReadableSpan): void; | ||
shutdown(cb?: () => void): void; | ||
shutdown(): Promise<void>; | ||
} | ||
//# sourceMappingURL=SimpleSpanProcessor.d.ts.map |
@@ -31,6 +31,7 @@ "use strict"; | ||
this._isShutdown = false; | ||
this._shuttingDownPromise = Promise.resolve(); | ||
} | ||
forceFlush(cb = () => { }) { | ||
forceFlush() { | ||
// do nothing as all spans are being exported without waiting | ||
setTimeout(cb, 0); | ||
return Promise.resolve(); | ||
} | ||
@@ -48,10 +49,18 @@ // does nothing. | ||
} | ||
shutdown(cb = () => { }) { | ||
shutdown() { | ||
if (this._isShutdown) { | ||
setTimeout(cb, 0); | ||
return; | ||
return this._shuttingDownPromise; | ||
} | ||
this._isShutdown = true; | ||
this._exporter.shutdown(); | ||
setTimeout(cb, 0); | ||
this._shuttingDownPromise = new Promise((resolve, reject) => { | ||
Promise.resolve() | ||
.then(() => { | ||
return this._exporter.shutdown(); | ||
}) | ||
.then(resolve) | ||
.catch(e => { | ||
reject(e); | ||
}); | ||
}); | ||
return this._shuttingDownPromise; | ||
} | ||
@@ -58,0 +67,0 @@ } |
@@ -17,4 +17,4 @@ import { ExportResult } from '@opentelemetry/core'; | ||
/** Stops the exporter. */ | ||
shutdown(): void; | ||
shutdown(): Promise<void>; | ||
} | ||
//# sourceMappingURL=SpanExporter.d.ts.map |
@@ -10,7 +10,7 @@ import { SpanProcessor } from './SpanProcessor'; | ||
constructor(_spanProcessors: SpanProcessor[]); | ||
forceFlush(cb?: () => void): void; | ||
forceFlush(): Promise<void>; | ||
onStart(span: ReadableSpan): void; | ||
onEnd(span: ReadableSpan): void; | ||
shutdown(cb?: () => void): void; | ||
shutdown(): Promise<void>; | ||
} | ||
//# sourceMappingURL=MultiSpanProcessor.d.ts.map |
@@ -27,12 +27,12 @@ "use strict"; | ||
} | ||
forceFlush(cb = () => { }) { | ||
let finished = 0; | ||
const total = this._spanProcessors.length; | ||
forceFlush() { | ||
const promises = []; | ||
for (const spanProcessor of this._spanProcessors) { | ||
spanProcessor.forceFlush(() => { | ||
if (++finished === total) { | ||
cb(); | ||
} | ||
}); | ||
promises.push(spanProcessor.forceFlush()); | ||
} | ||
return new Promise((resolve, reject) => { | ||
Promise.all(promises).then(() => { | ||
resolve(); | ||
}, reject); | ||
}); | ||
} | ||
@@ -49,12 +49,12 @@ onStart(span) { | ||
} | ||
shutdown(cb = () => { }) { | ||
let finished = 0; | ||
const total = this._spanProcessors.length; | ||
shutdown() { | ||
const promises = []; | ||
for (const spanProcessor of this._spanProcessors) { | ||
spanProcessor.shutdown(() => { | ||
if (++finished === total) { | ||
cb(); | ||
} | ||
}); | ||
promises.push(spanProcessor.shutdown()); | ||
} | ||
return new Promise((resolve, reject) => { | ||
Promise.all(promises).then(() => { | ||
resolve(); | ||
}, reject); | ||
}); | ||
} | ||
@@ -61,0 +61,0 @@ } |
@@ -7,5 +7,5 @@ import { SpanProcessor } from './SpanProcessor'; | ||
onEnd(span: ReadableSpan): void; | ||
shutdown(cb?: () => unknown): void; | ||
forceFlush(cb?: () => unknown): void; | ||
shutdown(): Promise<void>; | ||
forceFlush(): Promise<void>; | ||
} | ||
//# sourceMappingURL=NoopSpanProcessor.d.ts.map |
@@ -23,7 +23,7 @@ "use strict"; | ||
onEnd(span) { } | ||
shutdown(cb = () => { }) { | ||
setTimeout(cb, 0); | ||
shutdown() { | ||
return Promise.resolve(); | ||
} | ||
forceFlush(cb = () => { }) { | ||
setTimeout(cb, 0); | ||
forceFlush() { | ||
return Promise.resolve(); | ||
} | ||
@@ -30,0 +30,0 @@ } |
@@ -10,3 +10,3 @@ import { ReadableSpan } from './export/ReadableSpan'; | ||
*/ | ||
forceFlush(callback: () => void): void; | ||
forceFlush(): Promise<void>; | ||
/** | ||
@@ -28,4 +28,4 @@ * Called when a {@link ReadableSpan} is started, if the `span.isRecording()` | ||
*/ | ||
shutdown(callback: () => void): void; | ||
shutdown(): Promise<void>; | ||
} | ||
//# sourceMappingURL=SpanProcessor.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.11.0"; | ||
export declare const VERSION = "0.11.1-alpha.15+e170039"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.11.0'; | ||
exports.VERSION = '0.11.1-alpha.15+e170039'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/tracing", | ||
"version": "0.11.0", | ||
"version": "0.11.1-alpha.15+e170039", | ||
"description": "OpenTelemetry Tracing", | ||
@@ -77,9 +77,9 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.11.0", | ||
"@opentelemetry/api": "^0.11.1-alpha.15+e170039", | ||
"@opentelemetry/context-base": "^0.11.0", | ||
"@opentelemetry/core": "^0.11.0", | ||
"@opentelemetry/resources": "^0.11.0", | ||
"@opentelemetry/core": "^0.11.1-alpha.15+e170039", | ||
"@opentelemetry/resources": "^0.11.1-alpha.15+e170039", | ||
"@opentelemetry/semantic-conventions": "^0.11.0" | ||
}, | ||
"gitHead": "15174c6647ab9863dfc1424412fa60f2fddb3351" | ||
"gitHead": "e170039015e8a1a7419bb835a00659b2a734b8a6" | ||
} |
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
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
92287
1431
+ Added@opentelemetry/api@0.11.1-alpha.53(transitive)
+ Added@opentelemetry/core@0.11.1-alpha.53(transitive)
+ Added@opentelemetry/resources@0.11.1-alpha.53(transitive)
- Removed@opentelemetry/api@0.11.0(transitive)
- Removed@opentelemetry/core@0.11.0(transitive)
- Removed@opentelemetry/resources@0.11.0(transitive)