@opentelemetry/api 1.0.0-rc.3 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +53 -6
  3. package/build/esm/api/context.d.ts +41 -0
  4. package/build/esm/api/context.js +90 -0
  5. package/build/esm/api/context.js.map +1 -0
  6. package/build/esm/api/diag.d.ts +38 -0
  7. package/build/esm/api/diag.js +89 -0
  8. package/build/esm/api/diag.js.map +1 -0
  9. package/build/esm/api/propagation.d.ts +48 -0
  10. package/build/esm/api/propagation.js +88 -0
  11. package/build/esm/api/propagation.js.map +1 -0
  12. package/build/esm/api/trace.d.ts +39 -0
  13. package/build/esm/api/trace.js +76 -0
  14. package/build/esm/api/trace.js.map +1 -0
  15. package/build/esm/baggage/context-helpers.d.ts +23 -0
  16. package/build/esm/baggage/context-helpers.js +47 -0
  17. package/build/esm/baggage/context-helpers.js.map +1 -0
  18. package/build/{src/baggage/internal/baggage.d.ts → esm/baggage/internal/baggage-impl.d.ts} +2 -3
  19. package/build/esm/baggage/internal/baggage-impl.js +61 -0
  20. package/build/esm/baggage/internal/baggage-impl.js.map +1 -0
  21. package/build/esm/baggage/internal/symbol.d.ts +5 -0
  22. package/build/esm/baggage/internal/symbol.js +20 -0
  23. package/build/esm/baggage/internal/symbol.js.map +1 -0
  24. package/build/{src/baggage/Baggage.d.ts → esm/baggage/types.d.ts} +20 -2
  25. package/build/{src/trace/Event.js → esm/baggage/types.js} +2 -3
  26. package/build/esm/baggage/types.js.map +1 -0
  27. package/build/{src/baggage/index.d.ts → esm/baggage/utils.d.ts} +2 -5
  28. package/build/esm/baggage/utils.js +47 -0
  29. package/build/esm/baggage/utils.js.map +1 -0
  30. package/build/esm/common/Exception.d.ts +26 -0
  31. package/build/{src/baggage/Baggage.js → esm/common/Exception.js} +2 -3
  32. package/build/esm/common/Exception.js.map +1 -0
  33. package/build/esm/common/Time.d.ts +8 -0
  34. package/build/esm/common/Time.js +2 -0
  35. package/build/esm/common/Time.js.map +1 -0
  36. package/build/esm/context/NoopContextManager.d.ts +9 -0
  37. package/build/esm/context/NoopContextManager.js +47 -0
  38. package/build/esm/context/NoopContextManager.js.map +1 -0
  39. package/build/esm/context/context.d.ts +6 -0
  40. package/build/esm/context/context.js +52 -0
  41. package/build/esm/context/context.js.map +1 -0
  42. package/build/esm/context/types.d.ts +52 -0
  43. package/build/{src/trace/TimedEvent.js → esm/context/types.js} +2 -3
  44. package/build/esm/context/types.js.map +1 -0
  45. package/build/esm/diag/ComponentLogger.d.ts +20 -0
  46. package/build/esm/diag/ComponentLogger.js +77 -0
  47. package/build/esm/diag/ComponentLogger.js.map +1 -0
  48. package/build/esm/diag/consoleLogger.d.ts +38 -0
  49. package/build/esm/diag/consoleLogger.js +54 -0
  50. package/build/esm/diag/consoleLogger.js.map +1 -0
  51. package/build/esm/diag/index.d.ts +3 -0
  52. package/build/esm/diag/index.js +18 -0
  53. package/build/esm/diag/index.js.map +1 -0
  54. package/build/esm/diag/internal/logLevelLogger.d.ts +3 -0
  55. package/build/esm/diag/internal/logLevelLogger.js +41 -0
  56. package/build/esm/diag/internal/logLevelLogger.js.map +1 -0
  57. package/build/esm/diag/internal/noopLogger.d.ts +8 -0
  58. package/build/esm/diag/internal/noopLogger.js +31 -0
  59. package/build/esm/diag/internal/noopLogger.js.map +1 -0
  60. package/build/esm/diag/types.d.ts +70 -0
  61. package/build/esm/diag/types.js +41 -0
  62. package/build/esm/diag/types.js.map +1 -0
  63. package/build/esm/index.d.ts +54 -0
  64. package/build/esm/index.js +64 -0
  65. package/build/esm/index.js.map +1 -0
  66. package/build/esm/internal/global-utils.d.ts +16 -0
  67. package/build/esm/internal/global-utils.js +59 -0
  68. package/build/esm/internal/global-utils.js.map +1 -0
  69. package/build/esm/internal/semver.d.ts +34 -0
  70. package/build/esm/internal/semver.js +118 -0
  71. package/build/esm/internal/semver.js.map +1 -0
  72. package/build/esm/platform/browser/globalThis.d.ts +3 -0
  73. package/build/esm/platform/browser/globalThis.js +19 -0
  74. package/build/esm/platform/browser/globalThis.js.map +1 -0
  75. package/build/esm/platform/browser/index.d.ts +2 -0
  76. package/build/esm/platform/browser/index.js +17 -0
  77. package/build/esm/platform/browser/index.js.map +1 -0
  78. package/build/esm/platform/index.d.ts +2 -0
  79. package/build/esm/platform/index.js +17 -0
  80. package/build/esm/platform/index.js.map +1 -0
  81. package/build/esm/platform/node/globalThis.d.ts +3 -0
  82. package/build/esm/platform/node/globalThis.js +19 -0
  83. package/build/esm/platform/node/globalThis.js.map +1 -0
  84. package/build/esm/platform/node/index.d.ts +2 -0
  85. package/build/esm/platform/node/index.js +17 -0
  86. package/build/esm/platform/node/index.js.map +1 -0
  87. package/build/esm/propagation/NoopTextMapPropagator.d.ts +13 -0
  88. package/build/esm/propagation/NoopTextMapPropagator.js +34 -0
  89. package/build/esm/propagation/NoopTextMapPropagator.js.map +1 -0
  90. package/build/esm/propagation/TextMapPropagator.d.ts +84 -0
  91. package/build/esm/propagation/TextMapPropagator.js +38 -0
  92. package/build/esm/propagation/TextMapPropagator.js.map +1 -0
  93. package/build/{src/trace/NoopSpan.d.ts → esm/trace/NonRecordingSpan.d.ts} +4 -4
  94. package/build/{src/trace/NoopSpan.js → esm/trace/NonRecordingSpan.js} +18 -21
  95. package/build/esm/trace/NonRecordingSpan.js.map +1 -0
  96. package/build/esm/trace/NoopTracer.d.ts +14 -0
  97. package/build/esm/trace/NoopTracer.js +75 -0
  98. package/build/esm/trace/NoopTracer.js.map +1 -0
  99. package/build/esm/trace/NoopTracerProvider.d.ts +12 -0
  100. package/build/esm/trace/NoopTracerProvider.js +32 -0
  101. package/build/esm/trace/NoopTracerProvider.js.map +1 -0
  102. package/build/esm/trace/ProxyTracer.d.ts +25 -0
  103. package/build/esm/trace/ProxyTracer.js +52 -0
  104. package/build/esm/trace/ProxyTracer.js.map +1 -0
  105. package/build/esm/trace/ProxyTracerProvider.d.ts +24 -0
  106. package/build/esm/trace/ProxyTracerProvider.js +54 -0
  107. package/build/esm/trace/ProxyTracerProvider.js.map +1 -0
  108. package/build/esm/trace/Sampler.d.ts +30 -0
  109. package/build/esm/trace/Sampler.js +17 -0
  110. package/build/esm/trace/Sampler.js.map +1 -0
  111. package/build/esm/trace/SamplingResult.d.ts +39 -0
  112. package/build/esm/trace/SamplingResult.js +38 -0
  113. package/build/esm/trace/SamplingResult.js.map +1 -0
  114. package/build/esm/trace/SpanOptions.d.ts +23 -0
  115. package/build/esm/trace/SpanOptions.js +17 -0
  116. package/build/esm/trace/SpanOptions.js.map +1 -0
  117. package/build/esm/trace/attributes.d.ts +10 -0
  118. package/build/esm/trace/attributes.js +17 -0
  119. package/build/esm/trace/attributes.js.map +1 -0
  120. package/build/esm/trace/context-utils.d.ts +37 -0
  121. package/build/esm/trace/context-utils.js +66 -0
  122. package/build/esm/trace/context-utils.js.map +1 -0
  123. package/build/esm/trace/invalid-span-constants.d.ts +5 -0
  124. package/build/esm/trace/invalid-span-constants.js +24 -0
  125. package/build/esm/trace/invalid-span-constants.js.map +1 -0
  126. package/build/esm/trace/link.d.ts +24 -0
  127. package/build/esm/trace/link.js +17 -0
  128. package/build/esm/trace/link.js.map +1 -0
  129. package/build/esm/trace/span.d.ts +101 -0
  130. package/build/esm/trace/span.js +17 -0
  131. package/build/esm/trace/span.js.map +1 -0
  132. package/build/esm/trace/span_context.d.ts +53 -0
  133. package/build/esm/trace/span_context.js +17 -0
  134. package/build/esm/trace/span_context.js.map +1 -0
  135. package/build/esm/trace/span_kind.d.ts +27 -0
  136. package/build/esm/trace/span_kind.js +43 -0
  137. package/build/esm/trace/span_kind.js.map +1 -0
  138. package/build/esm/trace/spancontext-utils.d.ts +17 -0
  139. package/build/esm/trace/spancontext-utils.js +42 -0
  140. package/build/esm/trace/spancontext-utils.js.map +1 -0
  141. package/build/esm/trace/status.d.ts +25 -0
  142. package/build/esm/trace/status.js +20 -0
  143. package/build/esm/trace/status.js.map +1 -0
  144. package/build/esm/trace/trace_flags.d.ts +7 -0
  145. package/build/esm/trace/trace_flags.js +23 -0
  146. package/build/esm/trace/trace_flags.js.map +1 -0
  147. package/build/esm/trace/trace_state.d.ts +38 -0
  148. package/build/esm/trace/trace_state.js +17 -0
  149. package/build/esm/trace/trace_state.js.map +1 -0
  150. package/build/esm/trace/tracer.d.ts +71 -0
  151. package/build/esm/trace/tracer.js +17 -0
  152. package/build/esm/trace/tracer.js.map +1 -0
  153. package/build/esm/trace/tracer_provider.d.ts +19 -0
  154. package/build/esm/trace/tracer_provider.js +17 -0
  155. package/build/esm/trace/tracer_provider.js.map +1 -0
  156. package/build/esm/version.d.ts +2 -0
  157. package/build/esm/version.js +18 -0
  158. package/build/esm/version.js.map +1 -0
  159. package/build/src/api/context.d.ts +6 -4
  160. package/build/src/api/context.js +14 -15
  161. package/build/src/api/context.js.map +1 -1
  162. package/build/src/api/diag.d.ts +7 -3
  163. package/build/src/api/diag.js +16 -4
  164. package/build/src/api/diag.js.map +1 -1
  165. package/build/src/api/propagation.d.ts +10 -2
  166. package/build/src/api/propagation.js +15 -6
  167. package/build/src/api/propagation.js.map +1 -1
  168. package/build/src/api/trace.d.ts +12 -3
  169. package/build/src/api/trace.js +18 -6
  170. package/build/src/api/trace.js.map +1 -1
  171. package/build/src/baggage/context-helpers.d.ts +23 -0
  172. package/build/src/baggage/context-helpers.js +53 -0
  173. package/build/src/baggage/context-helpers.js.map +1 -0
  174. package/build/src/baggage/internal/baggage-impl.d.ts +12 -0
  175. package/build/src/baggage/internal/{baggage.js → baggage-impl.js} +1 -1
  176. package/build/src/baggage/internal/baggage-impl.js.map +1 -0
  177. package/build/src/baggage/types.d.ts +60 -0
  178. package/build/src/baggage/{Entry.js → types.js} +1 -1
  179. package/build/src/baggage/types.js.map +1 -0
  180. package/build/src/baggage/utils.d.ts +15 -0
  181. package/build/src/baggage/{index.js → utils.js} +6 -16
  182. package/build/src/baggage/utils.js.map +1 -0
  183. package/build/src/context/NoopContextManager.d.ts +1 -1
  184. package/build/src/context/NoopContextManager.js +6 -8
  185. package/build/src/context/NoopContextManager.js.map +1 -1
  186. package/build/src/context/context.d.ts +0 -59
  187. package/build/src/context/context.js +7 -101
  188. package/build/src/context/context.js.map +1 -1
  189. package/build/src/context/types.d.ts +2 -2
  190. package/build/src/diag/ComponentLogger.d.ts +20 -0
  191. package/build/src/diag/ComponentLogger.js +80 -0
  192. package/build/src/diag/ComponentLogger.js.map +1 -0
  193. package/build/src/diag/types.d.ts +6 -0
  194. package/build/src/index.d.ts +4 -9
  195. package/build/src/index.js +8 -12
  196. package/build/src/index.js.map +1 -1
  197. package/build/src/internal/global-utils.d.ts +2 -2
  198. package/build/src/internal/global-utils.js +12 -11
  199. package/build/src/internal/global-utils.js.map +1 -1
  200. package/build/src/internal/semver.js +13 -1
  201. package/build/src/internal/semver.js.map +1 -1
  202. package/build/src/propagation/NoopTextMapPropagator.d.ts +0 -1
  203. package/build/src/propagation/NoopTextMapPropagator.js +1 -2
  204. package/build/src/propagation/NoopTextMapPropagator.js.map +1 -1
  205. package/build/src/trace/NonRecordingSpan.d.ts +25 -0
  206. package/build/src/trace/NonRecordingSpan.js +65 -0
  207. package/build/src/trace/NonRecordingSpan.js.map +1 -0
  208. package/build/src/trace/NoopTracer.d.ts +3 -1
  209. package/build/src/trace/NoopTracer.js +33 -8
  210. package/build/src/trace/NoopTracer.js.map +1 -1
  211. package/build/src/trace/NoopTracerProvider.d.ts +0 -1
  212. package/build/src/trace/NoopTracerProvider.js +2 -3
  213. package/build/src/trace/NoopTracerProvider.js.map +1 -1
  214. package/build/src/trace/ProxyTracer.d.ts +5 -2
  215. package/build/src/trace/ProxyTracer.js +6 -1
  216. package/build/src/trace/ProxyTracer.js.map +1 -1
  217. package/build/src/trace/ProxyTracerProvider.js +2 -1
  218. package/build/src/trace/ProxyTracerProvider.js.map +1 -1
  219. package/build/src/trace/context-utils.d.ts +37 -0
  220. package/build/src/trace/context-utils.js +74 -0
  221. package/build/src/trace/context-utils.js.map +1 -0
  222. package/build/src/trace/invalid-span-constants.d.ts +5 -0
  223. package/build/src/trace/invalid-span-constants.js +27 -0
  224. package/build/src/trace/invalid-span-constants.js.map +1 -0
  225. package/build/src/trace/link.d.ts +3 -3
  226. package/build/src/trace/span.d.ts +1 -1
  227. package/build/src/trace/spancontext-utils.d.ts +8 -3
  228. package/build/src/trace/spancontext-utils.js +30 -11
  229. package/build/src/trace/spancontext-utils.js.map +1 -1
  230. package/build/src/trace/tracer.d.ts +47 -0
  231. package/build/src/version.d.ts +1 -1
  232. package/build/src/version.js +1 -1
  233. package/build/src/version.js.map +1 -1
  234. package/package.json +27 -19
  235. package/build/src/baggage/Baggage.js.map +0 -1
  236. package/build/src/baggage/Entry.d.ts +0 -20
  237. package/build/src/baggage/Entry.js.map +0 -1
  238. package/build/src/baggage/index.js.map +0 -1
  239. package/build/src/baggage/internal/baggage.js.map +0 -1
  240. package/build/src/trace/Event.d.ts +0 -9
  241. package/build/src/trace/Event.js.map +0 -1
  242. package/build/src/trace/NoopSpan.js.map +0 -1
  243. package/build/src/trace/TimedEvent.d.ts +0 -10
  244. package/build/src/trace/TimedEvent.js.map +0 -1
  245. package/build/src/trace/link_context.d.ts +0 -6
  246. package/build/src/trace/link_context.js +0 -18
  247. package/build/src/trace/link_context.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ import { Context } from '../context/types';
2
+ import { Span } from './span';
3
+ import { SpanOptions } from './SpanOptions';
4
+ import { Tracer } from './tracer';
5
+ /**
6
+ * No-op implementations of {@link Tracer}.
7
+ */
8
+ export declare class NoopTracer implements Tracer {
9
+ startSpan(name: string, options?: SpanOptions, context?: Context): Span;
10
+ startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
11
+ startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions | undefined, fn: F): ReturnType<F>;
12
+ startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions | undefined, ctx: Context | undefined, fn: F): ReturnType<F>;
13
+ }
14
+ //# sourceMappingURL=NoopTracer.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 { ContextAPI } from '../api/context';
17
+ import { getSpanContext, setSpan } from '../trace/context-utils';
18
+ import { NonRecordingSpan } from './NonRecordingSpan';
19
+ import { isSpanContextValid } from './spancontext-utils';
20
+ var context = ContextAPI.getInstance();
21
+ /**
22
+ * No-op implementations of {@link Tracer}.
23
+ */
24
+ var NoopTracer = /** @class */ (function () {
25
+ function NoopTracer() {
26
+ }
27
+ // startSpan starts a noop span.
28
+ NoopTracer.prototype.startSpan = function (name, options, context) {
29
+ var root = Boolean(options === null || options === void 0 ? void 0 : options.root);
30
+ if (root) {
31
+ return new NonRecordingSpan();
32
+ }
33
+ var parentFromContext = context && getSpanContext(context);
34
+ if (isSpanContext(parentFromContext) &&
35
+ isSpanContextValid(parentFromContext)) {
36
+ return new NonRecordingSpan(parentFromContext);
37
+ }
38
+ else {
39
+ return new NonRecordingSpan();
40
+ }
41
+ };
42
+ NoopTracer.prototype.startActiveSpan = function (name, arg2, arg3, arg4) {
43
+ var opts;
44
+ var ctx;
45
+ var fn;
46
+ if (arguments.length < 2) {
47
+ return;
48
+ }
49
+ else if (arguments.length === 2) {
50
+ fn = arg2;
51
+ }
52
+ else if (arguments.length === 3) {
53
+ opts = arg2;
54
+ fn = arg3;
55
+ }
56
+ else {
57
+ opts = arg2;
58
+ ctx = arg3;
59
+ fn = arg4;
60
+ }
61
+ var parentContext = ctx !== null && ctx !== void 0 ? ctx : context.active();
62
+ var span = this.startSpan(name, opts, parentContext);
63
+ var contextWithSpanSet = setSpan(parentContext, span);
64
+ return context.with(contextWithSpanSet, fn, undefined, span);
65
+ };
66
+ return NoopTracer;
67
+ }());
68
+ export { NoopTracer };
69
+ function isSpanContext(spanContext) {
70
+ return (typeof spanContext === 'object' &&
71
+ typeof spanContext['spanId'] === 'string' &&
72
+ typeof spanContext['traceId'] === 'string' &&
73
+ typeof spanContext['traceFlags'] === 'number');
74
+ }
75
+ //# sourceMappingURL=NoopTracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopTracer.js","sourceRoot":"","sources":["../../../src/trace/NoopTracer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAKzD,IAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;AAEzC;;GAEG;AACH;IAAA;IAgEA,CAAC;IA/DC,gCAAgC;IAChC,8BAAS,GAAT,UAAU,IAAY,EAAE,OAAqB,EAAE,OAAiB;QAC9D,IAAM,IAAI,GAAG,OAAO,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;QACpC,IAAI,IAAI,EAAE;YACR,OAAO,IAAI,gBAAgB,EAAE,CAAC;SAC/B;QAED,IAAM,iBAAiB,GAAG,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAE7D,IACE,aAAa,CAAC,iBAAiB,CAAC;YAChC,kBAAkB,CAAC,iBAAiB,CAAC,EACrC;YACA,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;SAChD;aAAM;YACL,OAAO,IAAI,gBAAgB,EAAE,CAAC;SAC/B;IACH,CAAC;IAiBD,oCAAe,GAAf,UACE,IAAY,EACZ,IAAsB,EACtB,IAAkB,EAClB,IAAQ;QAER,IAAI,IAA6B,CAAC;QAClC,IAAI,GAAwB,CAAC;QAC7B,IAAI,EAAK,CAAC;QAEV,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,OAAO;SACR;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,EAAE,GAAG,IAAS,CAAC;SAChB;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,IAAI,GAAG,IAA+B,CAAC;YACvC,EAAE,GAAG,IAAS,CAAC;SAChB;aAAM;YACL,IAAI,GAAG,IAA+B,CAAC;YACvC,GAAG,GAAG,IAA2B,CAAC;YAClC,EAAE,GAAG,IAAS,CAAC;SAChB;QAED,IAAM,aAAa,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9C,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACvD,IAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAExD,OAAO,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/D,CAAC;IACH,iBAAC;AAAD,CAAC,AAhED,IAgEC;;AAED,SAAS,aAAa,CAAC,WAAgB;IACrC,OAAO,CACL,OAAO,WAAW,KAAK,QAAQ;QAC/B,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,QAAQ;QACzC,OAAO,WAAW,CAAC,SAAS,CAAC,KAAK,QAAQ;QAC1C,OAAO,WAAW,CAAC,YAAY,CAAC,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Tracer } from './tracer';
2
+ import { TracerProvider } from './tracer_provider';
3
+ /**
4
+ * An implementation of the {@link TracerProvider} which returns an impotent
5
+ * Tracer for all calls to `getTracer`.
6
+ *
7
+ * All operations are no-op.
8
+ */
9
+ export declare class NoopTracerProvider implements TracerProvider {
10
+ getTracer(_name?: string, _version?: string): Tracer;
11
+ }
12
+ //# sourceMappingURL=NoopTracerProvider.d.ts.map
@@ -0,0 +1,32 @@
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 { NoopTracer } from './NoopTracer';
17
+ /**
18
+ * An implementation of the {@link TracerProvider} which returns an impotent
19
+ * Tracer for all calls to `getTracer`.
20
+ *
21
+ * All operations are no-op.
22
+ */
23
+ var NoopTracerProvider = /** @class */ (function () {
24
+ function NoopTracerProvider() {
25
+ }
26
+ NoopTracerProvider.prototype.getTracer = function (_name, _version) {
27
+ return new NoopTracer();
28
+ };
29
+ return NoopTracerProvider;
30
+ }());
31
+ export { NoopTracerProvider };
32
+ //# sourceMappingURL=NoopTracerProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/NoopTracerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;;;GAKG;AACH;IAAA;IAIA,CAAC;IAHC,sCAAS,GAAT,UAAU,KAAc,EAAE,QAAiB;QACzC,OAAO,IAAI,UAAU,EAAE,CAAC;IAC1B,CAAC;IACH,yBAAC;AAAD,CAAC,AAJD,IAIC"}
@@ -0,0 +1,25 @@
1
+ import { Context } from '../context/types';
2
+ import { Span } from './span';
3
+ import { SpanOptions } from './SpanOptions';
4
+ import { Tracer } from './tracer';
5
+ /**
6
+ * Proxy tracer provided by the proxy tracer provider
7
+ */
8
+ export declare class ProxyTracer implements Tracer {
9
+ private _provider;
10
+ readonly name: string;
11
+ readonly version?: string | undefined;
12
+ private _delegate?;
13
+ constructor(_provider: TracerDelegator, name: string, version?: string | undefined);
14
+ startSpan(name: string, options?: SpanOptions, context?: Context): Span;
15
+ startActiveSpan<F extends (span: Span) => unknown>(_name: string, _options: F | SpanOptions, _context?: F | Context, _fn?: F): ReturnType<F>;
16
+ /**
17
+ * Try to get a tracer from the proxy tracer provider.
18
+ * If the proxy tracer provider has no delegate, return a noop tracer.
19
+ */
20
+ private _getTracer;
21
+ }
22
+ export interface TracerDelegator {
23
+ getDelegateTracer(name: string, version?: string): Tracer | undefined;
24
+ }
25
+ //# sourceMappingURL=ProxyTracer.d.ts.map
@@ -0,0 +1,52 @@
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 { NoopTracer } from './NoopTracer';
17
+ var NOOP_TRACER = new NoopTracer();
18
+ /**
19
+ * Proxy tracer provided by the proxy tracer provider
20
+ */
21
+ var ProxyTracer = /** @class */ (function () {
22
+ function ProxyTracer(_provider, name, version) {
23
+ this._provider = _provider;
24
+ this.name = name;
25
+ this.version = version;
26
+ }
27
+ ProxyTracer.prototype.startSpan = function (name, options, context) {
28
+ return this._getTracer().startSpan(name, options, context);
29
+ };
30
+ ProxyTracer.prototype.startActiveSpan = function (_name, _options, _context, _fn) {
31
+ var tracer = this._getTracer();
32
+ return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
33
+ };
34
+ /**
35
+ * Try to get a tracer from the proxy tracer provider.
36
+ * If the proxy tracer provider has no delegate, return a noop tracer.
37
+ */
38
+ ProxyTracer.prototype._getTracer = function () {
39
+ if (this._delegate) {
40
+ return this._delegate;
41
+ }
42
+ var tracer = this._provider.getDelegateTracer(this.name, this.version);
43
+ if (!tracer) {
44
+ return NOOP_TRACER;
45
+ }
46
+ this._delegate = tracer;
47
+ return this._delegate;
48
+ };
49
+ return ProxyTracer;
50
+ }());
51
+ export { ProxyTracer };
52
+ //# sourceMappingURL=ProxyTracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyTracer.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,IAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;AAErC;;GAEG;AACH;IAIE,qBACU,SAA0B,EAClB,IAAY,EACZ,OAAgB;QAFxB,cAAS,GAAT,SAAS,CAAiB;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAS;IAC/B,CAAC;IAEJ,+BAAS,GAAT,UAAU,IAAY,EAAE,OAAqB,EAAE,OAAiB;QAC9D,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,qCAAe,GAAf,UACE,KAAa,EACb,QAAyB,EACzB,QAAsB,EACtB,GAAO;QAEP,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACK,gCAAU,GAAlB;QACE,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QAED,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzE,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,WAAW,CAAC;SACpB;QAED,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACH,kBAAC;AAAD,CAAC,AA1CD,IA0CC"}
@@ -0,0 +1,24 @@
1
+ import { Tracer } from './tracer';
2
+ import { TracerProvider } from './tracer_provider';
3
+ /**
4
+ * Tracer provider which provides {@link ProxyTracer}s.
5
+ *
6
+ * Before a delegate is set, tracers provided are NoOp.
7
+ * When a delegate is set, traces are provided from the delegate.
8
+ * When a delegate is set after tracers have already been provided,
9
+ * all tracers already provided will use the provided delegate implementation.
10
+ */
11
+ export declare class ProxyTracerProvider implements TracerProvider {
12
+ private _delegate?;
13
+ /**
14
+ * Get a {@link ProxyTracer}
15
+ */
16
+ getTracer(name: string, version?: string): Tracer;
17
+ getDelegate(): TracerProvider;
18
+ /**
19
+ * Set the delegate tracer provider
20
+ */
21
+ setDelegate(delegate: TracerProvider): void;
22
+ getDelegateTracer(name: string, version?: string): Tracer | undefined;
23
+ }
24
+ //# sourceMappingURL=ProxyTracerProvider.d.ts.map
@@ -0,0 +1,54 @@
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 { ProxyTracer } from './ProxyTracer';
17
+ import { NoopTracerProvider } from './NoopTracerProvider';
18
+ var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
19
+ /**
20
+ * Tracer provider which provides {@link ProxyTracer}s.
21
+ *
22
+ * Before a delegate is set, tracers provided are NoOp.
23
+ * When a delegate is set, traces are provided from the delegate.
24
+ * When a delegate is set after tracers have already been provided,
25
+ * all tracers already provided will use the provided delegate implementation.
26
+ */
27
+ var ProxyTracerProvider = /** @class */ (function () {
28
+ function ProxyTracerProvider() {
29
+ }
30
+ /**
31
+ * Get a {@link ProxyTracer}
32
+ */
33
+ ProxyTracerProvider.prototype.getTracer = function (name, version) {
34
+ var _a;
35
+ return ((_a = this.getDelegateTracer(name, version)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version));
36
+ };
37
+ ProxyTracerProvider.prototype.getDelegate = function () {
38
+ var _a;
39
+ return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
40
+ };
41
+ /**
42
+ * Set the delegate tracer provider
43
+ */
44
+ ProxyTracerProvider.prototype.setDelegate = function (delegate) {
45
+ this._delegate = delegate;
46
+ };
47
+ ProxyTracerProvider.prototype.getDelegateTracer = function (name, version) {
48
+ var _a;
49
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version);
50
+ };
51
+ return ProxyTracerProvider;
52
+ }());
53
+ export { ProxyTracerProvider };
54
+ //# sourceMappingURL=ProxyTracerProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,IAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAEtD;;;;;;;GAOG;AACH;IAAA;IA2BA,CAAC;IAxBC;;OAEG;IACH,uCAAS,GAAT,UAAU,IAAY,EAAE,OAAgB;;QACtC,OAAO,CACL,MAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,mCACrC,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CACrC,CAAC;IACJ,CAAC;IAED,yCAAW,GAAX;;QACE,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,oBAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,yCAAW,GAAX,UAAY,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,+CAAiB,GAAjB,UAAkB,IAAY,EAAE,OAAgB;;QAC9C,OAAO,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IACH,0BAAC;AAAD,CAAC,AA3BD,IA2BC"}
@@ -0,0 +1,30 @@
1
+ import { Context } from '../context/types';
2
+ import { SpanAttributes } from './attributes';
3
+ import { Link } from './link';
4
+ import { SamplingResult } from './SamplingResult';
5
+ import { SpanKind } from './span_kind';
6
+ /**
7
+ * This interface represent a sampler. Sampling is a mechanism to control the
8
+ * noise and overhead introduced by OpenTelemetry by reducing the number of
9
+ * samples of traces collected and sent to the backend.
10
+ */
11
+ export interface Sampler {
12
+ /**
13
+ * Checks whether span needs to be created and tracked.
14
+ *
15
+ * @param context Parent Context which may contain a span.
16
+ * @param traceId of the span to be created. It can be different from the
17
+ * traceId in the {@link SpanContext}. Typically in situations when the
18
+ * span to be created starts a new trace.
19
+ * @param spanName of the span to be created.
20
+ * @param spanKind of the span to be created.
21
+ * @param attributes Initial set of SpanAttributes for the Span being constructed.
22
+ * @param links Collection of links that will be associated with the Span to
23
+ * be created. Typically useful for batch operations.
24
+ * @returns a {@link SamplingResult}.
25
+ */
26
+ shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: SpanAttributes, links: Link[]): SamplingResult;
27
+ /** Returns the sampler name or short description with the configuration. */
28
+ toString(): string;
29
+ }
30
+ //# sourceMappingURL=Sampler.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=Sampler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sampler.js","sourceRoot":"","sources":["../../../src/trace/Sampler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,39 @@
1
+ import { SpanAttributes } from './attributes';
2
+ /**
3
+ * A sampling decision that determines how a {@link Span} will be recorded
4
+ * and collected.
5
+ */
6
+ export declare enum SamplingDecision {
7
+ /**
8
+ * `Span.isRecording() === false`, span will not be recorded and all events
9
+ * and attributes will be dropped.
10
+ */
11
+ NOT_RECORD = 0,
12
+ /**
13
+ * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}
14
+ * MUST NOT be set.
15
+ */
16
+ RECORD = 1,
17
+ /**
18
+ * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}
19
+ * MUST be set.
20
+ */
21
+ RECORD_AND_SAMPLED = 2
22
+ }
23
+ /**
24
+ * A sampling result contains a decision for a {@link Span} and additional
25
+ * attributes the sampler would like to added to the Span.
26
+ */
27
+ export interface SamplingResult {
28
+ /**
29
+ * A sampling decision, refer to {@link SamplingDecision} for details.
30
+ */
31
+ decision: SamplingDecision;
32
+ /**
33
+ * The list of attributes returned by SamplingResult MUST be immutable.
34
+ * Caller may call {@link Sampler}.shouldSample any number of times and
35
+ * can safely cache the returned value.
36
+ */
37
+ attributes?: Readonly<SpanAttributes>;
38
+ }
39
+ //# sourceMappingURL=SamplingResult.d.ts.map
@@ -0,0 +1,38 @@
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
+ * A sampling decision that determines how a {@link Span} will be recorded
18
+ * and collected.
19
+ */
20
+ export var SamplingDecision;
21
+ (function (SamplingDecision) {
22
+ /**
23
+ * `Span.isRecording() === false`, span will not be recorded and all events
24
+ * and attributes will be dropped.
25
+ */
26
+ SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD";
27
+ /**
28
+ * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}
29
+ * MUST NOT be set.
30
+ */
31
+ SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD";
32
+ /**
33
+ * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}
34
+ * MUST be set.
35
+ */
36
+ SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED";
37
+ })(SamplingDecision || (SamplingDecision = {}));
38
+ //# sourceMappingURL=SamplingResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SamplingResult.js","sourceRoot":"","sources":["../../../src/trace/SamplingResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B;;;OAGG;IACH,mEAAU,CAAA;IACV;;;OAGG;IACH,2DAAM,CAAA;IACN;;;OAGG;IACH,mFAAkB,CAAA;AACpB,CAAC,EAhBW,gBAAgB,KAAhB,gBAAgB,QAgB3B"}
@@ -0,0 +1,23 @@
1
+ import { TimeInput } from '../common/Time';
2
+ import { SpanAttributes } from './attributes';
3
+ import { Link } from './link';
4
+ import { SpanKind } from './span_kind';
5
+ /**
6
+ * Options needed for span creation
7
+ */
8
+ export interface SpanOptions {
9
+ /**
10
+ * The SpanKind of a span
11
+ * @default {@link SpanKind.INTERNAL}
12
+ */
13
+ kind?: SpanKind;
14
+ /** A span's attributes */
15
+ attributes?: SpanAttributes;
16
+ /** {@link Link}s span to other spans */
17
+ links?: Link[];
18
+ /** A manually specified start time for the created `Span` object. */
19
+ startTime?: TimeInput;
20
+ /** The new span should be a root span. (Ignore parent from context). */
21
+ root?: boolean;
22
+ }
23
+ //# sourceMappingURL=SpanOptions.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=SpanOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpanOptions.js","sourceRoot":"","sources":["../../../src/trace/SpanOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,10 @@
1
+ export interface SpanAttributes {
2
+ [attributeKey: string]: SpanAttributeValue | undefined;
3
+ }
4
+ /**
5
+ * Attribute values may be any non-nullish primitive value except an object.
6
+ *
7
+ * null or undefined attribute values are invalid and will result in undefined behavior.
8
+ */
9
+ export declare type SpanAttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
10
+ //# sourceMappingURL=attributes.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=attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/trace/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,37 @@
1
+ import { Context } from '../context/types';
2
+ import { Span } from './span';
3
+ import { SpanContext } from './span_context';
4
+ /**
5
+ * Return the span if one exists
6
+ *
7
+ * @param context context to get span from
8
+ */
9
+ export declare function getSpan(context: Context): Span | undefined;
10
+ /**
11
+ * Set the span on a context
12
+ *
13
+ * @param context context to use as parent
14
+ * @param span span to set active
15
+ */
16
+ export declare function setSpan(context: Context, span: Span): Context;
17
+ /**
18
+ * Remove current span stored in the context
19
+ *
20
+ * @param context context to delete span from
21
+ */
22
+ export declare function deleteSpan(context: Context): Context;
23
+ /**
24
+ * Wrap span context in a NoopSpan and set as span in a new
25
+ * context
26
+ *
27
+ * @param context context to set active span on
28
+ * @param spanContext span context to be wrapped
29
+ */
30
+ export declare function setSpanContext(context: Context, spanContext: SpanContext): Context;
31
+ /**
32
+ * Get the span context of the span if it exists.
33
+ *
34
+ * @param context context to get values from
35
+ */
36
+ export declare function getSpanContext(context: Context): SpanContext | undefined;
37
+ //# sourceMappingURL=context-utils.d.ts.map
@@ -0,0 +1,66 @@
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 { createContextKey } from '../context/context';
17
+ import { NonRecordingSpan } from './NonRecordingSpan';
18
+ /**
19
+ * span key
20
+ */
21
+ var SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');
22
+ /**
23
+ * Return the span if one exists
24
+ *
25
+ * @param context context to get span from
26
+ */
27
+ export function getSpan(context) {
28
+ return context.getValue(SPAN_KEY) || undefined;
29
+ }
30
+ /**
31
+ * Set the span on a context
32
+ *
33
+ * @param context context to use as parent
34
+ * @param span span to set active
35
+ */
36
+ export function setSpan(context, span) {
37
+ return context.setValue(SPAN_KEY, span);
38
+ }
39
+ /**
40
+ * Remove current span stored in the context
41
+ *
42
+ * @param context context to delete span from
43
+ */
44
+ export function deleteSpan(context) {
45
+ return context.deleteValue(SPAN_KEY);
46
+ }
47
+ /**
48
+ * Wrap span context in a NoopSpan and set as span in a new
49
+ * context
50
+ *
51
+ * @param context context to set active span on
52
+ * @param spanContext span context to be wrapped
53
+ */
54
+ export function setSpanContext(context, spanContext) {
55
+ return setSpan(context, new NonRecordingSpan(spanContext));
56
+ }
57
+ /**
58
+ * Get the span context of the span if it exists.
59
+ *
60
+ * @param context context to get values from
61
+ */
62
+ export function getSpanContext(context) {
63
+ var _a;
64
+ return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();
65
+ }
66
+ //# sourceMappingURL=context-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-utils.js","sourceRoot":"","sources":["../../../src/trace/context-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,IAAM,QAAQ,GAAG,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB;IACtC,OAAQ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU,IAAI,SAAS,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB,EAAE,IAAU;IAClD,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,WAAwB;IAExB,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;;IAC7C,OAAO,MAAA,OAAO,CAAC,OAAO,CAAC,0CAAE,WAAW,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { SpanContext } from './span_context';
2
+ export declare const INVALID_SPANID = "0000000000000000";
3
+ export declare const INVALID_TRACEID = "00000000000000000000000000000000";
4
+ export declare const INVALID_SPAN_CONTEXT: SpanContext;
5
+ //# sourceMappingURL=invalid-span-constants.d.ts.map