@opentelemetry/api 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/build/esm/index.d.ts +1 -1
  2. package/build/esm/index.js.map +1 -1
  3. package/build/esm/metrics/Metric.d.ts +16 -0
  4. package/build/esm/metrics/Metric.js.map +1 -1
  5. package/build/esm/version.d.ts +1 -1
  6. package/build/esm/version.js +1 -1
  7. package/build/esm/version.js.map +1 -1
  8. package/build/esnext/api/context.d.ts +41 -0
  9. package/build/esnext/api/context.js +77 -0
  10. package/build/esnext/api/context.js.map +1 -0
  11. package/build/esnext/api/diag.d.ts +30 -0
  12. package/build/esnext/api/diag.js +89 -0
  13. package/build/esnext/api/diag.js.map +1 -0
  14. package/build/esnext/api/metrics.d.ts +28 -0
  15. package/build/esnext/api/metrics.js +57 -0
  16. package/build/esnext/api/metrics.js.map +1 -0
  17. package/build/esnext/api/propagation.d.ts +49 -0
  18. package/build/esnext/api/propagation.js +85 -0
  19. package/build/esnext/api/propagation.js.map +1 -0
  20. package/build/esnext/api/trace.d.ts +40 -0
  21. package/build/esnext/api/trace.js +75 -0
  22. package/build/esnext/api/trace.js.map +1 -0
  23. package/build/esnext/baggage/context-helpers.d.ts +29 -0
  24. package/build/esnext/baggage/context-helpers.js +56 -0
  25. package/build/esnext/baggage/context-helpers.js.map +1 -0
  26. package/build/esnext/baggage/internal/baggage-impl.d.ts +12 -0
  27. package/build/esnext/baggage/internal/baggage-impl.js +51 -0
  28. package/build/esnext/baggage/internal/baggage-impl.js.map +1 -0
  29. package/build/esnext/baggage/internal/symbol.d.ts +5 -0
  30. package/build/esnext/baggage/internal/symbol.js +20 -0
  31. package/build/esnext/baggage/internal/symbol.js.map +1 -0
  32. package/build/esnext/baggage/types.d.ts +60 -0
  33. package/build/esnext/baggage/types.js +17 -0
  34. package/build/esnext/baggage/types.js.map +1 -0
  35. package/build/esnext/baggage/utils.d.ts +15 -0
  36. package/build/esnext/baggage/utils.js +46 -0
  37. package/build/esnext/baggage/utils.js.map +1 -0
  38. package/build/esnext/common/Attributes.d.ts +15 -0
  39. package/build/esnext/common/Attributes.js +17 -0
  40. package/build/esnext/common/Attributes.js.map +1 -0
  41. package/build/esnext/common/Exception.d.ts +26 -0
  42. package/build/esnext/common/Exception.js +17 -0
  43. package/build/esnext/common/Exception.js.map +1 -0
  44. package/build/esnext/common/Time.d.ts +20 -0
  45. package/build/esnext/common/Time.js +2 -0
  46. package/build/esnext/common/Time.js.map +1 -0
  47. package/build/esnext/context/NoopContextManager.d.ts +9 -0
  48. package/build/esnext/context/NoopContextManager.js +34 -0
  49. package/build/esnext/context/NoopContextManager.js.map +1 -0
  50. package/build/esnext/context/context.d.ts +6 -0
  51. package/build/esnext/context/context.js +51 -0
  52. package/build/esnext/context/context.js.map +1 -0
  53. package/build/esnext/context/types.d.ts +52 -0
  54. package/build/esnext/context/types.js +17 -0
  55. package/build/esnext/context/types.js.map +1 -0
  56. package/build/esnext/context-api.d.ts +4 -0
  57. package/build/esnext/context-api.js +21 -0
  58. package/build/esnext/context-api.js.map +1 -0
  59. package/build/esnext/diag/ComponentLogger.d.ts +20 -0
  60. package/build/esnext/diag/ComponentLogger.js +55 -0
  61. package/build/esnext/diag/ComponentLogger.js.map +1 -0
  62. package/build/esnext/diag/consoleLogger.d.ts +38 -0
  63. package/build/esnext/diag/consoleLogger.js +53 -0
  64. package/build/esnext/diag/consoleLogger.js.map +1 -0
  65. package/build/esnext/diag/internal/logLevelLogger.d.ts +3 -0
  66. package/build/esnext/diag/internal/logLevelLogger.js +41 -0
  67. package/build/esnext/diag/internal/logLevelLogger.js.map +1 -0
  68. package/build/esnext/diag/internal/noopLogger.d.ts +8 -0
  69. package/build/esnext/diag/internal/noopLogger.js +31 -0
  70. package/build/esnext/diag/internal/noopLogger.js.map +1 -0
  71. package/build/esnext/diag/types.d.ts +100 -0
  72. package/build/esnext/diag/types.js +41 -0
  73. package/build/esnext/diag/types.js.map +1 -0
  74. package/build/esnext/diag-api.d.ts +9 -0
  75. package/build/esnext/diag-api.js +26 -0
  76. package/build/esnext/diag-api.js.map +1 -0
  77. package/build/esnext/index.d.ts +54 -0
  78. package/build/esnext/index.js +53 -0
  79. package/build/esnext/index.js.map +1 -0
  80. package/build/esnext/internal/global-utils.d.ts +18 -0
  81. package/build/esnext/internal/global-utils.js +58 -0
  82. package/build/esnext/internal/global-utils.js.map +1 -0
  83. package/build/esnext/internal/semver.d.ts +34 -0
  84. package/build/esnext/internal/semver.js +118 -0
  85. package/build/esnext/internal/semver.js.map +1 -0
  86. package/build/esnext/metrics/Meter.d.ts +104 -0
  87. package/build/esnext/metrics/Meter.js +17 -0
  88. package/build/esnext/metrics/Meter.js.map +1 -0
  89. package/build/esnext/metrics/MeterProvider.d.ts +17 -0
  90. package/build/esnext/metrics/MeterProvider.js +17 -0
  91. package/build/esnext/metrics/MeterProvider.js.map +1 -0
  92. package/build/esnext/metrics/Metric.d.ts +109 -0
  93. package/build/esnext/metrics/Metric.js +22 -0
  94. package/build/esnext/metrics/Metric.js.map +1 -0
  95. package/build/esnext/metrics/NoopMeter.d.ts +74 -0
  96. package/build/esnext/metrics/NoopMeter.js +103 -0
  97. package/build/esnext/metrics/NoopMeter.js.map +1 -0
  98. package/build/esnext/metrics/NoopMeterProvider.d.ts +11 -0
  99. package/build/esnext/metrics/NoopMeterProvider.js +27 -0
  100. package/build/esnext/metrics/NoopMeterProvider.js.map +1 -0
  101. package/build/esnext/metrics/ObservableResult.d.ts +31 -0
  102. package/build/esnext/metrics/ObservableResult.js +17 -0
  103. package/build/esnext/metrics/ObservableResult.js.map +1 -0
  104. package/build/esnext/metrics-api.d.ts +4 -0
  105. package/build/esnext/metrics-api.js +21 -0
  106. package/build/esnext/metrics-api.js.map +1 -0
  107. package/build/esnext/platform/browser/globalThis.d.ts +10 -0
  108. package/build/esnext/platform/browser/globalThis.js +35 -0
  109. package/build/esnext/platform/browser/globalThis.js.map +1 -0
  110. package/build/esnext/platform/browser/index.d.ts +2 -0
  111. package/build/esnext/platform/browser/index.js +17 -0
  112. package/build/esnext/platform/browser/index.js.map +1 -0
  113. package/build/esnext/platform/index.d.ts +2 -0
  114. package/build/esnext/platform/index.js +17 -0
  115. package/build/esnext/platform/index.js.map +1 -0
  116. package/build/esnext/platform/node/globalThis.d.ts +3 -0
  117. package/build/esnext/platform/node/globalThis.js +19 -0
  118. package/build/esnext/platform/node/globalThis.js.map +1 -0
  119. package/build/esnext/platform/node/index.d.ts +2 -0
  120. package/build/esnext/platform/node/index.js +17 -0
  121. package/build/esnext/platform/node/index.js.map +1 -0
  122. package/build/esnext/propagation/NoopTextMapPropagator.d.ts +13 -0
  123. package/build/esnext/propagation/NoopTextMapPropagator.js +30 -0
  124. package/build/esnext/propagation/NoopTextMapPropagator.js.map +1 -0
  125. package/build/esnext/propagation/TextMapPropagator.d.ts +84 -0
  126. package/build/esnext/propagation/TextMapPropagator.js +38 -0
  127. package/build/esnext/propagation/TextMapPropagator.js.map +1 -0
  128. package/build/esnext/propagation-api.d.ts +4 -0
  129. package/build/esnext/propagation-api.js +21 -0
  130. package/build/esnext/propagation-api.js.map +1 -0
  131. package/build/esnext/trace/NonRecordingSpan.d.ts +25 -0
  132. package/build/esnext/trace/NonRecordingSpan.js +59 -0
  133. package/build/esnext/trace/NonRecordingSpan.js.map +1 -0
  134. package/build/esnext/trace/NoopTracer.d.ts +14 -0
  135. package/build/esnext/trace/NoopTracer.js +71 -0
  136. package/build/esnext/trace/NoopTracer.js.map +1 -0
  137. package/build/esnext/trace/NoopTracerProvider.d.ts +13 -0
  138. package/build/esnext/trace/NoopTracerProvider.js +28 -0
  139. package/build/esnext/trace/NoopTracerProvider.js.map +1 -0
  140. package/build/esnext/trace/ProxyTracer.d.ts +27 -0
  141. package/build/esnext/trace/ProxyTracer.js +51 -0
  142. package/build/esnext/trace/ProxyTracer.js.map +1 -0
  143. package/build/esnext/trace/ProxyTracerProvider.d.ts +25 -0
  144. package/build/esnext/trace/ProxyTracerProvider.js +50 -0
  145. package/build/esnext/trace/ProxyTracerProvider.js.map +1 -0
  146. package/build/esnext/trace/Sampler.d.ts +31 -0
  147. package/build/esnext/trace/Sampler.js +17 -0
  148. package/build/esnext/trace/Sampler.js.map +1 -0
  149. package/build/esnext/trace/SamplingResult.d.ts +49 -0
  150. package/build/esnext/trace/SamplingResult.js +39 -0
  151. package/build/esnext/trace/SamplingResult.js.map +1 -0
  152. package/build/esnext/trace/SpanOptions.d.ts +23 -0
  153. package/build/esnext/trace/SpanOptions.js +17 -0
  154. package/build/esnext/trace/SpanOptions.js.map +1 -0
  155. package/build/esnext/trace/attributes.d.ts +10 -0
  156. package/build/esnext/trace/attributes.js +17 -0
  157. package/build/esnext/trace/attributes.js.map +1 -0
  158. package/build/esnext/trace/context-utils.d.ts +41 -0
  159. package/build/esnext/trace/context-utils.js +73 -0
  160. package/build/esnext/trace/context-utils.js.map +1 -0
  161. package/build/esnext/trace/internal/tracestate-impl.d.ts +22 -0
  162. package/build/esnext/trace/internal/tracestate-impl.js +99 -0
  163. package/build/esnext/trace/internal/tracestate-impl.js.map +1 -0
  164. package/build/esnext/trace/internal/tracestate-validators.d.ts +15 -0
  165. package/build/esnext/trace/internal/tracestate-validators.js +41 -0
  166. package/build/esnext/trace/internal/tracestate-validators.js.map +1 -0
  167. package/build/esnext/trace/internal/utils.d.ts +3 -0
  168. package/build/esnext/trace/internal/utils.js +20 -0
  169. package/build/esnext/trace/internal/utils.js.map +1 -0
  170. package/build/esnext/trace/invalid-span-constants.d.ts +5 -0
  171. package/build/esnext/trace/invalid-span-constants.js +24 -0
  172. package/build/esnext/trace/invalid-span-constants.js.map +1 -0
  173. package/build/esnext/trace/link.d.ts +26 -0
  174. package/build/esnext/trace/link.js +17 -0
  175. package/build/esnext/trace/link.js.map +1 -0
  176. package/build/esnext/trace/span.d.ts +101 -0
  177. package/build/esnext/trace/span.js +17 -0
  178. package/build/esnext/trace/span.js.map +1 -0
  179. package/build/esnext/trace/span_context.d.ts +53 -0
  180. package/build/esnext/trace/span_context.js +17 -0
  181. package/build/esnext/trace/span_context.js.map +1 -0
  182. package/build/esnext/trace/span_kind.d.ts +27 -0
  183. package/build/esnext/trace/span_kind.js +43 -0
  184. package/build/esnext/trace/span_kind.js.map +1 -0
  185. package/build/esnext/trace/spancontext-utils.d.ts +17 -0
  186. package/build/esnext/trace/spancontext-utils.js +42 -0
  187. package/build/esnext/trace/spancontext-utils.js.map +1 -0
  188. package/build/esnext/trace/status.d.ts +25 -0
  189. package/build/esnext/trace/status.js +20 -0
  190. package/build/esnext/trace/status.js.map +1 -0
  191. package/build/esnext/trace/trace_flags.d.ts +7 -0
  192. package/build/esnext/trace/trace_flags.js +23 -0
  193. package/build/esnext/trace/trace_flags.js.map +1 -0
  194. package/build/esnext/trace/trace_state.d.ts +38 -0
  195. package/build/esnext/trace/trace_state.js +17 -0
  196. package/build/esnext/trace/trace_state.js.map +1 -0
  197. package/build/esnext/trace/tracer.d.ts +71 -0
  198. package/build/esnext/trace/tracer.js +17 -0
  199. package/build/esnext/trace/tracer.js.map +1 -0
  200. package/build/esnext/trace/tracer_options.d.ts +10 -0
  201. package/build/esnext/trace/tracer_options.js +17 -0
  202. package/build/esnext/trace/tracer_options.js.map +1 -0
  203. package/build/esnext/trace/tracer_provider.d.ts +21 -0
  204. package/build/esnext/trace/tracer_provider.js +17 -0
  205. package/build/esnext/trace/tracer_provider.js.map +1 -0
  206. package/build/esnext/trace-api.d.ts +4 -0
  207. package/build/esnext/trace-api.js +21 -0
  208. package/build/esnext/trace-api.js.map +1 -0
  209. package/build/esnext/version.d.ts +2 -0
  210. package/build/esnext/version.js +18 -0
  211. package/build/esnext/version.js.map +1 -0
  212. package/build/src/index.d.ts +1 -1
  213. package/build/src/index.js.map +1 -1
  214. package/build/src/metrics/Metric.d.ts +16 -0
  215. package/build/src/metrics/Metric.js.map +1 -1
  216. package/build/src/version.d.ts +1 -1
  217. package/build/src/version.js +1 -1
  218. package/build/src/version.js.map +1 -1
  219. package/package.json +11 -6
@@ -12,7 +12,7 @@ export type { DiagAPI } from './api/diag';
12
12
  export { createNoopMeter } from './metrics/NoopMeter';
13
13
  export { MeterOptions, Meter } from './metrics/Meter';
14
14
  export { MeterProvider } from './metrics/MeterProvider';
15
- export { ValueType, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, BatchObservableCallback, MetricAttributes, MetricAttributeValue, ObservableCallback, } from './metrics/Metric';
15
+ export { ValueType, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, BatchObservableCallback, MetricAdvice, MetricAttributes, MetricAttributeValue, ObservableCallback, } from './metrics/Metric';
16
16
  export { BatchObservableResult, ObservableResult, } from './metrics/ObservableResult';
17
17
  export type { MetricsAPI } from './api/metrics';
18
18
  export { TextMapPropagator, TextMapSetter, TextMapGetter, defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
@@ -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,GAaV,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,SAAA;IACP,IAAI,MAAA;IACJ,OAAO,SAAA;IACP,WAAW,aAAA;IACX,KAAK,OAAA;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 Histogram,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n BatchObservableCallback,\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;;;;;;;;;;;;;;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,GAcV,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,SAAA;IACP,IAAI,MAAA;IACJ,OAAO,SAAA;IACP,WAAW,aAAA;IACX,KAAK,OAAA;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 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,6 +1,17 @@
1
1
  import { Attributes, AttributeValue } from '../common/Attributes';
2
2
  import { Context } from '../context/types';
3
3
  import { BatchObservableResult, ObservableResult } from './ObservableResult';
4
+ /**
5
+ * Advisory options influencing aggregation configuration parameters.
6
+ * @experimental
7
+ */
8
+ export interface MetricAdvice {
9
+ /**
10
+ * Hint the explicit bucket boundaries for SDK if the metric is been
11
+ * aggregated with a HistogramAggregator.
12
+ */
13
+ explicitBucketBoundaries?: number[];
14
+ }
4
15
  /**
5
16
  * Options needed for metric creation
6
17
  */
@@ -20,6 +31,11 @@ export interface MetricOptions {
20
31
  * @default {@link ValueType.DOUBLE}
21
32
  */
22
33
  valueType?: ValueType;
34
+ /**
35
+ * The advice influencing aggregation configuration parameters.
36
+ * @experimental
37
+ */
38
+ advice?: MetricAdvice;
23
39
  }
24
40
  /** The Type of value. It describes how the data is reported. */
25
41
  export declare enum ValueType {
@@ -1 +1 @@
1
- {"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA6BH,gEAAgE;AAChE,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","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 { Attributes, AttributeValue } from '../common/Attributes';\nimport { Context } from '../context/types';\nimport { BatchObservableResult, ObservableResult } from './ObservableResult';\n\n/**\n * Options needed for metric creation\n */\nexport interface MetricOptions {\n /**\n * The description of the Metric.\n * @default ''\n */\n description?: string;\n\n /**\n * The unit of the Metric values.\n * @default ''\n */\n unit?: string;\n\n /**\n * Indicates the type of the recorded value.\n * @default {@link ValueType.DOUBLE}\n */\n valueType?: ValueType;\n}\n\n/** The Type of value. It describes how the data is reported. */\nexport enum ValueType {\n INT,\n DOUBLE,\n}\n\n/**\n * Counter is the most common synchronous instrument. This instrument supports\n * an `Add(increment)` function for reporting a sum, and is restricted to\n * non-negative increments. The default aggregation is Sum, as for any additive\n * instrument.\n *\n * Example uses for Counter:\n * <ol>\n * <li> count the number of bytes received. </li>\n * <li> count the number of requests completed. </li>\n * <li> count the number of accounts created. </li>\n * <li> count the number of checkpoints run. </li>\n * <li> count the number of 5xx errors. </li>\n * <ol>\n */\nexport interface Counter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs must not be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\nexport interface UpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\nexport interface Histogram<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * The observable callback for Observable instruments.\n */\nexport type ObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: ObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\n/**\n * The observable callback for a batch of Observable instruments.\n */\nexport type BatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: BatchObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\nexport interface Observable<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Sets up a function that will be called whenever a metric collection is initiated.\n *\n * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n */\n addCallback(callback: ObservableCallback<AttributesTypes>): void;\n\n /**\n * Removes a callback previously registered with {@link Observable.addCallback}.\n */\n removeCallback(callback: ObservableCallback<AttributesTypes>): void;\n}\n\nexport type ObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable<AttributesTypes>;\nexport type ObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable<AttributesTypes>;\nexport type ObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable<AttributesTypes>;\n"]}
1
+ {"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA+CH,gEAAgE;AAChE,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","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 { Attributes, AttributeValue } from '../common/Attributes';\nimport { Context } from '../context/types';\nimport { BatchObservableResult, ObservableResult } from './ObservableResult';\n\n/**\n * Advisory options influencing aggregation configuration parameters.\n * @experimental\n */\nexport interface MetricAdvice {\n /**\n * Hint the explicit bucket boundaries for SDK if the metric is been\n * aggregated with a HistogramAggregator.\n */\n explicitBucketBoundaries?: number[];\n}\n\n/**\n * Options needed for metric creation\n */\nexport interface MetricOptions {\n /**\n * The description of the Metric.\n * @default ''\n */\n description?: string;\n\n /**\n * The unit of the Metric values.\n * @default ''\n */\n unit?: string;\n\n /**\n * Indicates the type of the recorded value.\n * @default {@link ValueType.DOUBLE}\n */\n valueType?: ValueType;\n\n /**\n * The advice influencing aggregation configuration parameters.\n * @experimental\n */\n advice?: MetricAdvice;\n}\n\n/** The Type of value. It describes how the data is reported. */\nexport enum ValueType {\n INT,\n DOUBLE,\n}\n\n/**\n * Counter is the most common synchronous instrument. This instrument supports\n * an `Add(increment)` function for reporting a sum, and is restricted to\n * non-negative increments. The default aggregation is Sum, as for any additive\n * instrument.\n *\n * Example uses for Counter:\n * <ol>\n * <li> count the number of bytes received. </li>\n * <li> count the number of requests completed. </li>\n * <li> count the number of accounts created. </li>\n * <li> count the number of checkpoints run. </li>\n * <li> count the number of 5xx errors. </li>\n * <ol>\n */\nexport interface Counter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs must not be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\nexport interface UpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\nexport interface Histogram<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * The observable callback for Observable instruments.\n */\nexport type ObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: ObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\n/**\n * The observable callback for a batch of Observable instruments.\n */\nexport type BatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = (\n observableResult: BatchObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\nexport interface Observable<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> {\n /**\n * Sets up a function that will be called whenever a metric collection is initiated.\n *\n * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n */\n addCallback(callback: ObservableCallback<AttributesTypes>): void;\n\n /**\n * Removes a callback previously registered with {@link Observable.addCallback}.\n */\n removeCallback(callback: ObservableCallback<AttributesTypes>): void;\n}\n\nexport type ObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable<AttributesTypes>;\nexport type ObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable<AttributesTypes>;\nexport type ObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes,\n> = Observable<AttributesTypes>;\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.6.0";
1
+ export declare const VERSION = "1.7.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // this is autogenerated file, see scripts/version-update.js
17
- export var VERSION = '1.6.0';
17
+ export var VERSION = '1.7.0';
18
18
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,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// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.6.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,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// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.7.0';\n"]}
@@ -0,0 +1,41 @@
1
+ import { Context, ContextManager } from '../context/types';
2
+ /**
3
+ * Singleton object which represents the entry point to the OpenTelemetry Context API
4
+ */
5
+ export declare class ContextAPI {
6
+ private static _instance?;
7
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
8
+ private constructor();
9
+ /** Get the singleton instance of the Context API */
10
+ static getInstance(): ContextAPI;
11
+ /**
12
+ * Set the current context manager.
13
+ *
14
+ * @returns true if the context manager was successfully registered, else false
15
+ */
16
+ setGlobalContextManager(contextManager: ContextManager): boolean;
17
+ /**
18
+ * Get the currently active context
19
+ */
20
+ active(): Context;
21
+ /**
22
+ * Execute a function with an active context
23
+ *
24
+ * @param context context to be active during function execution
25
+ * @param fn function to execute in a context
26
+ * @param thisArg optional receiver to be used for calling fn
27
+ * @param args optional arguments forwarded to fn
28
+ */
29
+ with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
30
+ /**
31
+ * Bind a context to a target function or event emitter
32
+ *
33
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
34
+ * @param target function or event emitter to bind
35
+ */
36
+ bind<T>(context: Context, target: T): T;
37
+ private _getContextManager;
38
+ /** Disable and remove the global context manager */
39
+ disable(): void;
40
+ }
41
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { NoopContextManager } from '../context/NoopContextManager';
17
+ import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
18
+ import { DiagAPI } from './diag';
19
+ const API_NAME = 'context';
20
+ const NOOP_CONTEXT_MANAGER = new NoopContextManager();
21
+ /**
22
+ * Singleton object which represents the entry point to the OpenTelemetry Context API
23
+ */
24
+ export class ContextAPI {
25
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
26
+ constructor() { }
27
+ /** Get the singleton instance of the Context API */
28
+ static getInstance() {
29
+ if (!this._instance) {
30
+ this._instance = new ContextAPI();
31
+ }
32
+ return this._instance;
33
+ }
34
+ /**
35
+ * Set the current context manager.
36
+ *
37
+ * @returns true if the context manager was successfully registered, else false
38
+ */
39
+ setGlobalContextManager(contextManager) {
40
+ return registerGlobal(API_NAME, contextManager, DiagAPI.instance());
41
+ }
42
+ /**
43
+ * Get the currently active context
44
+ */
45
+ active() {
46
+ return this._getContextManager().active();
47
+ }
48
+ /**
49
+ * Execute a function with an active context
50
+ *
51
+ * @param context context to be active during function execution
52
+ * @param fn function to execute in a context
53
+ * @param thisArg optional receiver to be used for calling fn
54
+ * @param args optional arguments forwarded to fn
55
+ */
56
+ with(context, fn, thisArg, ...args) {
57
+ return this._getContextManager().with(context, fn, thisArg, ...args);
58
+ }
59
+ /**
60
+ * Bind a context to a target function or event emitter
61
+ *
62
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
63
+ * @param target function or event emitter to bind
64
+ */
65
+ bind(context, target) {
66
+ return this._getContextManager().bind(context, target);
67
+ }
68
+ _getContextManager() {
69
+ return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;
70
+ }
71
+ /** Disable and remove the global context manager */
72
+ disable() {
73
+ this._getContextManager().disable();
74
+ unregisterGlobal(API_NAME, DiagAPI.instance());
75
+ }
76
+ }
77
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/api/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,uBAAuB,CAAC,cAA8B;QAC3D,OAAO,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACI,IAAI,CACT,OAAgB,EAChB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAI,OAAgB,EAAE,MAAS;QACxC,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAEO,kBAAkB;QACxB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC;IACrD,CAAC;IAED,oDAAoD;IAC7C,OAAO;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC;QACpC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NoopContextManager } from '../context/NoopContextManager';\nimport { Context, ContextManager } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'context';\nconst NOOP_CONTEXT_MANAGER = new NoopContextManager();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Context API\n */\nexport class ContextAPI {\n private static _instance?: ContextAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Context API */\n public static getInstance(): ContextAPI {\n if (!this._instance) {\n this._instance = new ContextAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current context manager.\n *\n * @returns true if the context manager was successfully registered, else false\n */\n public setGlobalContextManager(contextManager: ContextManager): boolean {\n return registerGlobal(API_NAME, contextManager, DiagAPI.instance());\n }\n\n /**\n * Get the currently active context\n */\n public active(): Context {\n return this._getContextManager().active();\n }\n\n /**\n * Execute a function with an active context\n *\n * @param context context to be active during function execution\n * @param fn function to execute in a context\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n public with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F> {\n return this._getContextManager().with(context, fn, thisArg, ...args);\n }\n\n /**\n * Bind a context to a target function or event emitter\n *\n * @param context context to bind to the event emitter or function. Defaults to the currently active context\n * @param target function or event emitter to bind\n */\n public bind<T>(context: Context, target: T): T {\n return this._getContextManager().bind(context, target);\n }\n\n private _getContextManager(): ContextManager {\n return getGlobal(API_NAME) || NOOP_CONTEXT_MANAGER;\n }\n\n /** Disable and remove the global context manager */\n public disable() {\n this._getContextManager().disable();\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import { ComponentLoggerOptions, DiagLogFunction, DiagLogger, DiagLoggerApi } from '../diag/types';
2
+ /**
3
+ * Singleton object which represents the entry point to the OpenTelemetry internal
4
+ * diagnostic API
5
+ */
6
+ export declare class DiagAPI implements DiagLogger, DiagLoggerApi {
7
+ private static _instance?;
8
+ /** Get the singleton instance of the DiagAPI API */
9
+ static instance(): DiagAPI;
10
+ /**
11
+ * Private internal constructor
12
+ * @private
13
+ */
14
+ private constructor();
15
+ setLogger: DiagLoggerApi['setLogger'];
16
+ /**
17
+ *
18
+ */
19
+ createComponentLogger: (options: ComponentLoggerOptions) => DiagLogger;
20
+ verbose: DiagLogFunction;
21
+ debug: DiagLogFunction;
22
+ info: DiagLogFunction;
23
+ warn: DiagLogFunction;
24
+ error: DiagLogFunction;
25
+ /**
26
+ * Unregister the global logger and return to Noop
27
+ */
28
+ disable: () => void;
29
+ }
30
+ //# sourceMappingURL=diag.d.ts.map
@@ -0,0 +1,89 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { DiagComponentLogger } from '../diag/ComponentLogger';
17
+ import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';
18
+ import { DiagLogLevel, } from '../diag/types';
19
+ import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
20
+ const API_NAME = 'diag';
21
+ /**
22
+ * Singleton object which represents the entry point to the OpenTelemetry internal
23
+ * diagnostic API
24
+ */
25
+ export class DiagAPI {
26
+ /**
27
+ * Private internal constructor
28
+ * @private
29
+ */
30
+ constructor() {
31
+ function _logProxy(funcName) {
32
+ return function (...args) {
33
+ const logger = getGlobal('diag');
34
+ // shortcut if logger not set
35
+ if (!logger)
36
+ return;
37
+ return logger[funcName](...args);
38
+ };
39
+ }
40
+ // Using self local variable for minification purposes as 'this' cannot be minified
41
+ const self = this;
42
+ // DiagAPI specific functions
43
+ const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
44
+ var _a, _b, _c;
45
+ if (logger === self) {
46
+ // There isn't much we can do here.
47
+ // Logging to the console might break the user application.
48
+ // Try to log to self. If a logger was previously registered it will receive the log.
49
+ const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');
50
+ self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
51
+ return false;
52
+ }
53
+ if (typeof optionsOrLogLevel === 'number') {
54
+ optionsOrLogLevel = {
55
+ logLevel: optionsOrLogLevel,
56
+ };
57
+ }
58
+ const oldLogger = getGlobal('diag');
59
+ const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
60
+ // There already is an logger registered. We'll let it know before overwriting it.
61
+ if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
62
+ const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : '<failed to generate stacktrace>';
63
+ oldLogger.warn(`Current logger will be overwritten from ${stack}`);
64
+ newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
65
+ }
66
+ return registerGlobal('diag', newLogger, self, true);
67
+ };
68
+ self.setLogger = setLogger;
69
+ self.disable = () => {
70
+ unregisterGlobal(API_NAME, self);
71
+ };
72
+ self.createComponentLogger = (options) => {
73
+ return new DiagComponentLogger(options);
74
+ };
75
+ self.verbose = _logProxy('verbose');
76
+ self.debug = _logProxy('debug');
77
+ self.info = _logProxy('info');
78
+ self.warn = _logProxy('warn');
79
+ self.error = _logProxy('error');
80
+ }
81
+ /** Get the singleton instance of the DiagAPI API */
82
+ static instance() {
83
+ if (!this._instance) {
84
+ this._instance = new DiagAPI();
85
+ }
86
+ return this._instance;
87
+ }
88
+ }
89
+ //# sourceMappingURL=diag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diag.js","sourceRoot":"","sources":["../../../src/api/diag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAKL,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;GAGG;AACH,MAAM,OAAO,OAAO;IAYlB;;;OAGG;IACH;QACE,SAAS,SAAS,CAAC,QAA0B;YAC3C,OAAO,UAAU,GAAG,IAAI;gBACtB,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;gBACjC,6BAA6B;gBAC7B,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YACnC,CAAC,CAAC;QACJ,CAAC;QAED,mFAAmF;QACnF,MAAM,IAAI,GAAG,IAAI,CAAC;QAElB,6BAA6B;QAE7B,MAAM,SAAS,GAA+B,CAC5C,MAAM,EACN,iBAAiB,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,EAAE,EACnD,EAAE;;YACF,IAAI,MAAM,KAAK,IAAI,EAAE;gBACnB,mCAAmC;gBACnC,2DAA2D;gBAC3D,qFAAqF;gBACrF,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,oIAAoI,CACrI,CAAC;gBACF,IAAI,CAAC,KAAK,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrC,OAAO,KAAK,CAAC;aACd;YAED,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;gBACzC,iBAAiB,GAAG;oBAClB,QAAQ,EAAE,iBAAiB;iBAC5B,CAAC;aACH;YAED,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,SAAS,GAAG,wBAAwB,CACxC,MAAA,iBAAiB,CAAC,QAAQ,mCAAI,YAAY,CAAC,IAAI,EAC/C,MAAM,CACP,CAAC;YACF,kFAAkF;YAClF,IAAI,SAAS,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,EAAE;gBAC3D,MAAM,KAAK,GAAG,MAAA,IAAI,KAAK,EAAE,CAAC,KAAK,mCAAI,iCAAiC,CAAC;gBACrE,SAAS,CAAC,IAAI,CAAC,2CAA2C,KAAK,EAAE,CAAC,CAAC;gBACnE,SAAS,CAAC,IAAI,CACZ,6DAA6D,KAAK,EAAE,CACrE,CAAC;aACH;YAED,OAAO,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;YAClB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,IAAI,CAAC,qBAAqB,GAAG,CAAC,OAA+B,EAAE,EAAE;YAC/D,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAjFD,oDAAoD;IAC7C,MAAM,CAAC,QAAQ;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;SAChC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CA+FF","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 { DiagComponentLogger } from '../diag/ComponentLogger';\nimport { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';\nimport {\n ComponentLoggerOptions,\n DiagLogFunction,\n DiagLogger,\n DiagLoggerApi,\n DiagLogLevel,\n} from '../diag/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\n\nconst API_NAME = 'diag';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry internal\n * diagnostic API\n */\nexport class DiagAPI implements DiagLogger, DiagLoggerApi {\n private static _instance?: DiagAPI;\n\n /** Get the singleton instance of the DiagAPI API */\n public static instance(): DiagAPI {\n if (!this._instance) {\n this._instance = new DiagAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Private internal constructor\n * @private\n */\n private constructor() {\n function _logProxy(funcName: keyof DiagLogger): DiagLogFunction {\n return function (...args) {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) return;\n return logger[funcName](...args);\n };\n }\n\n // Using self local variable for minification purposes as 'this' cannot be minified\n const self = this;\n\n // DiagAPI specific functions\n\n const setLogger: DiagLoggerApi['setLogger'] = (\n logger,\n optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }\n ) => {\n if (logger === self) {\n // There isn't much we can do here.\n // Logging to the console might break the user application.\n // Try to log to self. If a logger was previously registered it will receive the log.\n const err = new Error(\n 'Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation'\n );\n self.error(err.stack ?? err.message);\n return false;\n }\n\n if (typeof optionsOrLogLevel === 'number') {\n optionsOrLogLevel = {\n logLevel: optionsOrLogLevel,\n };\n }\n\n const oldLogger = getGlobal('diag');\n const newLogger = createLogLevelDiagLogger(\n optionsOrLogLevel.logLevel ?? DiagLogLevel.INFO,\n logger\n );\n // There already is an logger registered. We'll let it know before overwriting it.\n if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {\n const stack = new Error().stack ?? '<failed to generate stacktrace>';\n oldLogger.warn(`Current logger will be overwritten from ${stack}`);\n newLogger.warn(\n `Current logger will overwrite one already registered from ${stack}`\n );\n }\n\n return registerGlobal('diag', newLogger, self, true);\n };\n\n self.setLogger = setLogger;\n\n self.disable = () => {\n unregisterGlobal(API_NAME, self);\n };\n\n self.createComponentLogger = (options: ComponentLoggerOptions) => {\n return new DiagComponentLogger(options);\n };\n\n self.verbose = _logProxy('verbose');\n self.debug = _logProxy('debug');\n self.info = _logProxy('info');\n self.warn = _logProxy('warn');\n self.error = _logProxy('error');\n }\n\n public setLogger!: DiagLoggerApi['setLogger'];\n /**\n *\n */\n public createComponentLogger!: (\n options: ComponentLoggerOptions\n ) => DiagLogger;\n\n // DiagLogger implementation\n public verbose!: DiagLogFunction;\n public debug!: DiagLogFunction;\n public info!: DiagLogFunction;\n public warn!: DiagLogFunction;\n public error!: DiagLogFunction;\n\n /**\n * Unregister the global logger and return to Noop\n */\n public disable!: () => void;\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import { Meter, MeterOptions } from '../metrics/Meter';
2
+ import { MeterProvider } from '../metrics/MeterProvider';
3
+ /**
4
+ * Singleton object which represents the entry point to the OpenTelemetry Metrics API
5
+ */
6
+ export declare class MetricsAPI {
7
+ private static _instance?;
8
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
9
+ private constructor();
10
+ /** Get the singleton instance of the Metrics API */
11
+ static getInstance(): MetricsAPI;
12
+ /**
13
+ * Set the current global meter provider.
14
+ * Returns true if the meter provider was successfully registered, else false.
15
+ */
16
+ setGlobalMeterProvider(provider: MeterProvider): boolean;
17
+ /**
18
+ * Returns the global meter provider.
19
+ */
20
+ getMeterProvider(): MeterProvider;
21
+ /**
22
+ * Returns a meter from the global meter provider.
23
+ */
24
+ getMeter(name: string, version?: string, options?: MeterOptions): Meter;
25
+ /** Remove the global meter provider */
26
+ disable(): void;
27
+ }
28
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';
17
+ import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
18
+ import { DiagAPI } from './diag';
19
+ const API_NAME = 'metrics';
20
+ /**
21
+ * Singleton object which represents the entry point to the OpenTelemetry Metrics API
22
+ */
23
+ export class MetricsAPI {
24
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
25
+ constructor() { }
26
+ /** Get the singleton instance of the Metrics API */
27
+ static getInstance() {
28
+ if (!this._instance) {
29
+ this._instance = new MetricsAPI();
30
+ }
31
+ return this._instance;
32
+ }
33
+ /**
34
+ * Set the current global meter provider.
35
+ * Returns true if the meter provider was successfully registered, else false.
36
+ */
37
+ setGlobalMeterProvider(provider) {
38
+ return registerGlobal(API_NAME, provider, DiagAPI.instance());
39
+ }
40
+ /**
41
+ * Returns the global meter provider.
42
+ */
43
+ getMeterProvider() {
44
+ return getGlobal(API_NAME) || NOOP_METER_PROVIDER;
45
+ }
46
+ /**
47
+ * Returns a meter from the global meter provider.
48
+ */
49
+ getMeter(name, version, options) {
50
+ return this.getMeterProvider().getMeter(name, version, options);
51
+ }
52
+ /** Remove the global meter provider */
53
+ disable() {
54
+ unregisterGlobal(API_NAME, DiagAPI.instance());
55
+ }
56
+ }
57
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/api/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAE3B;;GAEG;AACH,MAAM,OAAO,UAAU;IAGrB,+FAA+F;IAC/F,gBAAuB,CAAC;IAExB,oDAAoD;IAC7C,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;SACnC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,QAAuB;QACnD,OAAO,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,QAAQ,CACb,IAAY,EACZ,OAAgB,EAChB,OAAsB;QAEtB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Meter, MeterOptions } from '../metrics/Meter';\nimport { MeterProvider } from '../metrics/MeterProvider';\nimport { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'metrics';\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Metrics API\n */\nexport class MetricsAPI {\n private static _instance?: MetricsAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Metrics API */\n public static getInstance(): MetricsAPI {\n if (!this._instance) {\n this._instance = new MetricsAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current global meter provider.\n * Returns true if the meter provider was successfully registered, else false.\n */\n public setGlobalMeterProvider(provider: MeterProvider): boolean {\n return registerGlobal(API_NAME, provider, DiagAPI.instance());\n }\n\n /**\n * Returns the global meter provider.\n */\n public getMeterProvider(): MeterProvider {\n return getGlobal(API_NAME) || NOOP_METER_PROVIDER;\n }\n\n /**\n * Returns a meter from the global meter provider.\n */\n public getMeter(\n name: string,\n version?: string,\n options?: MeterOptions\n ): Meter {\n return this.getMeterProvider().getMeter(name, version, options);\n }\n\n /** Remove the global meter provider */\n public disable(): void {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n}\n"]}
@@ -0,0 +1,49 @@
1
+ import { Context } from '../context/types';
2
+ import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator';
3
+ import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers';
4
+ import { createBaggage } from '../baggage/utils';
5
+ /**
6
+ * Singleton object which represents the entry point to the OpenTelemetry Propagation API
7
+ */
8
+ export declare class PropagationAPI {
9
+ private static _instance?;
10
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
11
+ private constructor();
12
+ /** Get the singleton instance of the Propagator API */
13
+ static getInstance(): PropagationAPI;
14
+ /**
15
+ * Set the current propagator.
16
+ *
17
+ * @returns true if the propagator was successfully registered, else false
18
+ */
19
+ setGlobalPropagator(propagator: TextMapPropagator): boolean;
20
+ /**
21
+ * Inject context into a carrier to be propagated inter-process
22
+ *
23
+ * @param context Context carrying tracing data to inject
24
+ * @param carrier carrier to inject context into
25
+ * @param setter Function used to set values on the carrier
26
+ */
27
+ inject<Carrier>(context: Context, carrier: Carrier, setter?: TextMapSetter<Carrier>): void;
28
+ /**
29
+ * Extract context from a carrier
30
+ *
31
+ * @param context Context which the newly created context will inherit from
32
+ * @param carrier Carrier to extract context from
33
+ * @param getter Function used to extract keys from a carrier
34
+ */
35
+ extract<Carrier>(context: Context, carrier: Carrier, getter?: TextMapGetter<Carrier>): Context;
36
+ /**
37
+ * Return a list of all fields which may be used by the propagator.
38
+ */
39
+ fields(): string[];
40
+ /** Remove the global propagator */
41
+ disable(): void;
42
+ createBaggage: typeof createBaggage;
43
+ getBaggage: typeof getBaggage;
44
+ getActiveBaggage: typeof getActiveBaggage;
45
+ setBaggage: typeof setBaggage;
46
+ deleteBaggage: typeof deleteBaggage;
47
+ private _getGlobalPropagator;
48
+ }
49
+ //# sourceMappingURL=propagation.d.ts.map
@@ -0,0 +1,85 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { getGlobal, registerGlobal, unregisterGlobal, } from '../internal/global-utils';
17
+ import { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';
18
+ import { defaultTextMapGetter, defaultTextMapSetter, } from '../propagation/TextMapPropagator';
19
+ import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage, } from '../baggage/context-helpers';
20
+ import { createBaggage } from '../baggage/utils';
21
+ import { DiagAPI } from './diag';
22
+ const API_NAME = 'propagation';
23
+ const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
24
+ /**
25
+ * Singleton object which represents the entry point to the OpenTelemetry Propagation API
26
+ */
27
+ export class PropagationAPI {
28
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
29
+ constructor() {
30
+ this.createBaggage = createBaggage;
31
+ this.getBaggage = getBaggage;
32
+ this.getActiveBaggage = getActiveBaggage;
33
+ this.setBaggage = setBaggage;
34
+ this.deleteBaggage = deleteBaggage;
35
+ }
36
+ /** Get the singleton instance of the Propagator API */
37
+ static getInstance() {
38
+ if (!this._instance) {
39
+ this._instance = new PropagationAPI();
40
+ }
41
+ return this._instance;
42
+ }
43
+ /**
44
+ * Set the current propagator.
45
+ *
46
+ * @returns true if the propagator was successfully registered, else false
47
+ */
48
+ setGlobalPropagator(propagator) {
49
+ return registerGlobal(API_NAME, propagator, DiagAPI.instance());
50
+ }
51
+ /**
52
+ * Inject context into a carrier to be propagated inter-process
53
+ *
54
+ * @param context Context carrying tracing data to inject
55
+ * @param carrier carrier to inject context into
56
+ * @param setter Function used to set values on the carrier
57
+ */
58
+ inject(context, carrier, setter = defaultTextMapSetter) {
59
+ return this._getGlobalPropagator().inject(context, carrier, setter);
60
+ }
61
+ /**
62
+ * Extract context from a carrier
63
+ *
64
+ * @param context Context which the newly created context will inherit from
65
+ * @param carrier Carrier to extract context from
66
+ * @param getter Function used to extract keys from a carrier
67
+ */
68
+ extract(context, carrier, getter = defaultTextMapGetter) {
69
+ return this._getGlobalPropagator().extract(context, carrier, getter);
70
+ }
71
+ /**
72
+ * Return a list of all fields which may be used by the propagator.
73
+ */
74
+ fields() {
75
+ return this._getGlobalPropagator().fields();
76
+ }
77
+ /** Remove the global propagator */
78
+ disable() {
79
+ unregisterGlobal(API_NAME, DiagAPI.instance());
80
+ }
81
+ _getGlobalPropagator() {
82
+ return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
83
+ }
84
+ }
85
+ //# sourceMappingURL=propagation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAIrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,MAAM,wBAAwB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,cAAc;IAGzB,+FAA+F;IAC/F;QA8DO,kBAAa,GAAG,aAAa,CAAC;QAE9B,eAAU,GAAG,UAAU,CAAC;QAExB,qBAAgB,GAAG,gBAAgB,CAAC;QAEpC,eAAU,GAAG,UAAU,CAAC;QAExB,kBAAa,GAAG,aAAa,CAAC;IAtEd,CAAC;IAExB,uDAAuD;IAChD,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,UAA6B;QACtD,OAAO,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CACX,OAAgB,EAChB,OAAgB,EAChB,SAAiC,oBAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CACZ,OAAgB,EAChB,OAAgB,EAChB,SAAiC,oBAAoB;QAErD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,mCAAmC;IAC5B,OAAO;QACZ,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAYO,oBAAoB;QAC1B,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC;IACzD,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context } from '../context/types';\nimport {\n getGlobal,\n registerGlobal,\n unregisterGlobal,\n} from '../internal/global-utils';\nimport { NoopTextMapPropagator } from '../propagation/NoopTextMapPropagator';\nimport {\n defaultTextMapGetter,\n defaultTextMapSetter,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '../propagation/TextMapPropagator';\nimport {\n getBaggage,\n getActiveBaggage,\n setBaggage,\n deleteBaggage,\n} from '../baggage/context-helpers';\nimport { createBaggage } from '../baggage/utils';\nimport { DiagAPI } from './diag';\n\nconst API_NAME = 'propagation';\nconst NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();\n\n/**\n * Singleton object which represents the entry point to the OpenTelemetry Propagation API\n */\nexport class PropagationAPI {\n private static _instance?: PropagationAPI;\n\n /** Empty private constructor prevents end users from constructing a new instance of the API */\n private constructor() {}\n\n /** Get the singleton instance of the Propagator API */\n public static getInstance(): PropagationAPI {\n if (!this._instance) {\n this._instance = new PropagationAPI();\n }\n\n return this._instance;\n }\n\n /**\n * Set the current propagator.\n *\n * @returns true if the propagator was successfully registered, else false\n */\n public setGlobalPropagator(propagator: TextMapPropagator): boolean {\n return registerGlobal(API_NAME, propagator, DiagAPI.instance());\n }\n\n /**\n * Inject context into a carrier to be propagated inter-process\n *\n * @param context Context carrying tracing data to inject\n * @param carrier carrier to inject context into\n * @param setter Function used to set values on the carrier\n */\n public inject<Carrier>(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter<Carrier> = defaultTextMapSetter\n ): void {\n return this._getGlobalPropagator().inject(context, carrier, setter);\n }\n\n /**\n * Extract context from a carrier\n *\n * @param context Context which the newly created context will inherit from\n * @param carrier Carrier to extract context from\n * @param getter Function used to extract keys from a carrier\n */\n public extract<Carrier>(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter<Carrier> = defaultTextMapGetter\n ): Context {\n return this._getGlobalPropagator().extract(context, carrier, getter);\n }\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n public fields(): string[] {\n return this._getGlobalPropagator().fields();\n }\n\n /** Remove the global propagator */\n public disable() {\n unregisterGlobal(API_NAME, DiagAPI.instance());\n }\n\n public createBaggage = createBaggage;\n\n public getBaggage = getBaggage;\n\n public getActiveBaggage = getActiveBaggage;\n\n public setBaggage = setBaggage;\n\n public deleteBaggage = deleteBaggage;\n\n private _getGlobalPropagator(): TextMapPropagator {\n return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;\n }\n}\n"]}