@opentelemetry/sdk-trace-base
Advanced tools
Comparing version 1.27.0 to 1.28.0
@@ -30,2 +30,3 @@ import { TextMapPropagator, TracerProvider } from '@opentelemetry/api'; | ||
/** | ||
* @deprecated please use {@link TracerConfig} spanProcessors property | ||
* Adds a new {@link SpanProcessor} to this tracer. | ||
@@ -32,0 +33,0 @@ * @param spanProcessor the new SpanProcessor to be added. |
@@ -16,2 +16,27 @@ /* | ||
*/ | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { context, diag, propagation, trace, } from '@opentelemetry/api'; | ||
@@ -39,3 +64,3 @@ import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator, getEnv, merge, } from '@opentelemetry/core'; | ||
if (config === void 0) { config = {}; } | ||
var _a; | ||
var _a, _b; | ||
this._registeredSpanProcessors = []; | ||
@@ -45,13 +70,21 @@ this._tracers = new Map(); | ||
this.resource = (_a = mergedConfig.resource) !== null && _a !== void 0 ? _a : Resource.empty(); | ||
this.resource = Resource.default().merge(this.resource); | ||
if (mergedConfig.mergeResourceWithDefaults) { | ||
this.resource = Resource.default().merge(this.resource); | ||
} | ||
this._config = Object.assign({}, mergedConfig, { | ||
resource: this.resource, | ||
}); | ||
var defaultExporter = this._buildExporterFromEnv(); | ||
if (defaultExporter !== undefined) { | ||
var batchProcessor = new BatchSpanProcessor(defaultExporter); | ||
this.activeSpanProcessor = batchProcessor; | ||
if ((_b = config.spanProcessors) === null || _b === void 0 ? void 0 : _b.length) { | ||
this._registeredSpanProcessors = __spreadArray([], __read(config.spanProcessors), false); | ||
this.activeSpanProcessor = new MultiSpanProcessor(this._registeredSpanProcessors); | ||
} | ||
else { | ||
this.activeSpanProcessor = new NoopSpanProcessor(); | ||
var defaultExporter = this._buildExporterFromEnv(); | ||
if (defaultExporter !== undefined) { | ||
var batchProcessor = new BatchSpanProcessor(defaultExporter); | ||
this.activeSpanProcessor = batchProcessor; | ||
} | ||
else { | ||
this.activeSpanProcessor = new NoopSpanProcessor(); | ||
} | ||
} | ||
@@ -68,2 +101,3 @@ } | ||
/** | ||
* @deprecated please use {@link TracerConfig} spanProcessors property | ||
* Adds a new {@link SpanProcessor} to this tracer. | ||
@@ -70,0 +104,0 @@ * @param spanProcessor the new SpanProcessor to be added. |
@@ -24,2 +24,3 @@ import { ENVIRONMENT } from '@opentelemetry/core'; | ||
}; | ||
mergeResourceWithDefaults: boolean; | ||
}; | ||
@@ -26,0 +27,0 @@ /** |
@@ -50,2 +50,3 @@ /* | ||
}, | ||
mergeResourceWithDefaults: true, | ||
}; | ||
@@ -52,0 +53,0 @@ } |
@@ -32,2 +32,3 @@ /* | ||
import { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase'; | ||
import { globalErrorHandler } from '@opentelemetry/core'; | ||
var BatchSpanProcessor = /** @class */ (function (_super) { | ||
@@ -46,7 +47,11 @@ __extends(BatchSpanProcessor, _super); | ||
if (document.visibilityState === 'hidden') { | ||
void _this.forceFlush(); | ||
_this.forceFlush().catch(function (error) { | ||
globalErrorHandler(error); | ||
}); | ||
} | ||
}; | ||
this._pageHideListener = function () { | ||
void _this.forceFlush(); | ||
_this.forceFlush().catch(function (error) { | ||
globalErrorHandler(error); | ||
}); | ||
}; | ||
@@ -53,0 +58,0 @@ document.addEventListener('visibilitychange', this._visibilityChangeListener); |
@@ -238,3 +238,3 @@ /* | ||
Span.prototype._getTime = function (inp) { | ||
if (typeof inp === 'number' && inp < otperformance.now()) { | ||
if (typeof inp === 'number' && inp <= otperformance.now()) { | ||
// must be a performance timestamp | ||
@@ -241,0 +241,0 @@ // apply correction and convert to hrtime |
@@ -5,2 +5,3 @@ import { ContextManager, TextMapPropagator } from '@opentelemetry/api'; | ||
import { Sampler } from './Sampler'; | ||
import { SpanProcessor } from './SpanProcessor'; | ||
/** | ||
@@ -18,2 +19,7 @@ * TracerConfig provides an interface for configuring a Basic Tracer. | ||
spanLimits?: SpanLimits; | ||
/** | ||
* Merge resource with {@link Resource.default()}? | ||
* Default: {@code true} | ||
**/ | ||
mergeResourceWithDefaults?: boolean; | ||
/** Resource associated with trace telemetry */ | ||
@@ -31,2 +37,6 @@ resource?: IResource; | ||
forceFlushTimeoutMillis?: number; | ||
/** | ||
* List of SpanProcessor for the tracer | ||
*/ | ||
spanProcessors?: SpanProcessor[]; | ||
} | ||
@@ -33,0 +43,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.27.0"; | ||
export declare const VERSION = "1.28.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export var VERSION = '1.27.0'; | ||
export var VERSION = '1.28.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -30,2 +30,3 @@ import { TextMapPropagator, TracerProvider } from '@opentelemetry/api'; | ||
/** | ||
* @deprecated please use {@link TracerConfig} spanProcessors property | ||
* Adds a new {@link SpanProcessor} to this tracer. | ||
@@ -32,0 +33,0 @@ * @param spanProcessor the new SpanProcessor to be added. |
@@ -37,3 +37,3 @@ /* | ||
constructor(config = {}) { | ||
var _a; | ||
var _a, _b; | ||
this._registeredSpanProcessors = []; | ||
@@ -43,13 +43,21 @@ this._tracers = new Map(); | ||
this.resource = (_a = mergedConfig.resource) !== null && _a !== void 0 ? _a : Resource.empty(); | ||
this.resource = Resource.default().merge(this.resource); | ||
if (mergedConfig.mergeResourceWithDefaults) { | ||
this.resource = Resource.default().merge(this.resource); | ||
} | ||
this._config = Object.assign({}, mergedConfig, { | ||
resource: this.resource, | ||
}); | ||
const defaultExporter = this._buildExporterFromEnv(); | ||
if (defaultExporter !== undefined) { | ||
const batchProcessor = new BatchSpanProcessor(defaultExporter); | ||
this.activeSpanProcessor = batchProcessor; | ||
if ((_b = config.spanProcessors) === null || _b === void 0 ? void 0 : _b.length) { | ||
this._registeredSpanProcessors = [...config.spanProcessors]; | ||
this.activeSpanProcessor = new MultiSpanProcessor(this._registeredSpanProcessors); | ||
} | ||
else { | ||
this.activeSpanProcessor = new NoopSpanProcessor(); | ||
const defaultExporter = this._buildExporterFromEnv(); | ||
if (defaultExporter !== undefined) { | ||
const batchProcessor = new BatchSpanProcessor(defaultExporter); | ||
this.activeSpanProcessor = batchProcessor; | ||
} | ||
else { | ||
this.activeSpanProcessor = new NoopSpanProcessor(); | ||
} | ||
} | ||
@@ -66,2 +74,3 @@ } | ||
/** | ||
* @deprecated please use {@link TracerConfig} spanProcessors property | ||
* Adds a new {@link SpanProcessor} to this tracer. | ||
@@ -68,0 +77,0 @@ * @param spanProcessor the new SpanProcessor to be added. |
@@ -24,2 +24,3 @@ import { ENVIRONMENT } from '@opentelemetry/core'; | ||
}; | ||
mergeResourceWithDefaults: boolean; | ||
}; | ||
@@ -26,0 +27,0 @@ /** |
@@ -50,2 +50,3 @@ /* | ||
}, | ||
mergeResourceWithDefaults: true, | ||
}; | ||
@@ -52,0 +53,0 @@ } |
@@ -17,2 +17,3 @@ /* | ||
import { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase'; | ||
import { globalErrorHandler } from '@opentelemetry/core'; | ||
export class BatchSpanProcessor extends BatchSpanProcessorBase { | ||
@@ -28,7 +29,11 @@ constructor(_exporter, config) { | ||
if (document.visibilityState === 'hidden') { | ||
void this.forceFlush(); | ||
this.forceFlush().catch(error => { | ||
globalErrorHandler(error); | ||
}); | ||
} | ||
}; | ||
this._pageHideListener = () => { | ||
void this.forceFlush(); | ||
this.forceFlush().catch(error => { | ||
globalErrorHandler(error); | ||
}); | ||
}; | ||
@@ -35,0 +40,0 @@ document.addEventListener('visibilitychange', this._visibilityChangeListener); |
@@ -178,3 +178,3 @@ /* | ||
_getTime(inp) { | ||
if (typeof inp === 'number' && inp < otperformance.now()) { | ||
if (typeof inp === 'number' && inp <= otperformance.now()) { | ||
// must be a performance timestamp | ||
@@ -181,0 +181,0 @@ // apply correction and convert to hrtime |
@@ -5,2 +5,3 @@ import { ContextManager, TextMapPropagator } from '@opentelemetry/api'; | ||
import { Sampler } from './Sampler'; | ||
import { SpanProcessor } from './SpanProcessor'; | ||
/** | ||
@@ -18,2 +19,7 @@ * TracerConfig provides an interface for configuring a Basic Tracer. | ||
spanLimits?: SpanLimits; | ||
/** | ||
* Merge resource with {@link Resource.default()}? | ||
* Default: {@code true} | ||
**/ | ||
mergeResourceWithDefaults?: boolean; | ||
/** Resource associated with trace telemetry */ | ||
@@ -31,2 +37,6 @@ resource?: IResource; | ||
forceFlushTimeoutMillis?: number; | ||
/** | ||
* List of SpanProcessor for the tracer | ||
*/ | ||
spanProcessors?: SpanProcessor[]; | ||
} | ||
@@ -33,0 +43,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.27.0"; | ||
export declare const VERSION = "1.28.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '1.27.0'; | ||
export const VERSION = '1.28.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -30,2 +30,3 @@ import { TextMapPropagator, TracerProvider } from '@opentelemetry/api'; | ||
/** | ||
* @deprecated please use {@link TracerConfig} spanProcessors property | ||
* Adds a new {@link SpanProcessor} to this tracer. | ||
@@ -32,0 +33,0 @@ * @param spanProcessor the new SpanProcessor to be added. |
@@ -40,3 +40,3 @@ "use strict"; | ||
constructor(config = {}) { | ||
var _a; | ||
var _a, _b; | ||
this._registeredSpanProcessors = []; | ||
@@ -46,13 +46,21 @@ this._tracers = new Map(); | ||
this.resource = (_a = mergedConfig.resource) !== null && _a !== void 0 ? _a : resources_1.Resource.empty(); | ||
this.resource = resources_1.Resource.default().merge(this.resource); | ||
if (mergedConfig.mergeResourceWithDefaults) { | ||
this.resource = resources_1.Resource.default().merge(this.resource); | ||
} | ||
this._config = Object.assign({}, mergedConfig, { | ||
resource: this.resource, | ||
}); | ||
const defaultExporter = this._buildExporterFromEnv(); | ||
if (defaultExporter !== undefined) { | ||
const batchProcessor = new platform_1.BatchSpanProcessor(defaultExporter); | ||
this.activeSpanProcessor = batchProcessor; | ||
if ((_b = config.spanProcessors) === null || _b === void 0 ? void 0 : _b.length) { | ||
this._registeredSpanProcessors = [...config.spanProcessors]; | ||
this.activeSpanProcessor = new MultiSpanProcessor_1.MultiSpanProcessor(this._registeredSpanProcessors); | ||
} | ||
else { | ||
this.activeSpanProcessor = new NoopSpanProcessor_1.NoopSpanProcessor(); | ||
const defaultExporter = this._buildExporterFromEnv(); | ||
if (defaultExporter !== undefined) { | ||
const batchProcessor = new platform_1.BatchSpanProcessor(defaultExporter); | ||
this.activeSpanProcessor = batchProcessor; | ||
} | ||
else { | ||
this.activeSpanProcessor = new NoopSpanProcessor_1.NoopSpanProcessor(); | ||
} | ||
} | ||
@@ -69,2 +77,3 @@ } | ||
/** | ||
* @deprecated please use {@link TracerConfig} spanProcessors property | ||
* Adds a new {@link SpanProcessor} to this tracer. | ||
@@ -71,0 +80,0 @@ * @param spanProcessor the new SpanProcessor to be added. |
@@ -24,2 +24,3 @@ import { ENVIRONMENT } from '@opentelemetry/core'; | ||
}; | ||
mergeResourceWithDefaults: boolean; | ||
}; | ||
@@ -26,0 +27,0 @@ /** |
@@ -53,2 +53,3 @@ "use strict"; | ||
}, | ||
mergeResourceWithDefaults: true, | ||
}; | ||
@@ -55,0 +56,0 @@ } |
@@ -20,2 +20,3 @@ "use strict"; | ||
const BatchSpanProcessorBase_1 = require("../../../export/BatchSpanProcessorBase"); | ||
const core_1 = require("@opentelemetry/core"); | ||
class BatchSpanProcessor extends BatchSpanProcessorBase_1.BatchSpanProcessorBase { | ||
@@ -31,7 +32,11 @@ constructor(_exporter, config) { | ||
if (document.visibilityState === 'hidden') { | ||
void this.forceFlush(); | ||
this.forceFlush().catch(error => { | ||
(0, core_1.globalErrorHandler)(error); | ||
}); | ||
} | ||
}; | ||
this._pageHideListener = () => { | ||
void this.forceFlush(); | ||
this.forceFlush().catch(error => { | ||
(0, core_1.globalErrorHandler)(error); | ||
}); | ||
}; | ||
@@ -38,0 +43,0 @@ document.addEventListener('visibilitychange', this._visibilityChangeListener); |
@@ -181,3 +181,3 @@ "use strict"; | ||
_getTime(inp) { | ||
if (typeof inp === 'number' && inp < core_1.otperformance.now()) { | ||
if (typeof inp === 'number' && inp <= core_1.otperformance.now()) { | ||
// must be a performance timestamp | ||
@@ -184,0 +184,0 @@ // apply correction and convert to hrtime |
@@ -5,2 +5,3 @@ import { ContextManager, TextMapPropagator } from '@opentelemetry/api'; | ||
import { Sampler } from './Sampler'; | ||
import { SpanProcessor } from './SpanProcessor'; | ||
/** | ||
@@ -18,2 +19,7 @@ * TracerConfig provides an interface for configuring a Basic Tracer. | ||
spanLimits?: SpanLimits; | ||
/** | ||
* Merge resource with {@link Resource.default()}? | ||
* Default: {@code true} | ||
**/ | ||
mergeResourceWithDefaults?: boolean; | ||
/** Resource associated with trace telemetry */ | ||
@@ -31,2 +37,6 @@ resource?: IResource; | ||
forceFlushTimeoutMillis?: number; | ||
/** | ||
* List of SpanProcessor for the tracer | ||
*/ | ||
spanProcessors?: SpanProcessor[]; | ||
} | ||
@@ -33,0 +43,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.27.0"; | ||
export declare const VERSION = "1.28.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '1.27.0'; | ||
exports.VERSION = '1.28.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/sdk-trace-base", | ||
"version": "1.27.0", | ||
"version": "1.28.0", | ||
"description": "OpenTelemetry Tracing", | ||
@@ -68,3 +68,3 @@ "main": "build/src/index.js", | ||
"@opentelemetry/api": ">=1.0.0 <1.10.0", | ||
"@types/mocha": "10.0.8", | ||
"@types/mocha": "10.0.9", | ||
"@types/node": "18.6.5", | ||
@@ -83,3 +83,3 @@ "@types/sinon": "17.0.3", | ||
"lerna": "6.6.2", | ||
"mocha": "10.7.3", | ||
"mocha": "10.8.2", | ||
"nyc": "15.1.0", | ||
@@ -89,3 +89,3 @@ "sinon": "15.1.2", | ||
"typescript": "4.4.4", | ||
"webpack": "5.94.0" | ||
"webpack": "5.96.1" | ||
}, | ||
@@ -96,4 +96,4 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@opentelemetry/core": "1.27.0", | ||
"@opentelemetry/resources": "1.27.0", | ||
"@opentelemetry/core": "1.28.0", | ||
"@opentelemetry/resources": "1.28.0", | ||
"@opentelemetry/semantic-conventions": "1.27.0" | ||
@@ -103,3 +103,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "eb3ca4fb07ee31c62093f5fcec56575573c902ce" | ||
"gitHead": "4b1ad3fda0cde58907e30fab25c3c767546708e5" | ||
} |
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
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
796305
8488
+ Added@opentelemetry/core@1.28.0(transitive)
+ Added@opentelemetry/resources@1.28.0(transitive)
- Removed@opentelemetry/core@1.27.0(transitive)
- Removed@opentelemetry/resources@1.27.0(transitive)
Updated@opentelemetry/core@1.28.0