@opentelemetry/tracing
Advanced tools
Comparing version 0.14.0 to 0.15.0
import * as api from '@opentelemetry/api'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
import { SpanProcessor, Tracer } from '.'; | ||
import { SDKRegistrationConfig, TracerConfig } from './types'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
/** | ||
@@ -6,0 +6,0 @@ * This class represents a basic tracer provider which platform libraries can extend |
@@ -21,2 +21,3 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const resources_1 = require("@opentelemetry/resources"); | ||
const _1 = require("."); | ||
@@ -26,3 +27,3 @@ const config_1 = require("./config"); | ||
const NoopSpanProcessor_1 = require("./NoopSpanProcessor"); | ||
const resources_1 = require("@opentelemetry/resources"); | ||
const merge = require("lodash.merge"); | ||
/** | ||
@@ -32,3 +33,3 @@ * This class represents a basic tracer provider which platform libraries can extend | ||
class BasicTracerProvider { | ||
constructor(config = config_1.DEFAULT_CONFIG) { | ||
constructor(config = {}) { | ||
var _a, _b; | ||
@@ -38,5 +39,6 @@ this._registeredSpanProcessors = []; | ||
this.activeSpanProcessor = new NoopSpanProcessor_1.NoopSpanProcessor(); | ||
this.logger = (_a = config.logger) !== null && _a !== void 0 ? _a : new core_1.ConsoleLogger(config.logLevel); | ||
this.resource = (_b = config.resource) !== null && _b !== void 0 ? _b : resources_1.Resource.createTelemetrySDKResource(); | ||
this._config = Object.assign({}, config, { | ||
const mergedConfig = merge({}, config_1.DEFAULT_CONFIG, config); | ||
this.logger = (_a = mergedConfig.logger) !== null && _a !== void 0 ? _a : new core_1.ConsoleLogger(mergedConfig.logLevel); | ||
this.resource = (_b = mergedConfig.resource) !== null && _b !== void 0 ? _b : resources_1.Resource.createTelemetrySDKResource(); | ||
this._config = Object.assign({}, mergedConfig, { | ||
logger: this.logger, | ||
@@ -46,4 +48,4 @@ resource: this.resource, | ||
} | ||
getTracer(name, version = '*', config) { | ||
const key = `${name}@${version}`; | ||
getTracer(name, version, config) { | ||
const key = `${name}@${version || ''}`; | ||
if (!this._tracers.has(key)) { | ||
@@ -50,0 +52,0 @@ this._tracers.set(key, new _1.Tracer({ name, version }, config || this._config, this)); |
@@ -21,4 +21,2 @@ "use strict"; | ||
const core_1 = require("@opentelemetry/core"); | ||
const DEFAULT_BUFFER_SIZE = 100; | ||
const DEFAULT_BUFFER_TIMEOUT_MS = 20000; | ||
/** | ||
@@ -34,8 +32,11 @@ * Implementation of the {@link SpanProcessor} that batches spans exported by | ||
this._shuttingDownPromise = Promise.resolve(); | ||
const env = core_1.getEnv(); | ||
this._bufferSize = | ||
config && config.bufferSize ? config.bufferSize : DEFAULT_BUFFER_SIZE; | ||
config && config.bufferSize | ||
? config.bufferSize | ||
: env.OTEL_BSP_MAX_BATCH_SIZE; | ||
this._bufferTimeout = | ||
config && typeof config.bufferTimeout === 'number' | ||
? config.bufferTimeout | ||
: DEFAULT_BUFFER_TIMEOUT_MS; | ||
: env.OTEL_BSP_SCHEDULE_DELAY_MILLIS; | ||
} | ||
@@ -42,0 +43,0 @@ forceFlush() { |
@@ -26,16 +26,2 @@ import * as api from '@opentelemetry/api'; | ||
startSpan(name: string, options?: api.SpanOptions, context?: api.Context): api.Span; | ||
/** | ||
* Returns the current Span from the current context. | ||
* | ||
* If there is no Span associated with the current context, undefined is returned. | ||
*/ | ||
getCurrentSpan(): api.Span | undefined; | ||
/** | ||
* Enters the context of code where the given Span is in the current context. | ||
*/ | ||
withSpan<T extends (...args: unknown[]) => ReturnType<T>>(span: api.Span, fn: T): ReturnType<T>; | ||
/** | ||
* Bind a span (or the current one) to the target's context | ||
*/ | ||
bind<T>(target: T, span?: api.Span): T; | ||
/** Returns the active {@link TraceParams}. */ | ||
@@ -42,0 +28,0 @@ getActiveTraceParams(): TraceParams; |
@@ -81,27 +81,2 @@ "use strict"; | ||
} | ||
/** | ||
* Returns the current Span from the current context. | ||
* | ||
* If there is no Span associated with the current context, undefined is returned. | ||
*/ | ||
getCurrentSpan() { | ||
const ctx = api.context.active(); | ||
// Get the current Span from the context or null if none found. | ||
return api.getActiveSpan(ctx); | ||
} | ||
/** | ||
* Enters the context of code where the given Span is in the current context. | ||
*/ | ||
withSpan(span, fn) { | ||
// Set given span to context. | ||
return api.context.with(api.setActiveSpan(api.context.active(), span), fn); | ||
} | ||
/** | ||
* Bind a span (or the current one) to the target's context | ||
*/ | ||
bind(target, span) { | ||
return api.context.bind(target, span | ||
? api.setActiveSpan(api.context.active(), span) | ||
: api.context.active()); | ||
} | ||
/** Returns the active {@link TraceParams}. */ | ||
@@ -126,4 +101,4 @@ getActiveTraceParams() { | ||
return undefined; | ||
return api.getParentSpanContext(context); | ||
return api.getSpanContext(context); | ||
} | ||
//# sourceMappingURL=Tracer.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.14.0"; | ||
export declare const VERSION = "0.15.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.14.0'; | ||
exports.VERSION = '0.15.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/tracing", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "OpenTelemetry Tracing", | ||
@@ -13,2 +13,4 @@ "main": "build/src/index.js", | ||
"scripts": { | ||
"compile": "tsc --build", | ||
"clean": "tsc --build --clean", | ||
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/index-webpack.ts'", | ||
@@ -21,9 +23,5 @@ "test:browser": "nyc karma start --single-run", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"clean": "rimraf build/*", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", | ||
"precompile": "tsc --version", | ||
"version:update": "node ../../scripts/version-update.js", | ||
"compile": "npm run version:update && tsc -p .", | ||
"prepare": "npm run compile", | ||
"watch": "tsc -w" | ||
"version": "node ../../scripts/version-update.js", | ||
"watch": "tsc --build --watch" | ||
}, | ||
@@ -55,5 +53,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/lodash.merge": "4.6.6", | ||
"@types/mocha": "8.2.0", | ||
"@types/node": "14.14.12", | ||
"@types/sinon": "9.0.9", | ||
"@types/node": "14.14.20", | ||
"@types/sinon": "9.0.10", | ||
"@types/webpack-env": "1.16.0", | ||
@@ -72,17 +71,18 @@ "codecov": "3.8.1", | ||
"rimraf": "3.0.2", | ||
"sinon": "9.2.2", | ||
"ts-loader": "8.0.12", | ||
"sinon": "9.2.3", | ||
"ts-loader": "8.0.14", | ||
"ts-mocha": "8.0.0", | ||
"ts-node": "9.1.1", | ||
"typescript": "3.9.7", | ||
"webpack": "4.44.2" | ||
"webpack": "4.46.0" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.14.0", | ||
"@opentelemetry/context-base": "^0.14.0", | ||
"@opentelemetry/core": "^0.14.0", | ||
"@opentelemetry/resources": "^0.14.0", | ||
"@opentelemetry/semantic-conventions": "^0.14.0" | ||
"@opentelemetry/api": "^0.15.0", | ||
"@opentelemetry/context-base": "^0.15.0", | ||
"@opentelemetry/core": "^0.15.0", | ||
"@opentelemetry/resources": "^0.15.0", | ||
"@opentelemetry/semantic-conventions": "^0.15.0", | ||
"lodash.merge": "^4.6.2" | ||
}, | ||
"gitHead": "27a8d4530c56257c191468b073669909bf8892a1" | ||
"gitHead": "960b868f5b7686eabbf49190071b8463551e5d8f" | ||
} |
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
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
89974
6
23
1387
+ Addedlodash.merge@^4.6.2
+ Added@opentelemetry/api@0.15.0(transitive)
+ Added@opentelemetry/context-base@0.15.0(transitive)
+ Added@opentelemetry/core@0.15.0(transitive)
+ Added@opentelemetry/resources@0.15.0(transitive)
+ Added@opentelemetry/semantic-conventions@0.15.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
- Removed@opentelemetry/api@0.14.0(transitive)
- Removed@opentelemetry/context-base@0.14.0(transitive)
- Removed@opentelemetry/core@0.14.0(transitive)
- Removed@opentelemetry/resources@0.14.0(transitive)
- Removed@opentelemetry/semantic-conventions@0.14.0(transitive)
Updated@opentelemetry/api@^0.15.0
Updated@opentelemetry/core@^0.15.0