@opentelemetry/api 1.6.0 → 1.8.0
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/build/esm/experimental/index.d.ts +3 -0
- package/build/esm/experimental/index.js +17 -0
- package/build/esm/experimental/index.js.map +1 -0
- package/build/esm/experimental/trace/SugaredOptions.d.ts +13 -0
- package/build/esm/experimental/trace/SugaredOptions.js +17 -0
- package/build/esm/experimental/trace/SugaredOptions.js.map +1 -0
- package/build/esm/experimental/trace/SugaredTracer.d.ts +64 -0
- package/build/esm/experimental/trace/SugaredTracer.js +92 -0
- package/build/esm/experimental/trace/SugaredTracer.js.map +1 -0
- package/build/esm/index.d.ts +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/metrics/Metric.d.ts +16 -0
- package/build/esm/metrics/Metric.js.map +1 -1
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esnext/api/context.d.ts +41 -0
- package/build/esnext/api/context.js +77 -0
- package/build/esnext/api/context.js.map +1 -0
- package/build/esnext/api/diag.d.ts +30 -0
- package/build/esnext/api/diag.js +89 -0
- package/build/esnext/api/diag.js.map +1 -0
- package/build/esnext/api/metrics.d.ts +28 -0
- package/build/esnext/api/metrics.js +57 -0
- package/build/esnext/api/metrics.js.map +1 -0
- package/build/esnext/api/propagation.d.ts +49 -0
- package/build/esnext/api/propagation.js +85 -0
- package/build/esnext/api/propagation.js.map +1 -0
- package/build/esnext/api/trace.d.ts +40 -0
- package/build/esnext/api/trace.js +75 -0
- package/build/esnext/api/trace.js.map +1 -0
- package/build/esnext/baggage/context-helpers.d.ts +29 -0
- package/build/esnext/baggage/context-helpers.js +56 -0
- package/build/esnext/baggage/context-helpers.js.map +1 -0
- package/build/esnext/baggage/internal/baggage-impl.d.ts +12 -0
- package/build/esnext/baggage/internal/baggage-impl.js +51 -0
- package/build/esnext/baggage/internal/baggage-impl.js.map +1 -0
- package/build/esnext/baggage/internal/symbol.d.ts +5 -0
- package/build/esnext/baggage/internal/symbol.js +20 -0
- package/build/esnext/baggage/internal/symbol.js.map +1 -0
- package/build/esnext/baggage/types.d.ts +60 -0
- package/build/esnext/baggage/types.js +17 -0
- package/build/esnext/baggage/types.js.map +1 -0
- package/build/esnext/baggage/utils.d.ts +15 -0
- package/build/esnext/baggage/utils.js +46 -0
- package/build/esnext/baggage/utils.js.map +1 -0
- package/build/esnext/common/Attributes.d.ts +15 -0
- package/build/esnext/common/Attributes.js +17 -0
- package/build/esnext/common/Attributes.js.map +1 -0
- package/build/esnext/common/Exception.d.ts +26 -0
- package/build/esnext/common/Exception.js +17 -0
- package/build/esnext/common/Exception.js.map +1 -0
- package/build/esnext/common/Time.d.ts +20 -0
- package/build/esnext/common/Time.js +2 -0
- package/build/esnext/common/Time.js.map +1 -0
- package/build/esnext/context/NoopContextManager.d.ts +9 -0
- package/build/esnext/context/NoopContextManager.js +34 -0
- package/build/esnext/context/NoopContextManager.js.map +1 -0
- package/build/esnext/context/context.d.ts +6 -0
- package/build/esnext/context/context.js +51 -0
- package/build/esnext/context/context.js.map +1 -0
- package/build/esnext/context/types.d.ts +52 -0
- package/build/esnext/context/types.js +17 -0
- package/build/esnext/context/types.js.map +1 -0
- package/build/esnext/context-api.d.ts +4 -0
- package/build/esnext/context-api.js +21 -0
- package/build/esnext/context-api.js.map +1 -0
- package/build/esnext/diag/ComponentLogger.d.ts +20 -0
- package/build/esnext/diag/ComponentLogger.js +55 -0
- package/build/esnext/diag/ComponentLogger.js.map +1 -0
- package/build/esnext/diag/consoleLogger.d.ts +38 -0
- package/build/esnext/diag/consoleLogger.js +53 -0
- package/build/esnext/diag/consoleLogger.js.map +1 -0
- package/build/esnext/diag/internal/logLevelLogger.d.ts +3 -0
- package/build/esnext/diag/internal/logLevelLogger.js +41 -0
- package/build/esnext/diag/internal/logLevelLogger.js.map +1 -0
- package/build/esnext/diag/internal/noopLogger.d.ts +8 -0
- package/build/esnext/diag/internal/noopLogger.js +31 -0
- package/build/esnext/diag/internal/noopLogger.js.map +1 -0
- package/build/esnext/diag/types.d.ts +100 -0
- package/build/esnext/diag/types.js +41 -0
- package/build/esnext/diag/types.js.map +1 -0
- package/build/esnext/diag-api.d.ts +9 -0
- package/build/esnext/diag-api.js +26 -0
- package/build/esnext/diag-api.js.map +1 -0
- package/build/esnext/experimental/index.d.ts +3 -0
- package/build/esnext/experimental/index.js +17 -0
- package/build/esnext/experimental/index.js.map +1 -0
- package/build/esnext/experimental/trace/SugaredOptions.d.ts +13 -0
- package/build/esnext/experimental/trace/SugaredOptions.js +17 -0
- package/build/esnext/experimental/trace/SugaredOptions.js.map +1 -0
- package/build/esnext/experimental/trace/SugaredTracer.d.ts +64 -0
- package/build/esnext/experimental/trace/SugaredTracer.js +88 -0
- package/build/esnext/experimental/trace/SugaredTracer.js.map +1 -0
- package/build/esnext/index.d.ts +54 -0
- package/build/esnext/index.js +53 -0
- package/build/esnext/index.js.map +1 -0
- package/build/esnext/internal/global-utils.d.ts +18 -0
- package/build/esnext/internal/global-utils.js +58 -0
- package/build/esnext/internal/global-utils.js.map +1 -0
- package/build/esnext/internal/semver.d.ts +34 -0
- package/build/esnext/internal/semver.js +118 -0
- package/build/esnext/internal/semver.js.map +1 -0
- package/build/esnext/metrics/Meter.d.ts +104 -0
- package/build/esnext/metrics/Meter.js +17 -0
- package/build/esnext/metrics/Meter.js.map +1 -0
- package/build/esnext/metrics/MeterProvider.d.ts +17 -0
- package/build/esnext/metrics/MeterProvider.js +17 -0
- package/build/esnext/metrics/MeterProvider.js.map +1 -0
- package/build/esnext/metrics/Metric.d.ts +109 -0
- package/build/esnext/metrics/Metric.js +22 -0
- package/build/esnext/metrics/Metric.js.map +1 -0
- package/build/esnext/metrics/NoopMeter.d.ts +74 -0
- package/build/esnext/metrics/NoopMeter.js +103 -0
- package/build/esnext/metrics/NoopMeter.js.map +1 -0
- package/build/esnext/metrics/NoopMeterProvider.d.ts +11 -0
- package/build/esnext/metrics/NoopMeterProvider.js +27 -0
- package/build/esnext/metrics/NoopMeterProvider.js.map +1 -0
- package/build/esnext/metrics/ObservableResult.d.ts +31 -0
- package/build/esnext/metrics/ObservableResult.js +17 -0
- package/build/esnext/metrics/ObservableResult.js.map +1 -0
- package/build/esnext/metrics-api.d.ts +4 -0
- package/build/esnext/metrics-api.js +21 -0
- package/build/esnext/metrics-api.js.map +1 -0
- package/build/esnext/platform/browser/globalThis.d.ts +10 -0
- package/build/esnext/platform/browser/globalThis.js +35 -0
- package/build/esnext/platform/browser/globalThis.js.map +1 -0
- package/build/esnext/platform/browser/index.d.ts +2 -0
- package/build/esnext/platform/browser/index.js +17 -0
- package/build/esnext/platform/browser/index.js.map +1 -0
- package/build/esnext/platform/index.d.ts +2 -0
- package/build/esnext/platform/index.js +17 -0
- package/build/esnext/platform/index.js.map +1 -0
- package/build/esnext/platform/node/globalThis.d.ts +3 -0
- package/build/esnext/platform/node/globalThis.js +19 -0
- package/build/esnext/platform/node/globalThis.js.map +1 -0
- package/build/esnext/platform/node/index.d.ts +2 -0
- package/build/esnext/platform/node/index.js +17 -0
- package/build/esnext/platform/node/index.js.map +1 -0
- package/build/esnext/propagation/NoopTextMapPropagator.d.ts +13 -0
- package/build/esnext/propagation/NoopTextMapPropagator.js +30 -0
- package/build/esnext/propagation/NoopTextMapPropagator.js.map +1 -0
- package/build/esnext/propagation/TextMapPropagator.d.ts +84 -0
- package/build/esnext/propagation/TextMapPropagator.js +38 -0
- package/build/esnext/propagation/TextMapPropagator.js.map +1 -0
- package/build/esnext/propagation-api.d.ts +4 -0
- package/build/esnext/propagation-api.js +21 -0
- package/build/esnext/propagation-api.js.map +1 -0
- package/build/esnext/trace/NonRecordingSpan.d.ts +25 -0
- package/build/esnext/trace/NonRecordingSpan.js +59 -0
- package/build/esnext/trace/NonRecordingSpan.js.map +1 -0
- package/build/esnext/trace/NoopTracer.d.ts +14 -0
- package/build/esnext/trace/NoopTracer.js +71 -0
- package/build/esnext/trace/NoopTracer.js.map +1 -0
- package/build/esnext/trace/NoopTracerProvider.d.ts +13 -0
- package/build/esnext/trace/NoopTracerProvider.js +28 -0
- package/build/esnext/trace/NoopTracerProvider.js.map +1 -0
- package/build/esnext/trace/ProxyTracer.d.ts +27 -0
- package/build/esnext/trace/ProxyTracer.js +51 -0
- package/build/esnext/trace/ProxyTracer.js.map +1 -0
- package/build/esnext/trace/ProxyTracerProvider.d.ts +25 -0
- package/build/esnext/trace/ProxyTracerProvider.js +50 -0
- package/build/esnext/trace/ProxyTracerProvider.js.map +1 -0
- package/build/esnext/trace/Sampler.d.ts +31 -0
- package/build/esnext/trace/Sampler.js +17 -0
- package/build/esnext/trace/Sampler.js.map +1 -0
- package/build/esnext/trace/SamplingResult.d.ts +49 -0
- package/build/esnext/trace/SamplingResult.js +39 -0
- package/build/esnext/trace/SamplingResult.js.map +1 -0
- package/build/esnext/trace/SpanOptions.d.ts +23 -0
- package/build/esnext/trace/SpanOptions.js +17 -0
- package/build/esnext/trace/SpanOptions.js.map +1 -0
- package/build/esnext/trace/attributes.d.ts +10 -0
- package/build/esnext/trace/attributes.js +17 -0
- package/build/esnext/trace/attributes.js.map +1 -0
- package/build/esnext/trace/context-utils.d.ts +41 -0
- package/build/esnext/trace/context-utils.js +73 -0
- package/build/esnext/trace/context-utils.js.map +1 -0
- package/build/esnext/trace/internal/tracestate-impl.d.ts +22 -0
- package/build/esnext/trace/internal/tracestate-impl.js +99 -0
- package/build/esnext/trace/internal/tracestate-impl.js.map +1 -0
- package/build/esnext/trace/internal/tracestate-validators.d.ts +15 -0
- package/build/esnext/trace/internal/tracestate-validators.js +41 -0
- package/build/esnext/trace/internal/tracestate-validators.js.map +1 -0
- package/build/esnext/trace/internal/utils.d.ts +3 -0
- package/build/esnext/trace/internal/utils.js +20 -0
- package/build/esnext/trace/internal/utils.js.map +1 -0
- package/build/esnext/trace/invalid-span-constants.d.ts +5 -0
- package/build/esnext/trace/invalid-span-constants.js +24 -0
- package/build/esnext/trace/invalid-span-constants.js.map +1 -0
- package/build/esnext/trace/link.d.ts +26 -0
- package/build/esnext/trace/link.js +17 -0
- package/build/esnext/trace/link.js.map +1 -0
- package/build/esnext/trace/span.d.ts +101 -0
- package/build/esnext/trace/span.js +17 -0
- package/build/esnext/trace/span.js.map +1 -0
- package/build/esnext/trace/span_context.d.ts +53 -0
- package/build/esnext/trace/span_context.js +17 -0
- package/build/esnext/trace/span_context.js.map +1 -0
- package/build/esnext/trace/span_kind.d.ts +27 -0
- package/build/esnext/trace/span_kind.js +43 -0
- package/build/esnext/trace/span_kind.js.map +1 -0
- package/build/esnext/trace/spancontext-utils.d.ts +17 -0
- package/build/esnext/trace/spancontext-utils.js +42 -0
- package/build/esnext/trace/spancontext-utils.js.map +1 -0
- package/build/esnext/trace/status.d.ts +25 -0
- package/build/esnext/trace/status.js +20 -0
- package/build/esnext/trace/status.js.map +1 -0
- package/build/esnext/trace/trace_flags.d.ts +7 -0
- package/build/esnext/trace/trace_flags.js +23 -0
- package/build/esnext/trace/trace_flags.js.map +1 -0
- package/build/esnext/trace/trace_state.d.ts +38 -0
- package/build/esnext/trace/trace_state.js +17 -0
- package/build/esnext/trace/trace_state.js.map +1 -0
- package/build/esnext/trace/tracer.d.ts +71 -0
- package/build/esnext/trace/tracer.js +17 -0
- package/build/esnext/trace/tracer.js.map +1 -0
- package/build/esnext/trace/tracer_options.d.ts +10 -0
- package/build/esnext/trace/tracer_options.js +17 -0
- package/build/esnext/trace/tracer_options.js.map +1 -0
- package/build/esnext/trace/tracer_provider.d.ts +21 -0
- package/build/esnext/trace/tracer_provider.js +17 -0
- package/build/esnext/trace/tracer_provider.js.map +1 -0
- package/build/esnext/trace-api.d.ts +4 -0
- package/build/esnext/trace-api.js +21 -0
- package/build/esnext/trace-api.js.map +1 -0
- package/build/esnext/version.d.ts +2 -0
- package/build/esnext/version.js +18 -0
- package/build/esnext/version.js.map +1 -0
- package/build/src/experimental/index.d.ts +3 -0
- package/build/src/experimental/index.js +22 -0
- package/build/src/experimental/index.js.map +1 -0
- package/build/src/experimental/trace/SugaredOptions.d.ts +13 -0
- package/build/src/experimental/trace/SugaredOptions.js +18 -0
- package/build/src/experimental/trace/SugaredOptions.js.map +1 -0
- package/build/src/experimental/trace/SugaredTracer.d.ts +64 -0
- package/build/src/experimental/trace/SugaredTracer.js +93 -0
- package/build/src/experimental/trace/SugaredTracer.js.map +1 -0
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/metrics/Metric.d.ts +16 -0
- package/build/src/metrics/Metric.js.map +1 -1
- 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 +26 -7
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Meter, MeterOptions } from '../metrics/Meter';
|
|
2
|
+
import { MeterProvider } from '../metrics/MeterProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Singleton object which represents the entry point to the OpenTelemetry Metrics API
|
|
5
|
+
*/
|
|
6
|
+
export declare class MetricsAPI {
|
|
7
|
+
private static _instance?;
|
|
8
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
9
|
+
private constructor();
|
|
10
|
+
/** Get the singleton instance of the Metrics API */
|
|
11
|
+
static getInstance(): MetricsAPI;
|
|
12
|
+
/**
|
|
13
|
+
* Set the current global meter provider.
|
|
14
|
+
* Returns true if the meter provider was successfully registered, else false.
|
|
15
|
+
*/
|
|
16
|
+
setGlobalMeterProvider(provider: MeterProvider): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the global meter provider.
|
|
19
|
+
*/
|
|
20
|
+
getMeterProvider(): MeterProvider;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a meter from the global meter provider.
|
|
23
|
+
*/
|
|
24
|
+
getMeter(name: string, version?: string, options?: MeterOptions): Meter;
|
|
25
|
+
/** Remove the global meter provider */
|
|
26
|
+
disable(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';
|
|
17
|
+
import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
|
|
18
|
+
import { DiagAPI } from './diag';
|
|
19
|
+
const API_NAME = 'metrics';
|
|
20
|
+
/**
|
|
21
|
+
* Singleton object which represents the entry point to the OpenTelemetry Metrics API
|
|
22
|
+
*/
|
|
23
|
+
export class MetricsAPI {
|
|
24
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
25
|
+
constructor() { }
|
|
26
|
+
/** Get the singleton instance of the Metrics API */
|
|
27
|
+
static getInstance() {
|
|
28
|
+
if (!this._instance) {
|
|
29
|
+
this._instance = new MetricsAPI();
|
|
30
|
+
}
|
|
31
|
+
return this._instance;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Set the current global meter provider.
|
|
35
|
+
* Returns true if the meter provider was successfully registered, else false.
|
|
36
|
+
*/
|
|
37
|
+
setGlobalMeterProvider(provider) {
|
|
38
|
+
return registerGlobal(API_NAME, provider, DiagAPI.instance());
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns the global meter provider.
|
|
42
|
+
*/
|
|
43
|
+
getMeterProvider() {
|
|
44
|
+
return getGlobal(API_NAME) || NOOP_METER_PROVIDER;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns a meter from the global meter provider.
|
|
48
|
+
*/
|
|
49
|
+
getMeter(name, version, options) {
|
|
50
|
+
return this.getMeterProvider().getMeter(name, version, options);
|
|
51
|
+
}
|
|
52
|
+
/** Remove the global meter provider */
|
|
53
|
+
disable() {
|
|
54
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/api/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAE3B;;GAEG;AACH,MAAM,OAAO,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,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;;;OAGG;IACI,sBAAsB,CAAC,QAAuB;QACnD,OAAO,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,QAAQ,CACb,IAAY,EACZ,OAAgB,EAChB,OAAsB;QAEtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Meter, MeterOptions } from '../metrics/Meter';\nimport { MeterProvider } from '../metrics/MeterProvider';\nimport { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'metrics';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Metrics API\n */\nexport class MetricsAPI {\n private static _instance?: MetricsAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Metrics API */\n public static getInstance(): MetricsAPI {\n if (!this._instance) {\n this._instance = new MetricsAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global meter provider.\n * Returns true if the meter provider was successfully registered, else false.\n */\n public setGlobalMeterProvider(provider: MeterProvider): boolean {\n return registerGlobal(API_NAME, provider, DiagAPI.instance());\n }\n\n /**\n * Returns the global meter provider.\n */\n public getMeterProvider(): MeterProvider {\n return getGlobal(API_NAME) || NOOP_METER_PROVIDER;\n }\n\n /**\n * Returns a meter from the global meter provider.\n */\n public getMeter(\n name: string,\n version?: string,\n options?: MeterOptions\n ): Meter {\n return this.getMeterProvider().getMeter(name, version, options);\n }\n\n /** Remove the global meter provider */\n public disable(): void {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Context } from '../context/types';
|
|
2
|
+
import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator';
|
|
3
|
+
import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers';
|
|
4
|
+
import { createBaggage } from '../baggage/utils';
|
|
5
|
+
/**
|
|
6
|
+
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
7
|
+
*/
|
|
8
|
+
export declare class PropagationAPI {
|
|
9
|
+
private static _instance?;
|
|
10
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11
|
+
private constructor();
|
|
12
|
+
/** Get the singleton instance of the Propagator API */
|
|
13
|
+
static getInstance(): PropagationAPI;
|
|
14
|
+
/**
|
|
15
|
+
* Set the current propagator.
|
|
16
|
+
*
|
|
17
|
+
* @returns true if the propagator was successfully registered, else false
|
|
18
|
+
*/
|
|
19
|
+
setGlobalPropagator(propagator: TextMapPropagator): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Inject context into a carrier to be propagated inter-process
|
|
22
|
+
*
|
|
23
|
+
* @param context Context carrying tracing data to inject
|
|
24
|
+
* @param carrier carrier to inject context into
|
|
25
|
+
* @param setter Function used to set values on the carrier
|
|
26
|
+
*/
|
|
27
|
+
inject<Carrier>(context: Context, carrier: Carrier, setter?: TextMapSetter<Carrier>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Extract context from a carrier
|
|
30
|
+
*
|
|
31
|
+
* @param context Context which the newly created context will inherit from
|
|
32
|
+
* @param carrier Carrier to extract context from
|
|
33
|
+
* @param getter Function used to extract keys from a carrier
|
|
34
|
+
*/
|
|
35
|
+
extract<Carrier>(context: Context, carrier: Carrier, getter?: TextMapGetter<Carrier>): Context;
|
|
36
|
+
/**
|
|
37
|
+
* Return a list of all fields which may be used by the propagator.
|
|
38
|
+
*/
|
|
39
|
+
fields(): string[];
|
|
40
|
+
/** Remove the global propagator */
|
|
41
|
+
disable(): void;
|
|
42
|
+
createBaggage: typeof createBaggage;
|
|
43
|
+
getBaggage: typeof getBaggage;
|
|
44
|
+
getActiveBaggage: typeof getActiveBaggage;
|
|
45
|
+
setBaggage: typeof setBaggage;
|
|
46
|
+
deleteBaggage: typeof deleteBaggage;
|
|
47
|
+
private _getGlobalPropagator;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=propagation.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
|
|
17
|
+
import { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';
|
|
18
|
+
import { defaultTextMapGetter, defaultTextMapSetter, } from '../propagation/TextMapPropagator';
|
|
19
|
+
import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage, } from '../baggage/context-helpers';
|
|
20
|
+
import { createBaggage } from '../baggage/utils';
|
|
21
|
+
import { DiagAPI } from './diag';
|
|
22
|
+
const API_NAME = 'propagation';
|
|
23
|
+
const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
|
|
24
|
+
/**
|
|
25
|
+
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
26
|
+
*/
|
|
27
|
+
export class PropagationAPI {
|
|
28
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
29
|
+
constructor() {
|
|
30
|
+
this.createBaggage = createBaggage;
|
|
31
|
+
this.getBaggage = getBaggage;
|
|
32
|
+
this.getActiveBaggage = getActiveBaggage;
|
|
33
|
+
this.setBaggage = setBaggage;
|
|
34
|
+
this.deleteBaggage = deleteBaggage;
|
|
35
|
+
}
|
|
36
|
+
/** Get the singleton instance of the Propagator API */
|
|
37
|
+
static getInstance() {
|
|
38
|
+
if (!this._instance) {
|
|
39
|
+
this._instance = new PropagationAPI();
|
|
40
|
+
}
|
|
41
|
+
return this._instance;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Set the current propagator.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if the propagator was successfully registered, else false
|
|
47
|
+
*/
|
|
48
|
+
setGlobalPropagator(propagator) {
|
|
49
|
+
return registerGlobal(API_NAME, propagator, DiagAPI.instance());
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Inject context into a carrier to be propagated inter-process
|
|
53
|
+
*
|
|
54
|
+
* @param context Context carrying tracing data to inject
|
|
55
|
+
* @param carrier carrier to inject context into
|
|
56
|
+
* @param setter Function used to set values on the carrier
|
|
57
|
+
*/
|
|
58
|
+
inject(context, carrier, setter = defaultTextMapSetter) {
|
|
59
|
+
return this._getGlobalPropagator().inject(context, carrier, setter);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Extract context from a carrier
|
|
63
|
+
*
|
|
64
|
+
* @param context Context which the newly created context will inherit from
|
|
65
|
+
* @param carrier Carrier to extract context from
|
|
66
|
+
* @param getter Function used to extract keys from a carrier
|
|
67
|
+
*/
|
|
68
|
+
extract(context, carrier, getter = defaultTextMapGetter) {
|
|
69
|
+
return this._getGlobalPropagator().extract(context, carrier, getter);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Return a list of all fields which may be used by the propagator.
|
|
73
|
+
*/
|
|
74
|
+
fields() {
|
|
75
|
+
return this._getGlobalPropagator().fields();
|
|
76
|
+
}
|
|
77
|
+
/** Remove the global propagator */
|
|
78
|
+
disable() {
|
|
79
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
80
|
+
}
|
|
81
|
+
_getGlobalPropagator() {
|
|
82
|
+
return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=propagation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAIrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,MAAM,wBAAwB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,cAAc;IAGzB,+FAA+F;IAC/F;QA8DO,kBAAa,GAAG,aAAa,CAAC;QAE9B,eAAU,GAAG,UAAU,CAAC;QAExB,qBAAgB,GAAG,gBAAgB,CAAC;QAEpC,eAAU,GAAG,UAAU,CAAC;QAExB,kBAAa,GAAG,aAAa,CAAC;IAtEd,CAAC;IAExB,uDAAuD;IAChD,MAAM,CAAC,WAAW;QACvB,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,mBAAmB,CAAC,UAA6B;QACtD,OAAO,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CACX,OAAgB,EAChB,OAAgB,EAChB,SAAiC,oBAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CACZ,OAAgB,EAChB,OAAgB,EAChB,SAAiC,oBAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAYO,oBAAoB;QAC1B,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n getBaggage,\n getActiveBaggage,\n setBaggage,\n deleteBaggage,\n} from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n */\nexport class PropagationAPI {\n private static _instance?: PropagationAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Propagator API */\n public static getInstance(): PropagationAPI {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n public setGlobalPropagator(propagator: TextMapPropagator): boolean {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n public inject<Carrier>(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter<Carrier> = defaultTextMapSetter\n ): void {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n public extract<Carrier>(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter<Carrier> = defaultTextMapGetter\n ): Context {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n public fields(): string[] {\n return this._getGlobalPropagator().fields();\n }\n\n /** Remove the global propagator */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n\n public createBaggage = createBaggage;\n\n public getBaggage = getBaggage;\n\n public getActiveBaggage = getActiveBaggage;\n\n public setBaggage = setBaggage;\n\n public deleteBaggage = deleteBaggage;\n\n private _getGlobalPropagator(): TextMapPropagator {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isSpanContextValid, wrapSpanContext } from '../trace/spancontext-utils';
|
|
2
|
+
import { Tracer } from '../trace/tracer';
|
|
3
|
+
import { TracerProvider } from '../trace/tracer_provider';
|
|
4
|
+
import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext } from '../trace/context-utils';
|
|
5
|
+
/**
|
|
6
|
+
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
7
|
+
*/
|
|
8
|
+
export declare class TraceAPI {
|
|
9
|
+
private static _instance?;
|
|
10
|
+
private _proxyTracerProvider;
|
|
11
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
12
|
+
private constructor();
|
|
13
|
+
/** Get the singleton instance of the Trace API */
|
|
14
|
+
static getInstance(): TraceAPI;
|
|
15
|
+
/**
|
|
16
|
+
* Set the current global tracer.
|
|
17
|
+
*
|
|
18
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
19
|
+
*/
|
|
20
|
+
setGlobalTracerProvider(provider: TracerProvider): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the global tracer provider.
|
|
23
|
+
*/
|
|
24
|
+
getTracerProvider(): TracerProvider;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a tracer from the global tracer provider.
|
|
27
|
+
*/
|
|
28
|
+
getTracer(name: string, version?: string): Tracer;
|
|
29
|
+
/** Remove the global tracer provider */
|
|
30
|
+
disable(): void;
|
|
31
|
+
wrapSpanContext: typeof wrapSpanContext;
|
|
32
|
+
isSpanContextValid: typeof isSpanContextValid;
|
|
33
|
+
deleteSpan: typeof deleteSpan;
|
|
34
|
+
getSpan: typeof getSpan;
|
|
35
|
+
getActiveSpan: typeof getActiveSpan;
|
|
36
|
+
getSpanContext: typeof getSpanContext;
|
|
37
|
+
setSpan: typeof setSpan;
|
|
38
|
+
setSpanContext: typeof setSpanContext;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
|
|
17
|
+
import { ProxyTracerProvider } from '../trace/ProxyTracerProvider';
|
|
18
|
+
import { isSpanContextValid, wrapSpanContext, } from '../trace/spancontext-utils';
|
|
19
|
+
import { deleteSpan, getActiveSpan, getSpan, getSpanContext, setSpan, setSpanContext, } from '../trace/context-utils';
|
|
20
|
+
import { DiagAPI } from './diag';
|
|
21
|
+
const API_NAME = 'trace';
|
|
22
|
+
/**
|
|
23
|
+
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
24
|
+
*/
|
|
25
|
+
export class TraceAPI {
|
|
26
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
27
|
+
constructor() {
|
|
28
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
29
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
30
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
31
|
+
this.deleteSpan = deleteSpan;
|
|
32
|
+
this.getSpan = getSpan;
|
|
33
|
+
this.getActiveSpan = getActiveSpan;
|
|
34
|
+
this.getSpanContext = getSpanContext;
|
|
35
|
+
this.setSpan = setSpan;
|
|
36
|
+
this.setSpanContext = setSpanContext;
|
|
37
|
+
}
|
|
38
|
+
/** Get the singleton instance of the Trace API */
|
|
39
|
+
static getInstance() {
|
|
40
|
+
if (!this._instance) {
|
|
41
|
+
this._instance = new TraceAPI();
|
|
42
|
+
}
|
|
43
|
+
return this._instance;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set the current global tracer.
|
|
47
|
+
*
|
|
48
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
49
|
+
*/
|
|
50
|
+
setGlobalTracerProvider(provider) {
|
|
51
|
+
const success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
|
|
52
|
+
if (success) {
|
|
53
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
54
|
+
}
|
|
55
|
+
return success;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the global tracer provider.
|
|
59
|
+
*/
|
|
60
|
+
getTracerProvider() {
|
|
61
|
+
return getGlobal(API_NAME) || this._proxyTracerProvider;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns a tracer from the global tracer provider.
|
|
65
|
+
*/
|
|
66
|
+
getTracer(name, version) {
|
|
67
|
+
return this.getTracerProvider().getTracer(name, version);
|
|
68
|
+
}
|
|
69
|
+
/** Remove the global tracer provider */
|
|
70
|
+
disable() {
|
|
71
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
72
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,OAAO,EACP,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;GAEG;AACH,MAAM,OAAO,QAAQ;IAKnB,+FAA+F;IAC/F;QAHQ,yBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAmDlD,oBAAe,GAAG,eAAe,CAAC;QAElC,uBAAkB,GAAG,kBAAkB,CAAC;QAExC,eAAU,GAAG,UAAU,CAAC;QAExB,YAAO,GAAG,OAAO,CAAC;QAElB,kBAAa,GAAG,aAAa,CAAC;QAE9B,mBAAc,GAAG,cAAc,CAAC;QAEhC,YAAO,GAAG,OAAO,CAAC;QAElB,mBAAc,GAAG,cAAc,CAAC;IA9DhB,CAAC;IAExB,kDAAkD;IAC3C,MAAM,CAAC,WAAW;QACvB,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,uBAAuB,CAAC,QAAwB;QACrD,MAAM,OAAO,GAAG,cAAc,CAC5B,QAAQ,EACR,IAAI,CAAC,oBAAoB,EACzB,OAAO,CAAC,QAAQ,EAAE,CACnB,CAAC;QACF,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SACjD;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,IAAY,EAAE,OAAgB;QAC7C,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,wCAAwC;IACjC,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACxD,CAAC;CAiBF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { ProxyTracerProvider } from '../trace/ProxyTracerProvider';\nimport {\n isSpanContextValid,\n wrapSpanContext,\n} from '../trace/spancontext-utils';\nimport { Tracer } from '../trace/tracer';\nimport { TracerProvider } from '../trace/tracer_provider';\nimport {\n deleteSpan,\n getActiveSpan,\n getSpan,\n getSpanContext,\n setSpan,\n setSpanContext,\n} from '../trace/context-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'trace';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Tracing API\n */\nexport class TraceAPI {\n private static _instance?: TraceAPI;\n\n private _proxyTracerProvider = new ProxyTracerProvider();\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Trace API */\n public static getInstance(): TraceAPI {\n if (!this._instance) {\n this._instance = new TraceAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global tracer.\n *\n * @returns true if the tracer provider was successfully registered, else false\n */\n public setGlobalTracerProvider(provider: TracerProvider): boolean {\n const success = registerGlobal(\n API_NAME,\n this._proxyTracerProvider,\n DiagAPI.instance()\n );\n if (success) {\n this._proxyTracerProvider.setDelegate(provider);\n }\n return success;\n }\n\n /**\n * Returns the global tracer provider.\n */\n public getTracerProvider(): TracerProvider {\n return getGlobal(API_NAME) || this._proxyTracerProvider;\n }\n\n /**\n * Returns a tracer from the global tracer provider.\n */\n public getTracer(name: string, version?: string): Tracer {\n return this.getTracerProvider().getTracer(name, version);\n }\n\n /** Remove the global tracer provider */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n this._proxyTracerProvider = new ProxyTracerProvider();\n }\n\n public wrapSpanContext = wrapSpanContext;\n\n public isSpanContextValid = isSpanContextValid;\n\n public deleteSpan = deleteSpan;\n\n public getSpan = getSpan;\n\n public getActiveSpan = getActiveSpan;\n\n public getSpanContext = getSpanContext;\n\n public setSpan = setSpan;\n\n public setSpanContext = setSpanContext;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* Retrieve the current baggage from the active/current context
|
|
12
|
+
*
|
|
13
|
+
* @returns {Baggage} Extracted baggage from the context
|
|
14
|
+
*/
|
|
15
|
+
export declare function getActiveBaggage(): Baggage | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Store a baggage in the given context
|
|
18
|
+
*
|
|
19
|
+
* @param {Context} Context that manage all context values
|
|
20
|
+
* @param {Baggage} baggage that will be set in the actual context
|
|
21
|
+
*/
|
|
22
|
+
export declare function setBaggage(context: Context, baggage: Baggage): Context;
|
|
23
|
+
/**
|
|
24
|
+
* Delete the baggage stored in the given context
|
|
25
|
+
*
|
|
26
|
+
* @param {Context} Context that manage all context values
|
|
27
|
+
*/
|
|
28
|
+
export declare function deleteBaggage(context: Context): Context;
|
|
29
|
+
//# sourceMappingURL=context-helpers.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ContextAPI } from '../api/context';
|
|
17
|
+
import { createContextKey } from '../context/context';
|
|
18
|
+
/**
|
|
19
|
+
* Baggage key
|
|
20
|
+
*/
|
|
21
|
+
const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve the current baggage from the given context
|
|
24
|
+
*
|
|
25
|
+
* @param {Context} Context that manage all context values
|
|
26
|
+
* @returns {Baggage} Extracted baggage from the context
|
|
27
|
+
*/
|
|
28
|
+
export function getBaggage(context) {
|
|
29
|
+
return context.getValue(BAGGAGE_KEY) || undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieve the current baggage from the active/current context
|
|
33
|
+
*
|
|
34
|
+
* @returns {Baggage} Extracted baggage from the context
|
|
35
|
+
*/
|
|
36
|
+
export function getActiveBaggage() {
|
|
37
|
+
return getBaggage(ContextAPI.getInstance().active());
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Store a baggage in the given context
|
|
41
|
+
*
|
|
42
|
+
* @param {Context} Context that manage all context values
|
|
43
|
+
* @param {Baggage} baggage that will be set in the actual context
|
|
44
|
+
*/
|
|
45
|
+
export function setBaggage(context, baggage) {
|
|
46
|
+
return context.setValue(BAGGAGE_KEY, baggage);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Delete the baggage stored in the given context
|
|
50
|
+
*
|
|
51
|
+
* @param {Context} Context that manage all context values
|
|
52
|
+
*/
|
|
53
|
+
export function deleteBaggage(context) {
|
|
54
|
+
return context.deleteValue(BAGGAGE_KEY);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=context-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-helpers.js","sourceRoot":"","sources":["../../../src/baggage/context-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD;;GAEG;AACH,MAAM,WAAW,GAAG,gBAAgB,CAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa,IAAI,SAAS,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ContextAPI } from '../api/context';\nimport { createContextKey } from '../context/context';\nimport { Context } from '../context/types';\nimport { Baggage } from './types';\n\n/**\n * Baggage key\n */\nconst BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');\n\n/**\n * Retrieve the current baggage from the given context\n *\n * @param {Context} Context that manage all context values\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getBaggage(context: Context): Baggage | undefined {\n return (context.getValue(BAGGAGE_KEY) as Baggage) || undefined;\n}\n\n/**\n * Retrieve the current baggage from the active/current context\n *\n * @returns {Baggage} Extracted baggage from the context\n */\nexport function getActiveBaggage(): Baggage | undefined {\n return getBaggage(ContextAPI.getInstance().active());\n}\n\n/**\n * Store a baggage in the given context\n *\n * @param {Context} Context that manage all context values\n * @param {Baggage} baggage that will be set in the actual context\n */\nexport function setBaggage(context: Context, baggage: Baggage): Context {\n return context.setValue(BAGGAGE_KEY, baggage);\n}\n\n/**\n * Delete the baggage stored in the given context\n *\n * @param {Context} Context that manage all context values\n */\nexport function deleteBaggage(context: Context): Context {\n return context.deleteValue(BAGGAGE_KEY);\n}\n"]}
|
|
@@ -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,51 @@
|
|
|
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 class BaggageImpl {
|
|
17
|
+
constructor(entries) {
|
|
18
|
+
this._entries = entries ? new Map(entries) : new Map();
|
|
19
|
+
}
|
|
20
|
+
getEntry(key) {
|
|
21
|
+
const entry = this._entries.get(key);
|
|
22
|
+
if (!entry) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return Object.assign({}, entry);
|
|
26
|
+
}
|
|
27
|
+
getAllEntries() {
|
|
28
|
+
return Array.from(this._entries.entries()).map(([k, v]) => [k, v]);
|
|
29
|
+
}
|
|
30
|
+
setEntry(key, entry) {
|
|
31
|
+
const newBaggage = new BaggageImpl(this._entries);
|
|
32
|
+
newBaggage._entries.set(key, entry);
|
|
33
|
+
return newBaggage;
|
|
34
|
+
}
|
|
35
|
+
removeEntry(key) {
|
|
36
|
+
const newBaggage = new BaggageImpl(this._entries);
|
|
37
|
+
newBaggage._entries.delete(key);
|
|
38
|
+
return newBaggage;
|
|
39
|
+
}
|
|
40
|
+
removeEntries(...keys) {
|
|
41
|
+
const newBaggage = new BaggageImpl(this._entries);
|
|
42
|
+
for (const key of keys) {
|
|
43
|
+
newBaggage._entries.delete(key);
|
|
44
|
+
}
|
|
45
|
+
return newBaggage;
|
|
46
|
+
}
|
|
47
|
+
clear() {
|
|
48
|
+
return new BaggageImpl();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# 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,MAAM,OAAO,WAAW;IAGtB,YAAY,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,QAAQ,CAAC,GAAW;QAClB,MAAM,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,aAAa;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAmB;QACvC,MAAM,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,WAAW,CAAC,GAAW;QACrB,MAAM,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,aAAa,CAAC,GAAG,IAAc;QAC7B,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Baggage, BaggageEntry } from '../types';\n\nexport class BaggageImpl implements Baggage {\n private _entries: Map<string, BaggageEntry>;\n\n constructor(entries?: Map<string, BaggageEntry>) {\n this._entries = entries ? new Map(entries) : new Map();\n }\n\n getEntry(key: string): BaggageEntry | undefined {\n const entry = this._entries.get(key);\n if (!entry) {\n return undefined;\n }\n\n return Object.assign({}, entry);\n }\n\n getAllEntries(): [string, BaggageEntry][] {\n return Array.from(this._entries.entries()).map(([k, v]) => [k, v]);\n }\n\n setEntry(key: string, entry: BaggageEntry): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.set(key, entry);\n return newBaggage;\n }\n\n removeEntry(key: string): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n newBaggage._entries.delete(key);\n return newBaggage;\n }\n\n removeEntries(...keys: string[]): BaggageImpl {\n const newBaggage = new BaggageImpl(this._entries);\n for (const key of keys) {\n newBaggage._entries.delete(key);\n }\n return newBaggage;\n }\n\n clear(): BaggageImpl {\n return new BaggageImpl();\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Symbol used to make BaggageEntryMetadata an opaque type
|
|
18
|
+
*/
|
|
19
|
+
export const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');
|
|
20
|
+
//# sourceMappingURL=symbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../../src/baggage/internal/symbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Symbol used to make BaggageEntryMetadata an opaque type\n */\nexport const baggageEntryMetadataSymbol = Symbol('BaggageEntryMetadata');\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { baggageEntryMetadataSymbol } from './internal/symbol';
|
|
2
|
+
export interface BaggageEntry {
|
|
3
|
+
/** `String` value of the `BaggageEntry`. */
|
|
4
|
+
value: string;
|
|
5
|
+
/**
|
|
6
|
+
* Metadata is an optional string property defined by the W3C baggage specification.
|
|
7
|
+
* It currently has no special meaning defined by the specification.
|
|
8
|
+
*/
|
|
9
|
+
metadata?: BaggageEntryMetadata;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Serializable Metadata defined by the W3C baggage specification.
|
|
13
|
+
* It currently has no special meaning defined by the OpenTelemetry or W3C.
|
|
14
|
+
*/
|
|
15
|
+
export declare type BaggageEntryMetadata = {
|
|
16
|
+
toString(): string;
|
|
17
|
+
} & {
|
|
18
|
+
__TYPE__: typeof baggageEntryMetadataSymbol;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Baggage represents collection of key-value pairs with optional metadata.
|
|
22
|
+
* Each key of Baggage is associated with exactly one value.
|
|
23
|
+
* Baggage may be used to annotate and enrich telemetry data.
|
|
24
|
+
*/
|
|
25
|
+
export interface Baggage {
|
|
26
|
+
/**
|
|
27
|
+
* Get an entry from Baggage if it exists
|
|
28
|
+
*
|
|
29
|
+
* @param key The key which identifies the BaggageEntry
|
|
30
|
+
*/
|
|
31
|
+
getEntry(key: string): BaggageEntry | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get a list of all entries in the Baggage
|
|
34
|
+
*/
|
|
35
|
+
getAllEntries(): [string, BaggageEntry][];
|
|
36
|
+
/**
|
|
37
|
+
* Returns a new baggage with the entries from the current bag and the specified entry
|
|
38
|
+
*
|
|
39
|
+
* @param key string which identifies the baggage entry
|
|
40
|
+
* @param entry BaggageEntry for the given key
|
|
41
|
+
*/
|
|
42
|
+
setEntry(key: string, entry: BaggageEntry): Baggage;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a new baggage with the entries from the current bag except the removed entry
|
|
45
|
+
*
|
|
46
|
+
* @param key key identifying the entry to be removed
|
|
47
|
+
*/
|
|
48
|
+
removeEntry(key: string): Baggage;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a new baggage with the entries from the current bag except the removed entries
|
|
51
|
+
*
|
|
52
|
+
* @param key keys identifying the entries to be removed
|
|
53
|
+
*/
|
|
54
|
+
removeEntries(...key: string[]): Baggage;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a new baggage with no entries
|
|
57
|
+
*/
|
|
58
|
+
clear(): Baggage;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|