@opentelemetry/api 1.0.0-rc.3 → 1.0.3
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 +130 -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/{src/baggage/internal/baggage.d.ts → esm/baggage/internal/baggage-impl.d.ts} +2 -3
- 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/{src/baggage/Baggage.d.ts → esm/baggage/types.d.ts} +20 -2
- package/build/{src/trace/Event.js → esm/baggage/types.js} +2 -3
- package/build/esm/baggage/types.js.map +1 -0
- package/build/{src/baggage/index.d.ts → esm/baggage/utils.d.ts} +2 -5
- package/build/esm/baggage/utils.js +47 -0
- package/build/esm/baggage/utils.js.map +1 -0
- package/build/esm/common/Exception.d.ts +26 -0
- package/build/{src/baggage/Baggage.js → esm/common/Exception.js} +2 -3
- 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/{src/trace/TimedEvent.js → esm/context/types.js} +2 -3
- 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 +54 -0
- package/build/esm/index.js +64 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/internal/global-utils.d.ts +16 -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/{src/trace/NoopSpan.d.ts → esm/trace/NonRecordingSpan.d.ts} +4 -4
- package/build/{src/trace/NoopSpan.js → esm/trace/NonRecordingSpan.js} +18 -21
- package/build/esm/trace/NonRecordingSpan.js.map +1 -0
- package/build/esm/trace/NoopTracer.d.ts +14 -0
- package/build/esm/trace/NoopTracer.js +75 -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 +25 -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/invalid-span-constants.d.ts +5 -0
- package/build/esm/trace/invalid-span-constants.js +24 -0
- package/build/esm/trace/invalid-span-constants.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 +17 -0
- package/build/esm/trace/spancontext-utils.js +42 -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 +6 -4
- package/build/src/api/context.js +14 -15
- package/build/src/api/context.js.map +1 -1
- package/build/src/api/diag.d.ts +7 -3
- package/build/src/api/diag.js +16 -4
- package/build/src/api/diag.js.map +1 -1
- package/build/src/api/propagation.d.ts +10 -2
- package/build/src/api/propagation.js +15 -6
- package/build/src/api/propagation.js.map +1 -1
- package/build/src/api/trace.d.ts +12 -3
- package/build/src/api/trace.js +18 -6
- package/build/src/api/trace.js.map +1 -1
- 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.js → baggage-impl.js} +1 -1
- package/build/src/baggage/internal/baggage-impl.js.map +1 -0
- package/build/src/baggage/types.d.ts +60 -0
- package/build/src/baggage/{Entry.js → types.js} +1 -1
- package/build/src/baggage/types.js.map +1 -0
- package/build/src/baggage/utils.d.ts +15 -0
- package/build/src/baggage/{index.js → utils.js} +6 -16
- package/build/src/baggage/utils.js.map +1 -0
- package/build/src/context/NoopContextManager.d.ts +1 -1
- package/build/src/context/NoopContextManager.js +6 -8
- package/build/src/context/NoopContextManager.js.map +1 -1
- package/build/src/context/context.d.ts +0 -59
- package/build/src/context/context.js +7 -101
- package/build/src/context/context.js.map +1 -1
- package/build/src/context/types.d.ts +2 -2
- 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/types.d.ts +6 -0
- package/build/src/index.d.ts +4 -9
- package/build/src/index.js +8 -12
- package/build/src/index.js.map +1 -1
- package/build/src/internal/global-utils.d.ts +2 -2
- package/build/src/internal/global-utils.js +12 -11
- package/build/src/internal/global-utils.js.map +1 -1
- package/build/src/internal/semver.js +13 -1
- package/build/src/internal/semver.js.map +1 -1
- package/build/src/propagation/NoopTextMapPropagator.d.ts +0 -1
- package/build/src/propagation/NoopTextMapPropagator.js +1 -2
- package/build/src/propagation/NoopTextMapPropagator.js.map +1 -1
- 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 +3 -1
- package/build/src/trace/NoopTracer.js +33 -8
- package/build/src/trace/NoopTracer.js.map +1 -1
- package/build/src/trace/NoopTracerProvider.d.ts +0 -1
- package/build/src/trace/NoopTracerProvider.js +2 -3
- package/build/src/trace/NoopTracerProvider.js.map +1 -1
- package/build/src/trace/ProxyTracer.d.ts +5 -2
- package/build/src/trace/ProxyTracer.js +6 -1
- package/build/src/trace/ProxyTracer.js.map +1 -1
- package/build/src/trace/ProxyTracerProvider.js +2 -1
- package/build/src/trace/ProxyTracerProvider.js.map +1 -1
- 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/invalid-span-constants.d.ts +5 -0
- package/build/src/trace/invalid-span-constants.js +27 -0
- package/build/src/trace/invalid-span-constants.js.map +1 -0
- package/build/src/trace/link.d.ts +3 -3
- package/build/src/trace/span.d.ts +1 -1
- package/build/src/trace/spancontext-utils.d.ts +8 -3
- package/build/src/trace/spancontext-utils.js +30 -11
- package/build/src/trace/spancontext-utils.js.map +1 -1
- package/build/src/trace/tracer.d.ts +47 -0
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +27 -19
- package/build/src/baggage/Baggage.js.map +0 -1
- package/build/src/baggage/Entry.d.ts +0 -20
- package/build/src/baggage/Entry.js.map +0 -1
- package/build/src/baggage/index.js.map +0 -1
- package/build/src/baggage/internal/baggage.js.map +0 -1
- package/build/src/trace/Event.d.ts +0 -9
- package/build/src/trace/Event.js.map +0 -1
- package/build/src/trace/NoopSpan.js.map +0 -1
- package/build/src/trace/TimedEvent.d.ts +0 -10
- package/build/src/trace/TimedEvent.js.map +0 -1
- package/build/src/trace/link_context.d.ts +0 -6
- package/build/src/trace/link_context.js +0 -18
- package/build/src/trace/link_context.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tracer } from './tracer';
|
|
2
|
+
/**
|
|
3
|
+
* A registry for creating named {@link Tracer}s.
|
|
4
|
+
*/
|
|
5
|
+
export interface TracerProvider {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a Tracer, creating one if one with the given name and version is
|
|
8
|
+
* not already created.
|
|
9
|
+
*
|
|
10
|
+
* This function may return different Tracer types (e.g.
|
|
11
|
+
* {@link NoopTracerProvider} vs. a functional tracer).
|
|
12
|
+
*
|
|
13
|
+
* @param name The name of the tracer or instrumentation library.
|
|
14
|
+
* @param version The version of the tracer or instrumentation library.
|
|
15
|
+
* @returns Tracer A Tracer with the given name and version
|
|
16
|
+
*/
|
|
17
|
+
getTracer(name: string, version?: string): Tracer;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tracer_provider.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=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.3';
|
|
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"}
|
|
@@ -9,9 +9,11 @@ export declare class ContextAPI {
|
|
|
9
9
|
/** Get the singleton instance of the Context API */
|
|
10
10
|
static getInstance(): ContextAPI;
|
|
11
11
|
/**
|
|
12
|
-
* Set the current context manager.
|
|
12
|
+
* Set the current context manager.
|
|
13
|
+
*
|
|
14
|
+
* @returns true if the context manager was successfully registered, else false
|
|
13
15
|
*/
|
|
14
|
-
setGlobalContextManager(contextManager: ContextManager):
|
|
16
|
+
setGlobalContextManager(contextManager: ContextManager): boolean;
|
|
15
17
|
/**
|
|
16
18
|
* Get the currently active context
|
|
17
19
|
*/
|
|
@@ -28,10 +30,10 @@ export declare class ContextAPI {
|
|
|
28
30
|
/**
|
|
29
31
|
* Bind a context to a target function or event emitter
|
|
30
32
|
*
|
|
31
|
-
* @param target function or event emitter to bind
|
|
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
|
|
33
35
|
*/
|
|
34
|
-
bind<T>(
|
|
36
|
+
bind<T>(context: Context, target: T): T;
|
|
35
37
|
private _getContextManager;
|
|
36
38
|
/** Disable and remove the global context manager */
|
|
37
39
|
disable(): void;
|
package/build/src/api/context.js
CHANGED
|
@@ -14,17 +14,16 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
r[k] = a[j];
|
|
22
|
-
return r;
|
|
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;
|
|
23
21
|
};
|
|
24
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
23
|
exports.ContextAPI = void 0;
|
|
26
24
|
var NoopContextManager_1 = require("../context/NoopContextManager");
|
|
27
25
|
var global_utils_1 = require("../internal/global-utils");
|
|
26
|
+
var diag_1 = require("./diag");
|
|
28
27
|
var API_NAME = 'context';
|
|
29
28
|
var NOOP_CONTEXT_MANAGER = new NoopContextManager_1.NoopContextManager();
|
|
30
29
|
/**
|
|
@@ -42,11 +41,12 @@ var ContextAPI = /** @class */ (function () {
|
|
|
42
41
|
return this._instance;
|
|
43
42
|
};
|
|
44
43
|
/**
|
|
45
|
-
* Set the current context manager.
|
|
44
|
+
* Set the current context manager.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if the context manager was successfully registered, else false
|
|
46
47
|
*/
|
|
47
48
|
ContextAPI.prototype.setGlobalContextManager = function (contextManager) {
|
|
48
|
-
global_utils_1.registerGlobal(API_NAME, contextManager);
|
|
49
|
-
return contextManager;
|
|
49
|
+
return global_utils_1.registerGlobal(API_NAME, contextManager, diag_1.DiagAPI.instance());
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
52
52
|
* Get the currently active context
|
|
@@ -68,17 +68,16 @@ var ContextAPI = /** @class */ (function () {
|
|
|
68
68
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
69
69
|
args[_i - 3] = arguments[_i];
|
|
70
70
|
}
|
|
71
|
-
return (_a = this._getContextManager()).with.apply(_a,
|
|
71
|
+
return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args));
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
74
|
* Bind a context to a target function or event emitter
|
|
75
75
|
*
|
|
76
|
-
* @param target function or event emitter to bind
|
|
77
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
78
|
*/
|
|
79
|
-
ContextAPI.prototype.bind = function (
|
|
80
|
-
|
|
81
|
-
return this._getContextManager().bind(target, context);
|
|
79
|
+
ContextAPI.prototype.bind = function (context, target) {
|
|
80
|
+
return this._getContextManager().bind(context, target);
|
|
82
81
|
};
|
|
83
82
|
ContextAPI.prototype._getContextManager = function () {
|
|
84
83
|
return global_utils_1.getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;
|
|
@@ -86,7 +85,7 @@ var ContextAPI = /** @class */ (function () {
|
|
|
86
85
|
/** Disable and remove the global context manager */
|
|
87
86
|
ContextAPI.prototype.disable = function () {
|
|
88
87
|
this._getContextManager().disable();
|
|
89
|
-
global_utils_1.unregisterGlobal(API_NAME);
|
|
88
|
+
global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance());
|
|
90
89
|
};
|
|
91
90
|
return ContextAPI;
|
|
92
91
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
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"}
|
package/build/src/api/diag.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types';
|
|
1
|
+
import { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types';
|
|
2
2
|
/**
|
|
3
3
|
* Singleton object which represents the entry point to the OpenTelemetry internal
|
|
4
4
|
* diagnostic API
|
|
@@ -18,9 +18,13 @@ export declare class DiagAPI implements DiagLogger {
|
|
|
18
18
|
*
|
|
19
19
|
* @param logger - [Optional] The DiagLogger instance to set as the default logger.
|
|
20
20
|
* @param logLevel - [Optional] The DiagLogLevel used to filter logs sent to the logger. If not provided it will default to INFO.
|
|
21
|
-
* @returns
|
|
21
|
+
* @returns true if the logger was successfully registered, else false
|
|
22
22
|
*/
|
|
23
|
-
setLogger: (logger: DiagLogger, logLevel?: DiagLogLevel) =>
|
|
23
|
+
setLogger: (logger: DiagLogger, logLevel?: DiagLogLevel) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger;
|
|
24
28
|
verbose: DiagLogFunction;
|
|
25
29
|
debug: DiagLogFunction;
|
|
26
30
|
info: DiagLogFunction;
|
package/build/src/api/diag.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.DiagAPI = void 0;
|
|
19
|
+
var ComponentLogger_1 = require("../diag/ComponentLogger");
|
|
19
20
|
var logLevelLogger_1 = require("../diag/internal/logLevelLogger");
|
|
20
21
|
var types_1 = require("../diag/types");
|
|
21
22
|
var global_utils_1 = require("../internal/global-utils");
|
|
@@ -46,7 +47,7 @@ var DiagAPI = /** @class */ (function () {
|
|
|
46
47
|
var self = this;
|
|
47
48
|
// DiagAPI specific functions
|
|
48
49
|
self.setLogger = function (logger, logLevel) {
|
|
49
|
-
var _a;
|
|
50
|
+
var _a, _b;
|
|
50
51
|
if (logLevel === void 0) { logLevel = types_1.DiagLogLevel.INFO; }
|
|
51
52
|
if (logger === self) {
|
|
52
53
|
// There isn't much we can do here.
|
|
@@ -54,12 +55,23 @@ var DiagAPI = /** @class */ (function () {
|
|
|
54
55
|
// Try to log to self. If a logger was previously registered it will receive the log.
|
|
55
56
|
var err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');
|
|
56
57
|
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
57
|
-
return;
|
|
58
|
+
return false;
|
|
58
59
|
}
|
|
59
|
-
global_utils_1.
|
|
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);
|
|
60
69
|
};
|
|
61
70
|
self.disable = function () {
|
|
62
|
-
global_utils_1.unregisterGlobal(API_NAME);
|
|
71
|
+
global_utils_1.unregisterGlobal(API_NAME, self);
|
|
72
|
+
};
|
|
73
|
+
self.createComponentLogger = function (options) {
|
|
74
|
+
return new ComponentLogger_1.DiagComponentLogger(options);
|
|
63
75
|
};
|
|
64
76
|
self.verbose = _logProxy('verbose');
|
|
65
77
|
self.debug = _logProxy('debug');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diag.js","sourceRoot":"","sources":["../../../src/api/diag.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,kEAA2E;AAC3E,
|
|
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"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Context } from '../context/types';
|
|
2
2
|
import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator';
|
|
3
|
+
import { getBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers';
|
|
4
|
+
import { createBaggage } from '../baggage/utils';
|
|
3
5
|
/**
|
|
4
6
|
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
5
7
|
*/
|
|
@@ -10,9 +12,11 @@ export declare class PropagationAPI {
|
|
|
10
12
|
/** Get the singleton instance of the Propagator API */
|
|
11
13
|
static getInstance(): PropagationAPI;
|
|
12
14
|
/**
|
|
13
|
-
* Set the current propagator.
|
|
15
|
+
* Set the current propagator.
|
|
16
|
+
*
|
|
17
|
+
* @returns true if the propagator was successfully registered, else false
|
|
14
18
|
*/
|
|
15
|
-
setGlobalPropagator(propagator: TextMapPropagator):
|
|
19
|
+
setGlobalPropagator(propagator: TextMapPropagator): boolean;
|
|
16
20
|
/**
|
|
17
21
|
* Inject context into a carrier to be propagated inter-process
|
|
18
22
|
*
|
|
@@ -35,6 +39,10 @@ export declare class PropagationAPI {
|
|
|
35
39
|
fields(): string[];
|
|
36
40
|
/** Remove the global propagator */
|
|
37
41
|
disable(): void;
|
|
42
|
+
createBaggage: typeof createBaggage;
|
|
43
|
+
getBaggage: typeof getBaggage;
|
|
44
|
+
setBaggage: typeof setBaggage;
|
|
45
|
+
deleteBaggage: typeof deleteBaggage;
|
|
38
46
|
private _getGlobalPropagator;
|
|
39
47
|
}
|
|
40
48
|
//# sourceMappingURL=propagation.d.ts.map
|
|
@@ -16,16 +16,24 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PropagationAPI = void 0;
|
|
19
|
+
var global_utils_1 = require("../internal/global-utils");
|
|
19
20
|
var NoopTextMapPropagator_1 = require("../propagation/NoopTextMapPropagator");
|
|
20
21
|
var TextMapPropagator_1 = require("../propagation/TextMapPropagator");
|
|
21
|
-
var
|
|
22
|
+
var context_helpers_1 = require("../baggage/context-helpers");
|
|
23
|
+
var utils_1 = require("../baggage/utils");
|
|
24
|
+
var diag_1 = require("./diag");
|
|
22
25
|
var API_NAME = 'propagation';
|
|
26
|
+
var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator_1.NoopTextMapPropagator();
|
|
23
27
|
/**
|
|
24
28
|
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
25
29
|
*/
|
|
26
30
|
var PropagationAPI = /** @class */ (function () {
|
|
27
31
|
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
28
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;
|
|
29
37
|
}
|
|
30
38
|
/** Get the singleton instance of the Propagator API */
|
|
31
39
|
PropagationAPI.getInstance = function () {
|
|
@@ -35,11 +43,12 @@ var PropagationAPI = /** @class */ (function () {
|
|
|
35
43
|
return this._instance;
|
|
36
44
|
};
|
|
37
45
|
/**
|
|
38
|
-
* Set the current propagator.
|
|
46
|
+
* Set the current propagator.
|
|
47
|
+
*
|
|
48
|
+
* @returns true if the propagator was successfully registered, else false
|
|
39
49
|
*/
|
|
40
50
|
PropagationAPI.prototype.setGlobalPropagator = function (propagator) {
|
|
41
|
-
global_utils_1.registerGlobal(API_NAME, propagator);
|
|
42
|
-
return propagator;
|
|
51
|
+
return global_utils_1.registerGlobal(API_NAME, propagator, diag_1.DiagAPI.instance());
|
|
43
52
|
};
|
|
44
53
|
/**
|
|
45
54
|
* Inject context into a carrier to be propagated inter-process
|
|
@@ -71,10 +80,10 @@ var PropagationAPI = /** @class */ (function () {
|
|
|
71
80
|
};
|
|
72
81
|
/** Remove the global propagator */
|
|
73
82
|
PropagationAPI.prototype.disable = function () {
|
|
74
|
-
global_utils_1.unregisterGlobal(API_NAME);
|
|
83
|
+
global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance());
|
|
75
84
|
};
|
|
76
85
|
PropagationAPI.prototype._getGlobalPropagator = function () {
|
|
77
|
-
return global_utils_1.getGlobal(API_NAME) ||
|
|
86
|
+
return global_utils_1.getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
78
87
|
};
|
|
79
88
|
return PropagationAPI;
|
|
80
89
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,
|
|
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"}
|
package/build/src/api/trace.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils';
|
|
1
2
|
import { Tracer } from '../trace/tracer';
|
|
2
3
|
import { TracerProvider } from '../trace/tracer_provider';
|
|
3
|
-
import {
|
|
4
|
+
import { deleteSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils';
|
|
4
5
|
/**
|
|
5
6
|
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
6
7
|
*/
|
|
@@ -12,9 +13,11 @@ export declare class TraceAPI {
|
|
|
12
13
|
/** Get the singleton instance of the Trace API */
|
|
13
14
|
static getInstance(): TraceAPI;
|
|
14
15
|
/**
|
|
15
|
-
* Set the current global tracer.
|
|
16
|
+
* Set the current global tracer.
|
|
17
|
+
*
|
|
18
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
16
19
|
*/
|
|
17
|
-
setGlobalTracerProvider(provider: TracerProvider):
|
|
20
|
+
setGlobalTracerProvider(provider: TracerProvider): boolean;
|
|
18
21
|
/**
|
|
19
22
|
* Returns the global tracer provider.
|
|
20
23
|
*/
|
|
@@ -25,6 +28,12 @@ export declare class TraceAPI {
|
|
|
25
28
|
getTracer(name: string, version?: string): Tracer;
|
|
26
29
|
/** Remove the global tracer provider */
|
|
27
30
|
disable(): void;
|
|
31
|
+
wrapSpanContext: typeof wrapSpanContext;
|
|
28
32
|
isSpanContextValid: typeof isSpanContextValid;
|
|
33
|
+
deleteSpan: typeof deleteSpan;
|
|
34
|
+
getSpan: typeof getSpan;
|
|
35
|
+
getSpanContext: typeof getSpanContext;
|
|
36
|
+
setSpan: typeof setSpan;
|
|
37
|
+
setSpanContext: typeof setSpanContext;
|
|
29
38
|
}
|
|
30
39
|
//# sourceMappingURL=trace.d.ts.map
|
package/build/src/api/trace.js
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.TraceAPI = void 0;
|
|
19
|
+
var global_utils_1 = require("../internal/global-utils");
|
|
19
20
|
var ProxyTracerProvider_1 = require("../trace/ProxyTracerProvider");
|
|
20
21
|
var spancontext_utils_1 = require("../trace/spancontext-utils");
|
|
21
|
-
var
|
|
22
|
+
var context_utils_1 = require("../trace/context-utils");
|
|
23
|
+
var diag_1 = require("./diag");
|
|
22
24
|
var API_NAME = 'trace';
|
|
23
25
|
/**
|
|
24
26
|
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
@@ -27,7 +29,13 @@ var TraceAPI = /** @class */ (function () {
|
|
|
27
29
|
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
28
30
|
function TraceAPI() {
|
|
29
31
|
this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();
|
|
32
|
+
this.wrapSpanContext = spancontext_utils_1.wrapSpanContext;
|
|
30
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;
|
|
31
39
|
}
|
|
32
40
|
/** Get the singleton instance of the Trace API */
|
|
33
41
|
TraceAPI.getInstance = function () {
|
|
@@ -37,12 +45,16 @@ var TraceAPI = /** @class */ (function () {
|
|
|
37
45
|
return this._instance;
|
|
38
46
|
};
|
|
39
47
|
/**
|
|
40
|
-
* Set the current global tracer.
|
|
48
|
+
* Set the current global tracer.
|
|
49
|
+
*
|
|
50
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
41
51
|
*/
|
|
42
52
|
TraceAPI.prototype.setGlobalTracerProvider = function (provider) {
|
|
43
|
-
this._proxyTracerProvider.
|
|
44
|
-
|
|
45
|
-
|
|
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;
|
|
46
58
|
};
|
|
47
59
|
/**
|
|
48
60
|
* Returns the global tracer provider.
|
|
@@ -58,7 +70,7 @@ var TraceAPI = /** @class */ (function () {
|
|
|
58
70
|
};
|
|
59
71
|
/** Remove the global tracer provider */
|
|
60
72
|
TraceAPI.prototype.disable = function () {
|
|
61
|
-
global_utils_1.unregisterGlobal(API_NAME);
|
|
73
|
+
global_utils_1.unregisterGlobal(API_NAME, diag_1.DiagAPI.instance());
|
|
62
74
|
this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();
|
|
63
75
|
};
|
|
64
76
|
return TraceAPI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,oEAAmE;
|
|
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
|
|
@@ -0,0 +1,53 @@
|
|
|
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.deleteBaggage = exports.setBaggage = exports.getBaggage = void 0;
|
|
19
|
+
var context_1 = require("../context/context");
|
|
20
|
+
/**
|
|
21
|
+
* Baggage key
|
|
22
|
+
*/
|
|
23
|
+
var BAGGAGE_KEY = context_1.createContextKey('OpenTelemetry Baggage Key');
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve the current baggage from the given context
|
|
26
|
+
*
|
|
27
|
+
* @param {Context} Context that manage all context values
|
|
28
|
+
* @returns {Baggage} Extracted baggage from the context
|
|
29
|
+
*/
|
|
30
|
+
function getBaggage(context) {
|
|
31
|
+
return context.getValue(BAGGAGE_KEY) || undefined;
|
|
32
|
+
}
|
|
33
|
+
exports.getBaggage = getBaggage;
|
|
34
|
+
/**
|
|
35
|
+
* Store a baggage in the given context
|
|
36
|
+
*
|
|
37
|
+
* @param {Context} Context that manage all context values
|
|
38
|
+
* @param {Baggage} baggage that will be set in the actual context
|
|
39
|
+
*/
|
|
40
|
+
function setBaggage(context, baggage) {
|
|
41
|
+
return context.setValue(BAGGAGE_KEY, baggage);
|
|
42
|
+
}
|
|
43
|
+
exports.setBaggage = setBaggage;
|
|
44
|
+
/**
|
|
45
|
+
* Delete the baggage stored in the given context
|
|
46
|
+
*
|
|
47
|
+
* @param {Context} Context that manage all context values
|
|
48
|
+
*/
|
|
49
|
+
function deleteBaggage(context) {
|
|
50
|
+
return context.deleteValue(BAGGAGE_KEY);
|
|
51
|
+
}
|
|
52
|
+
exports.deleteBaggage = deleteBaggage;
|
|
53
|
+
//# 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,8CAAsD;AAItD;;GAEG;AACH,IAAM,WAAW,GAAG,0BAAgB,CAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAAgB;IACzC,OAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa,IAAI,SAAS,CAAC;AACjE,CAAC;AAFD,gCAEC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,gCAEC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC;AAFD,sCAEC"}
|
|
@@ -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 @@
|
|
|
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;AA3CY,kCAAW"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/baggage/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|