Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/tracing

Package Overview
Dependencies
Maintainers
4
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/tracing - npm Package Compare versions

Comparing version 0.19.1-alpha.26 to 0.19.1-alpha.27

7

build/esm/BasicTracerProvider.d.ts

@@ -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();

1

build/esm/config.d.ts

@@ -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;

8

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc