@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,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,64 @@
|
|
|
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.BaggageImpl = void 0;
|
|
19
|
+
var BaggageImpl = /** @class */ (function () {
|
|
20
|
+
function BaggageImpl(entries) {
|
|
21
|
+
this._entries = entries ? new Map(entries) : new Map();
|
|
22
|
+
}
|
|
23
|
+
BaggageImpl.prototype.getEntry = function (key) {
|
|
24
|
+
var entry = this._entries.get(key);
|
|
25
|
+
if (!entry) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return Object.assign({}, entry);
|
|
29
|
+
};
|
|
30
|
+
BaggageImpl.prototype.getAllEntries = function () {
|
|
31
|
+
return Array.from(this._entries.entries()).map(function (_a) {
|
|
32
|
+
var k = _a[0], v = _a[1];
|
|
33
|
+
return [k, v];
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
BaggageImpl.prototype.setEntry = function (key, entry) {
|
|
37
|
+
var newBaggage = new BaggageImpl(this._entries);
|
|
38
|
+
newBaggage._entries.set(key, entry);
|
|
39
|
+
return newBaggage;
|
|
40
|
+
};
|
|
41
|
+
BaggageImpl.prototype.removeEntry = function (key) {
|
|
42
|
+
var newBaggage = new BaggageImpl(this._entries);
|
|
43
|
+
newBaggage._entries.delete(key);
|
|
44
|
+
return newBaggage;
|
|
45
|
+
};
|
|
46
|
+
BaggageImpl.prototype.removeEntries = function () {
|
|
47
|
+
var keys = [];
|
|
48
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
49
|
+
keys[_i] = arguments[_i];
|
|
50
|
+
}
|
|
51
|
+
var newBaggage = new BaggageImpl(this._entries);
|
|
52
|
+
for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) {
|
|
53
|
+
var key = keys_1[_a];
|
|
54
|
+
newBaggage._entries.delete(key);
|
|
55
|
+
}
|
|
56
|
+
return newBaggage;
|
|
57
|
+
};
|
|
58
|
+
BaggageImpl.prototype.clear = function () {
|
|
59
|
+
return new BaggageImpl();
|
|
60
|
+
};
|
|
61
|
+
return BaggageImpl;
|
|
62
|
+
}());
|
|
63
|
+
exports.BaggageImpl = BaggageImpl;
|
|
64
|
+
//# sourceMappingURL=baggage-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baggage-impl.js","sourceRoot":"","sources":["../../../../src/baggage/internal/baggage-impl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH;IAGE,qBAAY,OAAmC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,8BAAQ,GAAR,UAAS,GAAW;QAClB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,mCAAa,GAAb;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,EAAM;gBAAL,CAAC,QAAA,EAAE,CAAC,QAAA;YAAM,OAAA,CAAC,CAAC,EAAE,CAAC,CAAC;QAAN,CAAM,CAAC,CAAC;IACrE,CAAC;IAED,8BAAQ,GAAR,UAAS,GAAW,EAAE,KAAmB;QACvC,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,iCAAW,GAAX,UAAY,GAAW;QACrB,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,mCAAa,GAAb;QAAc,cAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,yBAAiB;;QAC7B,IAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,2BAAK,GAAL;QACE,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IACH,kBAAC;AAAD,CAAC,AA3CD,IA2CC;AA3CY,kCAAW"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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.baggageEntryMetadataSymbol = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* Symbol used to make BaggageEntryMetadata an opaque type
|
|
21
|
+
*/
|
|
22
|
+
exports.baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');
|
|
23
|
+
//# sourceMappingURL=symbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../../src/baggage/internal/symbol.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACU,QAAA,0BAA0B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { baggageEntryMetadataSymbol } from './internal/symbol';
|
|
2
|
+
export interface BaggageEntry {
|
|
3
|
+
/** `String` value of the `BaggageEntry`. */
|
|
4
|
+
value: string;
|
|
5
|
+
/**
|
|
6
|
+
* Metadata is an optional string property defined by the W3C baggage specification.
|
|
7
|
+
* It currently has no special meaning defined by the specification.
|
|
8
|
+
*/
|
|
9
|
+
metadata?: BaggageEntryMetadata;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Serializable Metadata defined by the W3C baggage specification.
|
|
13
|
+
* It currently has no special meaning defined by the OpenTelemetry or W3C.
|
|
14
|
+
*/
|
|
15
|
+
export declare type BaggageEntryMetadata = {
|
|
16
|
+
toString(): string;
|
|
17
|
+
} & {
|
|
18
|
+
__TYPE__: typeof baggageEntryMetadataSymbol;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Baggage represents collection of key-value pairs with optional metadata.
|
|
22
|
+
* Each key of Baggage is associated with exactly one value.
|
|
23
|
+
* Baggage may be used to annotate and enrich telemetry data.
|
|
24
|
+
*/
|
|
25
|
+
export interface Baggage {
|
|
26
|
+
/**
|
|
27
|
+
* Get an entry from Baggage if it exists
|
|
28
|
+
*
|
|
29
|
+
* @param key The key which identifies the BaggageEntry
|
|
30
|
+
*/
|
|
31
|
+
getEntry(key: string): BaggageEntry | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get a list of all entries in the Baggage
|
|
34
|
+
*/
|
|
35
|
+
getAllEntries(): [string, BaggageEntry][];
|
|
36
|
+
/**
|
|
37
|
+
* Returns a new baggage with the entries from the current bag and the specified entry
|
|
38
|
+
*
|
|
39
|
+
* @param key string which identifies the baggage entry
|
|
40
|
+
* @param entry BaggageEntry for the given key
|
|
41
|
+
*/
|
|
42
|
+
setEntry(key: string, entry: BaggageEntry): Baggage;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a new baggage with the entries from the current bag except the removed entry
|
|
45
|
+
*
|
|
46
|
+
* @param key key identifying the entry to be removed
|
|
47
|
+
*/
|
|
48
|
+
removeEntry(key: string): Baggage;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a new baggage with the entries from the current bag except the removed entries
|
|
51
|
+
*
|
|
52
|
+
* @param key keys identifying the entries to be removed
|
|
53
|
+
*/
|
|
54
|
+
removeEntries(...key: string[]): Baggage;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a new baggage with no entries
|
|
57
|
+
*/
|
|
58
|
+
clear(): Baggage;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/baggage/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Baggage, BaggageEntry, BaggageEntryMetadata } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new Baggage with optional entries
|
|
4
|
+
*
|
|
5
|
+
* @param entries An array of baggage entries the new baggage should contain
|
|
6
|
+
*/
|
|
7
|
+
export declare function createBaggage(entries?: Record<string, BaggageEntry>): Baggage;
|
|
8
|
+
/**
|
|
9
|
+
* Create a serializable BaggageEntryMetadata object from a string.
|
|
10
|
+
*
|
|
11
|
+
* @param str string metadata. Format is currently not defined by the spec and has no special meaning.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare function baggageEntryMetadataFromString(str: string): BaggageEntryMetadata;
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
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.baggageEntryMetadataFromString = exports.createBaggage = void 0;
|
|
19
|
+
var __1 = require("..");
|
|
20
|
+
var baggage_impl_1 = require("./internal/baggage-impl");
|
|
21
|
+
var symbol_1 = require("./internal/symbol");
|
|
22
|
+
/**
|
|
23
|
+
* Create a new Baggage with optional entries
|
|
24
|
+
*
|
|
25
|
+
* @param entries An array of baggage entries the new baggage should contain
|
|
26
|
+
*/
|
|
27
|
+
function createBaggage(entries) {
|
|
28
|
+
if (entries === void 0) { entries = {}; }
|
|
29
|
+
return new baggage_impl_1.BaggageImpl(new Map(Object.entries(entries)));
|
|
30
|
+
}
|
|
31
|
+
exports.createBaggage = createBaggage;
|
|
32
|
+
/**
|
|
33
|
+
* Create a serializable BaggageEntryMetadata object from a string.
|
|
34
|
+
*
|
|
35
|
+
* @param str string metadata. Format is currently not defined by the spec and has no special meaning.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
function baggageEntryMetadataFromString(str) {
|
|
39
|
+
if (typeof str !== 'string') {
|
|
40
|
+
__1.diag.error("Cannot create baggage metadata from unknown type: " + typeof str);
|
|
41
|
+
str = '';
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
__TYPE__: symbol_1.baggageEntryMetadataSymbol,
|
|
45
|
+
toString: function () {
|
|
46
|
+
return str;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.baggageEntryMetadataFromString = baggageEntryMetadataFromString;
|
|
51
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/baggage/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,wBAA0B;AAC1B,wDAAsD;AACtD,4CAA+D;AAG/D;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,OAA0C;IAA1C,wBAAA,EAAA,YAA0C;IAE1C,OAAO,IAAI,0BAAW,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAJD,sCAIC;AAED;;;;;GAKG;AACH,SAAgB,8BAA8B,CAC5C,GAAW;IAEX,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,QAAI,CAAC,KAAK,CACR,uDAAqD,OAAO,GAAK,CAClE,CAAC;QACF,GAAG,GAAG,EAAE,CAAC;KACV;IAED,OAAO;QACL,QAAQ,EAAE,mCAA0B;QACpC,QAAQ;YACN,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC;AAhBD,wEAgBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface ExceptionWithCode {
|
|
2
|
+
code: string | number;
|
|
3
|
+
name?: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
stack?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ExceptionWithMessage {
|
|
8
|
+
code?: string | number;
|
|
9
|
+
message: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ExceptionWithName {
|
|
14
|
+
code?: string | number;
|
|
15
|
+
message?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
stack?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Defines Exception.
|
|
21
|
+
*
|
|
22
|
+
* string or an object with one of (message or name or code) and optional stack
|
|
23
|
+
*/
|
|
24
|
+
export declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=Exception.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
//# sourceMappingURL=Exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/common/Exception.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../src/common/Time.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as types from './types';
|
|
2
|
+
export declare class NoopContextManager implements types.ContextManager {
|
|
3
|
+
active(): types.Context;
|
|
4
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(_context: types.Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
5
|
+
bind<T>(_context: types.Context, target: T): T;
|
|
6
|
+
enable(): this;
|
|
7
|
+
disable(): this;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NoopContextManager.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
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.NoopContextManager = void 0;
|
|
24
|
+
var context_1 = require("./context");
|
|
25
|
+
var NoopContextManager = /** @class */ (function () {
|
|
26
|
+
function NoopContextManager() {
|
|
27
|
+
}
|
|
28
|
+
NoopContextManager.prototype.active = function () {
|
|
29
|
+
return context_1.ROOT_CONTEXT;
|
|
30
|
+
};
|
|
31
|
+
NoopContextManager.prototype.with = function (_context, fn, thisArg) {
|
|
32
|
+
var args = [];
|
|
33
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
34
|
+
args[_i - 3] = arguments[_i];
|
|
35
|
+
}
|
|
36
|
+
return fn.call.apply(fn, __spreadArray([thisArg], args));
|
|
37
|
+
};
|
|
38
|
+
NoopContextManager.prototype.bind = function (_context, target) {
|
|
39
|
+
return target;
|
|
40
|
+
};
|
|
41
|
+
NoopContextManager.prototype.enable = function () {
|
|
42
|
+
return this;
|
|
43
|
+
};
|
|
44
|
+
NoopContextManager.prototype.disable = function () {
|
|
45
|
+
return this;
|
|
46
|
+
};
|
|
47
|
+
return NoopContextManager;
|
|
48
|
+
}());
|
|
49
|
+
exports.NoopContextManager = NoopContextManager;
|
|
50
|
+
//# sourceMappingURL=NoopContextManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoopContextManager.js","sourceRoot":"","sources":["../../../src/context/NoopContextManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;AAEH,qCAAyC;AAGzC;IAAA;IAyBA,CAAC;IAxBC,mCAAM,GAAN;QACE,OAAO,sBAAY,CAAC;IACtB,CAAC;IAED,iCAAI,GAAJ,UACE,QAAuB,EACvB,EAAK,EACL,OAA8B;QAC9B,cAAU;aAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;YAAV,6BAAU;;QAEV,OAAO,EAAE,CAAC,IAAI,OAAP,EAAE,iBAAM,OAAO,GAAK,IAAI,GAAE;IACnC,CAAC;IAED,iCAAI,GAAJ,UAAQ,QAAuB,EAAE,MAAS;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mCAAM,GAAN;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oCAAO,GAAP;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IACH,yBAAC;AAAD,CAAC,AAzBD,IAyBC;AAzBY,gDAAkB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from './types';
|
|
2
|
+
/** Get a key to uniquely identify a context value */
|
|
3
|
+
export declare function createContextKey(description: string): symbol;
|
|
4
|
+
/** The root context is used as the default parent context when there is no active context */
|
|
5
|
+
export declare const ROOT_CONTEXT: Context;
|
|
6
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
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.ROOT_CONTEXT = exports.createContextKey = void 0;
|
|
19
|
+
/** Get a key to uniquely identify a context value */
|
|
20
|
+
function createContextKey(description) {
|
|
21
|
+
// The specification states that for the same input, multiple calls should
|
|
22
|
+
// return different keys. Due to the nature of the JS dependency management
|
|
23
|
+
// system, this creates problems where multiple versions of some package
|
|
24
|
+
// could hold different keys for the same property.
|
|
25
|
+
//
|
|
26
|
+
// Therefore, we use Symbol.for which returns the same key for the same input.
|
|
27
|
+
return Symbol.for(description);
|
|
28
|
+
}
|
|
29
|
+
exports.createContextKey = createContextKey;
|
|
30
|
+
var BaseContext = /** @class */ (function () {
|
|
31
|
+
/**
|
|
32
|
+
* Construct a new context which inherits values from an optional parent context.
|
|
33
|
+
*
|
|
34
|
+
* @param parentContext a context from which to inherit values
|
|
35
|
+
*/
|
|
36
|
+
function BaseContext(parentContext) {
|
|
37
|
+
// for minification
|
|
38
|
+
var self = this;
|
|
39
|
+
self._currentContext = parentContext ? new Map(parentContext) : new Map();
|
|
40
|
+
self.getValue = function (key) { return self._currentContext.get(key); };
|
|
41
|
+
self.setValue = function (key, value) {
|
|
42
|
+
var context = new BaseContext(self._currentContext);
|
|
43
|
+
context._currentContext.set(key, value);
|
|
44
|
+
return context;
|
|
45
|
+
};
|
|
46
|
+
self.deleteValue = function (key) {
|
|
47
|
+
var context = new BaseContext(self._currentContext);
|
|
48
|
+
context._currentContext.delete(key);
|
|
49
|
+
return context;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return BaseContext;
|
|
53
|
+
}());
|
|
54
|
+
/** The root context is used as the default parent context when there is no active context */
|
|
55
|
+
exports.ROOT_CONTEXT = new BaseContext();
|
|
56
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,qDAAqD;AACrD,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,mDAAmD;IACnD,EAAE;IACF,8EAA8E;IAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AARD,4CAQC;AAED;IAGE;;;;OAIG;IACH,qBAAY,aAAoC;QAC9C,mBAAmB;QACnB,IAAM,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,UAAC,GAAW,IAAK,OAAA,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,EAA7B,CAA6B,CAAC;QAE/D,IAAI,CAAC,QAAQ,GAAG,UAAC,GAAW,EAAE,KAAc;YAC1C,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,UAAC,GAAW;YAC7B,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtD,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAyBH,kBAAC;AAAD,CAAC,AApDD,IAoDC;AAED,6FAA6F;AAChF,QAAA,YAAY,GAAY,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface Context {
|
|
2
|
+
/**
|
|
3
|
+
* Get a value from the context.
|
|
4
|
+
*
|
|
5
|
+
* @param key key which identifies a context value
|
|
6
|
+
*/
|
|
7
|
+
getValue(key: symbol): unknown;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new context which inherits from this context and has
|
|
10
|
+
* the given key set to the given value.
|
|
11
|
+
*
|
|
12
|
+
* @param key context key for which to set the value
|
|
13
|
+
* @param value value to set for the given key
|
|
14
|
+
*/
|
|
15
|
+
setValue(key: symbol, value: unknown): Context;
|
|
16
|
+
/**
|
|
17
|
+
* Return a new context which inherits from this context but does
|
|
18
|
+
* not contain a value for the given key.
|
|
19
|
+
*
|
|
20
|
+
* @param key context key for which to clear a value
|
|
21
|
+
*/
|
|
22
|
+
deleteValue(key: symbol): Context;
|
|
23
|
+
}
|
|
24
|
+
export interface ContextManager {
|
|
25
|
+
/**
|
|
26
|
+
* Get the current active context
|
|
27
|
+
*/
|
|
28
|
+
active(): Context;
|
|
29
|
+
/**
|
|
30
|
+
* Run the fn callback with object set as the current active context
|
|
31
|
+
* @param context Any object to set as the current active context
|
|
32
|
+
* @param fn A callback to be immediately run within a specific context
|
|
33
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
34
|
+
* @param args optional arguments forwarded to fn
|
|
35
|
+
*/
|
|
36
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
37
|
+
/**
|
|
38
|
+
* Bind an object as the current context (or a specific one)
|
|
39
|
+
* @param [context] Optionally specify the context which you want to assign
|
|
40
|
+
* @param target Any object to which a context need to be set
|
|
41
|
+
*/
|
|
42
|
+
bind<T>(context: Context, target: T): T;
|
|
43
|
+
/**
|
|
44
|
+
* Enable context management
|
|
45
|
+
*/
|
|
46
|
+
enable(): this;
|
|
47
|
+
/**
|
|
48
|
+
* Disable context management
|
|
49
|
+
*/
|
|
50
|
+
disable(): this;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/context/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentLoggerOptions, DiagLogger } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component Logger which is meant to be used as part of any component which
|
|
4
|
+
* will add automatically additional namespace in front of the log message.
|
|
5
|
+
* It will then forward all message to global diag logger
|
|
6
|
+
* @example
|
|
7
|
+
* const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });
|
|
8
|
+
* cLogger.debug('test');
|
|
9
|
+
* // @opentelemetry/instrumentation-http test
|
|
10
|
+
*/
|
|
11
|
+
export declare class DiagComponentLogger implements DiagLogger {
|
|
12
|
+
private _namespace;
|
|
13
|
+
constructor(props: ComponentLoggerOptions);
|
|
14
|
+
debug(...args: any[]): void;
|
|
15
|
+
error(...args: any[]): void;
|
|
16
|
+
info(...args: any[]): void;
|
|
17
|
+
warn(...args: any[]): void;
|
|
18
|
+
verbose(...args: any[]): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ComponentLogger.d.ts.map
|