@opentelemetry/api 1.2.0 → 1.3.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 (169) hide show
  1. package/README.md +4 -4
  2. package/build/esm/api/context.js +25 -5
  3. package/build/esm/api/context.js.map +1 -1
  4. package/build/esm/api/diag.d.ts +3 -11
  5. package/build/esm/api/diag.js +38 -7
  6. package/build/esm/api/diag.js.map +1 -1
  7. package/build/esm/api/metrics.d.ts +28 -0
  8. package/build/esm/api/metrics.js +60 -0
  9. package/build/esm/api/metrics.js.map +1 -0
  10. package/build/esm/baggage/internal/baggage-impl.js +41 -4
  11. package/build/esm/baggage/internal/baggage-impl.js.map +1 -1
  12. package/build/esm/context/NoopContextManager.js +25 -5
  13. package/build/esm/context/NoopContextManager.js.map +1 -1
  14. package/build/esm/context-api.d.ts +4 -0
  15. package/build/esm/context-api.js +21 -0
  16. package/build/esm/context-api.js.map +1 -0
  17. package/build/esm/diag/ComponentLogger.js +26 -1
  18. package/build/esm/diag/ComponentLogger.js.map +1 -1
  19. package/build/esm/diag/types.d.ts +30 -0
  20. package/build/esm/diag/types.js.map +1 -1
  21. package/build/esm/diag-api.d.ts +9 -0
  22. package/build/esm/diag-api.js +26 -0
  23. package/build/esm/diag-api.js.map +1 -0
  24. package/build/esm/index.d.ts +44 -48
  25. package/build/esm/index.js +29 -43
  26. package/build/esm/index.js.map +1 -1
  27. package/build/esm/internal/global-utils.d.ts +3 -1
  28. package/build/esm/internal/global-utils.js.map +1 -1
  29. package/build/esm/metrics/Meter.d.ts +104 -0
  30. package/build/esm/{diag/index.js → metrics/Meter.js} +2 -3
  31. package/build/esm/metrics/Meter.js.map +1 -0
  32. package/build/esm/metrics/MeterProvider.d.ts +17 -0
  33. package/build/esm/metrics/MeterProvider.js +17 -0
  34. package/build/esm/metrics/MeterProvider.js.map +1 -0
  35. package/build/esm/metrics/Metric.d.ts +97 -0
  36. package/build/esm/metrics/Metric.js +22 -0
  37. package/build/esm/metrics/Metric.js.map +1 -0
  38. package/build/esm/metrics/NoopMeter.d.ts +74 -0
  39. package/build/esm/metrics/NoopMeter.js +165 -0
  40. package/build/esm/metrics/NoopMeter.js.map +1 -0
  41. package/build/esm/metrics/NoopMeterProvider.d.ts +11 -0
  42. package/build/esm/metrics/NoopMeterProvider.js +31 -0
  43. package/build/esm/metrics/NoopMeterProvider.js.map +1 -0
  44. package/build/esm/metrics/ObservableResult.d.ts +31 -0
  45. package/build/esm/metrics/ObservableResult.js +17 -0
  46. package/build/esm/metrics/ObservableResult.js.map +1 -0
  47. package/build/esm/metrics-api.d.ts +4 -0
  48. package/build/esm/metrics-api.js +21 -0
  49. package/build/esm/metrics-api.js.map +1 -0
  50. package/build/esm/platform/browser/globalThis.js +1 -2
  51. package/build/esm/platform/browser/globalThis.js.map +1 -1
  52. package/build/esm/propagation-api.d.ts +4 -0
  53. package/build/esm/propagation-api.js +21 -0
  54. package/build/esm/propagation-api.js.map +1 -0
  55. package/build/esm/trace/NoopTracer.js +3 -3
  56. package/build/esm/trace/NoopTracer.js.map +1 -1
  57. package/build/esm/trace-api.d.ts +4 -0
  58. package/build/esm/trace-api.js +21 -0
  59. package/build/esm/trace-api.js.map +1 -0
  60. package/build/esm/version.d.ts +1 -1
  61. package/build/esm/version.js +1 -1
  62. package/build/esm/version.js.map +1 -1
  63. package/build/src/api/context.js +26 -38
  64. package/build/src/api/context.js.map +1 -1
  65. package/build/src/api/diag.d.ts +3 -11
  66. package/build/src/api/diag.js +33 -33
  67. package/build/src/api/diag.js.map +1 -1
  68. package/build/src/api/metrics.d.ts +28 -0
  69. package/build/src/api/metrics.js +61 -0
  70. package/build/src/api/metrics.js.map +1 -0
  71. package/build/src/api/propagation.js +28 -31
  72. package/build/src/api/propagation.js.map +1 -1
  73. package/build/src/api/trace.js +22 -23
  74. package/build/src/api/trace.js.map +1 -1
  75. package/build/src/baggage/context-helpers.js +2 -2
  76. package/build/src/baggage/context-helpers.js.map +1 -1
  77. package/build/src/baggage/internal/baggage-impl.js +21 -30
  78. package/build/src/baggage/internal/baggage-impl.js.map +1 -1
  79. package/build/src/baggage/utils.js +7 -8
  80. package/build/src/baggage/utils.js.map +1 -1
  81. package/build/src/context/NoopContextManager.js +14 -26
  82. package/build/src/context/NoopContextManager.js.map +1 -1
  83. package/build/src/context/context.js +9 -10
  84. package/build/src/context/context.js.map +1 -1
  85. package/build/src/context-api.d.ts +4 -0
  86. package/build/src/{diag/index.js → context-api.js} +7 -13
  87. package/build/src/context-api.js.map +1 -0
  88. package/build/src/diag/ComponentLogger.js +16 -37
  89. package/build/src/diag/ComponentLogger.js.map +1 -1
  90. package/build/src/diag/consoleLogger.js +7 -12
  91. package/build/src/diag/consoleLogger.js.map +1 -1
  92. package/build/src/diag/internal/logLevelLogger.js +2 -2
  93. package/build/src/diag/internal/logLevelLogger.js.map +1 -1
  94. package/build/src/diag/types.d.ts +30 -0
  95. package/build/src/diag/types.js.map +1 -1
  96. package/build/src/diag-api.d.ts +9 -0
  97. package/build/src/diag-api.js +29 -0
  98. package/build/src/diag-api.js.map +1 -0
  99. package/build/src/index.d.ts +44 -48
  100. package/build/src/index.js +49 -56
  101. package/build/src/index.js.map +1 -1
  102. package/build/src/internal/global-utils.d.ts +3 -1
  103. package/build/src/internal/global-utils.js +15 -16
  104. package/build/src/internal/global-utils.js.map +1 -1
  105. package/build/src/internal/semver.js +9 -9
  106. package/build/src/internal/semver.js.map +1 -1
  107. package/build/src/metrics/Meter.d.ts +104 -0
  108. package/build/src/metrics/Meter.js +18 -0
  109. package/build/src/metrics/Meter.js.map +1 -0
  110. package/build/src/metrics/MeterProvider.d.ts +17 -0
  111. package/build/src/metrics/MeterProvider.js +18 -0
  112. package/build/src/metrics/MeterProvider.js.map +1 -0
  113. package/build/src/metrics/Metric.d.ts +97 -0
  114. package/build/src/metrics/Metric.js +25 -0
  115. package/build/src/metrics/Metric.js.map +1 -0
  116. package/build/src/metrics/NoopMeter.d.ts +74 -0
  117. package/build/src/metrics/NoopMeter.js +116 -0
  118. package/build/src/metrics/NoopMeter.js.map +1 -0
  119. package/build/src/metrics/NoopMeterProvider.d.ts +11 -0
  120. package/build/src/metrics/NoopMeterProvider.js +31 -0
  121. package/build/src/metrics/NoopMeterProvider.js.map +1 -0
  122. package/build/src/metrics/ObservableResult.d.ts +31 -0
  123. package/build/src/metrics/ObservableResult.js +18 -0
  124. package/build/src/metrics/ObservableResult.js.map +1 -0
  125. package/build/src/metrics-api.d.ts +4 -0
  126. package/build/src/metrics-api.js +24 -0
  127. package/build/src/metrics-api.js.map +1 -0
  128. package/build/src/platform/browser/globalThis.js +1 -2
  129. package/build/src/platform/browser/globalThis.js.map +1 -1
  130. package/build/src/propagation/NoopTextMapPropagator.js +7 -10
  131. package/build/src/propagation/NoopTextMapPropagator.js.map +1 -1
  132. package/build/src/propagation/TextMapPropagator.js +3 -3
  133. package/build/src/propagation/TextMapPropagator.js.map +1 -1
  134. package/build/src/propagation-api.d.ts +4 -0
  135. package/build/src/propagation-api.js +24 -0
  136. package/build/src/propagation-api.js.map +1 -0
  137. package/build/src/trace/NonRecordingSpan.js +20 -22
  138. package/build/src/trace/NonRecordingSpan.js.map +1 -1
  139. package/build/src/trace/NoopTracer.js +21 -24
  140. package/build/src/trace/NoopTracer.js.map +1 -1
  141. package/build/src/trace/NoopTracerProvider.js +5 -8
  142. package/build/src/trace/NoopTracerProvider.js.map +1 -1
  143. package/build/src/trace/ProxyTracer.js +13 -14
  144. package/build/src/trace/ProxyTracer.js.map +1 -1
  145. package/build/src/trace/ProxyTracerProvider.js +13 -16
  146. package/build/src/trace/ProxyTracerProvider.js.map +1 -1
  147. package/build/src/trace/context-utils.js +4 -4
  148. package/build/src/trace/context-utils.js.map +1 -1
  149. package/build/src/trace/internal/tracestate-impl.js +33 -35
  150. package/build/src/trace/internal/tracestate-impl.js.map +1 -1
  151. package/build/src/trace/internal/tracestate-validators.js +6 -6
  152. package/build/src/trace/internal/tracestate-validators.js.map +1 -1
  153. package/build/src/trace/internal/utils.js +1 -1
  154. package/build/src/trace/internal/utils.js.map +1 -1
  155. package/build/src/trace/invalid-span-constants.js +1 -1
  156. package/build/src/trace/invalid-span-constants.js.map +1 -1
  157. package/build/src/trace/spancontext-utils.js +4 -4
  158. package/build/src/trace/spancontext-utils.js.map +1 -1
  159. package/build/src/trace-api.d.ts +4 -0
  160. package/build/src/trace-api.js +24 -0
  161. package/build/src/{diag/index.js.map → trace-api.js.map} +1 -1
  162. package/build/src/version.d.ts +1 -1
  163. package/build/src/version.js +1 -1
  164. package/build/src/version.js.map +1 -1
  165. package/package.json +34 -34
  166. package/CHANGELOG.md +0 -212
  167. package/build/esm/diag/index.d.ts +0 -3
  168. package/build/esm/diag/index.js.map +0 -1
  169. package/build/src/diag/index.d.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AA+CH;;;;GAIG;AACH,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AA+CH;;;;GAIG;AACH,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAwBvB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\nexport interface LoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link LoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: LoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { DiagAPI } from './api/diag';
2
+ /**
3
+ * Entrypoint for Diag API.
4
+ * Defines Diagnostic handler used for internal diagnostic logging operations.
5
+ * The default provides a Noop DiagLogger implementation which may be changed via the
6
+ * diag.setLogger(logger: DiagLogger) function.
7
+ */
8
+ export declare const diag: DiagAPI;
9
+ //# sourceMappingURL=diag-api.d.ts.map
@@ -0,0 +1,29 @@
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
+ exports.diag = void 0;
19
+ // Split module-level variable definition into separate files to allow
20
+ // tree-shaking on each api instance.
21
+ const diag_1 = require("./api/diag");
22
+ /**
23
+ * Entrypoint for Diag API.
24
+ * Defines Diagnostic handler used for internal diagnostic logging operations.
25
+ * The default provides a Noop DiagLogger implementation which may be changed via the
26
+ * diag.setLogger(logger: DiagLogger) function.
27
+ */
28
+ exports.diag = diag_1.DiagAPI.instance();
29
+ //# sourceMappingURL=diag-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,qCAAqC;AACrC;;;;;GAKG;AACU,QAAA,IAAI,GAAG,cAAO,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n */\nexport const diag = DiagAPI.instance();\n"]}
@@ -1,57 +1,53 @@
1
- export * from './baggage/types';
1
+ export { BaggageEntry, BaggageEntryMetadata, Baggage, } from './baggage/types';
2
2
  export { baggageEntryMetadataFromString } from './baggage/utils';
3
- export * from './common/Exception';
4
- export * from './common/Time';
5
- export * from './common/Attributes';
6
- export * from './diag';
7
- export * from './propagation/TextMapPropagator';
8
- export * from './trace/attributes';
9
- export * from './trace/link';
10
- export * from './trace/ProxyTracer';
11
- export * from './trace/ProxyTracerProvider';
12
- export * from './trace/Sampler';
13
- export * from './trace/SamplingResult';
14
- export * from './trace/span_context';
15
- export * from './trace/span_kind';
16
- export * from './trace/span';
17
- export * from './trace/SpanOptions';
18
- export * from './trace/status';
19
- export * from './trace/trace_flags';
20
- export * from './trace/trace_state';
3
+ export { Exception } from './common/Exception';
4
+ export { HrTime, TimeInput } from './common/Time';
5
+ export { Attributes, AttributeValue } from './common/Attributes';
6
+ export { createContextKey, ROOT_CONTEXT, } from './context/context';
7
+ export { Context, ContextManager, } from './context/types';
8
+ export type { ContextAPI } from './api/context';
9
+ export { DiagConsoleLogger } from './diag/consoleLogger';
10
+ export { DiagLogFunction, DiagLogger, DiagLogLevel, ComponentLoggerOptions, } from './diag/types';
11
+ export type { DiagAPI } from './api/diag';
12
+ export { createNoopMeter, } from './metrics/NoopMeter';
13
+ export { MeterOptions, Meter, } from './metrics/Meter';
14
+ export { MeterProvider, } from './metrics/MeterProvider';
15
+ export { ValueType, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, BatchObservableCallback, MetricAttributes, MetricAttributeValue, ObservableCallback, } from './metrics/Metric';
16
+ export { BatchObservableResult, ObservableResult, } from './metrics/ObservableResult';
17
+ export { TextMapPropagator, TextMapSetter, TextMapGetter, defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
18
+ export type { PropagationAPI } from './api/propagation';
19
+ export { SpanAttributes, SpanAttributeValue, } from './trace/attributes';
20
+ export { Link } from './trace/link';
21
+ export { ProxyTracer, TracerDelegator } from './trace/ProxyTracer';
22
+ export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
23
+ export { Sampler } from './trace/Sampler';
24
+ export { SamplingDecision, SamplingResult } from './trace/SamplingResult';
25
+ export { SpanContext } from './trace/span_context';
26
+ export { SpanKind } from './trace/span_kind';
27
+ export { Span } from './trace/span';
28
+ export { SpanOptions } from './trace/SpanOptions';
29
+ export { SpanStatus, SpanStatusCode } from './trace/status';
30
+ export { TraceFlags } from './trace/trace_flags';
31
+ export { TraceState } from './trace/trace_state';
21
32
  export { createTraceState } from './trace/internal/utils';
22
- export * from './trace/tracer_provider';
23
- export * from './trace/tracer';
24
- export * from './trace/tracer_options';
33
+ export { TracerProvider } from './trace/tracer_provider';
34
+ export { Tracer } from './trace/tracer';
35
+ export { TracerOptions } from './trace/tracer_options';
25
36
  export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils';
26
37
  export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants';
27
- export * from './context/context';
28
- export * from './context/types';
29
- import { ContextAPI } from './api/context';
30
- export type { ContextAPI } from './api/context';
31
- /** Entrypoint for context API */
32
- export declare const context: ContextAPI;
33
- import { TraceAPI } from './api/trace';
34
38
  export type { TraceAPI } from './api/trace';
35
- /** Entrypoint for trace API */
36
- export declare const trace: TraceAPI;
37
- import { PropagationAPI } from './api/propagation';
38
- export type { PropagationAPI } from './api/propagation';
39
- /** Entrypoint for propagation API */
40
- export declare const propagation: PropagationAPI;
41
- import { DiagAPI } from './api/diag';
42
- export type { DiagAPI } from './api/diag';
43
- /**
44
- * Entrypoint for Diag API.
45
- * Defines Diagnostic handler used for internal diagnostic logging operations.
46
- * The default provides a Noop DiagLogger implementation which may be changed via the
47
- * diag.setLogger(logger: DiagLogger) function.
48
- */
49
- export declare const diag: DiagAPI;
39
+ import { context } from './context-api';
40
+ import { diag } from './diag-api';
41
+ import { metrics } from './metrics-api';
42
+ import { propagation } from './propagation-api';
43
+ import { trace } from './trace-api';
44
+ export { context, diag, metrics, propagation, trace, };
50
45
  declare const _default: {
51
- trace: TraceAPI;
52
- context: ContextAPI;
53
- propagation: PropagationAPI;
54
- diag: DiagAPI;
46
+ context: import("./api/context").ContextAPI;
47
+ diag: import("./api/diag").DiagAPI;
48
+ metrics: import("./api/metrics").MetricsAPI;
49
+ propagation: import("./api/propagation").PropagationAPI;
50
+ trace: import("./api/trace").TraceAPI;
55
51
  };
56
52
  export default _default;
57
53
  //# sourceMappingURL=index.d.ts.map
@@ -14,44 +14,42 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
- };
27
17
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.diag = exports.propagation = exports.trace = exports.context = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = exports.isValidSpanId = exports.isValidTraceId = exports.isSpanContextValid = exports.createTraceState = exports.baggageEntryMetadataFromString = void 0;
29
- __exportStar(require("./baggage/types"), exports);
18
+ exports.trace = exports.propagation = exports.metrics = exports.diag = exports.context = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = exports.isValidSpanId = exports.isValidTraceId = exports.isSpanContextValid = exports.createTraceState = exports.TraceFlags = exports.SpanStatusCode = exports.SpanKind = exports.SamplingDecision = exports.ProxyTracerProvider = exports.ProxyTracer = exports.defaultTextMapSetter = exports.defaultTextMapGetter = exports.ValueType = exports.createNoopMeter = exports.DiagLogLevel = exports.DiagConsoleLogger = exports.ROOT_CONTEXT = exports.createContextKey = exports.baggageEntryMetadataFromString = void 0;
30
19
  var utils_1 = require("./baggage/utils");
31
20
  Object.defineProperty(exports, "baggageEntryMetadataFromString", { enumerable: true, get: function () { return utils_1.baggageEntryMetadataFromString; } });
32
- __exportStar(require("./common/Exception"), exports);
33
- __exportStar(require("./common/Time"), exports);
34
- __exportStar(require("./common/Attributes"), exports);
35
- __exportStar(require("./diag"), exports);
36
- __exportStar(require("./propagation/TextMapPropagator"), exports);
37
- __exportStar(require("./trace/attributes"), exports);
38
- __exportStar(require("./trace/link"), exports);
39
- __exportStar(require("./trace/ProxyTracer"), exports);
40
- __exportStar(require("./trace/ProxyTracerProvider"), exports);
41
- __exportStar(require("./trace/Sampler"), exports);
42
- __exportStar(require("./trace/SamplingResult"), exports);
43
- __exportStar(require("./trace/span_context"), exports);
44
- __exportStar(require("./trace/span_kind"), exports);
45
- __exportStar(require("./trace/span"), exports);
46
- __exportStar(require("./trace/SpanOptions"), exports);
47
- __exportStar(require("./trace/status"), exports);
48
- __exportStar(require("./trace/trace_flags"), exports);
49
- __exportStar(require("./trace/trace_state"), exports);
21
+ // Context APIs
22
+ var context_1 = require("./context/context");
23
+ Object.defineProperty(exports, "createContextKey", { enumerable: true, get: function () { return context_1.createContextKey; } });
24
+ Object.defineProperty(exports, "ROOT_CONTEXT", { enumerable: true, get: function () { return context_1.ROOT_CONTEXT; } });
25
+ // Diag APIs
26
+ var consoleLogger_1 = require("./diag/consoleLogger");
27
+ Object.defineProperty(exports, "DiagConsoleLogger", { enumerable: true, get: function () { return consoleLogger_1.DiagConsoleLogger; } });
28
+ var types_1 = require("./diag/types");
29
+ Object.defineProperty(exports, "DiagLogLevel", { enumerable: true, get: function () { return types_1.DiagLogLevel; } });
30
+ // Metrics APIs
31
+ var NoopMeter_1 = require("./metrics/NoopMeter");
32
+ Object.defineProperty(exports, "createNoopMeter", { enumerable: true, get: function () { return NoopMeter_1.createNoopMeter; } });
33
+ var Metric_1 = require("./metrics/Metric");
34
+ Object.defineProperty(exports, "ValueType", { enumerable: true, get: function () { return Metric_1.ValueType; } });
35
+ // Propagation APIs
36
+ var TextMapPropagator_1 = require("./propagation/TextMapPropagator");
37
+ Object.defineProperty(exports, "defaultTextMapGetter", { enumerable: true, get: function () { return TextMapPropagator_1.defaultTextMapGetter; } });
38
+ Object.defineProperty(exports, "defaultTextMapSetter", { enumerable: true, get: function () { return TextMapPropagator_1.defaultTextMapSetter; } });
39
+ var ProxyTracer_1 = require("./trace/ProxyTracer");
40
+ Object.defineProperty(exports, "ProxyTracer", { enumerable: true, get: function () { return ProxyTracer_1.ProxyTracer; } });
41
+ var ProxyTracerProvider_1 = require("./trace/ProxyTracerProvider");
42
+ Object.defineProperty(exports, "ProxyTracerProvider", { enumerable: true, get: function () { return ProxyTracerProvider_1.ProxyTracerProvider; } });
43
+ var SamplingResult_1 = require("./trace/SamplingResult");
44
+ Object.defineProperty(exports, "SamplingDecision", { enumerable: true, get: function () { return SamplingResult_1.SamplingDecision; } });
45
+ var span_kind_1 = require("./trace/span_kind");
46
+ Object.defineProperty(exports, "SpanKind", { enumerable: true, get: function () { return span_kind_1.SpanKind; } });
47
+ var status_1 = require("./trace/status");
48
+ Object.defineProperty(exports, "SpanStatusCode", { enumerable: true, get: function () { return status_1.SpanStatusCode; } });
49
+ var trace_flags_1 = require("./trace/trace_flags");
50
+ Object.defineProperty(exports, "TraceFlags", { enumerable: true, get: function () { return trace_flags_1.TraceFlags; } });
50
51
  var utils_2 = require("./trace/internal/utils");
51
52
  Object.defineProperty(exports, "createTraceState", { enumerable: true, get: function () { return utils_2.createTraceState; } });
52
- __exportStar(require("./trace/tracer_provider"), exports);
53
- __exportStar(require("./trace/tracer"), exports);
54
- __exportStar(require("./trace/tracer_options"), exports);
55
53
  var spancontext_utils_1 = require("./trace/spancontext-utils");
56
54
  Object.defineProperty(exports, "isSpanContextValid", { enumerable: true, get: function () { return spancontext_utils_1.isSpanContextValid; } });
57
55
  Object.defineProperty(exports, "isValidTraceId", { enumerable: true, get: function () { return spancontext_utils_1.isValidTraceId; } });
@@ -60,29 +58,24 @@ var invalid_span_constants_1 = require("./trace/invalid-span-constants");
60
58
  Object.defineProperty(exports, "INVALID_SPANID", { enumerable: true, get: function () { return invalid_span_constants_1.INVALID_SPANID; } });
61
59
  Object.defineProperty(exports, "INVALID_TRACEID", { enumerable: true, get: function () { return invalid_span_constants_1.INVALID_TRACEID; } });
62
60
  Object.defineProperty(exports, "INVALID_SPAN_CONTEXT", { enumerable: true, get: function () { return invalid_span_constants_1.INVALID_SPAN_CONTEXT; } });
63
- __exportStar(require("./context/context"), exports);
64
- __exportStar(require("./context/types"), exports);
65
- var context_1 = require("./api/context");
66
- /** Entrypoint for context API */
67
- exports.context = context_1.ContextAPI.getInstance();
68
- var trace_1 = require("./api/trace");
69
- /** Entrypoint for trace API */
70
- exports.trace = trace_1.TraceAPI.getInstance();
71
- var propagation_1 = require("./api/propagation");
72
- /** Entrypoint for propagation API */
73
- exports.propagation = propagation_1.PropagationAPI.getInstance();
74
- var diag_1 = require("./api/diag");
75
- /**
76
- * Entrypoint for Diag API.
77
- * Defines Diagnostic handler used for internal diagnostic logging operations.
78
- * The default provides a Noop DiagLogger implementation which may be changed via the
79
- * diag.setLogger(logger: DiagLogger) function.
80
- */
81
- exports.diag = diag_1.DiagAPI.instance();
61
+ // Split module-level variable definition into separate files to allow
62
+ // tree-shaking on each api instance.
63
+ const context_api_1 = require("./context-api");
64
+ Object.defineProperty(exports, "context", { enumerable: true, get: function () { return context_api_1.context; } });
65
+ const diag_api_1 = require("./diag-api");
66
+ Object.defineProperty(exports, "diag", { enumerable: true, get: function () { return diag_api_1.diag; } });
67
+ const metrics_api_1 = require("./metrics-api");
68
+ Object.defineProperty(exports, "metrics", { enumerable: true, get: function () { return metrics_api_1.metrics; } });
69
+ const propagation_api_1 = require("./propagation-api");
70
+ Object.defineProperty(exports, "propagation", { enumerable: true, get: function () { return propagation_api_1.propagation; } });
71
+ const trace_api_1 = require("./trace-api");
72
+ Object.defineProperty(exports, "trace", { enumerable: true, get: function () { return trace_api_1.trace; } });
73
+ // Default export.
82
74
  exports.default = {
83
- trace: exports.trace,
84
- context: exports.context,
85
- propagation: exports.propagation,
86
- diag: exports.diag,
75
+ context: context_api_1.context,
76
+ diag: diag_api_1.diag,
77
+ metrics: metrics_api_1.metrics,
78
+ propagation: propagation_api_1.propagation,
79
+ trace: trace_api_1.trace,
87
80
  };
88
81
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,kDAAgC;AAChC,yCAAiE;AAAxD,uHAAA,8BAA8B,OAAA;AACvC,qDAAmC;AACnC,gDAA8B;AAC9B,sDAAoC;AACpC,yCAAuB;AACvB,kEAAgD;AAChD,qDAAmC;AACnC,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,kDAAgC;AAChC,yDAAuC;AACvC,uDAAqC;AACrC,oDAAkC;AAClC,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,sDAAoC;AACpC,sDAAoC;AACpC,gDAA0D;AAAjD,yGAAA,gBAAgB,OAAA;AACzB,0DAAwC;AACxC,iDAA+B;AAC/B,yDAAuC;AAEvC,+DAImC;AAHjC,uHAAA,kBAAkB,OAAA;AAClB,mHAAA,cAAc,OAAA;AACd,kHAAA,aAAa,OAAA;AAGf,yEAIwC;AAHtC,wHAAA,cAAc,OAAA;AACd,yHAAA,eAAe,OAAA;AACf,8HAAA,oBAAoB,OAAA;AAGtB,oDAAkC;AAClC,kDAAgC;AAEhC,yCAA2C;AAE3C,iCAAiC;AACpB,QAAA,OAAO,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC;AAEhD,qCAAuC;AAEvC,+BAA+B;AAClB,QAAA,KAAK,GAAG,gBAAQ,CAAC,WAAW,EAAE,CAAC;AAE5C,iDAAmD;AAEnD,qCAAqC;AACxB,QAAA,WAAW,GAAG,4BAAc,CAAC,WAAW,EAAE,CAAC;AAExD,mCAAqC;AAGrC;;;;;GAKG;AACU,QAAA,IAAI,GAAG,cAAO,CAAC,QAAQ,EAAE,CAAC;AAEvC,kBAAe;IACb,KAAK,eAAA;IACL,OAAO,iBAAA;IACP,WAAW,qBAAA;IACX,IAAI,cAAA;CACL,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 * from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport * from './common/Exception';\nexport * from './common/Time';\nexport * from './common/Attributes';\nexport * from './diag';\nexport * from './propagation/TextMapPropagator';\nexport * from './trace/attributes';\nexport * from './trace/link';\nexport * from './trace/ProxyTracer';\nexport * from './trace/ProxyTracerProvider';\nexport * from './trace/Sampler';\nexport * from './trace/SamplingResult';\nexport * from './trace/span_context';\nexport * from './trace/span_kind';\nexport * from './trace/span';\nexport * from './trace/SpanOptions';\nexport * from './trace/status';\nexport * from './trace/trace_flags';\nexport * from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport * from './trace/tracer_provider';\nexport * from './trace/tracer';\nexport * from './trace/tracer_options';\n\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\n\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\n\nexport * from './context/context';\nexport * from './context/types';\n\nimport { ContextAPI } from './api/context';\nexport type { ContextAPI } from './api/context';\n/** Entrypoint for context API */\nexport const context = ContextAPI.getInstance();\n\nimport { TraceAPI } from './api/trace';\nexport type { TraceAPI } from './api/trace';\n/** Entrypoint for trace API */\nexport const trace = TraceAPI.getInstance();\n\nimport { PropagationAPI } from './api/propagation';\nexport type { PropagationAPI } from './api/propagation';\n/** Entrypoint for propagation API */\nexport const propagation = PropagationAPI.getInstance();\n\nimport { DiagAPI } from './api/diag';\nexport type { DiagAPI } from './api/diag';\n\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n */\nexport const diag = DiagAPI.instance();\n\nexport default {\n trace,\n context,\n propagation,\n diag,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAOH,yCAAiE;AAAxD,uHA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L,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 {\n BaggageEntry,\n BaggageEntryMetadata,\n Baggage,\n} 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 {\n createContextKey,\n ROOT_CONTEXT,\n} from './context/context';\nexport {\n Context,\n ContextManager,\n} 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} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport {\n createNoopMeter,\n} from './metrics/NoopMeter';\nexport {\n MeterOptions,\n Meter,\n} from './metrics/Meter';\nexport {\n MeterProvider,\n} 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';\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 {\n SpanAttributes,\n SpanAttributeValue,\n} 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 {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]}
@@ -1,5 +1,6 @@
1
+ import { MeterProvider } from '../metrics/MeterProvider';
1
2
  import { ContextManager } from '../context/types';
2
- import { DiagLogger } from '../diag';
3
+ import { DiagLogger } from '../diag/types';
3
4
  import { TextMapPropagator } from '../propagation/TextMapPropagator';
4
5
  import type { TracerProvider } from '../trace/tracer_provider';
5
6
  export declare function registerGlobal<Type extends keyof OTelGlobalAPI>(type: Type, instance: OTelGlobalAPI[Type], diag: DiagLogger, allowOverride?: boolean): boolean;
@@ -10,6 +11,7 @@ declare type OTelGlobalAPI = {
10
11
  diag?: DiagLogger;
11
12
  trace?: TracerProvider;
12
13
  context?: ContextManager;
14
+ metrics?: MeterProvider;
13
15
  propagation?: TextMapPropagator;
14
16
  };
15
17
  export {};
@@ -16,47 +16,46 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.unregisterGlobal = exports.getGlobal = exports.registerGlobal = void 0;
19
- var platform_1 = require("../platform");
20
- var version_1 = require("../version");
21
- var semver_1 = require("./semver");
22
- var major = version_1.VERSION.split('.')[0];
23
- var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
24
- var _global = platform_1._globalThis;
25
- function registerGlobal(type, instance, diag, allowOverride) {
19
+ const platform_1 = require("../platform");
20
+ const version_1 = require("../version");
21
+ const semver_1 = require("./semver");
22
+ const major = version_1.VERSION.split('.')[0];
23
+ const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
24
+ const _global = platform_1._globalThis;
25
+ function registerGlobal(type, instance, diag, allowOverride = false) {
26
26
  var _a;
27
- if (allowOverride === void 0) { allowOverride = false; }
28
- var api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
27
+ const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
29
28
  version: version_1.VERSION,
30
29
  });
31
30
  if (!allowOverride && api[type]) {
32
31
  // already registered an API of this type
33
- var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type);
32
+ const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
34
33
  diag.error(err.stack || err.message);
35
34
  return false;
36
35
  }
37
36
  if (api.version !== version_1.VERSION) {
38
37
  // All registered APIs must be of the same version exactly
39
- var err = new Error('@opentelemetry/api: All API registration versions must match');
38
+ const err = new Error('@opentelemetry/api: All API registration versions must match');
40
39
  diag.error(err.stack || err.message);
41
40
  return false;
42
41
  }
43
42
  api[type] = instance;
44
- diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + version_1.VERSION + ".");
43
+ diag.debug(`@opentelemetry/api: Registered a global for ${type} v${version_1.VERSION}.`);
45
44
  return true;
46
45
  }
47
46
  exports.registerGlobal = registerGlobal;
48
47
  function getGlobal(type) {
49
48
  var _a, _b;
50
- var globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
51
- if (!globalVersion || !semver_1.isCompatible(globalVersion)) {
49
+ const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
50
+ if (!globalVersion || !(0, semver_1.isCompatible)(globalVersion)) {
52
51
  return;
53
52
  }
54
53
  return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
55
54
  }
56
55
  exports.getGlobal = getGlobal;
57
56
  function unregisterGlobal(type, diag) {
58
- diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + version_1.VERSION + ".");
59
- var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
57
+ diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${version_1.VERSION}.`);
58
+ const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
60
59
  if (api) {
61
60
  delete api[type];
62
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,wCAA0C;AAG1C,sCAAqC;AACrC,mCAAwC;AAExC,IAAM,KAAK,GAAG,iBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,IAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,0BAAwB,KAAO,CAChC,C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;AARD,8BAQC;AAED,SAAgB,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,oDAAkD,IAAI,UAAK,iBAAO,MAAG,CACtE,CAAC;IACF,IAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC;AATD,4CASC","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 { ContextManager } from '../context/types';\nimport { DiagLogger } from '../diag';\nimport { _globalThis } from '../platform';\nimport { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\nconst _global = _globalThis as OTelGlobal;\n\nexport function registerGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n '@opentelemetry/api: All API registration versions must match'\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n propagation?: TextMapPropagator;\n};\n"]}
1
+ {"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,0CAA0C;AAG1C,wCAAqC;AACrC,qCAAwC;AAExC,MAAM,KAAK,GAAG,iBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,wBAAwB,KAAK,EAAE,CAChC,CAAC;AAEF,MAAM,OAAO,GAAG,sBAAyB,CAAC;AAE1C,SAAgB,cAAc,CAC5B,IAAU,EACV,QAA6B,EAC7B,IAAgB,EAChB,aAAa,GAAG,KAAK;;IAErB,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,MAAA,OAAO,CAC1D,4BAA4B,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O,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,CAAC;AATD,4CASC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MeterProvider } from '../metrics/MeterProvider';\nimport { ContextManager } from '../context/types';\nimport { DiagLogger } from '../diag/types';\nimport { _globalThis } from '../platform';\nimport { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\nconst _global = _globalThis as OTelGlobal;\n\nexport function registerGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n '@opentelemetry/api: All API registration versions must match'\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]}
@@ -16,8 +16,8 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isCompatible = exports._makeCompatibilityCheck = void 0;
19
- var version_1 = require("../version");
20
- var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
19
+ const version_1 = require("../version");
20
+ const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
21
21
  /**
22
22
  * Create a function to test an API version to see if it is compatible with the provided ownVersion.
23
23
  *
@@ -35,14 +35,14 @@ var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
35
35
  * @param ownVersion version which should be checked against
36
36
  */
37
37
  function _makeCompatibilityCheck(ownVersion) {
38
- var acceptedVersions = new Set([ownVersion]);
39
- var rejectedVersions = new Set();
40
- var myVersionMatch = ownVersion.match(re);
38
+ const acceptedVersions = new Set([ownVersion]);
39
+ const rejectedVersions = new Set();
40
+ const myVersionMatch = ownVersion.match(re);
41
41
  if (!myVersionMatch) {
42
42
  // we cannot guarantee compatibility so we always return noop
43
- return function () { return false; };
43
+ return () => false;
44
44
  }
45
- var ownVersionParsed = {
45
+ const ownVersionParsed = {
46
46
  major: +myVersionMatch[1],
47
47
  minor: +myVersionMatch[2],
48
48
  patch: +myVersionMatch[3],
@@ -69,13 +69,13 @@ function _makeCompatibilityCheck(ownVersion) {
69
69
  if (rejectedVersions.has(globalVersion)) {
70
70
  return false;
71
71
  }
72
- var globalVersionMatch = globalVersion.match(re);
72
+ const globalVersionMatch = globalVersion.match(re);
73
73
  if (!globalVersionMatch) {
74
74
  // cannot parse other version
75
75
  // we cannot guarantee compatibility so we always noop
76
76
  return _reject(globalVersion);
77
77
  }
78
- var globalVersionParsed = {
78
+ const globalVersionParsed = {
79
79
  major: +globalVersionMatch[1],
80
80
  minor: +globalVersionMatch[2],
81
81
  patch: +globalVersionMatch[3],
@@ -1 +1 @@
1
- {"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sCAAqC;AAErC,IAAM,EAAE,GAAG,+BAA+B,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,uBAAuB,CACrC,UAAkB;IAElB,IAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,IAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,IAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,EAAE;QACnB,6DAA6D;QAC7D,OAAO,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC;KACpB;IAED,IAAM,gBAAgB,GAAG;QACvB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;KAC9B,CAAC;IAEF,kEAAkE;IAClE,IAAI,gBAAgB,CAAC,UAAU,IAAI,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AK,KAAK,CAAC,EAAE;YAChC,IACE,gBAAgB,CAAC,KAAK,KAAK,mBAAmB,CAAC,KAAK;gBACpD,gBAAgB,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,EACnD;gBACA,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;aAC/B;YAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,IAAI,gBAAgB,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,EAAE;YACvD,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAtFD,0DAsFC;AAED;;;;;;;;;;;;;;GAcG;AACU,QAAA,YAAY,GAAG,uBAAuB,CAAC,iBAAO,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set<string>([ownVersion]);\n const rejectedVersions = new Set<string>();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]}
1
+ {"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../src/internal/semver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,wCAAqC;AAErC,MAAM,EAAE,GAAG,+BAA+B,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,uBAAuB,CACrC,UAAkB;IAElB,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,EAAE;QACnB,6DAA6D;QAC7D,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;KACpB;IAED,MAAM,gBAAgB,GAAG;QACvB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;KAC9B,CAAC;IAEF,kEAAkE;IAClE,IAAI,gBAAgB,CAAC,UAAU,IAAI,IAAI,EAAE;QACvC,OAAO,SAAS,YAAY,CAAC,aAAqB;YAChD,OAAO,aAAa,KAAK,UAAU,CAAC;QACtC,CAAC,CAAC;KACH;IAED,SAAS,OAAO,CAA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AAK,EACnD;gBACA,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;aAC/B;YAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,IAAI,gBAAgB,CAAC,KAAK,IAAI,mBAAmB,CAAC,KAAK,EAAE;YACvD,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;SAC/B;QAED,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAtFD,0DAsFC;AAED;;;;;;;;;;;;;;GAcG;AACU,QAAA,YAAY,GAAG,uBAAuB,CAAC,iBAAO,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { VERSION } from '../version';\n\nconst re = /^(\\d+)\\.(\\d+)\\.(\\d+)(-(.+))?$/;\n\n/**\n * Create a function to test an API version to see if it is compatible with the provided ownVersion.\n *\n * The returned function has the following semantics:\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param ownVersion version which should be checked against\n */\nexport function _makeCompatibilityCheck(\n ownVersion: string\n): (globalVersion: string) => boolean {\n const acceptedVersions = new Set<string>([ownVersion]);\n const rejectedVersions = new Set<string>();\n\n const myVersionMatch = ownVersion.match(re);\n if (!myVersionMatch) {\n // we cannot guarantee compatibility so we always return noop\n return () => false;\n }\n\n const ownVersionParsed = {\n major: +myVersionMatch[1],\n minor: +myVersionMatch[2],\n patch: +myVersionMatch[3],\n prerelease: myVersionMatch[4],\n };\n\n // if ownVersion has a prerelease tag, versions must match exactly\n if (ownVersionParsed.prerelease != null) {\n return function isExactmatch(globalVersion: string): boolean {\n return globalVersion === ownVersion;\n };\n }\n\n function _reject(v: string) {\n rejectedVersions.add(v);\n return false;\n }\n\n function _accept(v: string) {\n acceptedVersions.add(v);\n return true;\n }\n\n return function isCompatible(globalVersion: string): boolean {\n if (acceptedVersions.has(globalVersion)) {\n return true;\n }\n\n if (rejectedVersions.has(globalVersion)) {\n return false;\n }\n\n const globalVersionMatch = globalVersion.match(re);\n if (!globalVersionMatch) {\n // cannot parse other version\n // we cannot guarantee compatibility so we always noop\n return _reject(globalVersion);\n }\n\n const globalVersionParsed = {\n major: +globalVersionMatch[1],\n minor: +globalVersionMatch[2],\n patch: +globalVersionMatch[3],\n prerelease: globalVersionMatch[4],\n };\n\n // if globalVersion has a prerelease tag, versions must match exactly\n if (globalVersionParsed.prerelease != null) {\n return _reject(globalVersion);\n }\n\n // major versions must match\n if (ownVersionParsed.major !== globalVersionParsed.major) {\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.major === 0) {\n if (\n ownVersionParsed.minor === globalVersionParsed.minor &&\n ownVersionParsed.patch <= globalVersionParsed.patch\n ) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n }\n\n if (ownVersionParsed.minor <= globalVersionParsed.minor) {\n return _accept(globalVersion);\n }\n\n return _reject(globalVersion);\n };\n}\n\n/**\n * Test an API version to see if it is compatible with this API.\n *\n * - Exact match is always compatible\n * - Major versions must match exactly\n * - 1.x package cannot use global 2.x package\n * - 2.x package cannot use global 1.x package\n * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API\n * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects\n * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3\n * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor\n * - Patch and build tag differences are not considered at this time\n *\n * @param version version of the API requesting an instance of the global API\n */\nexport const isCompatible = _makeCompatibilityCheck(VERSION);\n"]}