@opentelemetry/tracing
Advanced tools
Comparing version 0.19.1-alpha.26 to 0.19.1-alpha.27
@@ -8,2 +8,8 @@ import { TracerProvider, TextMapPropagator } from '@opentelemetry/api'; | ||
export declare type EXPORTER_FACTORY = () => SpanExporter; | ||
export declare enum ForceFlushState { | ||
'resolved' = 0, | ||
'timeout' = 1, | ||
'error' = 2, | ||
'unresolved' = 3 | ||
} | ||
/** | ||
@@ -36,2 +42,3 @@ * This class represents a basic tracer provider which platform libraries can extend | ||
register(config?: SDKRegistrationConfig): void; | ||
forceFlush(): Promise<void>; | ||
shutdown(): Promise<void>; | ||
@@ -38,0 +45,0 @@ protected _getPropagator(name: string): TextMapPropagator | undefined; |
@@ -25,2 +25,9 @@ /* | ||
import { BatchSpanProcessor } from './export/BatchSpanProcessor'; | ||
export var ForceFlushState; | ||
(function (ForceFlushState) { | ||
ForceFlushState[ForceFlushState["resolved"] = 0] = "resolved"; | ||
ForceFlushState[ForceFlushState["timeout"] = 1] = "timeout"; | ||
ForceFlushState[ForceFlushState["error"] = 2] = "error"; | ||
ForceFlushState[ForceFlushState["unresolved"] = 3] = "unresolved"; | ||
})(ForceFlushState || (ForceFlushState = {})); | ||
/** | ||
@@ -97,2 +104,41 @@ * This class represents a basic tracer provider which platform libraries can extend | ||
}; | ||
BasicTracerProvider.prototype.forceFlush = function () { | ||
var timeout = this._config.forceFlushTimeoutMillis; | ||
var promises = this._registeredSpanProcessors.map(function (spanProcessor) { | ||
return new Promise(function (resolve) { | ||
var state; | ||
var timeoutInterval = setTimeout(function () { | ||
resolve(new Error("Span processor did not completed within timeout period of " + timeout + " ms")); | ||
state = ForceFlushState.timeout; | ||
}, timeout); | ||
spanProcessor | ||
.forceFlush() | ||
.then(function () { | ||
clearTimeout(timeoutInterval); | ||
if (state !== ForceFlushState.timeout) { | ||
state = ForceFlushState.resolved; | ||
resolve(state); | ||
} | ||
}) | ||
.catch(function (error) { | ||
clearTimeout(timeoutInterval); | ||
state = ForceFlushState.error; | ||
resolve(error); | ||
}); | ||
}); | ||
}); | ||
return new Promise(function (resolve, reject) { | ||
Promise.all(promises) | ||
.then(function (results) { | ||
var errors = results.filter(function (result) { return result !== ForceFlushState.resolved; }); | ||
if (errors.length > 0) { | ||
reject(errors); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
}) | ||
.catch(function (error) { return reject([error]); }); | ||
}); | ||
}; | ||
BasicTracerProvider.prototype.shutdown = function () { | ||
@@ -99,0 +145,0 @@ return this.activeSpanProcessor.shutdown(); |
@@ -11,2 +11,3 @@ import { Sampler } from '@opentelemetry/api'; | ||
sampler: Sampler; | ||
forceFlushTimeoutMillis: number; | ||
traceParams: { | ||
@@ -13,0 +14,0 @@ numberOfAttributesPerSpan: number; |
@@ -28,2 +28,3 @@ /* | ||
sampler: buildSamplerFromEnv(env), | ||
forceFlushTimeoutMillis: 30000, | ||
traceParams: { | ||
@@ -30,0 +31,0 @@ numberOfAttributesPerSpan: getEnv().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, |
@@ -22,2 +22,7 @@ import { TextMapPropagator, Sampler } from '@opentelemetry/api'; | ||
idGenerator?: IdGenerator; | ||
/** | ||
* How long the forceFlush can run before it is cancelled. | ||
* The default value is 30000ms | ||
*/ | ||
forceFlushTimeoutMillis?: number; | ||
} | ||
@@ -24,0 +29,0 @@ /** |
@@ -8,2 +8,3 @@ import { TracerConfig } from './types'; | ||
sampler: import("@opentelemetry/api").Sampler; | ||
forceFlushTimeoutMillis: number; | ||
traceParams: { | ||
@@ -10,0 +11,0 @@ numberOfAttributesPerSpan: number; |
@@ -8,2 +8,8 @@ import { TracerProvider, TextMapPropagator } from '@opentelemetry/api'; | ||
export declare type EXPORTER_FACTORY = () => SpanExporter; | ||
export declare enum ForceFlushState { | ||
'resolved' = 0, | ||
'timeout' = 1, | ||
'error' = 2, | ||
'unresolved' = 3 | ||
} | ||
/** | ||
@@ -36,2 +42,3 @@ * This class represents a basic tracer provider which platform libraries can extend | ||
register(config?: SDKRegistrationConfig): void; | ||
forceFlush(): Promise<void>; | ||
shutdown(): Promise<void>; | ||
@@ -38,0 +45,0 @@ protected _getPropagator(name: string): TextMapPropagator | undefined; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BasicTracerProvider = void 0; | ||
exports.BasicTracerProvider = exports.ForceFlushState = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
@@ -29,2 +29,9 @@ const core_1 = require("@opentelemetry/core"); | ||
const BatchSpanProcessor_1 = require("./export/BatchSpanProcessor"); | ||
var ForceFlushState; | ||
(function (ForceFlushState) { | ||
ForceFlushState[ForceFlushState["resolved"] = 0] = "resolved"; | ||
ForceFlushState[ForceFlushState["timeout"] = 1] = "timeout"; | ||
ForceFlushState[ForceFlushState["error"] = 2] = "error"; | ||
ForceFlushState[ForceFlushState["unresolved"] = 3] = "unresolved"; | ||
})(ForceFlushState = exports.ForceFlushState || (exports.ForceFlushState = {})); | ||
/** | ||
@@ -97,2 +104,41 @@ * This class represents a basic tracer provider which platform libraries can extend | ||
} | ||
forceFlush() { | ||
const timeout = this._config.forceFlushTimeoutMillis; | ||
const promises = this._registeredSpanProcessors.map((spanProcessor) => { | ||
return new Promise(resolve => { | ||
let state; | ||
const timeoutInterval = setTimeout(() => { | ||
resolve(new Error(`Span processor did not completed within timeout period of ${timeout} ms`)); | ||
state = ForceFlushState.timeout; | ||
}, timeout); | ||
spanProcessor | ||
.forceFlush() | ||
.then(() => { | ||
clearTimeout(timeoutInterval); | ||
if (state !== ForceFlushState.timeout) { | ||
state = ForceFlushState.resolved; | ||
resolve(state); | ||
} | ||
}) | ||
.catch(error => { | ||
clearTimeout(timeoutInterval); | ||
state = ForceFlushState.error; | ||
resolve(error); | ||
}); | ||
}); | ||
}); | ||
return new Promise((resolve, reject) => { | ||
Promise.all(promises) | ||
.then(results => { | ||
const errors = results.filter(result => result !== ForceFlushState.resolved); | ||
if (errors.length > 0) { | ||
reject(errors); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
}) | ||
.catch(error => reject([error])); | ||
}); | ||
} | ||
shutdown() { | ||
@@ -99,0 +145,0 @@ return this.activeSpanProcessor.shutdown(); |
@@ -11,2 +11,3 @@ import { Sampler } from '@opentelemetry/api'; | ||
sampler: Sampler; | ||
forceFlushTimeoutMillis: number; | ||
traceParams: { | ||
@@ -13,0 +14,0 @@ numberOfAttributesPerSpan: number; |
@@ -31,2 +31,3 @@ "use strict"; | ||
sampler: buildSamplerFromEnv(env), | ||
forceFlushTimeoutMillis: 30000, | ||
traceParams: { | ||
@@ -33,0 +34,0 @@ numberOfAttributesPerSpan: core_1.getEnv().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, |
@@ -22,2 +22,7 @@ import { TextMapPropagator, Sampler } from '@opentelemetry/api'; | ||
idGenerator?: IdGenerator; | ||
/** | ||
* How long the forceFlush can run before it is cancelled. | ||
* The default value is 30000ms | ||
*/ | ||
forceFlushTimeoutMillis?: number; | ||
} | ||
@@ -24,0 +29,0 @@ /** |
@@ -8,2 +8,3 @@ import { TracerConfig } from './types'; | ||
sampler: import("@opentelemetry/api").Sampler; | ||
forceFlushTimeoutMillis: number; | ||
traceParams: { | ||
@@ -10,0 +11,0 @@ numberOfAttributesPerSpan: number; |
{ | ||
"name": "@opentelemetry/tracing", | ||
"version": "0.19.1-alpha.26+1758fa6e", | ||
"version": "0.19.1-alpha.27+68852780", | ||
"description": "OpenTelemetry Tracing", | ||
@@ -85,8 +85,8 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opentelemetry/core": "^0.19.1-alpha.26+1758fa6e", | ||
"@opentelemetry/resources": "^0.19.1-alpha.26+1758fa6e", | ||
"@opentelemetry/core": "^0.19.0", | ||
"@opentelemetry/resources": "^0.19.0", | ||
"@opentelemetry/semantic-conventions": "^0.19.0", | ||
"lodash.merge": "^4.6.2" | ||
}, | ||
"gitHead": "1758fa6e84333c9c43cc468c5e99dd3646f7e3c7" | ||
"gitHead": "68852780eb2b65cc4bf492f020ad48a9af96a4e9" | ||
} |
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
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
202647
3320
+ Added@opentelemetry/core@0.19.0(transitive)
+ Added@opentelemetry/resources@0.19.0(transitive)
- Removed@opentelemetry/api@0.20.0(transitive)
- Removed@opentelemetry/core@0.19.1-alpha.43(transitive)
- Removed@opentelemetry/resources@0.19.1-alpha.43(transitive)
- Removed@opentelemetry/semantic-conventions@0.19.1-alpha.43(transitive)
Updated@opentelemetry/core@^0.19.0