@opentelemetry/api 1.9.0 → 1.9.1

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 (625) hide show
  1. package/README.md +3 -2
  2. package/build/esm/api/context.d.ts +3 -1
  3. package/build/esm/api/context.js +23 -65
  4. package/build/esm/api/context.js.map +1 -1
  5. package/build/esm/api/diag.d.ts +3 -1
  6. package/build/esm/api/diag.js +28 -69
  7. package/build/esm/api/diag.js.map +1 -1
  8. package/build/esm/api/metrics.d.ts +2 -2
  9. package/build/esm/api/metrics.js +15 -29
  10. package/build/esm/api/metrics.js.map +1 -1
  11. package/build/esm/api/propagation.d.ts +4 -2
  12. package/build/esm/api/propagation.js +22 -35
  13. package/build/esm/api/propagation.js.map +1 -1
  14. package/build/esm/api/trace.d.ts +4 -2
  15. package/build/esm/api/trace.js +18 -29
  16. package/build/esm/api/trace.js.map +1 -1
  17. package/build/esm/baggage/context-helpers.d.ts +2 -2
  18. package/build/esm/baggage/context-helpers.js +2 -13
  19. package/build/esm/baggage/context-helpers.js.map +1 -1
  20. package/build/esm/baggage/internal/baggage-impl.js +23 -81
  21. package/build/esm/baggage/internal/baggage-impl.js.map +1 -1
  22. package/build/esm/baggage/internal/symbol.js +2 -13
  23. package/build/esm/baggage/internal/symbol.js.map +1 -1
  24. package/build/esm/baggage/types.d.ts +9 -2
  25. package/build/esm/baggage/types.js +1 -12
  26. package/build/esm/baggage/types.js.map +1 -1
  27. package/build/esm/baggage/utils.d.ts +2 -1
  28. package/build/esm/baggage/utils.js +6 -17
  29. package/build/esm/baggage/utils.js.map +1 -1
  30. package/build/esm/common/Attributes.d.ts +5 -1
  31. package/build/esm/common/Attributes.js +1 -12
  32. package/build/esm/common/Attributes.js.map +1 -1
  33. package/build/esm/common/Exception.d.ts +3 -1
  34. package/build/esm/common/Exception.js +1 -12
  35. package/build/esm/common/Exception.js.map +1 -1
  36. package/build/esm/common/Time.d.ts +6 -2
  37. package/build/esm/common/Time.js.map +1 -1
  38. package/build/esm/context/NoopContextManager.d.ts +1 -1
  39. package/build/esm/context/NoopContextManager.js +14 -58
  40. package/build/esm/context/NoopContextManager.js.map +1 -1
  41. package/build/esm/context/context.d.ts +11 -3
  42. package/build/esm/context/context.js +20 -24
  43. package/build/esm/context/context.js.map +1 -1
  44. package/build/esm/context/types.d.ts +6 -0
  45. package/build/esm/context/types.js +1 -12
  46. package/build/esm/context/types.js.map +1 -1
  47. package/build/esm/context-api.d.ts +4 -1
  48. package/build/esm/context-api.js +6 -14
  49. package/build/esm/context-api.js.map +1 -1
  50. package/build/esm/diag/ComponentLogger.d.ts +6 -6
  51. package/build/esm/diag/ComponentLogger.js +16 -75
  52. package/build/esm/diag/ComponentLogger.js.map +1 -1
  53. package/build/esm/diag/consoleLogger.d.ts +6 -1
  54. package/build/esm/diag/consoleLogger.js +41 -31
  55. package/build/esm/diag/consoleLogger.js.map +1 -1
  56. package/build/esm/diag/internal/logLevelLogger.d.ts +2 -1
  57. package/build/esm/diag/internal/logLevelLogger.js +2 -13
  58. package/build/esm/diag/internal/logLevelLogger.js.map +1 -1
  59. package/build/esm/diag/internal/noopLogger.d.ts +1 -1
  60. package/build/esm/diag/internal/noopLogger.js +1 -12
  61. package/build/esm/diag/internal/noopLogger.js.map +1 -1
  62. package/build/esm/diag/types.d.ts +11 -1
  63. package/build/esm/diag/types.js +1 -12
  64. package/build/esm/diag/types.js.map +1 -1
  65. package/build/esm/diag-api.d.ts +2 -0
  66. package/build/esm/diag-api.js +4 -13
  67. package/build/esm/diag-api.js.map +1 -1
  68. package/build/esm/experimental/index.d.ts +5 -1
  69. package/build/esm/experimental/index.js +5 -12
  70. package/build/esm/experimental/index.js.map +1 -1
  71. package/build/esm/experimental/trace/SugaredOptions.d.ts +1 -1
  72. package/build/esm/experimental/trace/SugaredOptions.js +1 -12
  73. package/build/esm/experimental/trace/SugaredOptions.js.map +1 -1
  74. package/build/esm/experimental/trace/SugaredTracer.d.ts +2 -2
  75. package/build/esm/experimental/trace/SugaredTracer.js +22 -26
  76. package/build/esm/experimental/trace/SugaredTracer.js.map +1 -1
  77. package/build/esm/index.d.ts +29 -24
  78. package/build/esm/index.js +9 -19
  79. package/build/esm/index.js.map +1 -1
  80. package/build/esm/internal/global-utils.d.ts +5 -5
  81. package/build/esm/internal/global-utils.js +20 -25
  82. package/build/esm/internal/global-utils.js.map +1 -1
  83. package/build/esm/internal/semver.js +10 -21
  84. package/build/esm/internal/semver.js.map +1 -1
  85. package/build/esm/metrics/Meter.d.ts +5 -1
  86. package/build/esm/metrics/Meter.js +1 -12
  87. package/build/esm/metrics/Meter.js.map +1 -1
  88. package/build/esm/metrics/MeterProvider.d.ts +3 -1
  89. package/build/esm/metrics/MeterProvider.js +1 -12
  90. package/build/esm/metrics/MeterProvider.js.map +1 -1
  91. package/build/esm/metrics/Metric.d.ts +79 -11
  92. package/build/esm/metrics/Metric.js +5 -12
  93. package/build/esm/metrics/Metric.js.map +1 -1
  94. package/build/esm/metrics/NoopMeter.d.ts +4 -2
  95. package/build/esm/metrics/NoopMeter.js +54 -131
  96. package/build/esm/metrics/NoopMeter.js.map +1 -1
  97. package/build/esm/metrics/NoopMeterProvider.d.ts +2 -2
  98. package/build/esm/metrics/NoopMeterProvider.js +6 -21
  99. package/build/esm/metrics/NoopMeterProvider.js.map +1 -1
  100. package/build/esm/metrics-api.d.ts +5 -1
  101. package/build/esm/metrics-api.js +7 -14
  102. package/build/esm/metrics-api.js.map +1 -1
  103. package/build/esm/propagation/NoopTextMapPropagator.d.ts +2 -2
  104. package/build/esm/propagation/NoopTextMapPropagator.js +8 -23
  105. package/build/esm/propagation/NoopTextMapPropagator.js.map +1 -1
  106. package/build/esm/propagation/TextMapPropagator.d.ts +14 -2
  107. package/build/esm/propagation/TextMapPropagator.js +12 -17
  108. package/build/esm/propagation/TextMapPropagator.js.map +1 -1
  109. package/build/esm/propagation-api.d.ts +5 -1
  110. package/build/esm/propagation-api.js +7 -14
  111. package/build/esm/propagation-api.js.map +1 -1
  112. package/build/esm/trace/NonRecordingSpan.d.ts +8 -8
  113. package/build/esm/trace/NonRecordingSpan.js +25 -39
  114. package/build/esm/trace/NonRecordingSpan.js.map +1 -1
  115. package/build/esm/trace/NoopTracer.d.ts +4 -4
  116. package/build/esm/trace/NoopTracer.js +21 -33
  117. package/build/esm/trace/NoopTracer.js.map +1 -1
  118. package/build/esm/trace/NoopTracerProvider.d.ts +3 -3
  119. package/build/esm/trace/NoopTracerProvider.js +5 -20
  120. package/build/esm/trace/NoopTracerProvider.js.map +1 -1
  121. package/build/esm/trace/ProxyTracer.d.ts +14 -9
  122. package/build/esm/trace/ProxyTracer.js +16 -27
  123. package/build/esm/trace/ProxyTracer.js.map +1 -1
  124. package/build/esm/trace/ProxyTracerProvider.d.ts +6 -3
  125. package/build/esm/trace/ProxyTracerProvider.js +15 -27
  126. package/build/esm/trace/ProxyTracerProvider.js.map +1 -1
  127. package/build/esm/trace/Sampler.d.ts +7 -5
  128. package/build/esm/trace/Sampler.js +1 -12
  129. package/build/esm/trace/Sampler.js.map +1 -1
  130. package/build/esm/trace/SamplingResult.d.ts +6 -2
  131. package/build/esm/trace/SamplingResult.js +3 -12
  132. package/build/esm/trace/SamplingResult.js.map +1 -1
  133. package/build/esm/trace/SpanOptions.d.ts +7 -5
  134. package/build/esm/trace/SpanOptions.js +1 -12
  135. package/build/esm/trace/SpanOptions.js.map +1 -1
  136. package/build/esm/trace/attributes.d.ts +5 -3
  137. package/build/esm/trace/attributes.js +1 -12
  138. package/build/esm/trace/attributes.js.map +1 -1
  139. package/build/esm/trace/context-utils.d.ts +3 -3
  140. package/build/esm/trace/context-utils.js +2 -13
  141. package/build/esm/trace/context-utils.js.map +1 -1
  142. package/build/esm/trace/internal/tracestate-impl.d.ts +1 -1
  143. package/build/esm/trace/internal/tracestate-impl.js +37 -49
  144. package/build/esm/trace/internal/tracestate-impl.js.map +1 -1
  145. package/build/esm/trace/internal/tracestate-validators.js +7 -18
  146. package/build/esm/trace/internal/tracestate-validators.js.map +1 -1
  147. package/build/esm/trace/internal/utils.d.ts +4 -1
  148. package/build/esm/trace/internal/utils.js +4 -12
  149. package/build/esm/trace/internal/utils.js.map +1 -1
  150. package/build/esm/trace/invalid-span-constants.d.ts +10 -1
  151. package/build/esm/trace/invalid-span-constants.js +13 -15
  152. package/build/esm/trace/invalid-span-constants.js.map +1 -1
  153. package/build/esm/trace/link.d.ts +4 -2
  154. package/build/esm/trace/link.js +1 -12
  155. package/build/esm/trace/link.js.map +1 -1
  156. package/build/esm/trace/span.d.ts +22 -10
  157. package/build/esm/trace/span.js +1 -12
  158. package/build/esm/trace/span.js.map +1 -1
  159. package/build/esm/trace/span_context.d.ts +3 -1
  160. package/build/esm/trace/span_context.js +1 -12
  161. package/build/esm/trace/span_context.js.map +1 -1
  162. package/build/esm/trace/span_kind.d.ts +3 -0
  163. package/build/esm/trace/span_kind.js +4 -12
  164. package/build/esm/trace/span_kind.js.map +1 -1
  165. package/build/esm/trace/spancontext-utils.d.ts +10 -2
  166. package/build/esm/trace/spancontext-utils.js +33 -16
  167. package/build/esm/trace/spancontext-utils.js.map +1 -1
  168. package/build/esm/trace/status.d.ts +5 -0
  169. package/build/esm/trace/status.js +6 -0
  170. package/build/esm/trace/status.js.map +1 -1
  171. package/build/esm/trace/trace_flags.d.ts +3 -0
  172. package/build/esm/trace/trace_flags.js +4 -12
  173. package/build/esm/trace/trace_flags.js.map +1 -1
  174. package/build/esm/trace/trace_state.d.ts +3 -0
  175. package/build/esm/trace/trace_state.js +1 -12
  176. package/build/esm/trace/trace_state.js.map +1 -1
  177. package/build/esm/trace/tracer.d.ts +5 -3
  178. package/build/esm/trace/tracer.js +1 -12
  179. package/build/esm/trace/tracer.js.map +1 -1
  180. package/build/esm/trace/tracer_options.d.ts +2 -0
  181. package/build/esm/trace/tracer_options.js +1 -12
  182. package/build/esm/trace/tracer_options.js.map +1 -1
  183. package/build/esm/trace/tracer_provider.d.ts +4 -2
  184. package/build/esm/trace/tracer_provider.js +1 -12
  185. package/build/esm/trace/tracer_provider.js.map +1 -1
  186. package/build/esm/trace-api.d.ts +5 -1
  187. package/build/esm/trace-api.js +7 -14
  188. package/build/esm/trace-api.js.map +1 -1
  189. package/build/esm/version.d.ts +1 -1
  190. package/build/esm/version.js +2 -13
  191. package/build/esm/version.js.map +1 -1
  192. package/build/esnext/api/context.d.ts +3 -1
  193. package/build/esnext/api/context.js +3 -12
  194. package/build/esnext/api/context.js.map +1 -1
  195. package/build/esnext/api/diag.d.ts +3 -1
  196. package/build/esnext/api/diag.js +11 -20
  197. package/build/esnext/api/diag.js.map +1 -1
  198. package/build/esnext/api/metrics.d.ts +2 -2
  199. package/build/esnext/api/metrics.js +1 -12
  200. package/build/esnext/api/metrics.js.map +1 -1
  201. package/build/esnext/api/propagation.d.ts +4 -2
  202. package/build/esnext/api/propagation.js +3 -12
  203. package/build/esnext/api/propagation.js.map +1 -1
  204. package/build/esnext/api/trace.d.ts +4 -2
  205. package/build/esnext/api/trace.js +3 -12
  206. package/build/esnext/api/trace.js.map +1 -1
  207. package/build/esnext/baggage/context-helpers.d.ts +2 -2
  208. package/build/esnext/baggage/context-helpers.js +1 -12
  209. package/build/esnext/baggage/context-helpers.js.map +1 -1
  210. package/build/esnext/baggage/internal/baggage-impl.js +2 -13
  211. package/build/esnext/baggage/internal/baggage-impl.js.map +1 -1
  212. package/build/esnext/baggage/internal/symbol.js +1 -12
  213. package/build/esnext/baggage/internal/symbol.js.map +1 -1
  214. package/build/esnext/baggage/types.d.ts +9 -2
  215. package/build/esnext/baggage/types.js +1 -12
  216. package/build/esnext/baggage/types.js.map +1 -1
  217. package/build/esnext/baggage/utils.d.ts +2 -1
  218. package/build/esnext/baggage/utils.js +2 -12
  219. package/build/esnext/baggage/utils.js.map +1 -1
  220. package/build/esnext/common/Attributes.d.ts +5 -1
  221. package/build/esnext/common/Attributes.js +1 -12
  222. package/build/esnext/common/Attributes.js.map +1 -1
  223. package/build/esnext/common/Exception.d.ts +3 -1
  224. package/build/esnext/common/Exception.js +1 -12
  225. package/build/esnext/common/Exception.js.map +1 -1
  226. package/build/esnext/common/Time.d.ts +6 -2
  227. package/build/esnext/common/Time.js.map +1 -1
  228. package/build/esnext/context/NoopContextManager.d.ts +1 -1
  229. package/build/esnext/context/NoopContextManager.js +1 -12
  230. package/build/esnext/context/NoopContextManager.js.map +1 -1
  231. package/build/esnext/context/context.d.ts +11 -3
  232. package/build/esnext/context/context.js +10 -13
  233. package/build/esnext/context/context.js.map +1 -1
  234. package/build/esnext/context/types.d.ts +6 -0
  235. package/build/esnext/context/types.js +1 -12
  236. package/build/esnext/context/types.js.map +1 -1
  237. package/build/esnext/context-api.d.ts +4 -1
  238. package/build/esnext/context-api.js +5 -13
  239. package/build/esnext/context-api.js.map +1 -1
  240. package/build/esnext/diag/ComponentLogger.d.ts +6 -6
  241. package/build/esnext/diag/ComponentLogger.js +2 -14
  242. package/build/esnext/diag/ComponentLogger.js.map +1 -1
  243. package/build/esnext/diag/consoleLogger.d.ts +6 -1
  244. package/build/esnext/diag/consoleLogger.js +36 -20
  245. package/build/esnext/diag/consoleLogger.js.map +1 -1
  246. package/build/esnext/diag/internal/logLevelLogger.d.ts +2 -1
  247. package/build/esnext/diag/internal/logLevelLogger.js +1 -12
  248. package/build/esnext/diag/internal/logLevelLogger.js.map +1 -1
  249. package/build/esnext/diag/internal/noopLogger.d.ts +1 -1
  250. package/build/esnext/diag/internal/noopLogger.js +1 -12
  251. package/build/esnext/diag/internal/noopLogger.js.map +1 -1
  252. package/build/esnext/diag/types.d.ts +11 -1
  253. package/build/esnext/diag/types.js +1 -12
  254. package/build/esnext/diag/types.js.map +1 -1
  255. package/build/esnext/diag-api.d.ts +2 -0
  256. package/build/esnext/diag-api.js +3 -12
  257. package/build/esnext/diag-api.js.map +1 -1
  258. package/build/esnext/experimental/index.d.ts +5 -1
  259. package/build/esnext/experimental/index.js +5 -12
  260. package/build/esnext/experimental/index.js.map +1 -1
  261. package/build/esnext/experimental/trace/SugaredOptions.d.ts +1 -1
  262. package/build/esnext/experimental/trace/SugaredOptions.js +1 -12
  263. package/build/esnext/experimental/trace/SugaredOptions.js.map +1 -1
  264. package/build/esnext/experimental/trace/SugaredTracer.d.ts +2 -2
  265. package/build/esnext/experimental/trace/SugaredTracer.js +2 -2
  266. package/build/esnext/experimental/trace/SugaredTracer.js.map +1 -1
  267. package/build/esnext/index.d.ts +29 -24
  268. package/build/esnext/index.js +4 -14
  269. package/build/esnext/index.js.map +1 -1
  270. package/build/esnext/internal/global-utils.d.ts +5 -5
  271. package/build/esnext/internal/global-utils.js +10 -14
  272. package/build/esnext/internal/global-utils.js.map +1 -1
  273. package/build/esnext/internal/semver.js +1 -12
  274. package/build/esnext/internal/semver.js.map +1 -1
  275. package/build/esnext/metrics/Meter.d.ts +5 -1
  276. package/build/esnext/metrics/Meter.js +1 -12
  277. package/build/esnext/metrics/Meter.js.map +1 -1
  278. package/build/esnext/metrics/MeterProvider.d.ts +3 -1
  279. package/build/esnext/metrics/MeterProvider.js +1 -12
  280. package/build/esnext/metrics/MeterProvider.js.map +1 -1
  281. package/build/esnext/metrics/Metric.d.ts +79 -11
  282. package/build/esnext/metrics/Metric.js +5 -12
  283. package/build/esnext/metrics/Metric.js.map +1 -1
  284. package/build/esnext/metrics/NoopMeter.d.ts +4 -2
  285. package/build/esnext/metrics/NoopMeter.js +3 -12
  286. package/build/esnext/metrics/NoopMeter.js.map +1 -1
  287. package/build/esnext/metrics/NoopMeterProvider.d.ts +2 -2
  288. package/build/esnext/metrics/NoopMeterProvider.js +1 -12
  289. package/build/esnext/metrics/NoopMeterProvider.js.map +1 -1
  290. package/build/esnext/metrics-api.d.ts +5 -1
  291. package/build/esnext/metrics-api.js +6 -13
  292. package/build/esnext/metrics-api.js.map +1 -1
  293. package/build/esnext/propagation/NoopTextMapPropagator.d.ts +2 -2
  294. package/build/esnext/propagation/NoopTextMapPropagator.js +1 -12
  295. package/build/esnext/propagation/NoopTextMapPropagator.js.map +1 -1
  296. package/build/esnext/propagation/TextMapPropagator.d.ts +14 -2
  297. package/build/esnext/propagation/TextMapPropagator.js +7 -12
  298. package/build/esnext/propagation/TextMapPropagator.js.map +1 -1
  299. package/build/esnext/propagation-api.d.ts +5 -1
  300. package/build/esnext/propagation-api.js +6 -13
  301. package/build/esnext/propagation-api.js.map +1 -1
  302. package/build/esnext/trace/NonRecordingSpan.d.ts +8 -8
  303. package/build/esnext/trace/NonRecordingSpan.js +3 -14
  304. package/build/esnext/trace/NonRecordingSpan.js.map +1 -1
  305. package/build/esnext/trace/NoopTracer.d.ts +4 -4
  306. package/build/esnext/trace/NoopTracer.js +6 -13
  307. package/build/esnext/trace/NoopTracer.js.map +1 -1
  308. package/build/esnext/trace/NoopTracerProvider.d.ts +3 -3
  309. package/build/esnext/trace/NoopTracerProvider.js +1 -12
  310. package/build/esnext/trace/NoopTracerProvider.js.map +1 -1
  311. package/build/esnext/trace/ProxyTracer.d.ts +14 -9
  312. package/build/esnext/trace/ProxyTracer.js +5 -14
  313. package/build/esnext/trace/ProxyTracer.js.map +1 -1
  314. package/build/esnext/trace/ProxyTracerProvider.d.ts +6 -3
  315. package/build/esnext/trace/ProxyTracerProvider.js +4 -12
  316. package/build/esnext/trace/ProxyTracerProvider.js.map +1 -1
  317. package/build/esnext/trace/Sampler.d.ts +7 -5
  318. package/build/esnext/trace/Sampler.js +1 -12
  319. package/build/esnext/trace/Sampler.js.map +1 -1
  320. package/build/esnext/trace/SamplingResult.d.ts +6 -2
  321. package/build/esnext/trace/SamplingResult.js +3 -12
  322. package/build/esnext/trace/SamplingResult.js.map +1 -1
  323. package/build/esnext/trace/SpanOptions.d.ts +7 -5
  324. package/build/esnext/trace/SpanOptions.js +1 -12
  325. package/build/esnext/trace/SpanOptions.js.map +1 -1
  326. package/build/esnext/trace/attributes.d.ts +5 -3
  327. package/build/esnext/trace/attributes.js +1 -12
  328. package/build/esnext/trace/attributes.js.map +1 -1
  329. package/build/esnext/trace/context-utils.d.ts +3 -3
  330. package/build/esnext/trace/context-utils.js +1 -12
  331. package/build/esnext/trace/context-utils.js.map +1 -1
  332. package/build/esnext/trace/internal/tracestate-impl.d.ts +1 -1
  333. package/build/esnext/trace/internal/tracestate-impl.js +8 -17
  334. package/build/esnext/trace/internal/tracestate-impl.js.map +1 -1
  335. package/build/esnext/trace/internal/tracestate-validators.js +1 -12
  336. package/build/esnext/trace/internal/tracestate-validators.js.map +1 -1
  337. package/build/esnext/trace/internal/utils.d.ts +4 -1
  338. package/build/esnext/trace/internal/utils.js +4 -12
  339. package/build/esnext/trace/internal/utils.js.map +1 -1
  340. package/build/esnext/trace/invalid-span-constants.d.ts +10 -1
  341. package/build/esnext/trace/invalid-span-constants.js +10 -12
  342. package/build/esnext/trace/invalid-span-constants.js.map +1 -1
  343. package/build/esnext/trace/link.d.ts +4 -2
  344. package/build/esnext/trace/link.js +1 -12
  345. package/build/esnext/trace/link.js.map +1 -1
  346. package/build/esnext/trace/span.d.ts +22 -10
  347. package/build/esnext/trace/span.js +1 -12
  348. package/build/esnext/trace/span.js.map +1 -1
  349. package/build/esnext/trace/span_context.d.ts +3 -1
  350. package/build/esnext/trace/span_context.js +1 -12
  351. package/build/esnext/trace/span_context.js.map +1 -1
  352. package/build/esnext/trace/span_kind.d.ts +3 -0
  353. package/build/esnext/trace/span_kind.js +4 -12
  354. package/build/esnext/trace/span_kind.js.map +1 -1
  355. package/build/esnext/trace/spancontext-utils.d.ts +10 -2
  356. package/build/esnext/trace/spancontext-utils.js +33 -16
  357. package/build/esnext/trace/spancontext-utils.js.map +1 -1
  358. package/build/esnext/trace/status.d.ts +5 -0
  359. package/build/esnext/trace/status.js +6 -0
  360. package/build/esnext/trace/status.js.map +1 -1
  361. package/build/esnext/trace/trace_flags.d.ts +3 -0
  362. package/build/esnext/trace/trace_flags.js +4 -12
  363. package/build/esnext/trace/trace_flags.js.map +1 -1
  364. package/build/esnext/trace/trace_state.d.ts +3 -0
  365. package/build/esnext/trace/trace_state.js +1 -12
  366. package/build/esnext/trace/trace_state.js.map +1 -1
  367. package/build/esnext/trace/tracer.d.ts +5 -3
  368. package/build/esnext/trace/tracer.js +1 -12
  369. package/build/esnext/trace/tracer.js.map +1 -1
  370. package/build/esnext/trace/tracer_options.d.ts +2 -0
  371. package/build/esnext/trace/tracer_options.js +1 -12
  372. package/build/esnext/trace/tracer_options.js.map +1 -1
  373. package/build/esnext/trace/tracer_provider.d.ts +4 -2
  374. package/build/esnext/trace/tracer_provider.js +1 -12
  375. package/build/esnext/trace/tracer_provider.js.map +1 -1
  376. package/build/esnext/trace-api.d.ts +5 -1
  377. package/build/esnext/trace-api.js +6 -13
  378. package/build/esnext/trace-api.js.map +1 -1
  379. package/build/esnext/version.d.ts +1 -1
  380. package/build/esnext/version.js +2 -13
  381. package/build/esnext/version.js.map +1 -1
  382. package/build/src/api/context.d.ts +3 -1
  383. package/build/src/api/context.js +3 -12
  384. package/build/src/api/context.js.map +1 -1
  385. package/build/src/api/diag.d.ts +3 -1
  386. package/build/src/api/diag.js +10 -19
  387. package/build/src/api/diag.js.map +1 -1
  388. package/build/src/api/metrics.d.ts +2 -2
  389. package/build/src/api/metrics.js +1 -12
  390. package/build/src/api/metrics.js.map +1 -1
  391. package/build/src/api/propagation.d.ts +4 -2
  392. package/build/src/api/propagation.js +3 -12
  393. package/build/src/api/propagation.js.map +1 -1
  394. package/build/src/api/trace.d.ts +4 -2
  395. package/build/src/api/trace.js +3 -12
  396. package/build/src/api/trace.js.map +1 -1
  397. package/build/src/baggage/context-helpers.d.ts +2 -2
  398. package/build/src/baggage/context-helpers.js +1 -12
  399. package/build/src/baggage/context-helpers.js.map +1 -1
  400. package/build/src/baggage/internal/baggage-impl.js +2 -13
  401. package/build/src/baggage/internal/baggage-impl.js.map +1 -1
  402. package/build/src/baggage/internal/symbol.js +1 -12
  403. package/build/src/baggage/internal/symbol.js.map +1 -1
  404. package/build/src/baggage/types.d.ts +9 -2
  405. package/build/src/baggage/types.js +1 -12
  406. package/build/src/baggage/types.js.map +1 -1
  407. package/build/src/baggage/utils.d.ts +2 -1
  408. package/build/src/baggage/utils.js +2 -12
  409. package/build/src/baggage/utils.js.map +1 -1
  410. package/build/src/common/Attributes.d.ts +5 -1
  411. package/build/src/common/Attributes.js +1 -12
  412. package/build/src/common/Attributes.js.map +1 -1
  413. package/build/src/common/Exception.d.ts +3 -1
  414. package/build/src/common/Exception.js +1 -12
  415. package/build/src/common/Exception.js.map +1 -1
  416. package/build/src/common/Time.d.ts +6 -2
  417. package/build/src/common/Time.js.map +1 -1
  418. package/build/src/context/NoopContextManager.d.ts +1 -1
  419. package/build/src/context/NoopContextManager.js +1 -12
  420. package/build/src/context/NoopContextManager.js.map +1 -1
  421. package/build/src/context/context.d.ts +11 -3
  422. package/build/src/context/context.js +11 -14
  423. package/build/src/context/context.js.map +1 -1
  424. package/build/src/context/types.d.ts +6 -0
  425. package/build/src/context/types.js +1 -12
  426. package/build/src/context/types.js.map +1 -1
  427. package/build/src/context-api.d.ts +4 -1
  428. package/build/src/context-api.js +5 -13
  429. package/build/src/context-api.js.map +1 -1
  430. package/build/src/diag/ComponentLogger.d.ts +6 -6
  431. package/build/src/diag/ComponentLogger.js +2 -14
  432. package/build/src/diag/ComponentLogger.js.map +1 -1
  433. package/build/src/diag/consoleLogger.d.ts +6 -1
  434. package/build/src/diag/consoleLogger.js +37 -21
  435. package/build/src/diag/consoleLogger.js.map +1 -1
  436. package/build/src/diag/internal/logLevelLogger.d.ts +2 -1
  437. package/build/src/diag/internal/logLevelLogger.js +1 -12
  438. package/build/src/diag/internal/logLevelLogger.js.map +1 -1
  439. package/build/src/diag/internal/noopLogger.d.ts +1 -1
  440. package/build/src/diag/internal/noopLogger.js +1 -12
  441. package/build/src/diag/internal/noopLogger.js.map +1 -1
  442. package/build/src/diag/types.d.ts +11 -1
  443. package/build/src/diag/types.js +1 -12
  444. package/build/src/diag/types.js.map +1 -1
  445. package/build/src/diag-api.d.ts +2 -0
  446. package/build/src/diag-api.js +3 -12
  447. package/build/src/diag-api.js.map +1 -1
  448. package/build/src/experimental/index.d.ts +5 -1
  449. package/build/src/experimental/index.js +7 -14
  450. package/build/src/experimental/index.js.map +1 -1
  451. package/build/src/experimental/trace/SugaredOptions.d.ts +1 -1
  452. package/build/src/experimental/trace/SugaredOptions.js +1 -12
  453. package/build/src/experimental/trace/SugaredOptions.js.map +1 -1
  454. package/build/src/experimental/trace/SugaredTracer.d.ts +2 -2
  455. package/build/src/experimental/trace/SugaredTracer.js.map +1 -1
  456. package/build/src/index.d.ts +29 -24
  457. package/build/src/index.js +2 -12
  458. package/build/src/index.js.map +1 -1
  459. package/build/src/internal/global-utils.d.ts +5 -5
  460. package/build/src/internal/global-utils.js +10 -14
  461. package/build/src/internal/global-utils.js.map +1 -1
  462. package/build/src/internal/semver.js +1 -12
  463. package/build/src/internal/semver.js.map +1 -1
  464. package/build/src/metrics/Meter.d.ts +5 -1
  465. package/build/src/metrics/Meter.js +1 -12
  466. package/build/src/metrics/Meter.js.map +1 -1
  467. package/build/src/metrics/MeterProvider.d.ts +3 -1
  468. package/build/src/metrics/MeterProvider.js +1 -12
  469. package/build/src/metrics/MeterProvider.js.map +1 -1
  470. package/build/src/metrics/Metric.d.ts +79 -11
  471. package/build/src/metrics/Metric.js +6 -13
  472. package/build/src/metrics/Metric.js.map +1 -1
  473. package/build/src/metrics/NoopMeter.d.ts +4 -2
  474. package/build/src/metrics/NoopMeter.js +3 -12
  475. package/build/src/metrics/NoopMeter.js.map +1 -1
  476. package/build/src/metrics/NoopMeterProvider.d.ts +2 -2
  477. package/build/src/metrics/NoopMeterProvider.js +1 -12
  478. package/build/src/metrics/NoopMeterProvider.js.map +1 -1
  479. package/build/src/metrics-api.d.ts +5 -1
  480. package/build/src/metrics-api.js +6 -13
  481. package/build/src/metrics-api.js.map +1 -1
  482. package/build/src/propagation/NoopTextMapPropagator.d.ts +2 -2
  483. package/build/src/propagation/NoopTextMapPropagator.js +1 -12
  484. package/build/src/propagation/NoopTextMapPropagator.js.map +1 -1
  485. package/build/src/propagation/TextMapPropagator.d.ts +14 -2
  486. package/build/src/propagation/TextMapPropagator.js +7 -12
  487. package/build/src/propagation/TextMapPropagator.js.map +1 -1
  488. package/build/src/propagation-api.d.ts +5 -1
  489. package/build/src/propagation-api.js +6 -13
  490. package/build/src/propagation-api.js.map +1 -1
  491. package/build/src/trace/NonRecordingSpan.d.ts +8 -8
  492. package/build/src/trace/NonRecordingSpan.js +3 -14
  493. package/build/src/trace/NonRecordingSpan.js.map +1 -1
  494. package/build/src/trace/NoopTracer.d.ts +4 -4
  495. package/build/src/trace/NoopTracer.js +6 -13
  496. package/build/src/trace/NoopTracer.js.map +1 -1
  497. package/build/src/trace/NoopTracerProvider.d.ts +3 -3
  498. package/build/src/trace/NoopTracerProvider.js +1 -12
  499. package/build/src/trace/NoopTracerProvider.js.map +1 -1
  500. package/build/src/trace/ProxyTracer.d.ts +14 -9
  501. package/build/src/trace/ProxyTracer.js +5 -14
  502. package/build/src/trace/ProxyTracer.js.map +1 -1
  503. package/build/src/trace/ProxyTracerProvider.d.ts +6 -3
  504. package/build/src/trace/ProxyTracerProvider.js +4 -12
  505. package/build/src/trace/ProxyTracerProvider.js.map +1 -1
  506. package/build/src/trace/Sampler.d.ts +7 -5
  507. package/build/src/trace/Sampler.js +1 -12
  508. package/build/src/trace/Sampler.js.map +1 -1
  509. package/build/src/trace/SamplingResult.d.ts +6 -2
  510. package/build/src/trace/SamplingResult.js +3 -12
  511. package/build/src/trace/SamplingResult.js.map +1 -1
  512. package/build/src/trace/SpanOptions.d.ts +7 -5
  513. package/build/src/trace/SpanOptions.js +1 -12
  514. package/build/src/trace/SpanOptions.js.map +1 -1
  515. package/build/src/trace/attributes.d.ts +5 -3
  516. package/build/src/trace/attributes.js +1 -12
  517. package/build/src/trace/attributes.js.map +1 -1
  518. package/build/src/trace/context-utils.d.ts +3 -3
  519. package/build/src/trace/context-utils.js +1 -12
  520. package/build/src/trace/context-utils.js.map +1 -1
  521. package/build/src/trace/internal/tracestate-impl.d.ts +1 -1
  522. package/build/src/trace/internal/tracestate-impl.js +8 -17
  523. package/build/src/trace/internal/tracestate-impl.js.map +1 -1
  524. package/build/src/trace/internal/tracestate-validators.js +1 -12
  525. package/build/src/trace/internal/tracestate-validators.js.map +1 -1
  526. package/build/src/trace/internal/utils.d.ts +4 -1
  527. package/build/src/trace/internal/utils.js +4 -12
  528. package/build/src/trace/internal/utils.js.map +1 -1
  529. package/build/src/trace/invalid-span-constants.d.ts +10 -1
  530. package/build/src/trace/invalid-span-constants.js +10 -12
  531. package/build/src/trace/invalid-span-constants.js.map +1 -1
  532. package/build/src/trace/link.d.ts +4 -2
  533. package/build/src/trace/link.js +1 -12
  534. package/build/src/trace/link.js.map +1 -1
  535. package/build/src/trace/span.d.ts +22 -10
  536. package/build/src/trace/span.js +1 -12
  537. package/build/src/trace/span.js.map +1 -1
  538. package/build/src/trace/span_context.d.ts +3 -1
  539. package/build/src/trace/span_context.js +1 -12
  540. package/build/src/trace/span_context.js.map +1 -1
  541. package/build/src/trace/span_kind.d.ts +3 -0
  542. package/build/src/trace/span_kind.js +6 -14
  543. package/build/src/trace/span_kind.js.map +1 -1
  544. package/build/src/trace/spancontext-utils.d.ts +10 -2
  545. package/build/src/trace/spancontext-utils.js +33 -16
  546. package/build/src/trace/spancontext-utils.js.map +1 -1
  547. package/build/src/trace/status.d.ts +5 -0
  548. package/build/src/trace/status.js +6 -0
  549. package/build/src/trace/status.js.map +1 -1
  550. package/build/src/trace/trace_flags.d.ts +3 -0
  551. package/build/src/trace/trace_flags.js +4 -12
  552. package/build/src/trace/trace_flags.js.map +1 -1
  553. package/build/src/trace/trace_state.d.ts +3 -0
  554. package/build/src/trace/trace_state.js +1 -12
  555. package/build/src/trace/trace_state.js.map +1 -1
  556. package/build/src/trace/tracer.d.ts +5 -3
  557. package/build/src/trace/tracer.js +1 -12
  558. package/build/src/trace/tracer.js.map +1 -1
  559. package/build/src/trace/tracer_options.d.ts +2 -0
  560. package/build/src/trace/tracer_options.js +1 -12
  561. package/build/src/trace/tracer_options.js.map +1 -1
  562. package/build/src/trace/tracer_provider.d.ts +4 -2
  563. package/build/src/trace/tracer_provider.js +1 -12
  564. package/build/src/trace/tracer_provider.js.map +1 -1
  565. package/build/src/trace-api.d.ts +5 -1
  566. package/build/src/trace-api.js +6 -13
  567. package/build/src/trace-api.js.map +1 -1
  568. package/build/src/version.d.ts +1 -1
  569. package/build/src/version.js +2 -13
  570. package/build/src/version.js.map +1 -1
  571. package/package.json +19 -36
  572. package/build/esm/metrics/ObservableResult.d.ts +0 -31
  573. package/build/esm/metrics/ObservableResult.js +0 -17
  574. package/build/esm/metrics/ObservableResult.js.map +0 -1
  575. package/build/esm/platform/browser/globalThis.d.ts +0 -10
  576. package/build/esm/platform/browser/globalThis.js +0 -35
  577. package/build/esm/platform/browser/globalThis.js.map +0 -1
  578. package/build/esm/platform/browser/index.d.ts +0 -2
  579. package/build/esm/platform/browser/index.js +0 -17
  580. package/build/esm/platform/browser/index.js.map +0 -1
  581. package/build/esm/platform/index.d.ts +0 -2
  582. package/build/esm/platform/index.js +0 -17
  583. package/build/esm/platform/index.js.map +0 -1
  584. package/build/esm/platform/node/globalThis.d.ts +0 -3
  585. package/build/esm/platform/node/globalThis.js +0 -19
  586. package/build/esm/platform/node/globalThis.js.map +0 -1
  587. package/build/esm/platform/node/index.d.ts +0 -2
  588. package/build/esm/platform/node/index.js +0 -17
  589. package/build/esm/platform/node/index.js.map +0 -1
  590. package/build/esnext/metrics/ObservableResult.d.ts +0 -31
  591. package/build/esnext/metrics/ObservableResult.js +0 -17
  592. package/build/esnext/metrics/ObservableResult.js.map +0 -1
  593. package/build/esnext/platform/browser/globalThis.d.ts +0 -10
  594. package/build/esnext/platform/browser/globalThis.js +0 -35
  595. package/build/esnext/platform/browser/globalThis.js.map +0 -1
  596. package/build/esnext/platform/browser/index.d.ts +0 -2
  597. package/build/esnext/platform/browser/index.js +0 -17
  598. package/build/esnext/platform/browser/index.js.map +0 -1
  599. package/build/esnext/platform/index.d.ts +0 -2
  600. package/build/esnext/platform/index.js +0 -17
  601. package/build/esnext/platform/index.js.map +0 -1
  602. package/build/esnext/platform/node/globalThis.d.ts +0 -3
  603. package/build/esnext/platform/node/globalThis.js +0 -19
  604. package/build/esnext/platform/node/globalThis.js.map +0 -1
  605. package/build/esnext/platform/node/index.d.ts +0 -2
  606. package/build/esnext/platform/node/index.js +0 -17
  607. package/build/esnext/platform/node/index.js.map +0 -1
  608. package/build/src/metrics/ObservableResult.d.ts +0 -31
  609. package/build/src/metrics/ObservableResult.js +0 -18
  610. package/build/src/metrics/ObservableResult.js.map +0 -1
  611. package/build/src/platform/browser/globalThis.d.ts +0 -10
  612. package/build/src/platform/browser/globalThis.js +0 -38
  613. package/build/src/platform/browser/globalThis.js.map +0 -1
  614. package/build/src/platform/browser/index.d.ts +0 -2
  615. package/build/src/platform/browser/index.js +0 -29
  616. package/build/src/platform/browser/index.js.map +0 -1
  617. package/build/src/platform/index.d.ts +0 -2
  618. package/build/src/platform/index.js +0 -29
  619. package/build/src/platform/index.js.map +0 -1
  620. package/build/src/platform/node/globalThis.d.ts +0 -3
  621. package/build/src/platform/node/globalThis.js +0 -22
  622. package/build/src/platform/node/globalThis.js.map +0 -1
  623. package/build/src/platform/node/index.d.ts +0 -2
  624. package/build/src/platform/node/index.js +0 -29
  625. package/build/src/platform/node/index.js.map +0 -1
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  function noopLogFunction() { }
17
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"noopLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/noopLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,SAAS,eAAe,KAAI,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DiagLogger } from '../types';\n\nfunction noopLogFunction() {}\n\n/**\n * Returns a No-Op Diagnostic logger where all messages do nothing.\n * @implements {@link DiagLogger}\n * @returns {DiagLogger}\n */\nexport function createNoopDiagLogger(): DiagLogger {\n return {\n verbose: noopLogFunction,\n debug: noopLogFunction,\n info: noopLogFunction,\n warn: noopLogFunction,\n error: noopLogFunction,\n };\n}\n"]}
1
+ {"version":3,"file":"noopLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/noopLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,SAAS,eAAe,KAAI,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DiagLogger } from '../types';\n\nfunction noopLogFunction() {}\n\n/**\n * Returns a No-Op Diagnostic logger where all messages do nothing.\n * @implements {@link DiagLogger}\n * @returns {DiagLogger}\n */\nexport function createNoopDiagLogger(): DiagLogger {\n return {\n verbose: noopLogFunction,\n debug: noopLogFunction,\n info: noopLogFunction,\n warn: noopLogFunction,\n error: noopLogFunction,\n };\n}\n"]}
@@ -1,4 +1,7 @@
1
- export declare type DiagLogFunction = (message: string, ...args: unknown[]) => void;
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ export type DiagLogFunction = (message: string, ...args: unknown[]) => void;
2
5
  /**
3
6
  * Defines an internal diagnostic logger interface which is used to log internal diagnostic
4
7
  * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.
@@ -6,6 +9,8 @@ export declare type DiagLogFunction = (message: string, ...args: unknown[]) => v
6
9
  * - a No-Op {@link createNoopDiagLogger}
7
10
  * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}
8
11
  * - a general Console {@link DiagConsoleLogger} version.
12
+ *
13
+ * @since 1.0.0
9
14
  */
10
15
  export interface DiagLogger {
11
16
  /** Log an error scenario that was not expected and caused the requested operation to fail. */
@@ -63,10 +68,15 @@ export declare enum DiagLogLevel {
63
68
  }
64
69
  /**
65
70
  * Defines options for ComponentLogger
71
+ *
72
+ * @since 1.0.0
66
73
  */
67
74
  export interface ComponentLoggerOptions {
68
75
  namespace: string;
69
76
  }
77
+ /**
78
+ * @since 1.4.1
79
+ */
70
80
  export interface DiagLoggerOptions {
71
81
  /**
72
82
  * The {@link DiagLogLevel} used to filter logs sent to the logger.
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  /**
17
6
  * Defines the available internal logging levels for the diagnostic logger, the numeric values
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA+CH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,KAAZ,YAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\nexport interface DiagLoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoDH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,KAAZ,YAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @since 1.0.0\n */\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n *\n * @since 1.0.0\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n *\n * @since 1.0.0\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\n/**\n * @since 1.4.1\n */\nexport interface DiagLoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]}
@@ -4,6 +4,8 @@ import { DiagAPI } from './api/diag';
4
4
  * Defines Diagnostic handler used for internal diagnostic logging operations.
5
5
  * The default provides a Noop DiagLogger implementation which may be changed via the
6
6
  * diag.setLogger(logger: DiagLogger) function.
7
+ *
8
+ * @since 1.0.0
7
9
  */
8
10
  export declare const diag: DiagAPI;
9
11
  //# sourceMappingURL=diag-api.d.ts.map
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  // Split module-level variable definition into separate files to allow
17
6
  // tree-shaking on each api instance.
@@ -21,6 +10,8 @@ import { DiagAPI } from './api/diag';
21
10
  * Defines Diagnostic handler used for internal diagnostic logging operations.
22
11
  * The default provides a Noop DiagLogger implementation which may be changed via the
23
12
  * diag.setLogger(logger: DiagLogger) function.
13
+ *
14
+ * @since 1.0.0
24
15
  */
25
16
  export const diag = DiagAPI.instance();
26
17
  //# sourceMappingURL=diag-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n */\nexport const diag = DiagAPI.instance();\n"]}
1
+ {"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n *\n * @since 1.0.0\n */\nexport const diag = DiagAPI.instance();\n"]}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Any exports here may change at any time and without warning
3
+ * @module @opentelemetry/api/experimental
4
+ */
1
5
  export { wrapTracer, SugaredTracer } from './trace/SugaredTracer';
2
- export { SugaredSpanOptions } from './trace/SugaredOptions';
6
+ export type { SugaredSpanOptions } from './trace/SugaredOptions';
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,17 +1,10 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * Any exports here may change at any time and without warning
7
+ * @module @opentelemetry/api/experimental
15
8
  */
16
9
  export { wrapTracer, SugaredTracer } from './trace/SugaredTracer';
17
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport { wrapTracer, SugaredTracer } from './trace/SugaredTracer';\nexport { SugaredSpanOptions } from './trace/SugaredOptions';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Any exports here may change at any time and without warning\n * @module @opentelemetry/api/experimental\n */\n\nexport { wrapTracer, SugaredTracer } from './trace/SugaredTracer';\nexport type { SugaredSpanOptions } from './trace/SugaredOptions';\n"]}
@@ -1,4 +1,4 @@
1
- import { Span, SpanOptions } from '../../';
1
+ import type { Span, SpanOptions } from '../../';
2
2
  /**
3
3
  * Options needed for span creation
4
4
  */
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export {};
17
6
  //# sourceMappingURL=SugaredOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SugaredOptions.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Span, SpanOptions } from '../../';\n\n/**\n * Options needed for span creation\n */\nexport interface SugaredSpanOptions extends SpanOptions {\n /**\n * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.\n * @param e Error which triggered this exception\n * @param span current span from context\n */\n onException?: (e: Error, span: Span) => void;\n}\n"]}
1
+ {"version":3,"file":"SugaredOptions.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Span, SpanOptions } from '../../';\n\n/**\n * Options needed for span creation\n */\nexport interface SugaredSpanOptions extends SpanOptions {\n /**\n * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.\n * @param e Error which triggered this exception\n * @param span current span from context\n */\n onException?: (e: Error, span: Span) => void;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { SugaredSpanOptions } from './SugaredOptions';
2
- import { Context, Span, Tracer } from '../../';
1
+ import type { SugaredSpanOptions } from './SugaredOptions';
2
+ import type { Context, Span, Tracer } from '../../';
3
3
  /**
4
4
  * return a new SugaredTracer created from the supplied one
5
5
  * @param tracer
@@ -1,4 +1,4 @@
1
- import { context, SpanStatusCode } from '../../';
1
+ import { context as contextApi, SpanStatusCode } from '../../';
2
2
  const defaultOnException = (e, span) => {
3
3
  span.recordException(e);
4
4
  span.setStatus({
@@ -51,7 +51,7 @@ function massageParams(arg, arg2, arg3) {
51
51
  fn = arg3;
52
52
  }
53
53
  opts = opts !== null && opts !== void 0 ? opts : {};
54
- ctx = ctx !== null && ctx !== void 0 ? ctx : context.active();
54
+ ctx = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
55
55
  return { opts, ctx, fn };
56
56
  }
57
57
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SugaredTracer.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredTracer.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { SugaredSpanOptions } from './SugaredOptions';\nimport { context, Context, Span, SpanStatusCode, Tracer } from '../../';\n\nconst defaultOnException = (e: Error, span: Span) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n });\n};\n\n/**\n * return a new SugaredTracer created from the supplied one\n * @param tracer\n */\nexport function wrapTracer(tracer: Tracer): SugaredTracer {\n return new SugaredTracer(tracer);\n}\n\nexport class SugaredTracer implements Tracer {\n private readonly _tracer: Tracer;\n\n constructor(tracer: Tracer) {\n this._tracer = tracer;\n this.startSpan = tracer.startSpan.bind(this._tracer);\n this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);\n }\n\n startActiveSpan: Tracer['startActiveSpan'];\n startSpan: Tracer['startSpan'];\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally, the new span gets set in context and this context is activated\n * for the duration of the function call.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.withActiveSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withActiveSpan('op', span => {\n * // do some async work\n * });\n */\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n fn: F\n ): ReturnType<F>;\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType<F>;\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType<F>;\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n arg2: F | SugaredSpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType<F> {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) =>\n handleFn(span, opts, fn)\n ) as ReturnType<F>;\n }\n\n /**\n * Starts a new {@link Span} and ends it after execution of fn without setting it on context.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is et to ERROR and rethrown.\n *\n * This method does NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns Span The newly created span\n * @example\n * const something = tracer.withSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withSpan('op', span => {\n * // do some async work\n * });\n */\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n arg2: SugaredSpanOptions | F,\n arg3?: Context | F,\n arg4?: F\n ): ReturnType<F> {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n const span = this._tracer.startSpan(name, opts, ctx);\n return handleFn(span, opts, fn) as ReturnType<F>;\n }\n}\n\n/**\n * Massages parameters of withSpan and withActiveSpan to allow signature overwrites\n * @param arg\n * @param arg2\n * @param arg3\n */\nfunction massageParams<F extends (span: Span) => ReturnType<F>>(\n arg: F | SugaredSpanOptions,\n arg2?: F | Context,\n arg3?: F\n) {\n let opts: SugaredSpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (!arg2 && !arg3) {\n fn = arg as F;\n } else if (!arg3) {\n opts = arg as SugaredSpanOptions;\n fn = arg2 as F;\n } else {\n opts = arg as SugaredSpanOptions;\n ctx = arg2 as Context;\n fn = arg3 as F;\n }\n opts = opts ?? {};\n ctx = ctx ?? context.active();\n\n return { opts, ctx, fn };\n}\n\n/**\n * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling\n * @param span\n * @param opts\n * @param fn\n */\nfunction handleFn<F extends (span: Span) => ReturnType<F>>(\n span: Span,\n opts: SugaredSpanOptions,\n fn: F\n): ReturnType<F> {\n const onException = opts.onException ?? defaultOnException;\n const errorHandler = (e: Error) => {\n onException(e, span);\n span.end();\n throw e;\n };\n\n try {\n const ret = fn(span) as Promise<ReturnType<F>>;\n // if fn is an async function, attach a recordException and spanEnd callback to the promise\n if (typeof ret?.then === 'function') {\n return ret.then(val => {\n span.end();\n return val;\n }, errorHandler) as ReturnType<F>;\n }\n span.end();\n return ret as ReturnType<F>;\n } catch (e) {\n // add throw to signal the compiler that this will throw in the inner scope\n throw errorHandler(e);\n }\n}\n"]}
1
+ {"version":3,"file":"SugaredTracer.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredTracer.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { SugaredSpanOptions } from './SugaredOptions';\nimport type { Context, Span, Tracer } from '../../';\nimport { context as contextApi, SpanStatusCode } from '../../';\n\nconst defaultOnException = (e: Error, span: Span) => {\n span.recordException(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n });\n};\n\n/**\n * return a new SugaredTracer created from the supplied one\n * @param tracer\n */\nexport function wrapTracer(tracer: Tracer): SugaredTracer {\n return new SugaredTracer(tracer);\n}\n\nexport class SugaredTracer implements Tracer {\n private readonly _tracer: Tracer;\n\n constructor(tracer: Tracer) {\n this._tracer = tracer;\n this.startSpan = tracer.startSpan.bind(this._tracer);\n this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);\n }\n\n startActiveSpan: Tracer['startActiveSpan'];\n startSpan: Tracer['startSpan'];\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally, the new span gets set in context and this context is activated\n * for the duration of the function call.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.withActiveSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withActiveSpan('op', span => {\n * // do some async work\n * });\n */\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n fn: F\n ): ReturnType<F>;\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType<F>;\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType<F>;\n withActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n arg2: F | SugaredSpanOptions,\n arg3?: F | Context,\n arg4?: F\n ): ReturnType<F> {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) =>\n handleFn(span, opts, fn)\n ) as ReturnType<F>;\n }\n\n /**\n * Starts a new {@link Span} and ends it after execution of fn without setting it on context.\n * The span will be closed after the function has executed.\n * If an exception occurs, it is recorded, the status is et to ERROR and rethrown.\n *\n * This method does NOT modify the current Context.\n *\n * @param name The name of the span\n * @param [options] SugaredSpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns Span The newly created span\n * @example\n * const something = tracer.withSpan('op', span => {\n * // do some work\n * });\n * @example\n * const something = await tracer.withSpan('op', span => {\n * // do some async work\n * });\n */\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n options: SugaredSpanOptions,\n context: Context,\n fn: F\n ): ReturnType<F>;\n withSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n arg2: SugaredSpanOptions | F,\n arg3?: Context | F,\n arg4?: F\n ): ReturnType<F> {\n const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);\n\n const span = this._tracer.startSpan(name, opts, ctx);\n return handleFn(span, opts, fn) as ReturnType<F>;\n }\n}\n\n/**\n * Massages parameters of withSpan and withActiveSpan to allow signature overwrites\n * @param arg\n * @param arg2\n * @param arg3\n */\nfunction massageParams<F extends (span: Span) => ReturnType<F>>(\n arg: F | SugaredSpanOptions,\n arg2?: F | Context,\n arg3?: F\n) {\n let opts: SugaredSpanOptions | undefined;\n let ctx: Context | undefined;\n let fn: F;\n\n if (!arg2 && !arg3) {\n fn = arg as F;\n } else if (!arg3) {\n opts = arg as SugaredSpanOptions;\n fn = arg2 as F;\n } else {\n opts = arg as SugaredSpanOptions;\n ctx = arg2 as Context;\n fn = arg3 as F;\n }\n opts = opts ?? {};\n ctx = ctx ?? contextApi.active();\n\n return { opts, ctx, fn };\n}\n\n/**\n * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling\n * @param span\n * @param opts\n * @param fn\n */\nfunction handleFn<F extends (span: Span) => ReturnType<F>>(\n span: Span,\n opts: SugaredSpanOptions,\n fn: F\n): ReturnType<F> {\n const onException = opts.onException ?? defaultOnException;\n const errorHandler = (e: Error) => {\n onException(e, span);\n span.end();\n throw e;\n };\n\n try {\n const ret = fn(span) as Promise<ReturnType<F>>;\n // if fn is an async function, attach a recordException and spanEnd callback to the promise\n if (typeof ret?.then === 'function') {\n return ret.then(val => {\n span.end();\n return val;\n }, errorHandler) as ReturnType<F>;\n }\n span.end();\n return ret as ReturnType<F>;\n } catch (e) {\n // add throw to signal the compiler that this will throw in the inner scope\n throw errorHandler(e);\n }\n}\n"]}
@@ -1,39 +1,44 @@
1
- export { BaggageEntry, BaggageEntryMetadata, Baggage } from './baggage/types';
1
+ /**
2
+ * @module @opentelemetry/api
3
+ */
4
+ export type { BaggageEntry, BaggageEntryMetadata, Baggage, } from './baggage/types';
2
5
  export { baggageEntryMetadataFromString } from './baggage/utils';
3
- export { Exception } from './common/Exception';
4
- export { HrTime, TimeInput } from './common/Time';
5
- export { Attributes, AttributeValue } from './common/Attributes';
6
+ export type { Exception } from './common/Exception';
7
+ export type { HrTime, TimeInput } from './common/Time';
8
+ export type { Attributes, AttributeValue } from './common/Attributes';
6
9
  export { createContextKey, ROOT_CONTEXT } from './context/context';
7
- export { Context, ContextManager } from './context/types';
10
+ export type { Context, ContextManager } from './context/types';
8
11
  export type { ContextAPI } from './api/context';
9
12
  export { DiagConsoleLogger } from './diag/consoleLogger';
10
- export { DiagLogFunction, DiagLogger, DiagLogLevel, ComponentLoggerOptions, DiagLoggerOptions, } from './diag/types';
13
+ export { DiagLogLevel } from './diag/types';
14
+ export type { DiagLogFunction, DiagLogger, ComponentLoggerOptions, DiagLoggerOptions, } from './diag/types';
11
15
  export type { DiagAPI } from './api/diag';
12
16
  export { createNoopMeter } from './metrics/NoopMeter';
13
- export { MeterOptions, Meter } from './metrics/Meter';
14
- export { MeterProvider } from './metrics/MeterProvider';
15
- export { ValueType, Counter, Gauge, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, BatchObservableCallback, MetricAdvice, MetricAttributes, MetricAttributeValue, ObservableCallback, } from './metrics/Metric';
16
- export { BatchObservableResult, ObservableResult, } from './metrics/ObservableResult';
17
+ export type { MeterOptions, Meter } from './metrics/Meter';
18
+ export type { MeterProvider } from './metrics/MeterProvider';
19
+ export { ValueType } from './metrics/Metric';
20
+ export type { Counter, Gauge, Histogram, MetricOptions, UpDownCounter, MetricAdvice, MetricAttributes, MetricAttributeValue, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, BatchObservableCallback, ObservableCallback, BatchObservableResult, ObservableResult, } from './metrics/Metric';
17
21
  export type { MetricsAPI } from './api/metrics';
18
- export { TextMapPropagator, TextMapSetter, TextMapGetter, defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
22
+ export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
23
+ export type { TextMapPropagator, TextMapSetter, TextMapGetter, } from './propagation/TextMapPropagator';
19
24
  export type { PropagationAPI } from './api/propagation';
20
- export { SpanAttributes, SpanAttributeValue } from './trace/attributes';
21
- export { Link } from './trace/link';
22
- export { ProxyTracer, TracerDelegator } from './trace/ProxyTracer';
25
+ export type { SpanAttributes, SpanAttributeValue } from './trace/attributes';
26
+ export type { Link } from './trace/link';
27
+ export { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer';
23
28
  export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
24
- export { Sampler } from './trace/Sampler';
25
- export { SamplingDecision, SamplingResult } from './trace/SamplingResult';
26
- export { SpanContext } from './trace/span_context';
29
+ export type { Sampler } from './trace/Sampler';
30
+ export { SamplingDecision, type SamplingResult } from './trace/SamplingResult';
31
+ export type { SpanContext } from './trace/span_context';
27
32
  export { SpanKind } from './trace/span_kind';
28
- export { Span } from './trace/span';
29
- export { SpanOptions } from './trace/SpanOptions';
30
- export { SpanStatus, SpanStatusCode } from './trace/status';
33
+ export type { Span } from './trace/span';
34
+ export type { SpanOptions } from './trace/SpanOptions';
35
+ export { type SpanStatus, SpanStatusCode } from './trace/status';
31
36
  export { TraceFlags } from './trace/trace_flags';
32
- export { TraceState } from './trace/trace_state';
37
+ export type { TraceState } from './trace/trace_state';
33
38
  export { createTraceState } from './trace/internal/utils';
34
- export { TracerProvider } from './trace/tracer_provider';
35
- export { Tracer } from './trace/tracer';
36
- export { TracerOptions } from './trace/tracer_options';
39
+ export type { TracerProvider } from './trace/tracer_provider';
40
+ export type { Tracer } from './trace/tracer';
41
+ export type { TracerOptions } from './trace/tracer_options';
37
42
  export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils';
38
43
  export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants';
39
44
  export type { TraceAPI } from './api/trace';
@@ -1,30 +1,20 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export { baggageEntryMetadataFromString } from './baggage/utils';
17
6
  // Context APIs
18
7
  export { createContextKey, ROOT_CONTEXT } from './context/context';
19
8
  // Diag APIs
20
9
  export { DiagConsoleLogger } from './diag/consoleLogger';
21
- export { DiagLogLevel, } from './diag/types';
10
+ export { DiagLogLevel } from './diag/types';
22
11
  // Metrics APIs
23
12
  export { createNoopMeter } from './metrics/NoopMeter';
24
- export { ValueType, } from './metrics/Metric';
13
+ export { ValueType } from './metrics/Metric';
25
14
  // Propagation APIs
26
15
  export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
27
16
  export { ProxyTracer } from './trace/ProxyTracer';
17
+ // TODO: Remove ProxyTracerProvider export in the next major version.
28
18
  export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
29
19
  export { SamplingDecision } from './trace/SamplingResult';
30
20
  export { SpanKind } from './trace/span_kind';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAKjE,eAAe;AACf,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAInE,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAGL,YAAY,GAGb,MAAM,cAAc,CAAC;AAGtB,eAAe;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EACL,SAAS,GAeV,MAAM,kBAAkB,CAAC;AAO1B,mBAAmB;AACnB,OAAO,EAIL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,WAAW,EAAmB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAc,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAGxC,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACtD,kBAAkB;AAClB,eAAe;IACb,OAAO;IACP,IAAI;IACJ,OAAO;IACP,WAAW;IACX,KAAK;CACN,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { BaggageEntry, BaggageEntryMetadata, Baggage } from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport { Exception } from './common/Exception';\nexport { HrTime, TimeInput } from './common/Time';\nexport { Attributes, AttributeValue } from './common/Attributes';\n\n// Context APIs\nexport { createContextKey, ROOT_CONTEXT } from './context/context';\nexport { Context, ContextManager } from './context/types';\nexport type { ContextAPI } from './api/context';\n\n// Diag APIs\nexport { DiagConsoleLogger } from './diag/consoleLogger';\nexport {\n DiagLogFunction,\n DiagLogger,\n DiagLogLevel,\n ComponentLoggerOptions,\n DiagLoggerOptions,\n} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport { createNoopMeter } from './metrics/NoopMeter';\nexport { MeterOptions, Meter } from './metrics/Meter';\nexport { MeterProvider } from './metrics/MeterProvider';\nexport {\n ValueType,\n Counter,\n Gauge,\n Histogram,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n BatchObservableCallback,\n MetricAdvice,\n MetricAttributes,\n MetricAttributeValue,\n ObservableCallback,\n} from './metrics/Metric';\nexport {\n BatchObservableResult,\n ObservableResult,\n} from './metrics/ObservableResult';\nexport type { MetricsAPI } from './api/metrics';\n\n// Propagation APIs\nexport {\n TextMapPropagator,\n TextMapSetter,\n TextMapGetter,\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from './propagation/TextMapPropagator';\nexport type { PropagationAPI } from './api/propagation';\n\n// Trace APIs\nexport { SpanAttributes, SpanAttributeValue } from './trace/attributes';\nexport { Link } from './trace/link';\nexport { ProxyTracer, TracerDelegator } from './trace/ProxyTracer';\nexport { ProxyTracerProvider } from './trace/ProxyTracerProvider';\nexport { Sampler } from './trace/Sampler';\nexport { SamplingDecision, SamplingResult } from './trace/SamplingResult';\nexport { SpanContext } from './trace/span_context';\nexport { SpanKind } from './trace/span_kind';\nexport { Span } from './trace/span';\nexport { SpanOptions } from './trace/SpanOptions';\nexport { SpanStatus, SpanStatusCode } from './trace/status';\nexport { TraceFlags } from './trace/trace_flags';\nexport { TraceState } from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport { TracerProvider } from './trace/tracer_provider';\nexport { Tracer } from './trace/tracer';\nexport { TracerOptions } from './trace/tracer_options';\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\nexport type { TraceAPI } from './api/trace';\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { context } from './context-api';\nimport { diag } from './diag-api';\nimport { metrics } from './metrics-api';\nimport { propagation } from './propagation-api';\nimport { trace } from './trace-api';\n\n// Named export.\nexport { context, diag, metrics, propagation, trace };\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAKjE,eAAe;AACf,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAInE,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5C,eAAe;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAqB7C,mBAAmB;AACnB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAAE,WAAW,EAAwB,MAAM,qBAAqB,CAAC;AACxE,qEAAqE;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAmB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAGxC,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACtD,kBAAkB;AAClB,eAAe;IACb,OAAO;IACP,IAAI;IACJ,OAAO;IACP,WAAW;IACX,KAAK;CACN,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @module @opentelemetry/api\n */\n\nexport type {\n BaggageEntry,\n BaggageEntryMetadata,\n Baggage,\n} from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport type { Exception } from './common/Exception';\nexport type { HrTime, TimeInput } from './common/Time';\nexport type { Attributes, AttributeValue } from './common/Attributes';\n\n// Context APIs\nexport { createContextKey, ROOT_CONTEXT } from './context/context';\nexport type { Context, ContextManager } from './context/types';\nexport type { ContextAPI } from './api/context';\n\n// Diag APIs\nexport { DiagConsoleLogger } from './diag/consoleLogger';\nexport { DiagLogLevel } from './diag/types';\nexport type {\n DiagLogFunction,\n DiagLogger,\n ComponentLoggerOptions,\n DiagLoggerOptions,\n} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport { createNoopMeter } from './metrics/NoopMeter';\nexport type { MeterOptions, Meter } from './metrics/Meter';\nexport type { MeterProvider } from './metrics/MeterProvider';\nexport { ValueType } from './metrics/Metric';\nexport type {\n Counter,\n Gauge,\n Histogram,\n MetricOptions,\n UpDownCounter,\n MetricAdvice,\n MetricAttributes,\n MetricAttributeValue,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n BatchObservableCallback,\n ObservableCallback,\n BatchObservableResult,\n ObservableResult,\n} from './metrics/Metric';\nexport type { MetricsAPI } from './api/metrics';\n\n// Propagation APIs\nexport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from './propagation/TextMapPropagator';\nexport type {\n TextMapPropagator,\n TextMapSetter,\n TextMapGetter,\n} from './propagation/TextMapPropagator';\nexport type { PropagationAPI } from './api/propagation';\n\n// Trace APIs\nexport type { SpanAttributes, SpanAttributeValue } from './trace/attributes';\nexport type { Link } from './trace/link';\nexport { ProxyTracer, type TracerDelegator } from './trace/ProxyTracer';\n// TODO: Remove ProxyTracerProvider export in the next major version.\nexport { ProxyTracerProvider } from './trace/ProxyTracerProvider';\nexport type { Sampler } from './trace/Sampler';\nexport { SamplingDecision, type SamplingResult } from './trace/SamplingResult';\nexport type { SpanContext } from './trace/span_context';\nexport { SpanKind } from './trace/span_kind';\nexport type { Span } from './trace/span';\nexport type { SpanOptions } from './trace/SpanOptions';\nexport { type SpanStatus, SpanStatusCode } from './trace/status';\nexport { TraceFlags } from './trace/trace_flags';\nexport type { TraceState } from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport type { TracerProvider } from './trace/tracer_provider';\nexport type { Tracer } from './trace/tracer';\nexport type { TracerOptions } from './trace/tracer_options';\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\nexport type { TraceAPI } from './api/trace';\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { context } from './context-api';\nimport { diag } from './diag-api';\nimport { metrics } from './metrics-api';\nimport { propagation } from './propagation-api';\nimport { trace } from './trace-api';\n\n// Named export.\nexport { context, diag, metrics, propagation, trace };\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]}
@@ -1,12 +1,12 @@
1
- import { MeterProvider } from '../metrics/MeterProvider';
2
- import { ContextManager } from '../context/types';
3
- import { DiagLogger } from '../diag/types';
4
- import { TextMapPropagator } from '../propagation/TextMapPropagator';
1
+ import type { MeterProvider } from '../metrics/MeterProvider';
2
+ import type { ContextManager } from '../context/types';
3
+ import type { DiagLogger } from '../diag/types';
4
+ import type { TextMapPropagator } from '../propagation/TextMapPropagator';
5
5
  import type { TracerProvider } from '../trace/tracer_provider';
6
6
  export declare function registerGlobal<Type extends keyof OTelGlobalAPI>(type: Type, instance: OTelGlobalAPI[Type], diag: DiagLogger, allowOverride?: boolean): boolean;
7
7
  export declare function getGlobal<Type extends keyof OTelGlobalAPI>(type: Type): OTelGlobalAPI[Type] | undefined;
8
8
  export declare function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger): void;
9
- declare type OTelGlobalAPI = {
9
+ type OTelGlobalAPI = {
10
10
  version: string;
11
11
  diag?: DiagLogger;
12
12
  trace?: TracerProvider;
@@ -1,24 +1,20 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
- import { _globalThis } from '../platform';
17
5
  import { VERSION } from '../version';
18
6
  import { isCompatible } from './semver';
19
7
  const major = VERSION.split('.')[0];
20
8
  const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
21
- const _global = _globalThis;
9
+ const _global = (typeof globalThis === 'object'
10
+ ? globalThis
11
+ : typeof self === 'object'
12
+ ? self
13
+ : typeof window === 'object'
14
+ ? window
15
+ : typeof global === 'object'
16
+ ? global
17
+ : {});
22
18
  export function registerGlobal(type, instance, diag, allowOverride = false) {
23
19
  var _a;
24
20
  const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
@@ -1 +1 @@
1
- {"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,wBAAwB,KAAK,EAAE,CAChC,CAAC;AAEF,MAAM,OAAO,GAAG,WAAyB,CAAC;AAE1C,MAAM,UAAU,cAAc,CAC5B,IAAU,EACV,QAA6B,EAC7B,IAAgB,EAChB,aAAa,GAAG,KAAK;;IAErB,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,MAAA,OAAO,CAC1D,4BAA4B,CAC7B,mCAAI;QACH,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE;QAC/B,yCAAyC;QACzC,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,gEAAgE,IAAI,EAAE,CACvE,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE;QAC3B,0DAA0D;QAC1D,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,gDAAgD,GAAG,CAAC,OAAO,QAAQ,IAAI,8CAA8C,OAAO,EAAE,CAC/H,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACrB,IAAI,CAAC,KAAK,CACR,+CAA+C,IAAI,KAAK,OAAO,GAAG,CACnE,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,IAAU;;IAEV,MAAM,aAAa,GAAG,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAE,OAAO,CAAC;IACrE,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QAClD,OAAO;KACR;IACD,OAAO,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,kDAAkD,IAAI,KAAK,OAAO,GAAG,CACtE,CAAC;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MeterProvider } from '../metrics/MeterProvider';\nimport { ContextManager } from '../context/types';\nimport { DiagLogger } from '../diag/types';\nimport { _globalThis } from '../platform';\nimport { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\nconst _global = _globalThis as OTelGlobal;\n\nexport function registerGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n `@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]}
1
+ {"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,wBAAwB,KAAK,EAAE,CAChC,CAAC;AAMF,MAAM,OAAO,GAAG,CACd,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QACxB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC1B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,EAAE,CACC,CAAC;AAEhB,MAAM,UAAU,cAAc,CAC5B,IAAU,EACV,QAA6B,EAC7B,IAAgB,EAChB,aAAa,GAAG,KAAK;;IAErB,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,MAAA,OAAO,CAC1D,4BAA4B,CAC7B,mCAAI;QACH,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE;QAC/B,yCAAyC;QACzC,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,gEAAgE,IAAI,EAAE,CACvE,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE;QAC3B,0DAA0D;QAC1D,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,gDAAgD,GAAG,CAAC,OAAO,QAAQ,IAAI,8CAA8C,OAAO,EAAE,CAC/H,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACrB,IAAI,CAAC,KAAK,CACR,+CAA+C,IAAI,KAAK,OAAO,GAAG,CACnE,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,IAAU;;IAEV,MAAM,aAAa,GAAG,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAE,OAAO,CAAC;IACrE,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QAClD,OAAO;KACR;IACD,OAAO,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,kDAAkD,IAAI,KAAK,OAAO,GAAG,CACtE,CAAC;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { MeterProvider } from '../metrics/MeterProvider';\nimport type { ContextManager } from '../context/types';\nimport type { DiagLogger } from '../diag/types';\nimport type { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\ndeclare const self: unknown;\ndeclare const window: unknown;\ndeclare const global: unknown;\n\nconst _global = (\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : {}\n) as OTelGlobal;\n\nexport function registerGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n `@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import { VERSION } from '../version';
17
6
  const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
@@ -1 +1 @@
1
- {"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set<string>([ownVersion]);\n const rejectedVersions = new Set<string>();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]}
1
+ {"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set<string>([ownVersion]);\n const rejectedVersions = new Set<string>();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]}
@@ -1,6 +1,8 @@
1
- import { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric';
1
+ import type { BatchObservableCallback, Counter, Gauge, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric';
2
2
  /**
3
3
  * An interface describes additional metadata of a meter.
4
+ *
5
+ * @since 1.3.0
4
6
  */
5
7
  export interface MeterOptions {
6
8
  /**
@@ -14,6 +16,8 @@ export interface MeterOptions {
14
16
  * {@link Metric}s are used for recording pre-defined aggregation (`Counter`),
15
17
  * or raw values (`Histogram`) in which the aggregation and attributes
16
18
  * for the exported metric are deferred.
19
+ *
20
+ * @since 1.3.0
17
21
  */
18
22
  export interface Meter {
19
23
  /**