Socket
Socket
Sign inDemoInstall

@opentelemetry/sdk-trace-base

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/sdk-trace-base - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

13

build/esm/Span.d.ts
import * as api from '@opentelemetry/api';
import { InstrumentationLibrary } from '@opentelemetry/core';
import { Context, SpanAttributeValue } from '@opentelemetry/api';
import { Clock, InstrumentationLibrary } from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';

@@ -7,3 +8,2 @@ import { ReadableSpan } from './export/ReadableSpan';

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

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

private readonly _attributeValueLengthLimit;
/** Constructs a new Span instance. */
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput);
private readonly _clock;
/**
* Constructs a new Span instance.
*
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
* */
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput, clock?: Clock);
spanContext(): api.SpanContext;

@@ -34,0 +39,0 @@ setAttribute(key: string, value?: SpanAttributeValue): this;

@@ -44,3 +44,3 @@ /*

import * as api from '@opentelemetry/api';
import { isAttributeValue, hrTime, hrTimeDuration, isTimeInput, timeInputToHrTime, sanitizeAttributes, } from '@opentelemetry/core';
import { hrTimeDuration, isAttributeValue, isTimeInput, otperformance, sanitizeAttributes, timeInputToHrTime } from '@opentelemetry/core';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';

@@ -52,6 +52,10 @@ import { ExceptionEventName } from './enums';

var Span = /** @class */ (function () {
/** Constructs a new Span instance. */
function Span(parentTracer, context, spanName, spanContext, kind, parentSpanId, links, startTime) {
/**
* Constructs a new Span instance.
*
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
* */
function Span(parentTracer, context, spanName, spanContext, kind, parentSpanId, links, startTime, clock) {
if (links === void 0) { links = []; }
if (startTime === void 0) { startTime = hrTime(); }
if (clock === void 0) { clock = otperformance; }
this.attributes = {};

@@ -66,2 +70,3 @@ this.links = [];

this._duration = [-1, -1];
this._clock = clock;
this.name = spanName;

@@ -72,3 +77,3 @@ this._spanContext = spanContext;

this.links = links;
this.startTime = timeInputToHrTime(startTime);
this.startTime = timeInputToHrTime(startTime !== null && startTime !== void 0 ? startTime : clock.now());
this.resource = parentTracer.resource;

@@ -145,3 +150,3 @@ this.instrumentationLibrary = parentTracer.instrumentationLibrary;

if (typeof startTime === 'undefined') {
startTime = hrTime();
startTime = this._clock.now();
}

@@ -169,3 +174,2 @@ var attributes = sanitizeAttributes(attributesOrStartTime);

Span.prototype.end = function (endTime) {
if (endTime === void 0) { endTime = hrTime(); }
if (this._isSpanEnded()) {

@@ -176,3 +180,3 @@ api.diag.error('You can only call end() on a span once.');

this._ended = true;
this.endTime = timeInputToHrTime(endTime);
this.endTime = timeInputToHrTime(endTime !== null && endTime !== void 0 ? endTime : this._clock.now());
this._duration = hrTimeDuration(this.startTime, this.endTime);

@@ -188,3 +192,3 @@ if (this._duration[0] < 0) {

Span.prototype.recordException = function (exception, time) {
if (time === void 0) { time = hrTime(); }
if (time === void 0) { time = this._clock.now(); }
var attributes = {};

@@ -191,0 +195,0 @@ if (typeof exception === 'string') {

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

import * as api from '@opentelemetry/api';
import { sanitizeAttributes, isTracingSuppressed, } from '@opentelemetry/core';
import { sanitizeAttributes, isTracingSuppressed, AnchoredClock, otperformance, } from '@opentelemetry/core';
import { Span } from './Span';

@@ -47,6 +47,2 @@ import { mergeConfig } from './utility';

if (context === void 0) { context = api.context.active(); }
if (isTracingSuppressed(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
return api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
}
// remove span from context in case a root span is requested via options

@@ -56,3 +52,20 @@ if (options.root) {

}
var parentSpanContext = api.trace.getSpanContext(context);
var parentSpan = api.trace.getSpan(context);
var clock;
if (parentSpan) {
clock = parentSpan['_clock'];
}
if (!clock) {
clock = new AnchoredClock(Date, otperformance);
if (parentSpan) {
parentSpan['_clock'] = clock;
}
}
if (isTracingSuppressed(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
var nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
nonRecordingSpan['_clock'] = clock;
return nonRecordingSpan;
}
var parentSpanContext = parentSpan === null || parentSpan === void 0 ? void 0 : parentSpan.spanContext();
var spanId = this._idGenerator.generateSpanId();

@@ -88,5 +101,7 @@ var traceId;

api.diag.debug('Recording is off, propagating context in a non-recording span');
return api.trace.wrapSpanContext(spanContext);
var nonRecordingSpan = api.trace.wrapSpanContext(spanContext);
nonRecordingSpan['_clock'] = clock;
return nonRecordingSpan;
}
var span = new Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime);
var span = new Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime, clock);
// Set initial span attributes. The attributes object may have been mutated

@@ -93,0 +108,0 @@ // by the sampler, so we sanitize the merged attributes before setting them.

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

export declare const VERSION = "1.6.0";
export declare const VERSION = "1.7.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
export var VERSION = '1.6.0';
export var VERSION = '1.7.0';
//# sourceMappingURL=version.js.map
import * as api from '@opentelemetry/api';
import { InstrumentationLibrary } from '@opentelemetry/core';
import { Context, SpanAttributeValue } from '@opentelemetry/api';
import { Clock, InstrumentationLibrary } from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';

@@ -7,3 +8,2 @@ import { ReadableSpan } from './export/ReadableSpan';

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

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

private readonly _attributeValueLengthLimit;
/** Constructs a new Span instance. */
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput);
private readonly _clock;
/**
* Constructs a new Span instance.
*
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
* */
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput, clock?: Clock);
spanContext(): api.SpanContext;

@@ -34,0 +39,0 @@ setAttribute(key: string, value?: SpanAttributeValue): this;

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

import * as api from '@opentelemetry/api';
import { isAttributeValue, hrTime, hrTimeDuration, isTimeInput, timeInputToHrTime, sanitizeAttributes, } from '@opentelemetry/core';
import { hrTimeDuration, isAttributeValue, isTimeInput, otperformance, sanitizeAttributes, timeInputToHrTime } from '@opentelemetry/core';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';

@@ -25,4 +25,8 @@ import { ExceptionEventName } from './enums';

export class Span {
/** Constructs a new Span instance. */
constructor(parentTracer, context, spanName, spanContext, kind, parentSpanId, links = [], startTime = hrTime()) {
/**
* Constructs a new Span instance.
*
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
* */
constructor(parentTracer, context, spanName, spanContext, kind, parentSpanId, links = [], startTime, clock = otperformance) {
this.attributes = {};

@@ -37,2 +41,3 @@ this.links = [];

this._duration = [-1, -1];
this._clock = clock;
this.name = spanName;

@@ -43,3 +48,3 @@ this._spanContext = spanContext;

this.links = links;
this.startTime = timeInputToHrTime(startTime);
this.startTime = timeInputToHrTime(startTime !== null && startTime !== void 0 ? startTime : clock.now());
this.resource = parentTracer.resource;

@@ -105,3 +110,3 @@ this.instrumentationLibrary = parentTracer.instrumentationLibrary;

if (typeof startTime === 'undefined') {
startTime = hrTime();
startTime = this._clock.now();
}

@@ -128,3 +133,3 @@ const attributes = sanitizeAttributes(attributesOrStartTime);

}
end(endTime = hrTime()) {
end(endTime) {
if (this._isSpanEnded()) {

@@ -135,3 +140,3 @@ api.diag.error('You can only call end() on a span once.');

this._ended = true;
this.endTime = timeInputToHrTime(endTime);
this.endTime = timeInputToHrTime(endTime !== null && endTime !== void 0 ? endTime : this._clock.now());
this._duration = hrTimeDuration(this.startTime, this.endTime);

@@ -146,3 +151,3 @@ if (this._duration[0] < 0) {

}
recordException(exception, time = hrTime()) {
recordException(exception, time = this._clock.now()) {
const attributes = {};

@@ -149,0 +154,0 @@ if (typeof exception === 'string') {

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

import * as api from '@opentelemetry/api';
import { sanitizeAttributes, isTracingSuppressed, } from '@opentelemetry/core';
import { sanitizeAttributes, isTracingSuppressed, AnchoredClock, otperformance, } from '@opentelemetry/core';
import { Span } from './Span';

@@ -45,6 +45,2 @@ import { mergeConfig } from './utility';

var _a, _b;
if (isTracingSuppressed(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
return api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
}
// remove span from context in case a root span is requested via options

@@ -54,3 +50,20 @@ if (options.root) {

}
const parentSpanContext = api.trace.getSpanContext(context);
const parentSpan = api.trace.getSpan(context);
let clock;
if (parentSpan) {
clock = parentSpan['_clock'];
}
if (!clock) {
clock = new AnchoredClock(Date, otperformance);
if (parentSpan) {
parentSpan['_clock'] = clock;
}
}
if (isTracingSuppressed(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
nonRecordingSpan['_clock'] = clock;
return nonRecordingSpan;
}
const parentSpanContext = parentSpan === null || parentSpan === void 0 ? void 0 : parentSpan.spanContext();
const spanId = this._idGenerator.generateSpanId();

@@ -86,5 +99,7 @@ let traceId;

api.diag.debug('Recording is off, propagating context in a non-recording span');
return api.trace.wrapSpanContext(spanContext);
const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);
nonRecordingSpan['_clock'] = clock;
return nonRecordingSpan;
}
const span = new Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime);
const span = new Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime, clock);
// Set initial span attributes. The attributes object may have been mutated

@@ -91,0 +106,0 @@ // by the sampler, so we sanitize the merged attributes before setting them.

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

export declare const VERSION = "1.6.0";
export declare const VERSION = "1.7.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
export const VERSION = '1.6.0';
export const VERSION = '1.7.0';
//# sourceMappingURL=version.js.map
import * as api from '@opentelemetry/api';
import { InstrumentationLibrary } from '@opentelemetry/core';
import { Context, SpanAttributeValue } from '@opentelemetry/api';
import { Clock, InstrumentationLibrary } from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';

@@ -7,3 +8,2 @@ import { ReadableSpan } from './export/ReadableSpan';

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

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

private readonly _attributeValueLengthLimit;
/** Constructs a new Span instance. */
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput);
private readonly _clock;
/**
* Constructs a new Span instance.
*
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
* */
constructor(parentTracer: Tracer, context: Context, spanName: string, spanContext: api.SpanContext, kind: api.SpanKind, parentSpanId?: string, links?: api.Link[], startTime?: api.TimeInput, clock?: Clock);
spanContext(): api.SpanContext;

@@ -34,0 +39,0 @@ setAttribute(key: string, value?: SpanAttributeValue): this;

@@ -27,4 +27,8 @@ "use strict";

class Span {
/** Constructs a new Span instance. */
constructor(parentTracer, context, spanName, spanContext, kind, parentSpanId, links = [], startTime = (0, core_1.hrTime)()) {
/**
* Constructs a new Span instance.
*
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
* */
constructor(parentTracer, context, spanName, spanContext, kind, parentSpanId, links = [], startTime, clock = core_1.otperformance) {
this.attributes = {};

@@ -39,2 +43,3 @@ this.links = [];

this._duration = [-1, -1];
this._clock = clock;
this.name = spanName;

@@ -45,3 +50,3 @@ this._spanContext = spanContext;

this.links = links;
this.startTime = (0, core_1.timeInputToHrTime)(startTime);
this.startTime = (0, core_1.timeInputToHrTime)(startTime !== null && startTime !== void 0 ? startTime : clock.now());
this.resource = parentTracer.resource;

@@ -107,3 +112,3 @@ this.instrumentationLibrary = parentTracer.instrumentationLibrary;

if (typeof startTime === 'undefined') {
startTime = (0, core_1.hrTime)();
startTime = this._clock.now();
}

@@ -130,3 +135,3 @@ const attributes = (0, core_1.sanitizeAttributes)(attributesOrStartTime);

}
end(endTime = (0, core_1.hrTime)()) {
end(endTime) {
if (this._isSpanEnded()) {

@@ -137,3 +142,3 @@ api.diag.error('You can only call end() on a span once.');

this._ended = true;
this.endTime = (0, core_1.timeInputToHrTime)(endTime);
this.endTime = (0, core_1.timeInputToHrTime)(endTime !== null && endTime !== void 0 ? endTime : this._clock.now());
this._duration = (0, core_1.hrTimeDuration)(this.startTime, this.endTime);

@@ -148,3 +153,3 @@ if (this._duration[0] < 0) {

}
recordException(exception, time = (0, core_1.hrTime)()) {
recordException(exception, time = this._clock.now()) {
const attributes = {};

@@ -151,0 +156,0 @@ if (typeof exception === 'string') {

@@ -47,6 +47,2 @@ "use strict";

var _a, _b;
if ((0, core_1.isTracingSuppressed)(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
return api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
}
// remove span from context in case a root span is requested via options

@@ -56,3 +52,20 @@ if (options.root) {

}
const parentSpanContext = api.trace.getSpanContext(context);
const parentSpan = api.trace.getSpan(context);
let clock;
if (parentSpan) {
clock = parentSpan['_clock'];
}
if (!clock) {
clock = new core_1.AnchoredClock(Date, core_1.otperformance);
if (parentSpan) {
parentSpan['_clock'] = clock;
}
}
if ((0, core_1.isTracingSuppressed)(context)) {
api.diag.debug('Instrumentation suppressed, returning Noop Span');
const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
nonRecordingSpan['_clock'] = clock;
return nonRecordingSpan;
}
const parentSpanContext = parentSpan === null || parentSpan === void 0 ? void 0 : parentSpan.spanContext();
const spanId = this._idGenerator.generateSpanId();

@@ -88,5 +101,7 @@ let traceId;

api.diag.debug('Recording is off, propagating context in a non-recording span');
return api.trace.wrapSpanContext(spanContext);
const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);
nonRecordingSpan['_clock'] = clock;
return nonRecordingSpan;
}
const span = new Span_1.Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime);
const span = new Span_1.Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime, clock);
// Set initial span attributes. The attributes object may have been mutated

@@ -93,0 +108,0 @@ // by the sampler, so we sanitize the merged attributes before setting them.

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

export declare const VERSION = "1.6.0";
export declare const VERSION = "1.7.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '1.6.0';
exports.VERSION = '1.7.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/sdk-trace-base",
"version": "1.6.0",
"version": "1.7.0",
"description": "OpenTelemetry Tracing",

@@ -94,8 +94,8 @@ "main": "build/src/index.js",

"dependencies": {
"@opentelemetry/core": "1.6.0",
"@opentelemetry/resources": "1.6.0",
"@opentelemetry/semantic-conventions": "1.6.0"
"@opentelemetry/core": "1.7.0",
"@opentelemetry/resources": "1.7.0",
"@opentelemetry/semantic-conventions": "1.7.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base",
"gitHead": "a5abee69119cc41d9d34f6beb5c1826eef1ac0dd"
"gitHead": "ad88c3d9aa0100fe259b93f4b660e84417b757ac"
}

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