@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,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=tracer_provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer_provider.js","sourceRoot":"","sources":["../../../src/trace/tracer_provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
// this is autogenerated file, see scripts/version-update.js
|
|
17
|
+
export var VERSION = '1.0.2';
|
|
18
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Context, ContextManager } from '../context/types';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
|
4
|
+
*/
|
|
5
|
+
export declare class ContextAPI {
|
|
6
|
+
private static _instance?;
|
|
7
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
8
|
+
private constructor();
|
|
9
|
+
/** Get the singleton instance of the Context API */
|
|
10
|
+
static getInstance(): ContextAPI;
|
|
11
|
+
/**
|
|
12
|
+
* Set the current context manager.
|
|
13
|
+
*
|
|
14
|
+
* @returns true if the context manager was successfully registered, else false
|
|
15
|
+
*/
|
|
16
|
+
setGlobalContextManager(contextManager: ContextManager): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the currently active context
|
|
19
|
+
*/
|
|
20
|
+
active(): Context;
|
|
21
|
+
/**
|
|
22
|
+
* Execute a function with an active context
|
|
23
|
+
*
|
|
24
|
+
* @param context context to be active during function execution
|
|
25
|
+
* @param fn function to execute in a context
|
|
26
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
27
|
+
* @param args optional arguments forwarded to fn
|
|
28
|
+
*/
|
|
29
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
30
|
+
/**
|
|
31
|
+
* Bind a context to a target function or event emitter
|
|
32
|
+
*
|
|
33
|
+
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
34
|
+
* @param target function or event emitter to bind
|
|
35
|
+
*/
|
|
36
|
+
bind<T>(context: Context, target: T): T;
|
|
37
|
+
private _getContextManager;
|
|
38
|
+
/** Disable and remove the global context manager */
|
|
39
|
+
disable(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
18
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
19
|
+
to[j] = from[i];
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.ContextAPI = void 0;
|
|
24
|
+
var NoopContextManager_1 = require("../context/NoopContextManager");
|
|
25
|
+
var global_utils_1 = require("../internal/global-utils");
|
|
26
|
+
var diag_1 = require("./diag");
|
|
27
|
+
var API_NAME = 'context';
|
|
28
|
+
var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager();
|
|
29
|
+
/**
|
|
30
|
+
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
|
31
|
+
*/
|
|
32
|
+
var ContextAPI = /** @class */ (function () {
|
|
33
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
34
|
+
function ContextAPI() {
|
|
35
|
+
}
|
|
36
|
+
/** Get the singleton instance of the Context API */
|
|
37
|
+
ContextAPI.getInstance = function () {
|
|
38
|
+
if (!this._instance) {
|
|
39
|
+
this._instance = new ContextAPI();
|
|
40
|
+
}
|
|
41
|
+
return this._instance;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Set the current context manager.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if the context manager was successfully registered, else false
|
|
47
|
+
*/
|
|
48
|
+
ContextAPI.prototype.setGlobalContextManager = function (contextManager) {
|
|
49
|
+
return global_utils_1.registerGlobal(API_NAME, contextManager, diag_1.DiagAPI.instance());
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Get the currently active context
|
|
53
|
+
*/
|
|
54
|
+
ContextAPI.prototype.active = function () {
|
|
55
|
+
return this._getContextManager().active();
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Execute a function with an active context
|
|
59
|
+
*
|
|
60
|
+
* @param context context to be active during function execution
|
|
61
|
+
* @param fn function to execute in a context
|
|
62
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
63
|
+
* @param args optional arguments forwarded to fn
|
|
64
|
+
*/
|
|
65
|
+
ContextAPI.prototype.with = function (context, fn, thisArg) {
|
|
66
|
+
var _a;
|
|
67
|
+
var args = [];
|
|
68
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
69
|
+
args[_i - 3] = arguments[_i];
|
|
70
|
+
}
|
|
71
|
+
return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args));
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Bind a context to a target function or event emitter
|
|
75
|
+
*
|
|
76
|
+
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
77
|
+
* @param target function or event emitter to bind
|
|
78
|
+
*/
|
|
79
|
+
ContextAPI.prototype.bind = function (context, target) {
|
|
80
|
+
return this._getContextManager().bind(context, target);
|
|
81
|
+
};
|
|
82
|
+
ContextAPI.prototype._getContextManager = function () {
|
|
83
|
+
return global_utils_1.getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;
|
|
84
|
+
};
|
|
85
|
+
/** Disable and remove the global context manager */
|
|
86
|
+
ContextAPI.prototype.disable = function () {
|
|
87
|
+
this._getContextManager().disable();
|
|
88
|
+
global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance());
|
|
89
|
+
};
|
|
90
|
+
return ContextAPI;
|
|
91
|
+
}());
|
|
92
|
+
exports.ContextAPI = ContextAPI;
|
|
93
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;AAEH,oEAAmE;AAEnE,yDAIkC;AAClC,+BAAiC;AAEjC,IAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,IAAM,oBAAoB,GAAG,IAAI,uCAAkB,EAAE,CAAC;AAEtD;;GAEG;AACH;IAGE,+FAA+F;IAC/F;IAAuB,CAAC;IAExB,oDAAoD;IACtC,sBAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,4CAAuB,GAA9B,UAA+B,cAA8B;QAC3D,OAAO,6BAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACI,2BAAM,GAAb;QACE,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,yBAAI,GAAX,UACE,OAAgB,EAChB,EAAK,EACL,OAA8B;;QAC9B,cAAU;aAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;YAAV,6BAAU;;QAEV,OAAO,CAAA,KAAA,IAAI,CAAC,kBAAkB,EAAE,CAAA,CAAC,IAAI,0BAAC,OAAO,EAAE,EAAE,EAAE,OAAO,GAAK,IAAI,GAAE;IACvE,CAAC;IAED;;;;;OAKG;IACI,yBAAI,GAAX,UAAe,OAAgB,EAAE,MAAS;QACxC,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAEO,uCAAkB,GAA1B;QACE,OAAO,wBAAS,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC;IACrD,CAAC;IAED,oDAAoD;IAC7C,4BAAO,GAAd;QACE,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC;QACpC,+BAAgB,CAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IACH,iBAAC;AAAD,CAAC,AAnED,IAmEC;AAnEY,gCAAU"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton object which represents the entry point to the OpenTelemetry internal
|
|
4
|
+
* diagnostic API
|
|
5
|
+
*/
|
|
6
|
+
export declare class DiagAPI implements DiagLogger {
|
|
7
|
+
private static _instance?;
|
|
8
|
+
/** Get the singleton instance of the DiagAPI API */
|
|
9
|
+
static instance(): DiagAPI;
|
|
10
|
+
/**
|
|
11
|
+
* Private internal constructor
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Set the global DiagLogger and DiagLogLevel.
|
|
17
|
+
* If a global diag logger is already set, this will override it.
|
|
18
|
+
*
|
|
19
|
+
* @param logger - [Optional] The DiagLogger instance to set as the default logger.
|
|
20
|
+
* @param logLevel - [Optional] The DiagLogLevel used to filter logs sent to the logger. If not provided it will default to INFO.
|
|
21
|
+
* @returns true if the logger was successfully registered, else false
|
|
22
|
+
*/
|
|
23
|
+
setLogger: (logger: DiagLogger, logLevel?: DiagLogLevel) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger;
|
|
28
|
+
verbose: DiagLogFunction;
|
|
29
|
+
debug: DiagLogFunction;
|
|
30
|
+
info: DiagLogFunction;
|
|
31
|
+
warn: DiagLogFunction;
|
|
32
|
+
error: DiagLogFunction;
|
|
33
|
+
/**
|
|
34
|
+
* Unregister the global logger and return to Noop
|
|
35
|
+
*/
|
|
36
|
+
disable: () => void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=diag.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DiagAPI = void 0;
|
|
19
|
+
var ComponentLogger_1 = require("../diag/ComponentLogger");
|
|
20
|
+
var logLevelLogger_1 = require("../diag/internal/logLevelLogger");
|
|
21
|
+
var types_1 = require("../diag/types");
|
|
22
|
+
var global_utils_1 = require("../internal/global-utils");
|
|
23
|
+
var API_NAME = 'diag';
|
|
24
|
+
/**
|
|
25
|
+
* Singleton object which represents the entry point to the OpenTelemetry internal
|
|
26
|
+
* diagnostic API
|
|
27
|
+
*/
|
|
28
|
+
var DiagAPI = /** @class */ (function () {
|
|
29
|
+
/**
|
|
30
|
+
* Private internal constructor
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
function DiagAPI() {
|
|
34
|
+
function _logProxy(funcName) {
|
|
35
|
+
return function () {
|
|
36
|
+
var logger = global_utils_1.getGlobal('diag');
|
|
37
|
+
// shortcut if logger not set
|
|
38
|
+
if (!logger)
|
|
39
|
+
return;
|
|
40
|
+
return logger[funcName].apply(logger,
|
|
41
|
+
// work around Function.prototype.apply types
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
arguments);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// Using self local variable for minification purposes as 'this' cannot be minified
|
|
47
|
+
var self = this;
|
|
48
|
+
// DiagAPI specific functions
|
|
49
|
+
self.setLogger = function (logger, logLevel) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
if (logLevel === void 0) { logLevel = types_1.DiagLogLevel.INFO; }
|
|
52
|
+
if (logger === self) {
|
|
53
|
+
// There isn't much we can do here.
|
|
54
|
+
// Logging to the console might break the user application.
|
|
55
|
+
// Try to log to self. If a logger was previously registered it will receive the log.
|
|
56
|
+
var err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');
|
|
57
|
+
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
var oldLogger = global_utils_1.getGlobal('diag');
|
|
61
|
+
var newLogger = logLevelLogger_1.createLogLevelDiagLogger(logLevel, logger);
|
|
62
|
+
// There already is an logger registered. We'll let it know before overwriting it.
|
|
63
|
+
if (oldLogger) {
|
|
64
|
+
var stack = (_b = new Error().stack) !== null && _b !== void 0 ? _b : '<failed to generate stacktrace>';
|
|
65
|
+
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
66
|
+
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
67
|
+
}
|
|
68
|
+
return global_utils_1.registerGlobal('diag', newLogger, self, true);
|
|
69
|
+
};
|
|
70
|
+
self.disable = function () {
|
|
71
|
+
global_utils_1.unregisterGlobal(API_NAME, self);
|
|
72
|
+
};
|
|
73
|
+
self.createComponentLogger = function (options) {
|
|
74
|
+
return new ComponentLogger_1.DiagComponentLogger(options);
|
|
75
|
+
};
|
|
76
|
+
self.verbose = _logProxy('verbose');
|
|
77
|
+
self.debug = _logProxy('debug');
|
|
78
|
+
self.info = _logProxy('info');
|
|
79
|
+
self.warn = _logProxy('warn');
|
|
80
|
+
self.error = _logProxy('error');
|
|
81
|
+
}
|
|
82
|
+
/** Get the singleton instance of the DiagAPI API */
|
|
83
|
+
DiagAPI.instance = function () {
|
|
84
|
+
if (!this._instance) {
|
|
85
|
+
this._instance = new DiagAPI();
|
|
86
|
+
}
|
|
87
|
+
return this._instance;
|
|
88
|
+
};
|
|
89
|
+
return DiagAPI;
|
|
90
|
+
}());
|
|
91
|
+
exports.DiagAPI = DiagAPI;
|
|
92
|
+
//# sourceMappingURL=diag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diag.js","sourceRoot":"","sources":["../../../src/api/diag.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAA8D;AAC9D,kEAA2E;AAC3E,uCAKuB;AACvB,yDAIkC;AAElC,IAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;GAGG;AACH;IAYE;;;OAGG;IACH;QACE,SAAS,SAAS,CAAC,QAA0B;YAC3C,OAAO;gBACL,IAAM,MAAM,GAAG,wBAAS,CAAC,MAAM,CAAC,CAAC;gBACjC,6BAA6B;gBAC7B,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAC3B,MAAM;gBACN,6CAA6C;gBAC7C,8DAA8D;gBAC9D,SAAgB,CACjB,CAAC;YACJ,CAAC,CAAC;QACJ,CAAC;QAED,mFAAmF;QACnF,IAAM,IAAI,GAAG,IAAI,CAAC;QAElB,6BAA6B;QAE7B,IAAI,CAAC,SAAS,GAAG,UACf,MAAkB,EAClB,QAA0C;;YAA1C,yBAAA,EAAA,WAAyB,oBAAY,CAAC,IAAI;YAE1C,IAAI,MAAM,KAAK,IAAI,EAAE;gBACnB,mCAAmC;gBACnC,2DAA2D;gBAC3D,qFAAqF;gBACrF,IAAM,GAAG,GAAG,IAAI,KAAK,CACnB,oIAAoI,CACrI,CAAC;gBACF,IAAI,CAAC,KAAK,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrC,OAAO,KAAK,CAAC;aACd;YAED,IAAM,SAAS,GAAG,wBAAS,CAAC,MAAM,CAAC,CAAC;YACpC,IAAM,SAAS,GAAG,yCAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC7D,kFAAkF;YAClF,IAAI,SAAS,EAAE;gBACb,IAAM,KAAK,GAAG,MAAA,IAAI,KAAK,EAAE,CAAC,KAAK,mCAAI,iCAAiC,CAAC;gBACrE,SAAS,CAAC,IAAI,CAAC,6CAA2C,KAAO,CAAC,CAAC;gBACnE,SAAS,CAAC,IAAI,CACZ,+DAA6D,KAAO,CACrE,CAAC;aACH;YAED,OAAO,6BAAc,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG;YACb,+BAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,UAAC,OAA+B;YAC3D,OAAO,IAAI,qCAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IA3ED,oDAAoD;IACtC,gBAAQ,GAAtB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAiGH,cAAC;AAAD,CAAC,AA3GD,IA2GC;AA3GY,0BAAO"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context } from '../context/types';
|
|
2
|
+
import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator';
|
|
3
|
+
import { getBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers';
|
|
4
|
+
import { createBaggage } from '../baggage/utils';
|
|
5
|
+
/**
|
|
6
|
+
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
7
|
+
*/
|
|
8
|
+
export declare class PropagationAPI {
|
|
9
|
+
private static _instance?;
|
|
10
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11
|
+
private constructor();
|
|
12
|
+
/** Get the singleton instance of the Propagator API */
|
|
13
|
+
static getInstance(): PropagationAPI;
|
|
14
|
+
/**
|
|
15
|
+
* Set the current propagator.
|
|
16
|
+
*
|
|
17
|
+
* @returns true if the propagator was successfully registered, else false
|
|
18
|
+
*/
|
|
19
|
+
setGlobalPropagator(propagator: TextMapPropagator): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Inject context into a carrier to be propagated inter-process
|
|
22
|
+
*
|
|
23
|
+
* @param context Context carrying tracing data to inject
|
|
24
|
+
* @param carrier carrier to inject context into
|
|
25
|
+
* @param setter Function used to set values on the carrier
|
|
26
|
+
*/
|
|
27
|
+
inject<Carrier>(context: Context, carrier: Carrier, setter?: TextMapSetter<Carrier>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Extract context from a carrier
|
|
30
|
+
*
|
|
31
|
+
* @param context Context which the newly created context will inherit from
|
|
32
|
+
* @param carrier Carrier to extract context from
|
|
33
|
+
* @param getter Function used to extract keys from a carrier
|
|
34
|
+
*/
|
|
35
|
+
extract<Carrier>(context: Context, carrier: Carrier, getter?: TextMapGetter<Carrier>): Context;
|
|
36
|
+
/**
|
|
37
|
+
* Return a list of all fields which may be used by the propagator.
|
|
38
|
+
*/
|
|
39
|
+
fields(): string[];
|
|
40
|
+
/** Remove the global propagator */
|
|
41
|
+
disable(): void;
|
|
42
|
+
createBaggage: typeof createBaggage;
|
|
43
|
+
getBaggage: typeof getBaggage;
|
|
44
|
+
setBaggage: typeof setBaggage;
|
|
45
|
+
deleteBaggage: typeof deleteBaggage;
|
|
46
|
+
private _getGlobalPropagator;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=propagation.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PropagationAPI = void 0;
|
|
19
|
+
var global_utils_1 = require("../internal/global-utils");
|
|
20
|
+
var NoopTextMapPropagator_1 = require("../propagation/NoopTextMapPropagator");
|
|
21
|
+
var TextMapPropagator_1 = require("../propagation/TextMapPropagator");
|
|
22
|
+
var context_helpers_1 = require("../baggage/context-helpers");
|
|
23
|
+
var utils_1 = require("../baggage/utils");
|
|
24
|
+
var diag_1 = require("./diag");
|
|
25
|
+
var API_NAME = 'propagation';
|
|
26
|
+
var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator();
|
|
27
|
+
/**
|
|
28
|
+
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
29
|
+
*/
|
|
30
|
+
var PropagationAPI = /** @class */ (function () {
|
|
31
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
32
|
+
function PropagationAPI() {
|
|
33
|
+
this.createBaggage = utils_1.createBaggage;
|
|
34
|
+
this.getBaggage = context_helpers_1.getBaggage;
|
|
35
|
+
this.setBaggage = context_helpers_1.setBaggage;
|
|
36
|
+
this.deleteBaggage = context_helpers_1.deleteBaggage;
|
|
37
|
+
}
|
|
38
|
+
/** Get the singleton instance of the Propagator API */
|
|
39
|
+
PropagationAPI.getInstance = function () {
|
|
40
|
+
if (!this._instance) {
|
|
41
|
+
this._instance = new PropagationAPI();
|
|
42
|
+
}
|
|
43
|
+
return this._instance;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Set the current propagator.
|
|
47
|
+
*
|
|
48
|
+
* @returns true if the propagator was successfully registered, else false
|
|
49
|
+
*/
|
|
50
|
+
PropagationAPI.prototype.setGlobalPropagator = function (propagator) {
|
|
51
|
+
return global_utils_1.registerGlobal(API_NAME, propagator, diag_1.DiagAPI.instance());
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Inject context into a carrier to be propagated inter-process
|
|
55
|
+
*
|
|
56
|
+
* @param context Context carrying tracing data to inject
|
|
57
|
+
* @param carrier carrier to inject context into
|
|
58
|
+
* @param setter Function used to set values on the carrier
|
|
59
|
+
*/
|
|
60
|
+
PropagationAPI.prototype.inject = function (context, carrier, setter) {
|
|
61
|
+
if (setter === void 0) { setter = TextMapPropagator_1.defaultTextMapSetter; }
|
|
62
|
+
return this._getGlobalPropagator().inject(context, carrier, setter);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Extract context from a carrier
|
|
66
|
+
*
|
|
67
|
+
* @param context Context which the newly created context will inherit from
|
|
68
|
+
* @param carrier Carrier to extract context from
|
|
69
|
+
* @param getter Function used to extract keys from a carrier
|
|
70
|
+
*/
|
|
71
|
+
PropagationAPI.prototype.extract = function (context, carrier, getter) {
|
|
72
|
+
if (getter === void 0) { getter = TextMapPropagator_1.defaultTextMapGetter; }
|
|
73
|
+
return this._getGlobalPropagator().extract(context, carrier, getter);
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Return a list of all fields which may be used by the propagator.
|
|
77
|
+
*/
|
|
78
|
+
PropagationAPI.prototype.fields = function () {
|
|
79
|
+
return this._getGlobalPropagator().fields();
|
|
80
|
+
};
|
|
81
|
+
/** Remove the global propagator */
|
|
82
|
+
PropagationAPI.prototype.disable = function () {
|
|
83
|
+
global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance());
|
|
84
|
+
};
|
|
85
|
+
PropagationAPI.prototype._getGlobalPropagator = function () {
|
|
86
|
+
return global_utils_1.getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
87
|
+
};
|
|
88
|
+
return PropagationAPI;
|
|
89
|
+
}());
|
|
90
|
+
exports.PropagationAPI = PropagationAPI;
|
|
91
|
+
//# sourceMappingURL=propagation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,yDAIkC;AAClC,8EAA6E;AAC7E,sEAM0C;AAC1C,8DAIoC;AACpC,0CAAiD;AACjD,+BAAiC;AAEjC,IAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,IAAM,wBAAwB,GAAG,IAAI,6CAAqB,EAAE,CAAC;AAE7D;;GAEG;AACH;IAGE,+FAA+F;IAC/F;QA8DO,kBAAa,GAAG,qBAAa,CAAC;QAE9B,eAAU,GAAG,4BAAU,CAAC;QAExB,eAAU,GAAG,4BAAU,CAAC;QAExB,kBAAa,GAAG,+BAAa,CAAC;IApEd,CAAC;IAExB,uDAAuD;IACzC,0BAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,4CAAmB,GAA1B,UAA2B,UAA6B;QACtD,OAAO,6BAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,+BAAM,GAAb,UACE,OAAgB,EAChB,OAAgB,EAChB,MAAqD;QAArD,uBAAA,EAAA,SAAiC,wCAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,gCAAO,GAAd,UACE,OAAgB,EAChB,OAAgB,EAChB,MAAqD;QAArD,uBAAA,EAAA,SAAiC,wCAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,+BAAM,GAAb;QACE,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,gCAAO,GAAd;QACE,+BAAgB,CAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAUO,6CAAoB,GAA5B;QACE,OAAO,wBAAS,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;IACH,qBAAC;AAAD,CAAC,AA7ED,IA6EC;AA7EY,wCAAc"}
|
|
@@ -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,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.TraceAPI = void 0;
|
|
19
|
+
var global_utils_1 = require("../internal/global-utils");
|
|
20
|
+
var ProxyTracerProvider_1 = require("../trace/ProxyTracerProvider");
|
|
21
|
+
var spancontext_utils_1 = require("../trace/spancontext-utils");
|
|
22
|
+
var context_utils_1 = require("../trace/context-utils");
|
|
23
|
+
var diag_1 = require("./diag");
|
|
24
|
+
var API_NAME = 'trace';
|
|
25
|
+
/**
|
|
26
|
+
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
27
|
+
*/
|
|
28
|
+
var TraceAPI = /** @class */ (function () {
|
|
29
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
30
|
+
function TraceAPI() {
|
|
31
|
+
this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();
|
|
32
|
+
this.wrapSpanContext = spancontext_utils_1.wrapSpanContext;
|
|
33
|
+
this.isSpanContextValid = spancontext_utils_1.isSpanContextValid;
|
|
34
|
+
this.deleteSpan = context_utils_1.deleteSpan;
|
|
35
|
+
this.getSpan = context_utils_1.getSpan;
|
|
36
|
+
this.getSpanContext = context_utils_1.getSpanContext;
|
|
37
|
+
this.setSpan = context_utils_1.setSpan;
|
|
38
|
+
this.setSpanContext = context_utils_1.setSpanContext;
|
|
39
|
+
}
|
|
40
|
+
/** Get the singleton instance of the Trace API */
|
|
41
|
+
TraceAPI.getInstance = function () {
|
|
42
|
+
if (!this._instance) {
|
|
43
|
+
this._instance = new TraceAPI();
|
|
44
|
+
}
|
|
45
|
+
return this._instance;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Set the current global tracer.
|
|
49
|
+
*
|
|
50
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
51
|
+
*/
|
|
52
|
+
TraceAPI.prototype.setGlobalTracerProvider = function (provider) {
|
|
53
|
+
var success = global_utils_1.registerGlobal(API_NAME, this._proxyTracerProvider, diag_1.DiagAPI.instance());
|
|
54
|
+
if (success) {
|
|
55
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
56
|
+
}
|
|
57
|
+
return success;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Returns the global tracer provider.
|
|
61
|
+
*/
|
|
62
|
+
TraceAPI.prototype.getTracerProvider = function () {
|
|
63
|
+
return global_utils_1.getGlobal(API_NAME) || this._proxyTracerProvider;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Returns a tracer from the global tracer provider.
|
|
67
|
+
*/
|
|
68
|
+
TraceAPI.prototype.getTracer = function (name, version) {
|
|
69
|
+
return this.getTracerProvider().getTracer(name, version);
|
|
70
|
+
};
|
|
71
|
+
/** Remove the global tracer provider */
|
|
72
|
+
TraceAPI.prototype.disable = function () {
|
|
73
|
+
global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance());
|
|
74
|
+
this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();
|
|
75
|
+
};
|
|
76
|
+
return TraceAPI;
|
|
77
|
+
}());
|
|
78
|
+
exports.TraceAPI = TraceAPI;
|
|
79
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yDAIkC;AAClC,oEAAmE;AACnE,gEAGoC;AAGpC,wDAMgC;AAChC,+BAAiC;AAEjC,IAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;GAEG;AACH;IAKE,+FAA+F;IAC/F;QAHQ,yBAAoB,GAAG,IAAI,yCAAmB,EAAE,CAAC;QAmDlD,oBAAe,GAAG,mCAAe,CAAC;QAElC,uBAAkB,GAAG,sCAAkB,CAAC;QAExC,eAAU,GAAG,0BAAU,CAAC;QAExB,YAAO,GAAG,uBAAO,CAAC;QAElB,mBAAc,GAAG,8BAAc,CAAC;QAEhC,YAAO,GAAG,uBAAO,CAAC;QAElB,mBAAc,GAAG,8BAAc,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,6BAAc,CAC5B,QAAQ,EACR,IAAI,CAAC,oBAAoB,EACzB,cAAO,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,wBAAS,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,+BAAgB,CAAC,QAAQ,EAAE,cAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,IAAI,yCAAmB,EAAE,CAAC;IACxD,CAAC;IAeH,eAAC;AAAD,CAAC,AAnED,IAmEC;AAnEY,4BAAQ"}
|
|
@@ -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
|