@opentelemetry/api 1.0.0-rc.2 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -0
- package/README.md +53 -6
- package/build/esm/api/context.d.ts +41 -0
- package/build/esm/api/context.js +90 -0
- package/build/esm/api/context.js.map +1 -0
- package/build/esm/api/diag.d.ts +38 -0
- package/build/esm/api/diag.js +89 -0
- package/build/esm/api/diag.js.map +1 -0
- package/build/esm/api/propagation.d.ts +48 -0
- package/build/esm/api/propagation.js +88 -0
- package/build/esm/api/propagation.js.map +1 -0
- package/build/esm/api/trace.d.ts +39 -0
- package/build/esm/api/trace.js +76 -0
- package/build/esm/api/trace.js.map +1 -0
- package/build/esm/baggage/context-helpers.d.ts +23 -0
- package/build/esm/baggage/context-helpers.js +47 -0
- package/build/esm/baggage/context-helpers.js.map +1 -0
- package/build/esm/baggage/internal/baggage-impl.d.ts +12 -0
- package/build/esm/baggage/internal/baggage-impl.js +61 -0
- package/build/esm/baggage/internal/baggage-impl.js.map +1 -0
- package/build/esm/baggage/internal/symbol.d.ts +5 -0
- package/build/esm/baggage/internal/symbol.js +20 -0
- package/build/esm/baggage/internal/symbol.js.map +1 -0
- package/build/esm/baggage/types.d.ts +60 -0
- package/build/esm/baggage/types.js +17 -0
- package/build/esm/baggage/types.js.map +1 -0
- package/build/esm/baggage/utils.d.ts +15 -0
- package/build/esm/baggage/utils.js +46 -0
- package/build/esm/baggage/utils.js.map +1 -0
- package/build/esm/common/Exception.d.ts +26 -0
- package/build/esm/common/Exception.js +17 -0
- package/build/esm/common/Exception.js.map +1 -0
- package/build/esm/common/Time.d.ts +8 -0
- package/build/esm/common/Time.js +2 -0
- package/build/esm/common/Time.js.map +1 -0
- package/build/esm/context/NoopContextManager.d.ts +9 -0
- package/build/esm/context/NoopContextManager.js +47 -0
- package/build/esm/context/NoopContextManager.js.map +1 -0
- package/build/esm/context/context.d.ts +6 -0
- package/build/esm/context/context.js +52 -0
- package/build/esm/context/context.js.map +1 -0
- package/build/esm/context/types.d.ts +52 -0
- package/build/esm/context/types.js +17 -0
- package/build/esm/context/types.js.map +1 -0
- package/build/esm/diag/ComponentLogger.d.ts +20 -0
- package/build/esm/diag/ComponentLogger.js +77 -0
- package/build/esm/diag/ComponentLogger.js.map +1 -0
- package/build/esm/diag/consoleLogger.d.ts +38 -0
- package/build/esm/diag/consoleLogger.js +54 -0
- package/build/esm/diag/consoleLogger.js.map +1 -0
- package/build/esm/diag/index.d.ts +3 -0
- package/build/esm/diag/index.js +18 -0
- package/build/esm/diag/index.js.map +1 -0
- package/build/esm/diag/internal/logLevelLogger.d.ts +3 -0
- package/build/esm/diag/internal/logLevelLogger.js +41 -0
- package/build/esm/diag/internal/logLevelLogger.js.map +1 -0
- package/build/esm/diag/internal/noopLogger.d.ts +8 -0
- package/build/esm/diag/internal/noopLogger.js +31 -0
- package/build/esm/diag/internal/noopLogger.js.map +1 -0
- package/build/esm/diag/types.d.ts +70 -0
- package/build/esm/diag/types.js +41 -0
- package/build/esm/diag/types.js.map +1 -0
- package/build/esm/index.d.ts +53 -0
- package/build/esm/index.js +63 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/internal/global-utils.d.ts +17 -0
- package/build/esm/internal/global-utils.js +59 -0
- package/build/esm/internal/global-utils.js.map +1 -0
- package/build/esm/internal/semver.d.ts +34 -0
- package/build/esm/internal/semver.js +118 -0
- package/build/esm/internal/semver.js.map +1 -0
- package/build/esm/platform/browser/globalThis.d.ts +3 -0
- package/build/esm/platform/browser/globalThis.js +19 -0
- package/build/esm/platform/browser/globalThis.js.map +1 -0
- package/build/esm/platform/browser/index.d.ts +2 -0
- package/build/esm/platform/browser/index.js +17 -0
- package/build/esm/platform/browser/index.js.map +1 -0
- package/build/esm/platform/index.d.ts +2 -0
- package/build/esm/platform/index.js +17 -0
- package/build/esm/platform/index.js.map +1 -0
- package/build/esm/platform/node/globalThis.d.ts +3 -0
- package/build/esm/platform/node/globalThis.js +19 -0
- package/build/esm/platform/node/globalThis.js.map +1 -0
- package/build/esm/platform/node/index.d.ts +2 -0
- package/build/esm/platform/node/index.js +17 -0
- package/build/esm/platform/node/index.js.map +1 -0
- package/build/esm/propagation/NoopTextMapPropagator.d.ts +13 -0
- package/build/esm/propagation/NoopTextMapPropagator.js +34 -0
- package/build/esm/propagation/NoopTextMapPropagator.js.map +1 -0
- package/build/esm/propagation/TextMapPropagator.d.ts +84 -0
- package/build/esm/propagation/TextMapPropagator.js +38 -0
- package/build/esm/propagation/TextMapPropagator.js.map +1 -0
- package/build/esm/trace/NonRecordingSpan.d.ts +25 -0
- package/build/esm/trace/NonRecordingSpan.js +62 -0
- package/build/esm/trace/NonRecordingSpan.js.map +1 -0
- package/build/esm/trace/NoopTracer.d.ts +14 -0
- package/build/esm/trace/NoopTracer.js +74 -0
- package/build/esm/trace/NoopTracer.js.map +1 -0
- package/build/esm/trace/NoopTracerProvider.d.ts +12 -0
- package/build/esm/trace/NoopTracerProvider.js +32 -0
- package/build/esm/trace/NoopTracerProvider.js.map +1 -0
- package/build/esm/trace/ProxyTracer.d.ts +23 -0
- package/build/esm/trace/ProxyTracer.js +52 -0
- package/build/esm/trace/ProxyTracer.js.map +1 -0
- package/build/esm/trace/ProxyTracerProvider.d.ts +24 -0
- package/build/esm/trace/ProxyTracerProvider.js +54 -0
- package/build/esm/trace/ProxyTracerProvider.js.map +1 -0
- package/build/esm/trace/Sampler.d.ts +30 -0
- package/build/esm/trace/Sampler.js +17 -0
- package/build/esm/trace/Sampler.js.map +1 -0
- package/build/esm/trace/SamplingResult.d.ts +39 -0
- package/build/esm/trace/SamplingResult.js +38 -0
- package/build/esm/trace/SamplingResult.js.map +1 -0
- package/build/esm/trace/SpanOptions.d.ts +23 -0
- package/build/esm/trace/SpanOptions.js +17 -0
- package/build/esm/trace/SpanOptions.js.map +1 -0
- package/build/esm/trace/attributes.d.ts +10 -0
- package/build/esm/trace/attributes.js +17 -0
- package/build/esm/trace/attributes.js.map +1 -0
- package/build/esm/trace/context-utils.d.ts +37 -0
- package/build/esm/trace/context-utils.js +66 -0
- package/build/esm/trace/context-utils.js.map +1 -0
- package/build/esm/trace/link.d.ts +24 -0
- package/build/esm/trace/link.js +17 -0
- package/build/esm/trace/link.js.map +1 -0
- package/build/esm/trace/span.d.ts +101 -0
- package/build/esm/trace/span.js +17 -0
- package/build/esm/trace/span.js.map +1 -0
- package/build/esm/trace/span_context.d.ts +53 -0
- package/build/esm/trace/span_context.js +17 -0
- package/build/esm/trace/span_context.js.map +1 -0
- package/build/esm/trace/span_kind.d.ts +27 -0
- package/build/esm/trace/span_kind.js +43 -0
- package/build/esm/trace/span_kind.js.map +1 -0
- package/build/esm/trace/spancontext-utils.d.ts +20 -0
- package/build/esm/trace/spancontext-utils.js +49 -0
- package/build/esm/trace/spancontext-utils.js.map +1 -0
- package/build/esm/trace/status.d.ts +25 -0
- package/build/esm/trace/status.js +20 -0
- package/build/esm/trace/status.js.map +1 -0
- package/build/esm/trace/trace_flags.d.ts +7 -0
- package/build/esm/trace/trace_flags.js +23 -0
- package/build/esm/trace/trace_flags.js.map +1 -0
- package/build/esm/trace/trace_state.d.ts +38 -0
- package/build/esm/trace/trace_state.js +17 -0
- package/build/esm/trace/trace_state.js.map +1 -0
- package/build/esm/trace/tracer.d.ts +71 -0
- package/build/esm/trace/tracer.js +17 -0
- package/build/esm/trace/tracer.js.map +1 -0
- package/build/esm/trace/tracer_provider.d.ts +19 -0
- package/build/esm/trace/tracer_provider.js +17 -0
- package/build/esm/trace/tracer_provider.js.map +1 -0
- package/build/esm/version.d.ts +2 -0
- package/build/esm/version.js +18 -0
- package/build/esm/version.js.map +1 -0
- package/build/src/api/context.d.ts +41 -0
- package/build/src/api/context.js +93 -0
- package/build/src/api/context.js.map +1 -0
- package/build/src/api/diag.d.ts +38 -0
- package/build/src/api/diag.js +92 -0
- package/build/src/api/diag.js.map +1 -0
- package/build/src/api/propagation.d.ts +48 -0
- package/build/src/api/propagation.js +91 -0
- package/build/src/api/propagation.js.map +1 -0
- package/build/src/api/trace.d.ts +39 -0
- package/build/src/api/trace.js +79 -0
- package/build/src/api/trace.js.map +1 -0
- package/build/src/baggage/context-helpers.d.ts +23 -0
- package/build/src/baggage/context-helpers.js +53 -0
- package/build/src/baggage/context-helpers.js.map +1 -0
- package/build/src/baggage/internal/baggage-impl.d.ts +12 -0
- package/build/src/baggage/internal/baggage-impl.js +64 -0
- package/build/src/baggage/internal/baggage-impl.js.map +1 -0
- package/build/src/baggage/internal/symbol.d.ts +5 -0
- package/build/src/baggage/internal/symbol.js +23 -0
- package/build/src/baggage/internal/symbol.js.map +1 -0
- package/build/src/baggage/types.d.ts +60 -0
- package/build/src/baggage/types.js +18 -0
- package/build/src/baggage/types.js.map +1 -0
- package/build/src/baggage/utils.d.ts +15 -0
- package/build/src/baggage/utils.js +51 -0
- package/build/src/baggage/utils.js.map +1 -0
- package/build/src/common/Exception.d.ts +26 -0
- package/build/src/common/Exception.js +18 -0
- package/build/src/common/Exception.js.map +1 -0
- package/build/src/common/Time.d.ts +8 -0
- package/build/src/common/Time.js +3 -0
- package/build/src/common/Time.js.map +1 -0
- package/build/src/context/NoopContextManager.d.ts +9 -0
- package/build/src/context/NoopContextManager.js +50 -0
- package/build/src/context/NoopContextManager.js.map +1 -0
- package/build/src/context/context.d.ts +6 -0
- package/build/src/context/context.js +56 -0
- package/build/src/context/context.js.map +1 -0
- package/build/src/context/types.d.ts +52 -0
- package/build/src/context/types.js +18 -0
- package/build/src/context/types.js.map +1 -0
- package/build/src/diag/ComponentLogger.d.ts +20 -0
- package/build/src/diag/ComponentLogger.js +80 -0
- package/build/src/diag/ComponentLogger.js.map +1 -0
- package/build/src/diag/consoleLogger.d.ts +38 -0
- package/build/src/diag/consoleLogger.js +57 -0
- package/build/src/diag/consoleLogger.js.map +1 -0
- package/build/src/diag/index.d.ts +3 -0
- package/build/src/diag/index.js +30 -0
- package/build/src/diag/index.js.map +1 -0
- package/build/src/diag/internal/logLevelLogger.d.ts +3 -0
- package/build/src/diag/internal/logLevelLogger.js +45 -0
- package/build/src/diag/internal/logLevelLogger.js.map +1 -0
- package/build/src/diag/internal/noopLogger.d.ts +8 -0
- package/build/src/diag/internal/noopLogger.js +35 -0
- package/build/src/diag/internal/noopLogger.js.map +1 -0
- package/build/src/diag/types.d.ts +70 -0
- package/build/src/diag/types.js +44 -0
- package/build/src/diag/types.js.map +1 -0
- package/build/src/index.d.ts +53 -0
- package/build/src/index.js +83 -0
- package/build/src/index.js.map +1 -0
- package/build/src/internal/global-utils.d.ts +17 -0
- package/build/src/internal/global-utils.js +65 -0
- package/build/src/internal/global-utils.js.map +1 -0
- package/build/src/internal/semver.d.ts +34 -0
- package/build/src/internal/semver.js +122 -0
- package/build/src/internal/semver.js.map +1 -0
- package/build/src/platform/browser/globalThis.d.ts +3 -0
- package/build/src/platform/browser/globalThis.js +22 -0
- package/build/src/platform/browser/globalThis.js.map +1 -0
- package/build/src/platform/browser/index.d.ts +2 -0
- package/build/src/platform/browser/index.js +29 -0
- package/build/src/platform/browser/index.js.map +1 -0
- package/build/src/platform/index.d.ts +2 -0
- package/build/src/platform/index.js +29 -0
- package/build/src/platform/index.js.map +1 -0
- package/build/src/platform/node/globalThis.d.ts +3 -0
- package/build/src/platform/node/globalThis.js +22 -0
- package/build/src/platform/node/globalThis.js.map +1 -0
- package/build/src/platform/node/index.d.ts +2 -0
- package/build/src/platform/node/index.js +29 -0
- package/build/src/platform/node/index.js.map +1 -0
- package/build/src/propagation/NoopTextMapPropagator.d.ts +13 -0
- package/build/src/propagation/NoopTextMapPropagator.js +37 -0
- package/build/src/propagation/NoopTextMapPropagator.js.map +1 -0
- package/build/src/propagation/TextMapPropagator.d.ts +84 -0
- package/build/src/propagation/TextMapPropagator.js +41 -0
- package/build/src/propagation/TextMapPropagator.js.map +1 -0
- package/build/src/trace/NonRecordingSpan.d.ts +25 -0
- package/build/src/trace/NonRecordingSpan.js +65 -0
- package/build/src/trace/NonRecordingSpan.js.map +1 -0
- package/build/src/trace/NoopTracer.d.ts +14 -0
- package/build/src/trace/NoopTracer.js +77 -0
- package/build/src/trace/NoopTracer.js.map +1 -0
- package/build/src/trace/NoopTracerProvider.d.ts +12 -0
- package/build/src/trace/NoopTracerProvider.js +35 -0
- package/build/src/trace/NoopTracerProvider.js.map +1 -0
- package/build/src/trace/ProxyTracer.d.ts +23 -0
- package/build/src/trace/ProxyTracer.js +55 -0
- package/build/src/trace/ProxyTracer.js.map +1 -0
- package/build/src/trace/ProxyTracerProvider.d.ts +24 -0
- package/build/src/trace/ProxyTracerProvider.js +57 -0
- package/build/src/trace/ProxyTracerProvider.js.map +1 -0
- package/build/src/trace/Sampler.d.ts +30 -0
- package/build/src/trace/Sampler.js +18 -0
- package/build/src/trace/Sampler.js.map +1 -0
- package/build/src/trace/SamplingResult.d.ts +39 -0
- package/build/src/trace/SamplingResult.js +41 -0
- package/build/src/trace/SamplingResult.js.map +1 -0
- package/build/src/trace/SpanOptions.d.ts +23 -0
- package/build/src/trace/SpanOptions.js +18 -0
- package/build/src/trace/SpanOptions.js.map +1 -0
- package/build/src/trace/attributes.d.ts +10 -0
- package/build/src/trace/attributes.js +18 -0
- package/build/src/trace/attributes.js.map +1 -0
- package/build/src/trace/context-utils.d.ts +37 -0
- package/build/src/trace/context-utils.js +74 -0
- package/build/src/trace/context-utils.js.map +1 -0
- package/build/src/trace/link.d.ts +24 -0
- package/build/src/trace/link.js +18 -0
- package/build/src/trace/link.js.map +1 -0
- package/build/src/trace/span.d.ts +101 -0
- package/build/src/trace/span.js +18 -0
- package/build/src/trace/span.js.map +1 -0
- package/build/src/trace/span_context.d.ts +53 -0
- package/build/src/trace/span_context.js +18 -0
- package/build/src/trace/span_context.js.map +1 -0
- package/build/src/trace/span_kind.d.ts +27 -0
- package/build/src/trace/span_kind.js +46 -0
- package/build/src/trace/span_kind.js.map +1 -0
- package/build/src/trace/spancontext-utils.d.ts +20 -0
- package/build/src/trace/spancontext-utils.js +56 -0
- package/build/src/trace/spancontext-utils.js.map +1 -0
- package/build/src/trace/status.d.ts +25 -0
- package/build/src/trace/status.js +23 -0
- package/build/src/trace/status.js.map +1 -0
- package/build/src/trace/trace_flags.d.ts +7 -0
- package/build/src/trace/trace_flags.js +26 -0
- package/build/src/trace/trace_flags.js.map +1 -0
- package/build/src/trace/trace_state.d.ts +38 -0
- package/build/src/trace/trace_state.js +18 -0
- package/build/src/trace/trace_state.js.map +1 -0
- package/build/src/trace/tracer.d.ts +71 -0
- package/build/src/trace/tracer.js +18 -0
- package/build/src/trace/tracer.js.map +1 -0
- package/build/src/trace/tracer_provider.d.ts +19 -0
- package/build/src/trace/tracer_provider.js +18 -0
- package/build/src/trace/tracer_provider.js.map +1 -0
- package/build/src/version.d.ts +2 -0
- package/build/src/version.js +21 -0
- package/build/src/version.js.map +1 -0
- package/package.json +23 -18
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils';
|
|
2
|
+
import { Tracer } from '../trace/tracer';
|
|
3
|
+
import { TracerProvider } from '../trace/tracer_provider';
|
|
4
|
+
import { deleteSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils';
|
|
5
|
+
/**
|
|
6
|
+
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
7
|
+
*/
|
|
8
|
+
export declare class TraceAPI {
|
|
9
|
+
private static _instance?;
|
|
10
|
+
private _proxyTracerProvider;
|
|
11
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
12
|
+
private constructor();
|
|
13
|
+
/** Get the singleton instance of the Trace API */
|
|
14
|
+
static getInstance(): TraceAPI;
|
|
15
|
+
/**
|
|
16
|
+
* Set the current global tracer.
|
|
17
|
+
*
|
|
18
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
19
|
+
*/
|
|
20
|
+
setGlobalTracerProvider(provider: TracerProvider): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the global tracer provider.
|
|
23
|
+
*/
|
|
24
|
+
getTracerProvider(): TracerProvider;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a tracer from the global tracer provider.
|
|
27
|
+
*/
|
|
28
|
+
getTracer(name: string, version?: string): Tracer;
|
|
29
|
+
/** Remove the global tracer provider */
|
|
30
|
+
disable(): void;
|
|
31
|
+
wrapSpanContext: typeof wrapSpanContext;
|
|
32
|
+
isSpanContextValid: typeof isSpanContextValid;
|
|
33
|
+
deleteSpan: typeof deleteSpan;
|
|
34
|
+
getSpan: typeof getSpan;
|
|
35
|
+
getSpanContext: typeof getSpanContext;
|
|
36
|
+
setSpan: typeof setSpan;
|
|
37
|
+
setSpanContext: typeof setSpanContext;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
|
|
17
|
+
import { ProxyTracerProvider } from '../trace/ProxyTracerProvider';
|
|
18
|
+
import { isSpanContextValid, wrapSpanContext, } from '../trace/spancontext-utils';
|
|
19
|
+
import { deleteSpan, getSpan, getSpanContext, setSpan, setSpanContext, } from '../trace/context-utils';
|
|
20
|
+
import { DiagAPI } from './diag';
|
|
21
|
+
var API_NAME = 'trace';
|
|
22
|
+
/**
|
|
23
|
+
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
24
|
+
*/
|
|
25
|
+
var TraceAPI = /** @class */ (function () {
|
|
26
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
27
|
+
function TraceAPI() {
|
|
28
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
29
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
30
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
31
|
+
this.deleteSpan = deleteSpan;
|
|
32
|
+
this.getSpan = getSpan;
|
|
33
|
+
this.getSpanContext = getSpanContext;
|
|
34
|
+
this.setSpan = setSpan;
|
|
35
|
+
this.setSpanContext = setSpanContext;
|
|
36
|
+
}
|
|
37
|
+
/** Get the singleton instance of the Trace API */
|
|
38
|
+
TraceAPI.getInstance = function () {
|
|
39
|
+
if (!this._instance) {
|
|
40
|
+
this._instance = new TraceAPI();
|
|
41
|
+
}
|
|
42
|
+
return this._instance;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Set the current global tracer.
|
|
46
|
+
*
|
|
47
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
48
|
+
*/
|
|
49
|
+
TraceAPI.prototype.setGlobalTracerProvider = function (provider) {
|
|
50
|
+
var success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
|
|
51
|
+
if (success) {
|
|
52
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
53
|
+
}
|
|
54
|
+
return success;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Returns the global tracer provider.
|
|
58
|
+
*/
|
|
59
|
+
TraceAPI.prototype.getTracerProvider = function () {
|
|
60
|
+
return getGlobal(API_NAME) || this._proxyTracerProvider;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Returns a tracer from the global tracer provider.
|
|
64
|
+
*/
|
|
65
|
+
TraceAPI.prototype.getTracer = function (name, version) {
|
|
66
|
+
return this.getTracerProvider().getTracer(name, version);
|
|
67
|
+
};
|
|
68
|
+
/** Remove the global tracer provider */
|
|
69
|
+
TraceAPI.prototype.disable = function () {
|
|
70
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
71
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
72
|
+
};
|
|
73
|
+
return TraceAPI;
|
|
74
|
+
}());
|
|
75
|
+
export { TraceAPI };
|
|
76
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,IAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;GAEG;AACH;IAKE,+FAA+F;IAC/F;QAHQ,yBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAmDlD,oBAAe,GAAG,eAAe,CAAC;QAElC,uBAAkB,GAAG,kBAAkB,CAAC;QAExC,eAAU,GAAG,UAAU,CAAC;QAExB,YAAO,GAAG,OAAO,CAAC;QAElB,mBAAc,GAAG,cAAc,CAAC;QAEhC,YAAO,GAAG,OAAO,CAAC;QAElB,mBAAc,GAAG,cAAc,CAAC;IA5DhB,CAAC;IAExB,kDAAkD;IACpC,oBAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SACjC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,0CAAuB,GAA9B,UAA+B,QAAwB;QACrD,IAAM,OAAO,GAAG,cAAc,CAC5B,QAAQ,EACR,IAAI,CAAC,oBAAoB,EACzB,OAAO,CAAC,QAAQ,EAAE,CACnB,CAAC;QACF,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SACjD;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,oCAAiB,GAAxB;QACE,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,4BAAS,GAAhB,UAAiB,IAAY,EAAE,OAAgB;QAC7C,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,wCAAwC;IACjC,0BAAO,GAAd;QACE,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACxD,CAAC;IAeH,eAAC;AAAD,CAAC,AAnED,IAmEC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context } from '../context/types';
|
|
2
|
+
import { Baggage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieve the current baggage from the given context
|
|
5
|
+
*
|
|
6
|
+
* @param {Context} Context that manage all context values
|
|
7
|
+
* @returns {Baggage} Extracted baggage from the context
|
|
8
|
+
*/
|
|
9
|
+
export declare function getBaggage(context: Context): Baggage | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Store a baggage in the given context
|
|
12
|
+
*
|
|
13
|
+
* @param {Context} Context that manage all context values
|
|
14
|
+
* @param {Baggage} baggage that will be set in the actual context
|
|
15
|
+
*/
|
|
16
|
+
export declare function setBaggage(context: Context, baggage: Baggage): Context;
|
|
17
|
+
/**
|
|
18
|
+
* Delete the baggage stored in the given context
|
|
19
|
+
*
|
|
20
|
+
* @param {Context} Context that manage all context values
|
|
21
|
+
*/
|
|
22
|
+
export declare function deleteBaggage(context: Context): Context;
|
|
23
|
+
//# sourceMappingURL=context-helpers.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { createContextKey } from '../context/context';
|
|
17
|
+
/**
|
|
18
|
+
* Baggage key
|
|
19
|
+
*/
|
|
20
|
+
var BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve the current baggage from the given context
|
|
23
|
+
*
|
|
24
|
+
* @param {Context} Context that manage all context values
|
|
25
|
+
* @returns {Baggage} Extracted baggage from the context
|
|
26
|
+
*/
|
|
27
|
+
export function getBaggage(context) {
|
|
28
|
+
return context.getValue(BAGGAGE_KEY) || undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Store a baggage in the given context
|
|
32
|
+
*
|
|
33
|
+
* @param {Context} Context that manage all context values
|
|
34
|
+
* @param {Baggage} baggage that will be set in the actual context
|
|
35
|
+
*/
|
|
36
|
+
export function setBaggage(context, baggage) {
|
|
37
|
+
return context.setValue(BAGGAGE_KEY, baggage);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Delete the baggage stored in the given context
|
|
41
|
+
*
|
|
42
|
+
* @param {Context} Context that manage all context values
|
|
43
|
+
*/
|
|
44
|
+
export function deleteBaggage(context) {
|
|
45
|
+
return context.deleteValue(BAGGAGE_KEY);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=context-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.js","sourceRoot":"","sources":["../../../src/baggage/context-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD;;GAEG;AACH,IAAM,WAAW,GAAG,gBAAgB,CAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa,IAAI,SAAS,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Baggage, BaggageEntry } from '../types';
|
|
2
|
+
export declare class BaggageImpl implements Baggage {
|
|
3
|
+
private _entries;
|
|
4
|
+
constructor(entries?: Map<string, BaggageEntry>);
|
|
5
|
+
getEntry(key: string): BaggageEntry | undefined;
|
|
6
|
+
getAllEntries(): [string, BaggageEntry][];
|
|
7
|
+
setEntry(key: string, entry: BaggageEntry): BaggageImpl;
|
|
8
|
+
removeEntry(key: string): BaggageImpl;
|
|
9
|
+
removeEntries(...keys: string[]): BaggageImpl;
|
|
10
|
+
clear(): BaggageImpl;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=baggage-impl.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var BaggageImpl = /** @class */ (function () {
|
|
17
|
+
function BaggageImpl(entries) {
|
|
18
|
+
this._entries = entries ? new Map(entries) : new Map();
|
|
19
|
+
}
|
|
20
|
+
BaggageImpl.prototype.getEntry = function (key) {
|
|
21
|
+
var entry = this._entries.get(key);
|
|
22
|
+
if (!entry) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return Object.assign({}, entry);
|
|
26
|
+
};
|
|
27
|
+
BaggageImpl.prototype.getAllEntries = function () {
|
|
28
|
+
return Array.from(this._entries.entries()).map(function (_a) {
|
|
29
|
+
var k = _a[0], v = _a[1];
|
|
30
|
+
return [k, v];
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
BaggageImpl.prototype.setEntry = function (key, entry) {
|
|
34
|
+
var newBaggage = new BaggageImpl(this._entries);
|
|
35
|
+
newBaggage._entries.set(key, entry);
|
|
36
|
+
return newBaggage;
|
|
37
|
+
};
|
|
38
|
+
BaggageImpl.prototype.removeEntry = function (key) {
|
|
39
|
+
var newBaggage = new BaggageImpl(this._entries);
|
|
40
|
+
newBaggage._entries.delete(key);
|
|
41
|
+
return newBaggage;
|
|
42
|
+
};
|
|
43
|
+
BaggageImpl.prototype.removeEntries = function () {
|
|
44
|
+
var keys = [];
|
|
45
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
46
|
+
keys[_i] = arguments[_i];
|
|
47
|
+
}
|
|
48
|
+
var newBaggage = new BaggageImpl(this._entries);
|
|
49
|
+
for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) {
|
|
50
|
+
var key = keys_1[_a];
|
|
51
|
+
newBaggage._entries.delete(key);
|
|
52
|
+
}
|
|
53
|
+
return newBaggage;
|
|
54
|
+
};
|
|
55
|
+
BaggageImpl.prototype.clear = function () {
|
|
56
|
+
return new BaggageImpl();
|
|
57
|
+
};
|
|
58
|
+
return BaggageImpl;
|
|
59
|
+
}());
|
|
60
|
+
export { BaggageImpl };
|
|
61
|
+
//# sourceMappingURL=baggage-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baggage-impl.js","sourceRoot":"","sources":["../../../../src/baggage/internal/baggage-impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;IAGE,qBAAY,OAAmC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,8BAAQ,GAAR,UAAS,GAAW;QAClB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,mCAAa,GAAb;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,EAAM;gBAAL,CAAC,QAAA,EAAE,CAAC,QAAA;YAAM,OAAA,CAAC,CAAC,EAAE,CAAC,CAAC;QAAN,CAAM,CAAC,CAAC;IACrE,CAAC;IAED,8BAAQ,GAAR,UAAS,GAAW,EAAE,KAAmB;QACvC,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,iCAAW,GAAX,UAAY,GAAW;QACrB,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,mCAAa,GAAb;QAAc,cAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,yBAAiB;;QAC7B,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,2BAAK,GAAL;QACE,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IACH,kBAAC;AAAD,CAAC,AA3CD,IA2CC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Symbol used to make BaggageEntryMetadata an opaque type
|
|
18
|
+
*/
|
|
19
|
+
export var baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');
|
|
20
|
+
//# sourceMappingURL=symbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../../src/baggage/internal/symbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,MAAM,CAAC,IAAM,0BAA0B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { baggageEntryMetadataSymbol } from './internal/symbol';
|
|
2
|
+
export interface BaggageEntry {
|
|
3
|
+
/** `String` value of the `BaggageEntry`. */
|
|
4
|
+
value: string;
|
|
5
|
+
/**
|
|
6
|
+
* Metadata is an optional string property defined by the W3C baggage specification.
|
|
7
|
+
* It currently has no special meaning defined by the specification.
|
|
8
|
+
*/
|
|
9
|
+
metadata?: BaggageEntryMetadata;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Serializable Metadata defined by the W3C baggage specification.
|
|
13
|
+
* It currently has no special meaning defined by the OpenTelemetry or W3C.
|
|
14
|
+
*/
|
|
15
|
+
export declare type BaggageEntryMetadata = {
|
|
16
|
+
toString(): string;
|
|
17
|
+
} & {
|
|
18
|
+
__TYPE__: typeof baggageEntryMetadataSymbol;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Baggage represents collection of key-value pairs with optional metadata.
|
|
22
|
+
* Each key of Baggage is associated with exactly one value.
|
|
23
|
+
* Baggage may be used to annotate and enrich telemetry data.
|
|
24
|
+
*/
|
|
25
|
+
export interface Baggage {
|
|
26
|
+
/**
|
|
27
|
+
* Get an entry from Baggage if it exists
|
|
28
|
+
*
|
|
29
|
+
* @param key The key which identifies the BaggageEntry
|
|
30
|
+
*/
|
|
31
|
+
getEntry(key: string): BaggageEntry | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get a list of all entries in the Baggage
|
|
34
|
+
*/
|
|
35
|
+
getAllEntries(): [string, BaggageEntry][];
|
|
36
|
+
/**
|
|
37
|
+
* Returns a new baggage with the entries from the current bag and the specified entry
|
|
38
|
+
*
|
|
39
|
+
* @param key string which identifies the baggage entry
|
|
40
|
+
* @param entry BaggageEntry for the given key
|
|
41
|
+
*/
|
|
42
|
+
setEntry(key: string, entry: BaggageEntry): Baggage;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a new baggage with the entries from the current bag except the removed entry
|
|
45
|
+
*
|
|
46
|
+
* @param key key identifying the entry to be removed
|
|
47
|
+
*/
|
|
48
|
+
removeEntry(key: string): Baggage;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a new baggage with the entries from the current bag except the removed entries
|
|
51
|
+
*
|
|
52
|
+
* @param key keys identifying the entries to be removed
|
|
53
|
+
*/
|
|
54
|
+
removeEntries(...key: string[]): Baggage;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a new baggage with no entries
|
|
57
|
+
*/
|
|
58
|
+
clear(): Baggage;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/baggage/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Baggage, BaggageEntry, BaggageEntryMetadata } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new Baggage with optional entries
|
|
4
|
+
*
|
|
5
|
+
* @param entries An array of baggage entries the new baggage should contain
|
|
6
|
+
*/
|
|
7
|
+
export declare function createBaggage(entries?: Record<string, BaggageEntry>): Baggage;
|
|
8
|
+
/**
|
|
9
|
+
* Create a serializable BaggageEntryMetadata object from a string.
|
|
10
|
+
*
|
|
11
|
+
* @param str string metadata. Format is currently not defined by the spec and has no special meaning.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare function baggageEntryMetadataFromString(str: string): BaggageEntryMetadata;
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { diag } from '..';
|
|
17
|
+
import { BaggageImpl } from './internal/baggage-impl';
|
|
18
|
+
import { baggageEntryMetadataSymbol } from './internal/symbol';
|
|
19
|
+
/**
|
|
20
|
+
* Create a new Baggage with optional entries
|
|
21
|
+
*
|
|
22
|
+
* @param entries An array of baggage entries the new baggage should contain
|
|
23
|
+
*/
|
|
24
|
+
export function createBaggage(entries) {
|
|
25
|
+
if (entries === void 0) { entries = {}; }
|
|
26
|
+
return new BaggageImpl(new Map(Object.entries(entries)));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a serializable BaggageEntryMetadata object from a string.
|
|
30
|
+
*
|
|
31
|
+
* @param str string metadata. Format is currently not defined by the spec and has no special meaning.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export function baggageEntryMetadataFromString(str) {
|
|
35
|
+
if (typeof str !== 'string') {
|
|
36
|
+
diag.error("Cannot create baggage metadata from unknown type: " + typeof str);
|
|
37
|
+
str = '';
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
__TYPE__: baggageEntryMetadataSymbol,
|
|
41
|
+
toString: function () {
|
|
42
|
+
return str;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/baggage/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAG/D;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,OAA0C;IAA1C,wBAAA,EAAA,YAA0C;IAE1C,OAAO,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAAW;IAEX,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,IAAI,CAAC,KAAK,CACR,uDAAqD,OAAO,GAAK,CAClE,CAAC;QACF,GAAG,GAAG,EAAE,CAAC;KACV;IAED,OAAO;QACL,QAAQ,EAAE,0BAA0B;QACpC,QAAQ;YACN,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface ExceptionWithCode {
|
|
2
|
+
code: string | number;
|
|
3
|
+
name?: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
stack?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ExceptionWithMessage {
|
|
8
|
+
code?: string | number;
|
|
9
|
+
message: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ExceptionWithName {
|
|
14
|
+
code?: string | number;
|
|
15
|
+
message?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
stack?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Defines Exception.
|
|
21
|
+
*
|
|
22
|
+
* string or an object with one of (message or name or code) and optional stack
|
|
23
|
+
*/
|
|
24
|
+
export declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=Exception.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/common/Exception.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/common/Time.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as types from './types';
|
|
2
|
+
export declare class NoopContextManager implements types.ContextManager {
|
|
3
|
+
active(): types.Context;
|
|
4
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(_context: types.Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
5
|
+
bind<T>(_context: types.Context, target: T): T;
|
|
6
|
+
enable(): this;
|
|
7
|
+
disable(): this;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NoopContextManager.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
17
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
18
|
+
to[j] = from[i];
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
import { ROOT_CONTEXT } from './context';
|
|
22
|
+
var NoopContextManager = /** @class */ (function () {
|
|
23
|
+
function NoopContextManager() {
|
|
24
|
+
}
|
|
25
|
+
NoopContextManager.prototype.active = function () {
|
|
26
|
+
return ROOT_CONTEXT;
|
|
27
|
+
};
|
|
28
|
+
NoopContextManager.prototype.with = function (_context, fn, thisArg) {
|
|
29
|
+
var args = [];
|
|
30
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
31
|
+
args[_i - 3] = arguments[_i];
|
|
32
|
+
}
|
|
33
|
+
return fn.call.apply(fn, __spreadArray([thisArg], args));
|
|
34
|
+
};
|
|
35
|
+
NoopContextManager.prototype.bind = function (_context, target) {
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
NoopContextManager.prototype.enable = function () {
|
|
39
|
+
return this;
|
|
40
|
+
};
|
|
41
|
+
NoopContextManager.prototype.disable = function () {
|
|
42
|
+
return this;
|
|
43
|
+
};
|
|
44
|
+
return NoopContextManager;
|
|
45
|
+
}());
|
|
46
|
+
export { NoopContextManager };
|
|
47
|
+
//# sourceMappingURL=NoopContextManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoopContextManager.js","sourceRoot":"","sources":["../../../src/context/NoopContextManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC;IAAA;IAyBA,CAAC;IAxBC,mCAAM,GAAN;QACE,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,iCAAI,GAAJ,UACE,QAAuB,EACvB,EAAK,EACL,OAA8B;QAC9B,cAAU;aAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;YAAV,6BAAU;;QAEV,OAAO,EAAE,CAAC,IAAI,OAAP,EAAE,iBAAM,OAAO,GAAK,IAAI,GAAE;IACnC,CAAC;IAED,iCAAI,GAAJ,UAAQ,QAAuB,EAAE,MAAS;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mCAAM,GAAN;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oCAAO,GAAP;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IACH,yBAAC;AAAD,CAAC,AAzBD,IAyBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from './types';
|
|
2
|
+
/** Get a key to uniquely identify a context value */
|
|
3
|
+
export declare function createContextKey(description: string): symbol;
|
|
4
|
+
/** The root context is used as the default parent context when there is no active context */
|
|
5
|
+
export declare const ROOT_CONTEXT: Context;
|
|
6
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/** Get a key to uniquely identify a context value */
|
|
17
|
+
export function createContextKey(description) {
|
|
18
|
+
// The specification states that for the same input, multiple calls should
|
|
19
|
+
// return different keys. Due to the nature of the JS dependency management
|
|
20
|
+
// system, this creates problems where multiple versions of some package
|
|
21
|
+
// could hold different keys for the same property.
|
|
22
|
+
//
|
|
23
|
+
// Therefore, we use Symbol.for which returns the same key for the same input.
|
|
24
|
+
return Symbol.for(description);
|
|
25
|
+
}
|
|
26
|
+
var BaseContext = /** @class */ (function () {
|
|
27
|
+
/**
|
|
28
|
+
* Construct a new context which inherits values from an optional parent context.
|
|
29
|
+
*
|
|
30
|
+
* @param parentContext a context from which to inherit values
|
|
31
|
+
*/
|
|
32
|
+
function BaseContext(parentContext) {
|
|
33
|
+
// for minification
|
|
34
|
+
var self = this;
|
|
35
|
+
self._currentContext = parentContext ? new Map(parentContext) : new Map();
|
|
36
|
+
self.getValue = function (key) { return self._currentContext.get(key); };
|
|
37
|
+
self.setValue = function (key, value) {
|
|
38
|
+
var context = new BaseContext(self._currentContext);
|
|
39
|
+
context._currentContext.set(key, value);
|
|
40
|
+
return context;
|
|
41
|
+
};
|
|
42
|
+
self.deleteValue = function (key) {
|
|
43
|
+
var context = new BaseContext(self._currentContext);
|
|
44
|
+
context._currentContext.delete(key);
|
|
45
|
+
return context;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return BaseContext;
|
|
49
|
+
}());
|
|
50
|
+
/** The root context is used as the default parent context when there is no active context */
|
|
51
|
+
export var ROOT_CONTEXT = new BaseContext();
|
|
52
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,qDAAqD;AACrD,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,mDAAmD;IACnD,EAAE;IACF,8EAA8E;IAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED;IAGE;;;;OAIG;IACH,qBAAY,aAAoC;QAC9C,mBAAmB;QACnB,IAAM,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,UAAC,GAAW,IAAK,OAAA,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,EAA7B,CAA6B,CAAC;QAE/D,IAAI,CAAC,QAAQ,GAAG,UAAC,GAAW,EAAE,KAAc;YAC1C,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,UAAC,GAAW;YAC7B,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAyBH,kBAAC;AAAD,CAAC,AApDD,IAoDC;AAED,6FAA6F;AAC7F,MAAM,CAAC,IAAM,YAAY,GAAY,IAAI,WAAW,EAAE,CAAC"}
|