@opentelemetry/api 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/build/esm/experimental/index.d.ts +3 -0
  2. package/build/esm/experimental/index.js +17 -0
  3. package/build/esm/experimental/index.js.map +1 -0
  4. package/build/esm/experimental/trace/SugaredOptions.d.ts +13 -0
  5. package/build/esm/experimental/trace/SugaredOptions.js +17 -0
  6. package/build/esm/experimental/trace/SugaredOptions.js.map +1 -0
  7. package/build/esm/experimental/trace/SugaredTracer.d.ts +64 -0
  8. package/build/esm/experimental/trace/SugaredTracer.js +92 -0
  9. package/build/esm/experimental/trace/SugaredTracer.js.map +1 -0
  10. package/build/esm/index.d.ts +1 -1
  11. package/build/esm/index.js.map +1 -1
  12. package/build/esm/metrics/Metric.d.ts +16 -0
  13. package/build/esm/metrics/Metric.js.map +1 -1
  14. package/build/esm/version.d.ts +1 -1
  15. package/build/esm/version.js +1 -1
  16. package/build/esm/version.js.map +1 -1
  17. package/build/esnext/api/context.d.ts +41 -0
  18. package/build/esnext/api/context.js +77 -0
  19. package/build/esnext/api/context.js.map +1 -0
  20. package/build/esnext/api/diag.d.ts +30 -0
  21. package/build/esnext/api/diag.js +89 -0
  22. package/build/esnext/api/diag.js.map +1 -0
  23. package/build/esnext/api/metrics.d.ts +28 -0
  24. package/build/esnext/api/metrics.js +57 -0
  25. package/build/esnext/api/metrics.js.map +1 -0
  26. package/build/esnext/api/propagation.d.ts +49 -0
  27. package/build/esnext/api/propagation.js +85 -0
  28. package/build/esnext/api/propagation.js.map +1 -0
  29. package/build/esnext/api/trace.d.ts +40 -0
  30. package/build/esnext/api/trace.js +75 -0
  31. package/build/esnext/api/trace.js.map +1 -0
  32. package/build/esnext/baggage/context-helpers.d.ts +29 -0
  33. package/build/esnext/baggage/context-helpers.js +56 -0
  34. package/build/esnext/baggage/context-helpers.js.map +1 -0
  35. package/build/esnext/baggage/internal/baggage-impl.d.ts +12 -0
  36. package/build/esnext/baggage/internal/baggage-impl.js +51 -0
  37. package/build/esnext/baggage/internal/baggage-impl.js.map +1 -0
  38. package/build/esnext/baggage/internal/symbol.d.ts +5 -0
  39. package/build/esnext/baggage/internal/symbol.js +20 -0
  40. package/build/esnext/baggage/internal/symbol.js.map +1 -0
  41. package/build/esnext/baggage/types.d.ts +60 -0
  42. package/build/esnext/baggage/types.js +17 -0
  43. package/build/esnext/baggage/types.js.map +1 -0
  44. package/build/esnext/baggage/utils.d.ts +15 -0
  45. package/build/esnext/baggage/utils.js +46 -0
  46. package/build/esnext/baggage/utils.js.map +1 -0
  47. package/build/esnext/common/Attributes.d.ts +15 -0
  48. package/build/esnext/common/Attributes.js +17 -0
  49. package/build/esnext/common/Attributes.js.map +1 -0
  50. package/build/esnext/common/Exception.d.ts +26 -0
  51. package/build/esnext/common/Exception.js +17 -0
  52. package/build/esnext/common/Exception.js.map +1 -0
  53. package/build/esnext/common/Time.d.ts +20 -0
  54. package/build/esnext/common/Time.js +2 -0
  55. package/build/esnext/common/Time.js.map +1 -0
  56. package/build/esnext/context/NoopContextManager.d.ts +9 -0
  57. package/build/esnext/context/NoopContextManager.js +34 -0
  58. package/build/esnext/context/NoopContextManager.js.map +1 -0
  59. package/build/esnext/context/context.d.ts +6 -0
  60. package/build/esnext/context/context.js +51 -0
  61. package/build/esnext/context/context.js.map +1 -0
  62. package/build/esnext/context/types.d.ts +52 -0
  63. package/build/esnext/context/types.js +17 -0
  64. package/build/esnext/context/types.js.map +1 -0
  65. package/build/esnext/context-api.d.ts +4 -0
  66. package/build/esnext/context-api.js +21 -0
  67. package/build/esnext/context-api.js.map +1 -0
  68. package/build/esnext/diag/ComponentLogger.d.ts +20 -0
  69. package/build/esnext/diag/ComponentLogger.js +55 -0
  70. package/build/esnext/diag/ComponentLogger.js.map +1 -0
  71. package/build/esnext/diag/consoleLogger.d.ts +38 -0
  72. package/build/esnext/diag/consoleLogger.js +53 -0
  73. package/build/esnext/diag/consoleLogger.js.map +1 -0
  74. package/build/esnext/diag/internal/logLevelLogger.d.ts +3 -0
  75. package/build/esnext/diag/internal/logLevelLogger.js +41 -0
  76. package/build/esnext/diag/internal/logLevelLogger.js.map +1 -0
  77. package/build/esnext/diag/internal/noopLogger.d.ts +8 -0
  78. package/build/esnext/diag/internal/noopLogger.js +31 -0
  79. package/build/esnext/diag/internal/noopLogger.js.map +1 -0
  80. package/build/esnext/diag/types.d.ts +100 -0
  81. package/build/esnext/diag/types.js +41 -0
  82. package/build/esnext/diag/types.js.map +1 -0
  83. package/build/esnext/diag-api.d.ts +9 -0
  84. package/build/esnext/diag-api.js +26 -0
  85. package/build/esnext/diag-api.js.map +1 -0
  86. package/build/esnext/experimental/index.d.ts +3 -0
  87. package/build/esnext/experimental/index.js +17 -0
  88. package/build/esnext/experimental/index.js.map +1 -0
  89. package/build/esnext/experimental/trace/SugaredOptions.d.ts +13 -0
  90. package/build/esnext/experimental/trace/SugaredOptions.js +17 -0
  91. package/build/esnext/experimental/trace/SugaredOptions.js.map +1 -0
  92. package/build/esnext/experimental/trace/SugaredTracer.d.ts +64 -0
  93. package/build/esnext/experimental/trace/SugaredTracer.js +88 -0
  94. package/build/esnext/experimental/trace/SugaredTracer.js.map +1 -0
  95. package/build/esnext/index.d.ts +54 -0
  96. package/build/esnext/index.js +53 -0
  97. package/build/esnext/index.js.map +1 -0
  98. package/build/esnext/internal/global-utils.d.ts +18 -0
  99. package/build/esnext/internal/global-utils.js +58 -0
  100. package/build/esnext/internal/global-utils.js.map +1 -0
  101. package/build/esnext/internal/semver.d.ts +34 -0
  102. package/build/esnext/internal/semver.js +118 -0
  103. package/build/esnext/internal/semver.js.map +1 -0
  104. package/build/esnext/metrics/Meter.d.ts +104 -0
  105. package/build/esnext/metrics/Meter.js +17 -0
  106. package/build/esnext/metrics/Meter.js.map +1 -0
  107. package/build/esnext/metrics/MeterProvider.d.ts +17 -0
  108. package/build/esnext/metrics/MeterProvider.js +17 -0
  109. package/build/esnext/metrics/MeterProvider.js.map +1 -0
  110. package/build/esnext/metrics/Metric.d.ts +109 -0
  111. package/build/esnext/metrics/Metric.js +22 -0
  112. package/build/esnext/metrics/Metric.js.map +1 -0
  113. package/build/esnext/metrics/NoopMeter.d.ts +74 -0
  114. package/build/esnext/metrics/NoopMeter.js +103 -0
  115. package/build/esnext/metrics/NoopMeter.js.map +1 -0
  116. package/build/esnext/metrics/NoopMeterProvider.d.ts +11 -0
  117. package/build/esnext/metrics/NoopMeterProvider.js +27 -0
  118. package/build/esnext/metrics/NoopMeterProvider.js.map +1 -0
  119. package/build/esnext/metrics/ObservableResult.d.ts +31 -0
  120. package/build/esnext/metrics/ObservableResult.js +17 -0
  121. package/build/esnext/metrics/ObservableResult.js.map +1 -0
  122. package/build/esnext/metrics-api.d.ts +4 -0
  123. package/build/esnext/metrics-api.js +21 -0
  124. package/build/esnext/metrics-api.js.map +1 -0
  125. package/build/esnext/platform/browser/globalThis.d.ts +10 -0
  126. package/build/esnext/platform/browser/globalThis.js +35 -0
  127. package/build/esnext/platform/browser/globalThis.js.map +1 -0
  128. package/build/esnext/platform/browser/index.d.ts +2 -0
  129. package/build/esnext/platform/browser/index.js +17 -0
  130. package/build/esnext/platform/browser/index.js.map +1 -0
  131. package/build/esnext/platform/index.d.ts +2 -0
  132. package/build/esnext/platform/index.js +17 -0
  133. package/build/esnext/platform/index.js.map +1 -0
  134. package/build/esnext/platform/node/globalThis.d.ts +3 -0
  135. package/build/esnext/platform/node/globalThis.js +19 -0
  136. package/build/esnext/platform/node/globalThis.js.map +1 -0
  137. package/build/esnext/platform/node/index.d.ts +2 -0
  138. package/build/esnext/platform/node/index.js +17 -0
  139. package/build/esnext/platform/node/index.js.map +1 -0
  140. package/build/esnext/propagation/NoopTextMapPropagator.d.ts +13 -0
  141. package/build/esnext/propagation/NoopTextMapPropagator.js +30 -0
  142. package/build/esnext/propagation/NoopTextMapPropagator.js.map +1 -0
  143. package/build/esnext/propagation/TextMapPropagator.d.ts +84 -0
  144. package/build/esnext/propagation/TextMapPropagator.js +38 -0
  145. package/build/esnext/propagation/TextMapPropagator.js.map +1 -0
  146. package/build/esnext/propagation-api.d.ts +4 -0
  147. package/build/esnext/propagation-api.js +21 -0
  148. package/build/esnext/propagation-api.js.map +1 -0
  149. package/build/esnext/trace/NonRecordingSpan.d.ts +25 -0
  150. package/build/esnext/trace/NonRecordingSpan.js +59 -0
  151. package/build/esnext/trace/NonRecordingSpan.js.map +1 -0
  152. package/build/esnext/trace/NoopTracer.d.ts +14 -0
  153. package/build/esnext/trace/NoopTracer.js +71 -0
  154. package/build/esnext/trace/NoopTracer.js.map +1 -0
  155. package/build/esnext/trace/NoopTracerProvider.d.ts +13 -0
  156. package/build/esnext/trace/NoopTracerProvider.js +28 -0
  157. package/build/esnext/trace/NoopTracerProvider.js.map +1 -0
  158. package/build/esnext/trace/ProxyTracer.d.ts +27 -0
  159. package/build/esnext/trace/ProxyTracer.js +51 -0
  160. package/build/esnext/trace/ProxyTracer.js.map +1 -0
  161. package/build/esnext/trace/ProxyTracerProvider.d.ts +25 -0
  162. package/build/esnext/trace/ProxyTracerProvider.js +50 -0
  163. package/build/esnext/trace/ProxyTracerProvider.js.map +1 -0
  164. package/build/esnext/trace/Sampler.d.ts +31 -0
  165. package/build/esnext/trace/Sampler.js +17 -0
  166. package/build/esnext/trace/Sampler.js.map +1 -0
  167. package/build/esnext/trace/SamplingResult.d.ts +49 -0
  168. package/build/esnext/trace/SamplingResult.js +39 -0
  169. package/build/esnext/trace/SamplingResult.js.map +1 -0
  170. package/build/esnext/trace/SpanOptions.d.ts +23 -0
  171. package/build/esnext/trace/SpanOptions.js +17 -0
  172. package/build/esnext/trace/SpanOptions.js.map +1 -0
  173. package/build/esnext/trace/attributes.d.ts +10 -0
  174. package/build/esnext/trace/attributes.js +17 -0
  175. package/build/esnext/trace/attributes.js.map +1 -0
  176. package/build/esnext/trace/context-utils.d.ts +41 -0
  177. package/build/esnext/trace/context-utils.js +73 -0
  178. package/build/esnext/trace/context-utils.js.map +1 -0
  179. package/build/esnext/trace/internal/tracestate-impl.d.ts +22 -0
  180. package/build/esnext/trace/internal/tracestate-impl.js +99 -0
  181. package/build/esnext/trace/internal/tracestate-impl.js.map +1 -0
  182. package/build/esnext/trace/internal/tracestate-validators.d.ts +15 -0
  183. package/build/esnext/trace/internal/tracestate-validators.js +41 -0
  184. package/build/esnext/trace/internal/tracestate-validators.js.map +1 -0
  185. package/build/esnext/trace/internal/utils.d.ts +3 -0
  186. package/build/esnext/trace/internal/utils.js +20 -0
  187. package/build/esnext/trace/internal/utils.js.map +1 -0
  188. package/build/esnext/trace/invalid-span-constants.d.ts +5 -0
  189. package/build/esnext/trace/invalid-span-constants.js +24 -0
  190. package/build/esnext/trace/invalid-span-constants.js.map +1 -0
  191. package/build/esnext/trace/link.d.ts +26 -0
  192. package/build/esnext/trace/link.js +17 -0
  193. package/build/esnext/trace/link.js.map +1 -0
  194. package/build/esnext/trace/span.d.ts +101 -0
  195. package/build/esnext/trace/span.js +17 -0
  196. package/build/esnext/trace/span.js.map +1 -0
  197. package/build/esnext/trace/span_context.d.ts +53 -0
  198. package/build/esnext/trace/span_context.js +17 -0
  199. package/build/esnext/trace/span_context.js.map +1 -0
  200. package/build/esnext/trace/span_kind.d.ts +27 -0
  201. package/build/esnext/trace/span_kind.js +43 -0
  202. package/build/esnext/trace/span_kind.js.map +1 -0
  203. package/build/esnext/trace/spancontext-utils.d.ts +17 -0
  204. package/build/esnext/trace/spancontext-utils.js +42 -0
  205. package/build/esnext/trace/spancontext-utils.js.map +1 -0
  206. package/build/esnext/trace/status.d.ts +25 -0
  207. package/build/esnext/trace/status.js +20 -0
  208. package/build/esnext/trace/status.js.map +1 -0
  209. package/build/esnext/trace/trace_flags.d.ts +7 -0
  210. package/build/esnext/trace/trace_flags.js +23 -0
  211. package/build/esnext/trace/trace_flags.js.map +1 -0
  212. package/build/esnext/trace/trace_state.d.ts +38 -0
  213. package/build/esnext/trace/trace_state.js +17 -0
  214. package/build/esnext/trace/trace_state.js.map +1 -0
  215. package/build/esnext/trace/tracer.d.ts +71 -0
  216. package/build/esnext/trace/tracer.js +17 -0
  217. package/build/esnext/trace/tracer.js.map +1 -0
  218. package/build/esnext/trace/tracer_options.d.ts +10 -0
  219. package/build/esnext/trace/tracer_options.js +17 -0
  220. package/build/esnext/trace/tracer_options.js.map +1 -0
  221. package/build/esnext/trace/tracer_provider.d.ts +21 -0
  222. package/build/esnext/trace/tracer_provider.js +17 -0
  223. package/build/esnext/trace/tracer_provider.js.map +1 -0
  224. package/build/esnext/trace-api.d.ts +4 -0
  225. package/build/esnext/trace-api.js +21 -0
  226. package/build/esnext/trace-api.js.map +1 -0
  227. package/build/esnext/version.d.ts +2 -0
  228. package/build/esnext/version.js +18 -0
  229. package/build/esnext/version.js.map +1 -0
  230. package/build/src/experimental/index.d.ts +3 -0
  231. package/build/src/experimental/index.js +22 -0
  232. package/build/src/experimental/index.js.map +1 -0
  233. package/build/src/experimental/trace/SugaredOptions.d.ts +13 -0
  234. package/build/src/experimental/trace/SugaredOptions.js +18 -0
  235. package/build/src/experimental/trace/SugaredOptions.js.map +1 -0
  236. package/build/src/experimental/trace/SugaredTracer.d.ts +64 -0
  237. package/build/src/experimental/trace/SugaredTracer.js +93 -0
  238. package/build/src/experimental/trace/SugaredTracer.js.map +1 -0
  239. package/build/src/index.d.ts +1 -1
  240. package/build/src/index.js.map +1 -1
  241. package/build/src/metrics/Metric.d.ts +16 -0
  242. package/build/src/metrics/Metric.js.map +1 -1
  243. package/build/src/version.d.ts +1 -1
  244. package/build/src/version.js +1 -1
  245. package/build/src/version.js.map +1 -1
  246. package/package.json +26 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer_options.js","sourceRoot":"","sources":["../../../src/trace/tracer_options.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\n/**\n * An interface describes additional metadata of a tracer.\n */\nexport interface TracerOptions {\n /**\n * The schemaUrl of the tracer or instrumentation library\n */\n schemaUrl?: string;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { Tracer } from './tracer';
2
+ import { TracerOptions } from './tracer_options';
3
+ /**
4
+ * A registry for creating named {@link Tracer}s.
5
+ */
6
+ export interface TracerProvider {
7
+ /**
8
+ * Returns a Tracer, creating one if one with the given name and version is
9
+ * not already created.
10
+ *
11
+ * This function may return different Tracer types (e.g.
12
+ * {@link NoopTracerProvider} vs. a functional tracer).
13
+ *
14
+ * @param name The name of the tracer or instrumentation library.
15
+ * @param version The version of the tracer or instrumentation library.
16
+ * @param options The options of the tracer or instrumentation library.
17
+ * @returns Tracer A Tracer with the given name and version
18
+ */
19
+ getTracer(name: string, version?: string, options?: TracerOptions): Tracer;
20
+ }
21
+ //# sourceMappingURL=tracer_provider.d.ts.map
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=tracer_provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer_provider.js","sourceRoot":"","sources":["../../../src/trace/tracer_provider.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 { Tracer } from './tracer';\nimport { TracerOptions } from './tracer_options';\n\n/**\n * A registry for creating named {@link Tracer}s.\n */\nexport interface TracerProvider {\n /**\n * Returns a Tracer, creating one if one with the given name and version is\n * not already created.\n *\n * This function may return different Tracer types (e.g.\n * {@link NoopTracerProvider} vs. a functional tracer).\n *\n * @param name The name of the tracer or instrumentation library.\n * @param version The version of the tracer or instrumentation library.\n * @param options The options of the tracer or instrumentation library.\n * @returns Tracer A Tracer with the given name and version\n */\n getTracer(name: string, version?: string, options?: TracerOptions): Tracer;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { TraceAPI } from './api/trace';
2
+ /** Entrypoint for trace API */
3
+ export declare const trace: TraceAPI;
4
+ //# sourceMappingURL=trace-api.d.ts.map
@@ -0,0 +1,21 @@
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
+ // Split module-level variable definition into separate files to allow
17
+ // tree-shaking on each api instance.
18
+ import { TraceAPI } from './api/trace';
19
+ /** Entrypoint for trace API */
20
+ export const trace = TraceAPI.getInstance();
21
+ //# sourceMappingURL=trace-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-api.js","sourceRoot":"","sources":["../../src/trace-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,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 { TraceAPI } from './api/trace';\n/** Entrypoint for trace API */\nexport const trace = TraceAPI.getInstance();\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.8.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,18 @@
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
+ // this is autogenerated file, see scripts/version-update.js
17
+ export const VERSION = '1.8.0';
18
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,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.8.0';\n"]}
@@ -0,0 +1,3 @@
1
+ export { wrapTracer, SugaredTracer } from './trace/SugaredTracer';
2
+ export { SugaredSpanOptions } from './trace/SugaredOptions';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SugaredTracer = exports.wrapTracer = void 0;
4
+ /*
5
+ * Copyright The OpenTelemetry Authors
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * https://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ var SugaredTracer_1 = require("./trace/SugaredTracer");
20
+ Object.defineProperty(exports, "wrapTracer", { enumerable: true, get: function () { return SugaredTracer_1.wrapTracer; } });
21
+ Object.defineProperty(exports, "SugaredTracer", { enumerable: true, get: function () { return SugaredTracer_1.SugaredTracer; } });
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,uDAAkE;AAAzD,2GAAA,UAAU,OAAA;AAAE,8GAAA,aAAa,OAAA","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"]}
@@ -0,0 +1,13 @@
1
+ import { Span, SpanOptions } from '../../';
2
+ /**
3
+ * Options needed for span creation
4
+ */
5
+ export interface SugaredSpanOptions extends SpanOptions {
6
+ /**
7
+ * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function.
8
+ * @param e Error which triggered this exception
9
+ * @param span current span from context
10
+ */
11
+ onException?: (e: Error, span: Span) => void;
12
+ }
13
+ //# sourceMappingURL=SugaredOptions.d.ts.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ //# sourceMappingURL=SugaredOptions.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,64 @@
1
+ import { SugaredSpanOptions } from './SugaredOptions';
2
+ import { Context, Span, Tracer } from '../../';
3
+ /**
4
+ * return a new SugaredTracer created from the supplied one
5
+ * @param tracer
6
+ */
7
+ export declare function wrapTracer(tracer: Tracer): SugaredTracer;
8
+ export declare class SugaredTracer implements Tracer {
9
+ private readonly _tracer;
10
+ constructor(tracer: Tracer);
11
+ startActiveSpan: Tracer['startActiveSpan'];
12
+ startSpan: Tracer['startSpan'];
13
+ /**
14
+ * Starts a new {@link Span} and calls the given function passing it the
15
+ * created span as first argument.
16
+ * Additionally, the new span gets set in context and this context is activated
17
+ * for the duration of the function call.
18
+ * The span will be closed after the function has executed.
19
+ * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown.
20
+ *
21
+ * @param name The name of the span
22
+ * @param [options] SugaredSpanOptions used for span creation
23
+ * @param [context] Context to use to extract parent
24
+ * @param fn function called in the context of the span and receives the newly created span as an argument
25
+ * @returns return value of fn
26
+ * @example
27
+ * const something = tracer.withActiveSpan('op', span => {
28
+ * // do some work
29
+ * });
30
+ * @example
31
+ * const something = await tracer.withActiveSpan('op', span => {
32
+ * // do some async work
33
+ * });
34
+ */
35
+ withActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
36
+ withActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, options: SugaredSpanOptions, fn: F): ReturnType<F>;
37
+ withActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType<F>;
38
+ /**
39
+ * Starts a new {@link Span} and ends it after execution of fn without setting it on context.
40
+ * The span will be closed after the function has executed.
41
+ * If an exception occurs, it is recorded, the status is et to ERROR and rethrown.
42
+ *
43
+ * This method does NOT modify the current Context.
44
+ *
45
+ * @param name The name of the span
46
+ * @param [options] SugaredSpanOptions used for span creation
47
+ * @param [context] Context to use to extract parent
48
+ * @param fn function called in the context of the span and receives the newly created span as an argument
49
+ * @returns Span The newly created span
50
+ * @example
51
+ * const something = tracer.withSpan('op', span => {
52
+ * // do some work
53
+ * });
54
+ * @example
55
+ * const something = await tracer.withSpan('op', span => {
56
+ * // do some async work
57
+ * });
58
+ */
59
+ withSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
60
+ withSpan<F extends (span: Span) => ReturnType<F>>(name: string, options: SugaredSpanOptions, fn: F): ReturnType<F>;
61
+ withSpan<F extends (span: Span) => ReturnType<F>>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType<F>;
62
+ withSpan<F extends (span: Span) => ReturnType<F>>(name: string, options: SugaredSpanOptions, context: Context, fn: F): ReturnType<F>;
63
+ }
64
+ //# sourceMappingURL=SugaredTracer.d.ts.map
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SugaredTracer = exports.wrapTracer = void 0;
4
+ const __1 = require("../../");
5
+ const defaultOnException = (e, span) => {
6
+ span.recordException(e);
7
+ span.setStatus({
8
+ code: __1.SpanStatusCode.ERROR,
9
+ });
10
+ };
11
+ /**
12
+ * return a new SugaredTracer created from the supplied one
13
+ * @param tracer
14
+ */
15
+ function wrapTracer(tracer) {
16
+ return new SugaredTracer(tracer);
17
+ }
18
+ exports.wrapTracer = wrapTracer;
19
+ class SugaredTracer {
20
+ constructor(tracer) {
21
+ this._tracer = tracer;
22
+ this.startSpan = tracer.startSpan.bind(this._tracer);
23
+ this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);
24
+ }
25
+ withActiveSpan(name, arg2, arg3, arg4) {
26
+ const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);
27
+ return this._tracer.startActiveSpan(name, opts, ctx, (span) => handleFn(span, opts, fn));
28
+ }
29
+ withSpan(name, arg2, arg3, arg4) {
30
+ const { opts, ctx, fn } = massageParams(arg2, arg3, arg4);
31
+ const span = this._tracer.startSpan(name, opts, ctx);
32
+ return handleFn(span, opts, fn);
33
+ }
34
+ }
35
+ exports.SugaredTracer = SugaredTracer;
36
+ /**
37
+ * Massages parameters of withSpan and withActiveSpan to allow signature overwrites
38
+ * @param arg
39
+ * @param arg2
40
+ * @param arg3
41
+ */
42
+ function massageParams(arg, arg2, arg3) {
43
+ let opts;
44
+ let ctx;
45
+ let fn;
46
+ if (!arg2 && !arg3) {
47
+ fn = arg;
48
+ }
49
+ else if (!arg3) {
50
+ opts = arg;
51
+ fn = arg2;
52
+ }
53
+ else {
54
+ opts = arg;
55
+ ctx = arg2;
56
+ fn = arg3;
57
+ }
58
+ opts = opts !== null && opts !== void 0 ? opts : {};
59
+ ctx = ctx !== null && ctx !== void 0 ? ctx : __1.context.active();
60
+ return { opts, ctx, fn };
61
+ }
62
+ /**
63
+ * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling
64
+ * @param span
65
+ * @param opts
66
+ * @param fn
67
+ */
68
+ function handleFn(span, opts, fn) {
69
+ var _a;
70
+ const onException = (_a = opts.onException) !== null && _a !== void 0 ? _a : defaultOnException;
71
+ const errorHandler = (e) => {
72
+ onException(e, span);
73
+ span.end();
74
+ throw e;
75
+ };
76
+ try {
77
+ const ret = fn(span);
78
+ // if fn is an async function, attach a recordException and spanEnd callback to the promise
79
+ if (typeof (ret === null || ret === void 0 ? void 0 : ret.then) === 'function') {
80
+ return ret.then(val => {
81
+ span.end();
82
+ return val;
83
+ }, errorHandler);
84
+ }
85
+ span.end();
86
+ return ret;
87
+ }
88
+ catch (e) {
89
+ // add throw to signal the compiler that this will throw in the inner scope
90
+ throw errorHandler(e);
91
+ }
92
+ }
93
+ //# sourceMappingURL=SugaredTracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SugaredTracer.js","sourceRoot":"","sources":["../../../../src/experimental/trace/SugaredTracer.ts"],"names":[],"mappings":";;;AAgBA,8BAAwE;AAExE,MAAM,kBAAkB,GAAG,CAAC,CAAQ,EAAE,IAAU,EAAE,EAAE;IAClD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,SAAS,CAAC;QACb,IAAI,EAAE,kBAAc,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAFD,gCAEC;AAED,MAAa,aAAa;IAGxB,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;IA0CD,cAAc,CACZ,IAAY,EACZ,IAA4B,EAC5B,IAAkB,EAClB,IAAQ;QAER,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,IAAU,EAAE,EAAE,CAClE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CACR,CAAC;IACrB,CAAC;IA4CD,QAAQ,CACN,IAAY,EACZ,IAA4B,EAC5B,IAAkB,EAClB,IAAQ;QAER,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAE1D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACrD,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAkB,CAAC;IACnD,CAAC;CACF;AAnHD,sCAmHC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CACpB,GAA2B,EAC3B,IAAkB,EAClB,IAAQ;IAER,IAAI,IAAoC,CAAC;IACzC,IAAI,GAAwB,CAAC;IAC7B,IAAI,EAAK,CAAC;IAEV,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;QAClB,EAAE,GAAG,GAAQ,CAAC;KACf;SAAM,IAAI,CAAC,IAAI,EAAE;QAChB,IAAI,GAAG,GAAyB,CAAC;QACjC,EAAE,GAAG,IAAS,CAAC;KAChB;SAAM;QACL,IAAI,GAAG,GAAyB,CAAC;QACjC,GAAG,GAAG,IAAe,CAAC;QACtB,EAAE,GAAG,IAAS,CAAC;KAChB;IACD,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IAClB,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,WAAO,CAAC,MAAM,EAAE,CAAC;IAE9B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CACf,IAAU,EACV,IAAwB,EACxB,EAAK;;IAEL,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,WAAW,mCAAI,kBAAkB,CAAC;IAC3D,MAAM,YAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;QAChC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,MAAM,CAAC,CAAC;IACV,CAAC,CAAC;IAEF,IAAI;QACF,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAA2B,CAAC;QAC/C,2FAA2F;QAC3F,IAAI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA,KAAK,UAAU,EAAE;YACnC,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACpB,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,YAAY,CAAkB,CAAC;SACnC;QACD,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,OAAO,GAAoB,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,2EAA2E;QAC3E,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC;KACvB;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 */\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"]}
@@ -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,yCAAiE;AAAxD,uHAAA,8BAA8B,OAAA;AAKvC,eAAe;AACf,6CAAmE;AAA1D,2GAAA,gBAAgB,OAAA;AAAE,uGAAA,YAAY,OAAA;AAIvC,YAAY;AACZ,sDAAyD;AAAhD,kHAAA,iBAAiB,OAAA;AAC1B,sCAMsB;AAHpB,qGAAA,YAAY,OAAA;AAMd,eAAe;AACf,iDAAsD;AAA7C,4GAAA,eAAe,OAAA;AAGxB,2CAc0B;AAbxB,mGAAA,SAAS,OAAA;AAoBX,mBAAmB;AACnB,qEAMyC;AAFvC,yHAAA,oBAAoB,OAAA;AACpB,yHAAA,oBAAoB,OAAA;AAOtB,mDAAmE;AAA1D,0GAAA,WAAW,OAAA;AACpB,mEAAkE;AAAzD,0HAAA,mBAAmB,OAAA;AAE5B,yDAA0E;AAAjE,kHAAA,gBAAgB,OAAA;AAEzB,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAGjB,yCAA4D;AAAvC,wGAAA,cAAc,OAAA;AACnC,mDAAiD;AAAxC,yGAAA,UAAU,OAAA;AAEnB,gDAA0D;AAAjD,yGAAA,gBAAgB,OAAA;AAIzB,+DAImC;AAHjC,uHAAA,kBAAkB,OAAA;AAClB,mHAAA,cAAc,OAAA;AACd,kHAAA,aAAa,OAAA;AAEf,yEAIwC;AAHtC,wHAAA,cAAc,OAAA;AACd,yHAAA,eAAe,OAAA;AACf,8HAAA,oBAAoB,OAAA;AAItB,sEAAsE;AACtE,qCAAqC;AACrC,+CAAwC;AAO/B,wFAPA,qBAAO,OAOA;AANhB,yCAAkC;AAMhB,qFANT,eAAI,OAMS;AALtB,+CAAwC;AAKhB,wFALf,qBAAO,OAKe;AAJ/B,uDAAgD;AAIf,4FAJxB,6BAAW,OAIwB;AAH5C,2CAAoC;AAGU,sFAHrC,iBAAK,OAGqC;AACnD,kBAAkB;AAClB,kBAAe;IACb,OAAO,EAAP,qBAAO;IACP,IAAI,EAAJ,eAAI;IACJ,OAAO,EAAP,qBAAO;IACP,WAAW,EAAX,6BAAW;IACX,KAAK,EAAL,iBAAK;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,yCAAiE;AAAxD,uHAAA,8BAA8B,OAAA;AAKvC,eAAe;AACf,6CAAmE;AAA1D,2GAAA,gBAAgB,OAAA;AAAE,uGAAA,YAAY,OAAA;AAIvC,YAAY;AACZ,sDAAyD;AAAhD,kHAAA,iBAAiB,OAAA;AAC1B,sCAMsB;AAHpB,qGAAA,YAAY,OAAA;AAMd,eAAe;AACf,iDAAsD;AAA7C,4GAAA,eAAe,OAAA;AAGxB,2CAe0B;AAdxB,mGAAA,SAAS,OAAA;AAqBX,mBAAmB;AACnB,qEAMyC;AAFvC,yHAAA,oBAAoB,OAAA;AACpB,yHAAA,oBAAoB,OAAA;AAOtB,mDAAmE;AAA1D,0GAAA,WAAW,OAAA;AACpB,mEAAkE;AAAzD,0HAAA,mBAAmB,OAAA;AAE5B,yDAA0E;AAAjE,kHAAA,gBAAgB,OAAA;AAEzB,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AAGjB,yCAA4D;AAAvC,wGAAA,cAAc,OAAA;AACnC,mDAAiD;AAAxC,yGAAA,UAAU,OAAA;AAEnB,gDAA0D;AAAjD,yGAAA,gBAAgB,OAAA;AAIzB,+DAImC;AAHjC,uHAAA,kBAAkB,OAAA;AAClB,mHAAA,cAAc,OAAA;AACd,kHAAA,aAAa,OAAA;AAEf,yEAIwC;AAHtC,wHAAA,cAAc,OAAA;AACd,yHAAA,eAAe,OAAA;AACf,8HAAA,oBAAoB,OAAA;AAItB,sEAAsE;AACtE,qCAAqC;AACrC,+CAAwC;AAO/B,wFAPA,qBAAO,OAOA;AANhB,yCAAkC;AAMhB,qFANT,eAAI,OAMS;AALtB,+CAAwC;AAKhB,wFALf,qBAAO,OAKe;AAJ/B,uDAAgD;AAIf,4FAJxB,6BAAW,OAIwB;AAH5C,2CAAoC;AAGU,sFAHrC,iBAAK,OAGqC;AACnD,kBAAkB;AAClB,kBAAe;IACb,OAAO,EAAP,qBAAO;IACP,IAAI,EAAJ,eAAI;IACJ,OAAO,EAAP,qBAAO;IACP,WAAW,EAAX,6BAAW;IACX,KAAK,EAAL,iBAAK;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,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,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,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,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.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '1.6.0';
20
+ exports.VERSION = '1.8.0';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,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;AAC/C,QAAA,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.8.0';\n"]}
package/package.json CHANGED
@@ -1,15 +1,31 @@
1
1
  {
2
2
  "name": "@opentelemetry/api",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "Public API for OpenTelemetry",
5
5
  "main": "build/src/index.js",
6
6
  "module": "build/esm/index.js",
7
+ "esnext": "build/esnext/index.js",
7
8
  "types": "build/src/index.d.ts",
8
9
  "browser": {
9
10
  "./src/platform/index.ts": "./src/platform/browser/index.ts",
10
11
  "./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
12
+ "./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
11
13
  "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
12
14
  },
15
+ "exports": {
16
+ ".": {
17
+ "module": "./build/esm/index.js",
18
+ "esnext": "./build/esnext/index.js",
19
+ "types": "./build/src/index.d.ts",
20
+ "default": "./build/src/index.js"
21
+ },
22
+ "./experimental": {
23
+ "module": "./build/esm/experimental/index.js",
24
+ "esnext": "./build/esnext/experimental/index.js",
25
+ "types": "./build/src/experimental/index.d.ts",
26
+ "default": "./build/src/experimental/index.js"
27
+ }
28
+ },
13
29
  "repository": "open-telemetry/opentelemetry-js",
14
30
  "scripts": {
15
31
  "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
@@ -51,6 +67,9 @@
51
67
  "build/esm/**/*.js",
52
68
  "build/esm/**/*.js.map",
53
69
  "build/esm/**/*.d.ts",
70
+ "build/esnext/**/*.js",
71
+ "build/esnext/**/*.js.map",
72
+ "build/esnext/**/*.d.ts",
54
73
  "build/src/**/*.js",
55
74
  "build/src/**/*.js.map",
56
75
  "build/src/**/*.d.ts",
@@ -61,10 +80,10 @@
61
80
  "access": "public"
62
81
  },
63
82
  "devDependencies": {
64
- "@types/mocha": "10.0.1",
83
+ "@types/mocha": "10.0.6",
65
84
  "@types/node": "18.6.5",
66
- "@types/sinon": "10.0.16",
67
- "@types/webpack": "4.41.33",
85
+ "@types/sinon": "10.0.20",
86
+ "@types/webpack": "5.28.5",
68
87
  "@types/webpack-env": "1.16.3",
69
88
  "babel-plugin-istanbul": "6.1.1",
70
89
  "codecov": "3.8.3",
@@ -77,7 +96,7 @@
77
96
  "karma-mocha-webworker": "1.3.0",
78
97
  "karma-spec-reporter": "0.0.36",
79
98
  "karma-webpack": "4.0.2",
80
- "lerna": "7.1.5",
99
+ "lerna": "6.6.2",
81
100
  "memfs": "3.5.3",
82
101
  "mocha": "10.2.0",
83
102
  "nyc": "15.1.0",
@@ -86,9 +105,9 @@
86
105
  "ts-mocha": "10.0.0",
87
106
  "typescript": "4.4.4",
88
107
  "unionfs": "4.5.1",
89
- "webpack": "4.46.0"
108
+ "webpack": "5.89.0"
90
109
  },
91
110
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api",
92
111
  "sideEffects": false,
93
- "gitHead": "faf939c77591f709afbc23fadbe629c9d3607ef6"
112
+ "gitHead": "7be35c7845e206b27b682e8ce1cee850b09cec04"
94
113
  }