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.12.1-alpha.54 to 0.13.0

3

build/src/BasicTracerProvider.d.ts
import * as api from '@opentelemetry/api';
import { SpanProcessor, Tracer } from '.';
import { NoopSpanProcessor } from './NoopSpanProcessor';
import { SDKRegistrationConfig, TracerConfig } from './types';

@@ -13,3 +12,3 @@ import { Resource } from '@opentelemetry/resources';

private readonly _tracers;
activeSpanProcessor: NoopSpanProcessor;
activeSpanProcessor: SpanProcessor;
readonly logger: api.Logger;

@@ -16,0 +15,0 @@ readonly resource: Resource;

import { AlwaysOnSampler } from '@opentelemetry/core';
/** Default limit for Message events per span */
export declare const DEFAULT_MAX_EVENTS_PER_SPAN = 128;
/** Default limit for Attributes per span */
export declare const DEFAULT_MAX_ATTRIBUTES_PER_SPAN = 32;
/** Default limit for Links per span */
export declare const DEFAULT_MAX_LINKS_PER_SPAN = 32;
/**

@@ -22,4 +16,3 @@ * Default configuration. For fields with primitive values, any user-provided

};
gracefulShutdown: boolean;
};
//# sourceMappingURL=config.d.ts.map

@@ -18,10 +18,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_CONFIG = exports.DEFAULT_MAX_LINKS_PER_SPAN = exports.DEFAULT_MAX_ATTRIBUTES_PER_SPAN = exports.DEFAULT_MAX_EVENTS_PER_SPAN = void 0;
exports.DEFAULT_CONFIG = void 0;
const core_1 = require("@opentelemetry/core");
/** Default limit for Message events per span */
exports.DEFAULT_MAX_EVENTS_PER_SPAN = 128;
/** Default limit for Attributes per span */
exports.DEFAULT_MAX_ATTRIBUTES_PER_SPAN = 32;
/** Default limit for Links per span */
exports.DEFAULT_MAX_LINKS_PER_SPAN = 32;
/**

@@ -37,8 +31,7 @@ * Default configuration. For fields with primitive values, any user-provided

traceParams: {
numberOfAttributesPerSpan: exports.DEFAULT_MAX_ATTRIBUTES_PER_SPAN,
numberOfLinksPerSpan: exports.DEFAULT_MAX_LINKS_PER_SPAN,
numberOfEventsPerSpan: exports.DEFAULT_MAX_EVENTS_PER_SPAN,
numberOfAttributesPerSpan: core_1.getEnv().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,
numberOfLinksPerSpan: core_1.getEnv().OTEL_SPAN_LINK_COUNT_LIMIT,
numberOfEventsPerSpan: core_1.getEnv().OTEL_SPAN_EVENT_COUNT_LIMIT,
},
gracefulShutdown: true,
};
//# sourceMappingURL=config.js.map

@@ -0,1 +1,2 @@

import { Span } from '../Span';
import { SpanProcessor } from '../SpanProcessor';

@@ -19,3 +20,3 @@ import { BufferConfig } from '../types';

forceFlush(): Promise<void>;
onStart(span: ReadableSpan): void;
onStart(_span: Span): void;
onEnd(span: ReadableSpan): void;

@@ -22,0 +23,0 @@ shutdown(): Promise<void>;

@@ -47,3 +47,3 @@ "use strict";

// does nothing.
onStart(span) { }
onStart(_span) { }
onEnd(span) {

@@ -80,3 +80,5 @@ if (this._isShutdown) {

if (this._finishedSpans.length > this._bufferSize) {
this._flush();
this._flush().catch(e => {
core_1.globalErrorHandler(e);
});
}

@@ -93,9 +95,12 @@ }

api_1.context.with(api_1.suppressInstrumentation(api_1.context.active()), () => {
this._exporter.export(this._finishedSpans, result => {
this._finishedSpans = [];
if (result === core_1.ExportResult.SUCCESS) {
// Reset the finished spans buffer here because the next invocations of the _flush method
// could pass the same finished spans to the exporter if the buffer is cleared
// outside of the execution of this callback.
this._exporter.export(this._finishedSpans.splice(0), result => {
var _a;
if (result.code === core_1.ExportResultCode.SUCCESS) {
resolve();
}
else {
reject(result);
reject((_a = result.error) !== null && _a !== void 0 ? _a : new Error('BatchSpanProcessor: span export failed'));
}

@@ -110,3 +115,5 @@ });

this._timer = setTimeout(() => {
this._flush().catch();
this._flush().catch(e => {
core_1.globalErrorHandler(e);
});
}, this._bufferTimeout);

@@ -113,0 +120,0 @@ core_1.unrefTimer(this._timer);

@@ -68,3 +68,3 @@ "use strict";

if (done) {
return done(core_1.ExportResult.SUCCESS);
return done({ code: core_1.ExportResultCode.SUCCESS });
}

@@ -71,0 +71,0 @@ }

@@ -36,5 +36,8 @@ "use strict";

if (this._stopped)
return resultCallback(core_1.ExportResult.FAILED_NOT_RETRYABLE);
return resultCallback({
code: core_1.ExportResultCode.FAILED,
error: new Error('Exporter has been stopped'),
});
this._finishedSpans.push(...spans);
setTimeout(() => resultCallback(core_1.ExportResult.SUCCESS), 0);
setTimeout(() => resultCallback({ code: core_1.ExportResultCode.SUCCESS }), 0);
}

@@ -41,0 +44,0 @@ shutdown() {

@@ -0,3 +1,4 @@

import { Span } from '../Span';
import { SpanExporter } from './SpanExporter';
import { SpanProcessor } from '../SpanProcessor';
import { SpanExporter } from './SpanExporter';
import { ReadableSpan } from './ReadableSpan';

@@ -16,3 +17,3 @@ /**

forceFlush(): Promise<void>;
onStart(span: ReadableSpan): void;
onStart(_span: Span): void;
onEnd(span: ReadableSpan): void;

@@ -19,0 +20,0 @@ shutdown(): Promise<void>;

@@ -20,2 +20,3 @@ "use strict";

const api_1 = require("@opentelemetry/api");
const core_1 = require("@opentelemetry/core");
/**

@@ -38,3 +39,3 @@ * An implementation of the {@link SpanProcessor} that converts the {@link Span}

// does nothing.
onStart(span) { }
onStart(_span) { }
onEnd(span) {

@@ -46,3 +47,8 @@ if (this._isShutdown) {

api_1.context.with(api_1.suppressInstrumentation(api_1.context.active()), () => {
this._exporter.export([span], () => { });
this._exporter.export([span], result => {
var _a;
if (result.code !== core_1.ExportResultCode.SUCCESS) {
core_1.globalErrorHandler((_a = result.error) !== null && _a !== void 0 ? _a : new Error(`SimpleSpanProcessor: span export failed (status ${result})`));
}
});
});

@@ -49,0 +55,0 @@ }

@@ -0,3 +1,5 @@

import { Context } from '@opentelemetry/api';
import { ReadableSpan } from './export/ReadableSpan';
import { Span } from './Span';
import { SpanProcessor } from './SpanProcessor';
import { ReadableSpan } from './export/ReadableSpan';
/**

@@ -11,3 +13,3 @@ * Implementation of the {@link SpanProcessor} that simply forwards all

forceFlush(): Promise<void>;
onStart(span: ReadableSpan): void;
onStart(span: Span, context: Context): void;
onEnd(span: ReadableSpan): void;

@@ -14,0 +16,0 @@ shutdown(): Promise<void>;

@@ -44,5 +44,5 @@ "use strict";

}
onStart(span) {
onStart(span, context) {
for (const spanProcessor of this._spanProcessors) {
spanProcessor.onStart(span);
spanProcessor.onStart(span, context);
}

@@ -49,0 +49,0 @@ }

@@ -0,7 +1,9 @@

import { Context } from '@opentelemetry/api';
import { ReadableSpan } from './export/ReadableSpan';
import { Span } from './Span';
import { SpanProcessor } from './SpanProcessor';
import { ReadableSpan } from './export/ReadableSpan';
/** No-op implementation of SpanProcessor */
export declare class NoopSpanProcessor implements SpanProcessor {
onStart(span: ReadableSpan): void;
onEnd(span: ReadableSpan): void;
onStart(_span: Span, _context: Context): void;
onEnd(_span: ReadableSpan): void;
shutdown(): Promise<void>;

@@ -8,0 +10,0 @@ forceFlush(): Promise<void>;

@@ -21,4 +21,4 @@ "use strict";

class NoopSpanProcessor {
onStart(span) { }
onEnd(span) { }
onStart(_span, _context) { }
onEnd(_span) { }
shutdown() {

@@ -25,0 +25,0 @@ return Promise.resolve();

@@ -6,3 +6,3 @@ import * as api from '@opentelemetry/api';

import { Tracer } from './Tracer';
import { AttributeValue } from '@opentelemetry/api';
import { AttributeValue, Context } from '@opentelemetry/api';
/**

@@ -30,3 +30,3 @@ * This class represents a span.

/** Constructs a new Span instance. */
constructor(parentTracer: Tracer, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput);
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput);
context(): api.SpanContext;

@@ -33,0 +33,0 @@ setAttribute(key: string, value?: AttributeValue): this;

@@ -27,3 +27,3 @@ "use strict";

/** Constructs a new Span instance. */
constructor(parentTracer, spanName, spanContext, kind, parentSpanId, links = [], startTime = core_1.hrTime()) {
constructor(parentTracer, context, spanName, spanContext, kind, parentSpanId, links = [], startTime = core_1.hrTime()) {
this.attributes = {};

@@ -33,3 +33,3 @@ this.links = [];

this.status = {
code: api.CanonicalCode.OK,
code: api.StatusCode.UNSET,
};

@@ -50,3 +50,3 @@ this.endTime = [0, 0];

this._spanProcessor = parentTracer.getActiveSpanProcessor();
this._spanProcessor.onStart(this);
this._spanProcessor.onStart(this, context);
}

@@ -140,3 +140,3 @@ context() {

isRecording() {
return true;
return this._ended === false;
}

@@ -143,0 +143,0 @@ recordException(exception, time = core_1.hrTime()) {

@@ -0,2 +1,4 @@

import { Context } from '@opentelemetry/api';
import { ReadableSpan } from './export/ReadableSpan';
import { Span } from './Span';
/**

@@ -12,7 +14,7 @@ * SpanProcessor is the interface Tracer SDK uses to allow synchronous hooks

/**
* Called when a {@link ReadableSpan} is started, if the `span.isRecording()`
* Called when a {@link Span} is started, if the `span.isRecording()`
* returns true.
* @param span the Span that just started.
*/
onStart(span: ReadableSpan): void;
onStart(span: Span, parentContext: Context): void;
/**

@@ -19,0 +21,0 @@ * Called when a {@link ReadableSpan} is ended, if the `span.isRecording()`

@@ -67,3 +67,3 @@ "use strict";

// make sampling decision
const samplingResult = this._sampler.shouldSample(parentContext, traceId, name, spanKind, attributes, links);
const samplingResult = this._sampler.shouldSample(context, traceId, name, spanKind, attributes, links);
const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED

@@ -77,3 +77,3 @@ ? api.TraceFlags.SAMPLED

}
const span = new Span_1.Span(this, name, spanContext, spanKind, parentContext ? parentContext.spanId : undefined, links, options.startTime);
const span = new Span_1.Span(this, context, name, spanContext, spanKind, parentContext ? parentContext.spanId : undefined, links, options.startTime);
// Set default attributes

@@ -125,14 +125,6 @@ span.setAttributes(Object.assign(attributes, samplingResult.attributes));

function getParent(options, context) {
if (options.parent === null)
if (options.root)
return undefined;
if (options.parent)
return getContext(options.parent);
return api.getParentSpanContext(context);
}
function getContext(span) {
return isSpan(span) ? span.context() : span;
}
function isSpan(span) {
return typeof span.context === 'function';
}
//# sourceMappingURL=Tracer.js.map

@@ -23,4 +23,2 @@ import { TextMapPropagator, Logger, Sampler } from '@opentelemetry/api';

resource?: Resource;
/** Bool for whether or not graceful shutdown is enabled. If disabled spans will not be exported when SIGTERM is recieved */
gracefulShutdown?: boolean;
/**

@@ -27,0 +25,0 @@ * Generator of trace and span IDs

@@ -15,3 +15,2 @@ import { TracerConfig } from './types';

};
gracefulShutdown: boolean;
} & {

@@ -18,0 +17,0 @@ sampler: ParentBasedSampler;

@@ -26,5 +26,4 @@ "use strict";

function mergeConfig(userConfig) {
const traceParams = userConfig.traceParams;
const otelSamplingProbability = core_1.getEnv().OTEL_SAMPLING_PROBABILITY;
const target = Object.assign(config_1.DEFAULT_CONFIG,
const target = Object.assign({}, config_1.DEFAULT_CONFIG,
// use default AlwaysOnSampler if otelSamplingProbability is 1

@@ -38,11 +37,3 @@ otelSamplingProbability !== undefined && otelSamplingProbability < 1

: {}, userConfig);
// the user-provided value will be used to extend the default value.
if (traceParams) {
target.traceParams.numberOfAttributesPerSpan =
traceParams.numberOfAttributesPerSpan || config_1.DEFAULT_MAX_ATTRIBUTES_PER_SPAN;
target.traceParams.numberOfEventsPerSpan =
traceParams.numberOfEventsPerSpan || config_1.DEFAULT_MAX_EVENTS_PER_SPAN;
target.traceParams.numberOfLinksPerSpan =
traceParams.numberOfLinksPerSpan || config_1.DEFAULT_MAX_LINKS_PER_SPAN;
}
target.traceParams = Object.assign({}, config_1.DEFAULT_CONFIG.traceParams, userConfig.traceParams || {});
return target;

@@ -49,0 +40,0 @@ }

@@ -1,2 +0,2 @@

export declare const VERSION = "0.12.1-alpha.54+3f72613a";
export declare const VERSION = "0.13.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.12.1-alpha.54+3f72613a';
exports.VERSION = '0.13.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/tracing",
"version": "0.12.1-alpha.54+3f72613a",
"version": "0.13.0",
"description": "OpenTelemetry Tracing",

@@ -53,10 +53,10 @@ "main": "build/src/index.js",

"devDependencies": {
"@types/mocha": "8.0.2",
"@types/node": "14.0.27",
"@types/sinon": "9.0.4",
"@types/webpack-env": "1.15.2",
"codecov": "3.7.2",
"@types/mocha": "8.0.4",
"@types/node": "14.14.10",
"@types/sinon": "9.0.9",
"@types/webpack-env": "1.16.0",
"codecov": "3.8.1",
"gts": "2.0.2",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "5.1.1",
"karma": "5.2.3",
"karma-chrome-launcher": "3.1.0",

@@ -70,17 +70,17 @@ "karma-coverage-istanbul-reporter": "3.0.3",

"rimraf": "3.0.2",
"sinon": "9.0.3",
"ts-loader": "8.0.2",
"ts-mocha": "7.0.0",
"sinon": "9.2.1",
"ts-loader": "8.0.11",
"ts-mocha": "8.0.0",
"ts-node": "9.0.0",
"typescript": "3.9.7",
"webpack": "4.44.1"
"webpack": "4.44.2"
},
"dependencies": {
"@opentelemetry/api": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/context-base": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/core": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/resources": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/semantic-conventions": "^0.12.1-alpha.54+3f72613a"
"@opentelemetry/api": "^0.13.0",
"@opentelemetry/context-base": "^0.13.0",
"@opentelemetry/core": "^0.13.0",
"@opentelemetry/resources": "^0.13.0",
"@opentelemetry/semantic-conventions": "^0.13.0"
},
"gitHead": "3f72613a36b6f97555a0fa7481755cf8b6cce1a7"
"gitHead": "86cbd6798f9318c5920f9d9055f289a1c3f26500"
}

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

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