@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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,129 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.0.2
|
|
6
|
+
|
|
7
|
+
### :bug: Bug Fix
|
|
8
|
+
|
|
9
|
+
* [#105](https://github.com/open-telemetry/opentelemetry-js-api/pull/105) fix: set delegate after successful registration ([@Flarna](https://github.com/Flarna))
|
|
10
|
+
* [#94](https://github.com/open-telemetry/opentelemetry-js-api/pull/94) fix: enforce strict equality on prerelease versions ([@dyladan](https://github.com/dyladan))
|
|
11
|
+
|
|
12
|
+
### :memo: Documentation
|
|
13
|
+
|
|
14
|
+
* [#106](https://github.com/open-telemetry/opentelemetry-js-api/pull/106) docs: fix crash in README example ([@trentm](https://github.com/trentm))
|
|
15
|
+
* [#101](https://github.com/open-telemetry/opentelemetry-js-api/pull/101) docs: Format example for tracer.startActiveSpan ([@ad-m](https://github.com/ad-m))
|
|
16
|
+
* [#99](https://github.com/open-telemetry/opentelemetry-js-api/pull/99) chore: fix link to API docs ([@dyladan](https://github.com/dyladan))
|
|
17
|
+
|
|
18
|
+
### :house: Internal
|
|
19
|
+
|
|
20
|
+
* [#109](https://github.com/open-telemetry/opentelemetry-js-api/pull/109) internal: add missing approvers from core ([@dyladan](https://github.com/dyladan))
|
|
21
|
+
* [#103](https://github.com/open-telemetry/opentelemetry-js-api/pull/103) chore: reuse NoopTracer in ProxyTracer ([@Flarna](https://github.com/Flarna))
|
|
22
|
+
|
|
23
|
+
### Committers: 4
|
|
24
|
+
|
|
25
|
+
* Adam Dobrawy ([@ad-m](https://github.com/ad-m))
|
|
26
|
+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
|
27
|
+
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
|
28
|
+
* Trent Mick ([@trentm](https://github.com/trentm))
|
|
29
|
+
|
|
30
|
+
## 1.0.1
|
|
31
|
+
|
|
32
|
+
### :bug: Bug Fix
|
|
33
|
+
|
|
34
|
+
* [#96](https://github.com/open-telemetry/opentelemetry-js-api/pull/96) chore: remove circular dependency ([@dyladan](https://github.com/dyladan))
|
|
35
|
+
|
|
36
|
+
### Committers: 1
|
|
37
|
+
|
|
38
|
+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
|
39
|
+
|
|
40
|
+
## 1.0.0
|
|
41
|
+
|
|
42
|
+
### :memo: Documentation
|
|
43
|
+
|
|
44
|
+
* [#89](https://github.com/open-telemetry/opentelemetry-js-api/pull/89) chore: update upgrade guidelines ([@dyladan](https://github.com/dyladan))
|
|
45
|
+
|
|
46
|
+
### :house: Internal
|
|
47
|
+
|
|
48
|
+
* [#90](https://github.com/open-telemetry/opentelemetry-js-api/pull/90) chore: enable typescript 4.3 noImplicitOverride option ([@Flarna](https://github.com/Flarna))
|
|
49
|
+
|
|
50
|
+
### Committers: 2
|
|
51
|
+
|
|
52
|
+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
|
53
|
+
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
|
54
|
+
|
|
55
|
+
## 0.21.0
|
|
56
|
+
|
|
57
|
+
### :boom: Breaking Change
|
|
58
|
+
|
|
59
|
+
* [#78](https://github.com/open-telemetry/opentelemetry-js-api/pull/78) feat: unify signatures of `with` and `bind` ([@Rauno56](https://github.com/Rauno56))
|
|
60
|
+
* [#46](https://github.com/open-telemetry/opentelemetry-js-api/pull/46) chore: do not export singletons ([@dyladan](https://github.com/dyladan))
|
|
61
|
+
|
|
62
|
+
### :rocket: Enhancement
|
|
63
|
+
|
|
64
|
+
* [#81](https://github.com/open-telemetry/opentelemetry-js-api/pull/81) chore: function overloads implementation of startActiveSpan in noop t… ([@naseemkullah](https://github.com/naseemkullah))
|
|
65
|
+
|
|
66
|
+
### :house: Internal
|
|
67
|
+
|
|
68
|
+
* [#84](https://github.com/open-telemetry/opentelemetry-js-api/pull/84) chore: remove unused backwards compatibility folder ([@Flarna](https://github.com/Flarna))
|
|
69
|
+
* [#85](https://github.com/open-telemetry/opentelemetry-js-api/pull/85) chore: add node:16 to the test matrix ([@Rauno56](https://github.com/Rauno56))
|
|
70
|
+
* [#63](https://github.com/open-telemetry/opentelemetry-js-api/pull/63) feat: debug log global registrations and logger overwrites ([@Rauno56](https://github.com/Rauno56))
|
|
71
|
+
* [#75](https://github.com/open-telemetry/opentelemetry-js-api/pull/75) Add CodeQL Security Scan ([@xukaren](https://github.com/xukaren))
|
|
72
|
+
* [#79](https://github.com/open-telemetry/opentelemetry-js-api/pull/79) chore: fix eslint config ([@Rauno56](https://github.com/Rauno56))
|
|
73
|
+
|
|
74
|
+
### Committers: 5
|
|
75
|
+
|
|
76
|
+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
|
77
|
+
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
|
78
|
+
* Karen Xu ([@xukaren](https://github.com/xukaren))
|
|
79
|
+
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
|
|
80
|
+
* Rauno Viskus ([@Rauno56](https://github.com/Rauno56))
|
|
81
|
+
|
|
82
|
+
## 0.20.0
|
|
83
|
+
|
|
84
|
+
### :rocket: Enhancement
|
|
85
|
+
|
|
86
|
+
* [#69](https://github.com/open-telemetry/opentelemetry-js-api/pull/69) feat(context): add utils method to remove keys from context ([@vmarchaud](https://github.com/vmarchaud))
|
|
87
|
+
* [#71](https://github.com/open-telemetry/opentelemetry-js-api/pull/71) chore: export baggage ([@dyladan](https://github.com/dyladan))
|
|
88
|
+
|
|
89
|
+
### Committers: 2
|
|
90
|
+
|
|
91
|
+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
|
92
|
+
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
|
|
93
|
+
|
|
94
|
+
## 0.19.0
|
|
95
|
+
|
|
96
|
+
### :boom: Breaking Change
|
|
97
|
+
|
|
98
|
+
* [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) chore: move baggage methods in propagation namespace ([@vmarchaud](https://github.com/vmarchaud))
|
|
99
|
+
* [#65](https://github.com/open-telemetry/opentelemetry-js-api/pull/65) chore: remove suppress instrumentation ([@dyladan](https://github.com/dyladan))
|
|
100
|
+
* [#60](https://github.com/open-telemetry/opentelemetry-js-api/pull/60) chore: removing timed event ([@obecny](https://github.com/obecny))
|
|
101
|
+
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
|
|
102
|
+
* [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) chore: move span method for context in trace API #40 ([@vmarchaud](https://github.com/vmarchaud))
|
|
103
|
+
* [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) chore: rename `span#context()` to `span#spanContext` ([@dyladan](https://github.com/dyladan))
|
|
104
|
+
* [#43](https://github.com/open-telemetry/opentelemetry-js-api/pull/43) chore: renaming noop span to non recording span ([@obecny](https://github.com/obecny))
|
|
105
|
+
* [#32](https://github.com/open-telemetry/opentelemetry-js-api/pull/32) feat!: return boolean success value from setGlobalXXX methods ([@dyladan](https://github.com/dyladan))
|
|
106
|
+
|
|
107
|
+
### :rocket: Enhancement
|
|
108
|
+
|
|
109
|
+
* [#62](https://github.com/open-telemetry/opentelemetry-js-api/pull/62) chore: adding component logger ([@obecny](https://github.com/obecny))
|
|
110
|
+
* [#54](https://github.com/open-telemetry/opentelemetry-js-api/pull/54) feat: add tracer.startActiveSpan() ([@naseemkullah](https://github.com/naseemkullah))
|
|
111
|
+
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
|
|
112
|
+
* [#51](https://github.com/open-telemetry/opentelemetry-js-api/pull/51) feat: add function to wrap SpanContext in NonRecordingSpan #49 ([@dyladan](https://github.com/dyladan))
|
|
113
|
+
|
|
114
|
+
### :memo: Documentation
|
|
115
|
+
|
|
116
|
+
* [#64](https://github.com/open-telemetry/opentelemetry-js-api/pull/64) chore: document the reason for symbol.for ([@dyladan](https://github.com/dyladan))
|
|
117
|
+
* [#44](https://github.com/open-telemetry/opentelemetry-js-api/pull/44) chore: updating readme headline and fixing links ([@obecny](https://github.com/obecny))
|
|
118
|
+
|
|
119
|
+
### Committers: 6
|
|
120
|
+
|
|
121
|
+
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
|
|
122
|
+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
|
|
123
|
+
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
|
|
124
|
+
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
|
|
125
|
+
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
|
|
126
|
+
* t2t2 ([@t2t2](https://github.com/t2t2))
|
|
127
|
+
|
|
5
128
|
## 1.0.0-rc.0
|
|
6
129
|
|
|
7
130
|
### :memo: Documentation
|
package/README.md
CHANGED
|
@@ -1,9 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>
|
|
5
|
+
<a href="https://open-telemetry.github.io/opentelemetry-js-api">API Documentation<a/>
|
|
6
|
+
•
|
|
7
|
+
<a href="https://github.com/open-telemetry/opentelemetry-js/discussions">Getting In Touch (GitHub Discussions)<a/>
|
|
8
|
+
</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://github.com/open-telemetry/opentelemetry-js-api/releases">
|
|
13
|
+
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-js-api?include_prereleases&style=for-the-badge">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://codecov.io/gh/open-telemetry/opentelemetry-js-api/branch/main/">
|
|
16
|
+
<img alt="Codecov Status" src="https://img.shields.io/codecov/c/github/open-telemetry/opentelemetry-js-api?style=for-the-badge">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE">
|
|
19
|
+
<img alt="license" src="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=for-the-badge">
|
|
20
|
+
</a>
|
|
21
|
+
<br/>
|
|
22
|
+
<a href="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/docs.yaml">
|
|
23
|
+
<img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/test.yaml/badge.svg?branch=main">
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/test.yaml?query=branch%3Amain">
|
|
26
|
+
<img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-js-api/actions/workflows/docs.yaml/badge.svg">
|
|
27
|
+
</a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
1
32
|
# OpenTelemetry API for JavaScript
|
|
2
33
|
|
|
3
34
|
[![NPM Published Version][npm-img]][npm-url]
|
|
4
35
|
[![dependencies][dependencies-image]][dependencies-url]
|
|
5
36
|
[![devDependencies][devDependencies-image]][devDependencies-url]
|
|
6
|
-
[![Apache License][license-image]][license-image]
|
|
7
37
|
|
|
8
38
|
This package provides everything needed to interact with the OpenTelemetry API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser.
|
|
9
39
|
|
|
@@ -50,14 +80,13 @@ const tracer = trace.getTracer(name, version);
|
|
|
50
80
|
// Trace your application by creating spans
|
|
51
81
|
async function operation() {
|
|
52
82
|
const span = tracer.startSpan("do operation");
|
|
53
|
-
|
|
83
|
+
|
|
54
84
|
// mock some work by sleeping 1 second
|
|
55
85
|
await new Promise((resolve, reject) => {
|
|
56
86
|
setTimeout(resolve, 1000);
|
|
57
87
|
})
|
|
58
88
|
|
|
59
89
|
span.end();
|
|
60
|
-
return output;
|
|
61
90
|
}
|
|
62
91
|
|
|
63
92
|
async function main() {
|
|
@@ -73,6 +102,25 @@ main();
|
|
|
73
102
|
|
|
74
103
|
Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same `node_modules` structure, the OpenTelemetry API takes advantage of a variable on the `global` object to store the global API. When an API method in the API package is called, it checks if this `global` API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API.
|
|
75
104
|
|
|
105
|
+
## Upgrade Guidelines
|
|
106
|
+
|
|
107
|
+
### 0.21.0 to 1.0.0
|
|
108
|
+
|
|
109
|
+
No breaking changes
|
|
110
|
+
|
|
111
|
+
### 0.20.0 to 0.21.0
|
|
112
|
+
|
|
113
|
+
- [#78](https://github.com/open-telemetry/opentelemetry-js-api/issues/78) `api.context.bind` arguments reversed and `context` is now a required argument.
|
|
114
|
+
- [#46](https://github.com/open-telemetry/opentelemetry-js-api/issues/46) Noop classes and singletons are no longer exported. To create a noop span it is recommended to use `api.trace.wrapSpanContext` with `INVALID_SPAN_CONTEXT` instead of using the `NOOP_TRACER`.
|
|
115
|
+
|
|
116
|
+
### 1.0.0-rc.3 to 0.20.0
|
|
117
|
+
|
|
118
|
+
- Removing `TimedEvent` which was not part of spec
|
|
119
|
+
- `HttpBaggage` renamed to `HttpBaggagePropagator`
|
|
120
|
+
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext`
|
|
121
|
+
- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace
|
|
122
|
+
- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace
|
|
123
|
+
|
|
76
124
|
## Useful links
|
|
77
125
|
|
|
78
126
|
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
|
@@ -88,12 +136,11 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
|
|
|
88
136
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
|
89
137
|
[license-url]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE
|
|
90
138
|
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
|
91
|
-
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js-api
|
|
139
|
+
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-api.svg
|
|
92
140
|
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-api
|
|
93
|
-
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js-api
|
|
141
|
+
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-api.svg?type=dev
|
|
94
142
|
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-api?type=dev
|
|
95
143
|
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api
|
|
96
144
|
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg
|
|
97
|
-
|
|
98
145
|
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/tracing.md
|
|
99
146
|
[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/sdk-registration.md
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Context, ContextManager } from '../context/types';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
|
4
|
+
*/
|
|
5
|
+
export declare class ContextAPI {
|
|
6
|
+
private static _instance?;
|
|
7
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
8
|
+
private constructor();
|
|
9
|
+
/** Get the singleton instance of the Context API */
|
|
10
|
+
static getInstance(): ContextAPI;
|
|
11
|
+
/**
|
|
12
|
+
* Set the current context manager.
|
|
13
|
+
*
|
|
14
|
+
* @returns true if the context manager was successfully registered, else false
|
|
15
|
+
*/
|
|
16
|
+
setGlobalContextManager(contextManager: ContextManager): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the currently active context
|
|
19
|
+
*/
|
|
20
|
+
active(): Context;
|
|
21
|
+
/**
|
|
22
|
+
* Execute a function with an active context
|
|
23
|
+
*
|
|
24
|
+
* @param context context to be active during function execution
|
|
25
|
+
* @param fn function to execute in a context
|
|
26
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
27
|
+
* @param args optional arguments forwarded to fn
|
|
28
|
+
*/
|
|
29
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
30
|
+
/**
|
|
31
|
+
* Bind a context to a target function or event emitter
|
|
32
|
+
*
|
|
33
|
+
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
34
|
+
* @param target function or event emitter to bind
|
|
35
|
+
*/
|
|
36
|
+
bind<T>(context: Context, target: T): T;
|
|
37
|
+
private _getContextManager;
|
|
38
|
+
/** Disable and remove the global context manager */
|
|
39
|
+
disable(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
17
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
18
|
+
to[j] = from[i];
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
import { NoopContextManager } from '../context/NoopContextManager';
|
|
22
|
+
import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
|
|
23
|
+
import { DiagAPI } from './diag';
|
|
24
|
+
var API_NAME = 'context';
|
|
25
|
+
var NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
26
|
+
/**
|
|
27
|
+
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
|
28
|
+
*/
|
|
29
|
+
var ContextAPI = /** @class */ (function () {
|
|
30
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
31
|
+
function ContextAPI() {
|
|
32
|
+
}
|
|
33
|
+
/** Get the singleton instance of the Context API */
|
|
34
|
+
ContextAPI.getInstance = function () {
|
|
35
|
+
if (!this._instance) {
|
|
36
|
+
this._instance = new ContextAPI();
|
|
37
|
+
}
|
|
38
|
+
return this._instance;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Set the current context manager.
|
|
42
|
+
*
|
|
43
|
+
* @returns true if the context manager was successfully registered, else false
|
|
44
|
+
*/
|
|
45
|
+
ContextAPI.prototype.setGlobalContextManager = function (contextManager) {
|
|
46
|
+
return registerGlobal(API_NAME, contextManager, DiagAPI.instance());
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get the currently active context
|
|
50
|
+
*/
|
|
51
|
+
ContextAPI.prototype.active = function () {
|
|
52
|
+
return this._getContextManager().active();
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Execute a function with an active context
|
|
56
|
+
*
|
|
57
|
+
* @param context context to be active during function execution
|
|
58
|
+
* @param fn function to execute in a context
|
|
59
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
60
|
+
* @param args optional arguments forwarded to fn
|
|
61
|
+
*/
|
|
62
|
+
ContextAPI.prototype.with = function (context, fn, thisArg) {
|
|
63
|
+
var _a;
|
|
64
|
+
var args = [];
|
|
65
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
66
|
+
args[_i - 3] = arguments[_i];
|
|
67
|
+
}
|
|
68
|
+
return (_a = this._getContextManager()).with.apply(_a, __spreadArray([context, fn, thisArg], args));
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Bind a context to a target function or event emitter
|
|
72
|
+
*
|
|
73
|
+
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
74
|
+
* @param target function or event emitter to bind
|
|
75
|
+
*/
|
|
76
|
+
ContextAPI.prototype.bind = function (context, target) {
|
|
77
|
+
return this._getContextManager().bind(context, target);
|
|
78
|
+
};
|
|
79
|
+
ContextAPI.prototype._getContextManager = function () {
|
|
80
|
+
return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;
|
|
81
|
+
};
|
|
82
|
+
/** Disable and remove the global context manager */
|
|
83
|
+
ContextAPI.prototype.disable = function () {
|
|
84
|
+
this._getContextManager().disable();
|
|
85
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
86
|
+
};
|
|
87
|
+
return ContextAPI;
|
|
88
|
+
}());
|
|
89
|
+
export { ContextAPI };
|
|
90
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,IAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,IAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAEtD;;GAEG;AACH;IAGE,+FAA+F;IAC/F;IAAuB,CAAC;IAExB,oDAAoD;IACtC,sBAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,4CAAuB,GAA9B,UAA+B,cAA8B;QAC3D,OAAO,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACI,2BAAM,GAAb;QACE,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,yBAAI,GAAX,UACE,OAAgB,EAChB,EAAK,EACL,OAA8B;;QAC9B,cAAU;aAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;YAAV,6BAAU;;QAEV,OAAO,CAAA,KAAA,IAAI,CAAC,kBAAkB,EAAE,CAAA,CAAC,IAAI,0BAAC,OAAO,EAAE,EAAE,EAAE,OAAO,GAAK,IAAI,GAAE;IACvE,CAAC;IAED;;;;;OAKG;IACI,yBAAI,GAAX,UAAe,OAAgB,EAAE,MAAS;QACxC,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAEO,uCAAkB,GAA1B;QACE,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC;IACrD,CAAC;IAED,oDAAoD;IAC7C,4BAAO,GAAd;QACE,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC;QACpC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IACH,iBAAC;AAAD,CAAC,AAnED,IAmEC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton object which represents the entry point to the OpenTelemetry internal
|
|
4
|
+
* diagnostic API
|
|
5
|
+
*/
|
|
6
|
+
export declare class DiagAPI implements DiagLogger {
|
|
7
|
+
private static _instance?;
|
|
8
|
+
/** Get the singleton instance of the DiagAPI API */
|
|
9
|
+
static instance(): DiagAPI;
|
|
10
|
+
/**
|
|
11
|
+
* Private internal constructor
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Set the global DiagLogger and DiagLogLevel.
|
|
17
|
+
* If a global diag logger is already set, this will override it.
|
|
18
|
+
*
|
|
19
|
+
* @param logger - [Optional] The DiagLogger instance to set as the default logger.
|
|
20
|
+
* @param logLevel - [Optional] The DiagLogLevel used to filter logs sent to the logger. If not provided it will default to INFO.
|
|
21
|
+
* @returns true if the logger was successfully registered, else false
|
|
22
|
+
*/
|
|
23
|
+
setLogger: (logger: DiagLogger, logLevel?: DiagLogLevel) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger;
|
|
28
|
+
verbose: DiagLogFunction;
|
|
29
|
+
debug: DiagLogFunction;
|
|
30
|
+
info: DiagLogFunction;
|
|
31
|
+
warn: DiagLogFunction;
|
|
32
|
+
error: DiagLogFunction;
|
|
33
|
+
/**
|
|
34
|
+
* Unregister the global logger and return to Noop
|
|
35
|
+
*/
|
|
36
|
+
disable: () => void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=diag.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
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 { DiagComponentLogger } from '../diag/ComponentLogger';
|
|
17
|
+
import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';
|
|
18
|
+
import { DiagLogLevel, } from '../diag/types';
|
|
19
|
+
import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
|
|
20
|
+
var API_NAME = 'diag';
|
|
21
|
+
/**
|
|
22
|
+
* Singleton object which represents the entry point to the OpenTelemetry internal
|
|
23
|
+
* diagnostic API
|
|
24
|
+
*/
|
|
25
|
+
var DiagAPI = /** @class */ (function () {
|
|
26
|
+
/**
|
|
27
|
+
* Private internal constructor
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
function DiagAPI() {
|
|
31
|
+
function _logProxy(funcName) {
|
|
32
|
+
return function () {
|
|
33
|
+
var logger = getGlobal('diag');
|
|
34
|
+
// shortcut if logger not set
|
|
35
|
+
if (!logger)
|
|
36
|
+
return;
|
|
37
|
+
return logger[funcName].apply(logger,
|
|
38
|
+
// work around Function.prototype.apply types
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
arguments);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Using self local variable for minification purposes as 'this' cannot be minified
|
|
44
|
+
var self = this;
|
|
45
|
+
// DiagAPI specific functions
|
|
46
|
+
self.setLogger = function (logger, logLevel) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
if (logLevel === void 0) { logLevel = DiagLogLevel.INFO; }
|
|
49
|
+
if (logger === self) {
|
|
50
|
+
// There isn't much we can do here.
|
|
51
|
+
// Logging to the console might break the user application.
|
|
52
|
+
// Try to log to self. If a logger was previously registered it will receive the log.
|
|
53
|
+
var err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');
|
|
54
|
+
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
var oldLogger = getGlobal('diag');
|
|
58
|
+
var newLogger = createLogLevelDiagLogger(logLevel, logger);
|
|
59
|
+
// There already is an logger registered. We'll let it know before overwriting it.
|
|
60
|
+
if (oldLogger) {
|
|
61
|
+
var stack = (_b = new Error().stack) !== null && _b !== void 0 ? _b : '<failed to generate stacktrace>';
|
|
62
|
+
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
63
|
+
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
64
|
+
}
|
|
65
|
+
return registerGlobal('diag', newLogger, self, true);
|
|
66
|
+
};
|
|
67
|
+
self.disable = function () {
|
|
68
|
+
unregisterGlobal(API_NAME, self);
|
|
69
|
+
};
|
|
70
|
+
self.createComponentLogger = function (options) {
|
|
71
|
+
return new DiagComponentLogger(options);
|
|
72
|
+
};
|
|
73
|
+
self.verbose = _logProxy('verbose');
|
|
74
|
+
self.debug = _logProxy('debug');
|
|
75
|
+
self.info = _logProxy('info');
|
|
76
|
+
self.warn = _logProxy('warn');
|
|
77
|
+
self.error = _logProxy('error');
|
|
78
|
+
}
|
|
79
|
+
/** Get the singleton instance of the DiagAPI API */
|
|
80
|
+
DiagAPI.instance = function () {
|
|
81
|
+
if (!this._instance) {
|
|
82
|
+
this._instance = new DiagAPI();
|
|
83
|
+
}
|
|
84
|
+
return this._instance;
|
|
85
|
+
};
|
|
86
|
+
return DiagAPI;
|
|
87
|
+
}());
|
|
88
|
+
export { DiagAPI };
|
|
89
|
+
//# sourceMappingURL=diag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diag.js","sourceRoot":"","sources":["../../../src/api/diag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAIL,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,IAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;GAGG;AACH;IAYE;;;OAGG;IACH;QACE,SAAS,SAAS,CAAC,QAA0B;YAC3C,OAAO;gBACL,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;gBACjC,6BAA6B;gBAC7B,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAC3B,MAAM;gBACN,6CAA6C;gBAC7C,8DAA8D;gBAC9D,SAAgB,CACjB,CAAC;YACJ,CAAC,CAAC;QACJ,CAAC;QAED,mFAAmF;QACnF,IAAM,IAAI,GAAG,IAAI,CAAC;QAElB,6BAA6B;QAE7B,IAAI,CAAC,SAAS,GAAG,UACf,MAAkB,EAClB,QAA0C;;YAA1C,yBAAA,EAAA,WAAyB,YAAY,CAAC,IAAI;YAE1C,IAAI,MAAM,KAAK,IAAI,EAAE;gBACnB,mCAAmC;gBACnC,2DAA2D;gBAC3D,qFAAqF;gBACrF,IAAM,GAAG,GAAG,IAAI,KAAK,CACnB,oIAAoI,CACrI,CAAC;gBACF,IAAI,CAAC,KAAK,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrC,OAAO,KAAK,CAAC;aACd;YAED,IAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;YACpC,IAAM,SAAS,GAAG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC7D,kFAAkF;YAClF,IAAI,SAAS,EAAE;gBACb,IAAM,KAAK,GAAG,MAAA,IAAI,KAAK,EAAE,CAAC,KAAK,mCAAI,iCAAiC,CAAC;gBACrE,SAAS,CAAC,IAAI,CAAC,6CAA2C,KAAO,CAAC,CAAC;gBACnE,SAAS,CAAC,IAAI,CACZ,+DAA6D,KAAO,CACrE,CAAC;aACH;YAED,OAAO,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG;YACb,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,UAAC,OAA+B;YAC3D,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IA3ED,oDAAoD;IACtC,gBAAQ,GAAtB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAiGH,cAAC;AAAD,CAAC,AA3GD,IA2GC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context } from '../context/types';
|
|
2
|
+
import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator';
|
|
3
|
+
import { getBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers';
|
|
4
|
+
import { createBaggage } from '../baggage/utils';
|
|
5
|
+
/**
|
|
6
|
+
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
7
|
+
*/
|
|
8
|
+
export declare class PropagationAPI {
|
|
9
|
+
private static _instance?;
|
|
10
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11
|
+
private constructor();
|
|
12
|
+
/** Get the singleton instance of the Propagator API */
|
|
13
|
+
static getInstance(): PropagationAPI;
|
|
14
|
+
/**
|
|
15
|
+
* Set the current propagator.
|
|
16
|
+
*
|
|
17
|
+
* @returns true if the propagator was successfully registered, else false
|
|
18
|
+
*/
|
|
19
|
+
setGlobalPropagator(propagator: TextMapPropagator): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Inject context into a carrier to be propagated inter-process
|
|
22
|
+
*
|
|
23
|
+
* @param context Context carrying tracing data to inject
|
|
24
|
+
* @param carrier carrier to inject context into
|
|
25
|
+
* @param setter Function used to set values on the carrier
|
|
26
|
+
*/
|
|
27
|
+
inject<Carrier>(context: Context, carrier: Carrier, setter?: TextMapSetter<Carrier>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Extract context from a carrier
|
|
30
|
+
*
|
|
31
|
+
* @param context Context which the newly created context will inherit from
|
|
32
|
+
* @param carrier Carrier to extract context from
|
|
33
|
+
* @param getter Function used to extract keys from a carrier
|
|
34
|
+
*/
|
|
35
|
+
extract<Carrier>(context: Context, carrier: Carrier, getter?: TextMapGetter<Carrier>): Context;
|
|
36
|
+
/**
|
|
37
|
+
* Return a list of all fields which may be used by the propagator.
|
|
38
|
+
*/
|
|
39
|
+
fields(): string[];
|
|
40
|
+
/** Remove the global propagator */
|
|
41
|
+
disable(): void;
|
|
42
|
+
createBaggage: typeof createBaggage;
|
|
43
|
+
getBaggage: typeof getBaggage;
|
|
44
|
+
setBaggage: typeof setBaggage;
|
|
45
|
+
deleteBaggage: typeof deleteBaggage;
|
|
46
|
+
private _getGlobalPropagator;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=propagation.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
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, setBaggage, deleteBaggage, } from '../baggage/context-helpers';
|
|
20
|
+
import { createBaggage } from '../baggage/utils';
|
|
21
|
+
import { DiagAPI } from './diag';
|
|
22
|
+
var API_NAME = 'propagation';
|
|
23
|
+
var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
|
|
24
|
+
/**
|
|
25
|
+
* Singleton object which represents the entry point to the OpenTelemetry Propagation API
|
|
26
|
+
*/
|
|
27
|
+
var PropagationAPI = /** @class */ (function () {
|
|
28
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
29
|
+
function PropagationAPI() {
|
|
30
|
+
this.createBaggage = createBaggage;
|
|
31
|
+
this.getBaggage = getBaggage;
|
|
32
|
+
this.setBaggage = setBaggage;
|
|
33
|
+
this.deleteBaggage = deleteBaggage;
|
|
34
|
+
}
|
|
35
|
+
/** Get the singleton instance of the Propagator API */
|
|
36
|
+
PropagationAPI.getInstance = function () {
|
|
37
|
+
if (!this._instance) {
|
|
38
|
+
this._instance = new PropagationAPI();
|
|
39
|
+
}
|
|
40
|
+
return this._instance;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Set the current propagator.
|
|
44
|
+
*
|
|
45
|
+
* @returns true if the propagator was successfully registered, else false
|
|
46
|
+
*/
|
|
47
|
+
PropagationAPI.prototype.setGlobalPropagator = function (propagator) {
|
|
48
|
+
return registerGlobal(API_NAME, propagator, DiagAPI.instance());
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Inject context into a carrier to be propagated inter-process
|
|
52
|
+
*
|
|
53
|
+
* @param context Context carrying tracing data to inject
|
|
54
|
+
* @param carrier carrier to inject context into
|
|
55
|
+
* @param setter Function used to set values on the carrier
|
|
56
|
+
*/
|
|
57
|
+
PropagationAPI.prototype.inject = function (context, carrier, setter) {
|
|
58
|
+
if (setter === void 0) { 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
|
+
PropagationAPI.prototype.extract = function (context, carrier, getter) {
|
|
69
|
+
if (getter === void 0) { getter = defaultTextMapGetter; }
|
|
70
|
+
return this._getGlobalPropagator().extract(context, carrier, getter);
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Return a list of all fields which may be used by the propagator.
|
|
74
|
+
*/
|
|
75
|
+
PropagationAPI.prototype.fields = function () {
|
|
76
|
+
return this._getGlobalPropagator().fields();
|
|
77
|
+
};
|
|
78
|
+
/** Remove the global propagator */
|
|
79
|
+
PropagationAPI.prototype.disable = function () {
|
|
80
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
81
|
+
};
|
|
82
|
+
PropagationAPI.prototype._getGlobalPropagator = function () {
|
|
83
|
+
return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
84
|
+
};
|
|
85
|
+
return PropagationAPI;
|
|
86
|
+
}());
|
|
87
|
+
export { PropagationAPI };
|
|
88
|
+
//# 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,UAAU,EACV,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,IAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,IAAM,wBAAwB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE7D;;GAEG;AACH;IAGE,+FAA+F;IAC/F;QA8DO,kBAAa,GAAG,aAAa,CAAC;QAE9B,eAAU,GAAG,UAAU,CAAC;QAExB,eAAU,GAAG,UAAU,CAAC;QAExB,kBAAa,GAAG,aAAa,CAAC;IApEd,CAAC;IAExB,uDAAuD;IACzC,0BAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,4CAAmB,GAA1B,UAA2B,UAA6B;QACtD,OAAO,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,+BAAM,GAAb,UACE,OAAgB,EAChB,OAAgB,EAChB,MAAqD;QAArD,uBAAA,EAAA,6BAAqD;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,gCAAO,GAAd,UACE,OAAgB,EAChB,OAAgB,EAChB,MAAqD;QAArD,uBAAA,EAAA,6BAAqD;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,+BAAM,GAAb;QACE,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,gCAAO,GAAd;QACE,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAUO,6CAAoB,GAA5B;QACE,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;IACH,qBAAC;AAAD,CAAC,AA7ED,IA6EC"}
|