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

@opentelemetry/core

Package Overview
Dependencies
Maintainers
5
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/core - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

build/src/metrics/NoopMeterRegistry.d.ts

2

build/src/context/propagation/HttpTraceContext.d.ts

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

*/
import { SpanContext, HttpTextFormat } from '@opentelemetry/types';
import { HttpTextFormat, SpanContext } from '@opentelemetry/types';
export declare const TRACE_PARENT_HEADER = "traceparent";

@@ -19,0 +19,0 @@ export declare const TRACE_STATE_HEADER = "tracestate";

@@ -22,6 +22,3 @@ "use strict";

exports.TRACE_STATE_HEADER = 'tracestate';
const VALID_TRACE_PARENT_REGEX = /^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/;
const VALID_TRACEID_REGEX = /^[0-9a-f]{32}$/i;
const VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
const INVALID_ID_REGEX = /^0+$/i;
const VALID_TRACE_PARENT_REGEX = /^00-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/;
const VERSION = '00';

@@ -40,25 +37,14 @@ /**

const match = traceParent.match(VALID_TRACE_PARENT_REGEX);
if (!match)
if (!match ||
match[1] === '00000000000000000000000000000000' ||
match[2] === '0000000000000000') {
return null;
const parts = traceParent.split('-');
const [version, traceId, spanId, option] = parts;
// tslint:disable-next-line:ban Needed to parse hexadecimal.
const traceFlags = parseInt(option, 16);
if (!isValidVersion(version) ||
!isValidTraceId(traceId) ||
!isValidSpanId(spanId)) {
return null;
}
return { traceId, spanId, traceFlags };
return {
traceId: match[1],
spanId: match[2],
traceFlags: parseInt(match[3], 16),
};
}
exports.parseTraceParent = parseTraceParent;
function isValidVersion(version) {
return version === VERSION;
}
function isValidTraceId(traceId) {
return VALID_TRACEID_REGEX.test(traceId) && !INVALID_ID_REGEX.test(traceId);
}
function isValidSpanId(spanId) {
return VALID_SPANID_REGEX.test(spanId) && !INVALID_ID_REGEX.test(spanId);
}
/**

@@ -65,0 +51,0 @@ * Propagates {@link SpanContext} through Trace Context format propagation.

@@ -29,6 +29,6 @@ /*!

export * from './trace/NoopTracer';
export * from './trace/NoopTracerRegistry';
export * from './trace/NoRecordingSpan';
export * from './trace/sampler/ProbabilitySampler';
export * from './trace/spancontext-utils';
export * from './trace/TracerDelegate';
export * from './trace/TraceState';

@@ -35,0 +35,0 @@ export * from './metrics/NoopMeter';

@@ -34,6 +34,6 @@ "use strict";

__export(require("./trace/NoopTracer"));
__export(require("./trace/NoopTracerRegistry"));
__export(require("./trace/NoRecordingSpan"));
__export(require("./trace/sampler/ProbabilitySampler"));
__export(require("./trace/spancontext-utils"));
__export(require("./trace/TracerDelegate"));
__export(require("./trace/TraceState"));

@@ -40,0 +40,0 @@ __export(require("./metrics/NoopMeter"));

@@ -86,2 +86,3 @@ /*!

}
export declare const noopMeter: NoopMeter;
export declare const NOOP_BOUND_GAUGE: NoopBoundGauge;

@@ -88,0 +89,0 @@ export declare const NOOP_GAUGE_METRIC: NoopGaugeMetric;

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

exports.NoopBoundMeasure = NoopBoundMeasure;
exports.noopMeter = new NoopMeter();
exports.NOOP_BOUND_GAUGE = new NoopBoundGauge();

@@ -137,0 +138,0 @@ exports.NOOP_GAUGE_METRIC = new NoopGaugeMetric(exports.NOOP_BOUND_GAUGE);

@@ -20,6 +20,10 @@ /*!

*/
export declare function initGlobalTracer(tracer: types.Tracer): types.Tracer;
export declare function initGlobalTracerRegistry(tracerRegistry: types.TracerRegistry): types.TracerRegistry;
/**
* Returns the global tracer
* Returns the global tracer registry.
*/
export declare function getTracer(): types.Tracer;
export declare function getTracerRegistry(): types.TracerRegistry;
/**
* Returns a tracer from the global tracer registry.
*/
export declare function getTracer(name: string, version?: string): types.Tracer;

@@ -18,19 +18,27 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const TracerDelegate_1 = require("./TracerDelegate");
let globalTracerDelegate = new TracerDelegate_1.TracerDelegate();
const NoopTracerRegistry_1 = require("./NoopTracerRegistry");
let globalTracerRegistry = new NoopTracerRegistry_1.NoopTracerRegistry();
/**
* Set the current global tracer. Returns the initialized global tracer
*/
function initGlobalTracer(tracer) {
return (globalTracerDelegate = new TracerDelegate_1.TracerDelegate(tracer));
function initGlobalTracerRegistry(tracerRegistry) {
return (globalTracerRegistry = tracerRegistry);
}
exports.initGlobalTracer = initGlobalTracer;
exports.initGlobalTracerRegistry = initGlobalTracerRegistry;
/**
* Returns the global tracer
* Returns the global tracer registry.
*/
function getTracer() {
// Return the global tracer delegate
return globalTracerDelegate;
function getTracerRegistry() {
// Return the global tracer registry
return globalTracerRegistry;
}
exports.getTracerRegistry = getTracerRegistry;
/**
* Returns a tracer from the global tracer registry.
*/
function getTracer(name, version) {
// Return the global tracer registry
return globalTracerRegistry.getTracer(name, version);
}
exports.getTracer = getTracer;
//# sourceMappingURL=globaltracer-utils.js.map

@@ -16,5 +16,7 @@ /*!

*/
import { Tracer, Plugin, Logger, PluginConfig, PluginInternalFiles } from '@opentelemetry/types';
import { Tracer, Plugin, Logger, PluginConfig, PluginInternalFiles, TracerRegistry } from '@opentelemetry/types';
/** This class represent the base to patch plugin. */
export declare abstract class BasePlugin<T> implements Plugin<T> {
protected readonly _tracerName: string;
protected readonly _tracerVersion?: string | undefined;
supportedVersions?: string[];

@@ -32,3 +34,4 @@ readonly moduleName?: string;

protected _config: PluginConfig;
enable(moduleExports: T, tracer: Tracer, logger: Logger, config?: PluginConfig): T;
constructor(_tracerName: string, _tracerVersion?: string | undefined);
enable(moduleExports: T, tracerRegistry: TracerRegistry, logger: Logger, config?: PluginConfig): T;
disable(): void;

@@ -35,0 +38,0 @@ /**

@@ -22,5 +22,9 @@ "use strict";

class BasePlugin {
enable(moduleExports, tracer, logger, config) {
constructor(_tracerName, _tracerVersion) {
this._tracerName = _tracerName;
this._tracerVersion = _tracerVersion;
}
enable(moduleExports, tracerRegistry, logger, config) {
this._moduleExports = moduleExports;
this._tracer = tracer;
this._tracer = tracerRegistry.getTracer(this._tracerName, this._tracerVersion);
this._logger = logger;

@@ -27,0 +31,0 @@ this._internalFilesExports = this._loadInternalFilesExports();

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

import * as types from '@opentelemetry/types';
import { SpanContext } from '@opentelemetry/types';
/**

@@ -26,3 +25,3 @@ * The NoopSpan is the default {@link Span} that is used when no Span

private readonly _spanContext;
constructor(_spanContext?: SpanContext);
constructor(_spanContext?: types.SpanContext);
context(): types.SpanContext;

@@ -29,0 +28,0 @@ setAttribute(key: string, value: unknown): this;

@@ -28,1 +28,2 @@ /*!

}
export declare const noopTracer: NoopTracer;

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

exports.NoopTracer = NoopTracer;
exports.noopTracer = new NoopTracer();
//# sourceMappingURL=NoopTracer.js.map

@@ -16,2 +16,2 @@ /*!

*/
export declare const VERSION = "0.3.2";
export declare const VERSION = "0.3.3";

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

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.3.2';
exports.VERSION = '0.3.3';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/core",
"version": "0.3.2",
"version": "0.3.3",
"description": "OpenTelemetry Core provides default and no-op implementations of the OpenTelemetry types for trace and metrics",

@@ -74,3 +74,3 @@ "main": "build/src/index.js",

"ts-mocha": "^6.0.0",
"ts-node": "^8.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.16.0",

@@ -82,5 +82,5 @@ "tslint-microsoft-contrib": "^6.2.0",

"dependencies": {
"@opentelemetry/types": "^0.3.2",
"@opentelemetry/types": "^0.3.3",
"semver": "^6.3.0"
}
}
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