@opentelemetry/api 1.1.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 (187) 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/api/trace.d.ts +2 -1
  11. package/build/esm/api/trace.js +2 -1
  12. package/build/esm/api/trace.js.map +1 -1
  13. package/build/esm/baggage/internal/baggage-impl.js +41 -4
  14. package/build/esm/baggage/internal/baggage-impl.js.map +1 -1
  15. package/build/esm/context/NoopContextManager.js +25 -5
  16. package/build/esm/context/NoopContextManager.js.map +1 -1
  17. package/build/esm/context-api.d.ts +4 -0
  18. package/build/esm/context-api.js +21 -0
  19. package/build/esm/context-api.js.map +1 -0
  20. package/build/esm/diag/ComponentLogger.js +26 -1
  21. package/build/esm/diag/ComponentLogger.js.map +1 -1
  22. package/build/esm/diag/types.d.ts +30 -0
  23. package/build/esm/diag/types.js.map +1 -1
  24. package/build/esm/diag-api.d.ts +9 -0
  25. package/build/esm/diag-api.js +26 -0
  26. package/build/esm/diag-api.js.map +1 -0
  27. package/build/esm/index.d.ts +44 -48
  28. package/build/esm/index.js +29 -43
  29. package/build/esm/index.js.map +1 -1
  30. package/build/esm/internal/global-utils.d.ts +3 -1
  31. package/build/esm/internal/global-utils.js.map +1 -1
  32. package/build/esm/metrics/Meter.d.ts +104 -0
  33. package/build/esm/{diag/index.js → metrics/Meter.js} +2 -3
  34. package/build/esm/metrics/Meter.js.map +1 -0
  35. package/build/esm/metrics/MeterProvider.d.ts +17 -0
  36. package/build/esm/metrics/MeterProvider.js +17 -0
  37. package/build/esm/metrics/MeterProvider.js.map +1 -0
  38. package/build/esm/metrics/Metric.d.ts +97 -0
  39. package/build/esm/metrics/Metric.js +22 -0
  40. package/build/esm/metrics/Metric.js.map +1 -0
  41. package/build/esm/metrics/NoopMeter.d.ts +74 -0
  42. package/build/esm/metrics/NoopMeter.js +165 -0
  43. package/build/esm/metrics/NoopMeter.js.map +1 -0
  44. package/build/esm/metrics/NoopMeterProvider.d.ts +11 -0
  45. package/build/esm/metrics/NoopMeterProvider.js +31 -0
  46. package/build/esm/metrics/NoopMeterProvider.js.map +1 -0
  47. package/build/esm/metrics/ObservableResult.d.ts +31 -0
  48. package/build/esm/metrics/ObservableResult.js +17 -0
  49. package/build/esm/metrics/ObservableResult.js.map +1 -0
  50. package/build/esm/metrics-api.d.ts +4 -0
  51. package/build/esm/metrics-api.js +21 -0
  52. package/build/esm/metrics-api.js.map +1 -0
  53. package/build/esm/platform/browser/globalThis.js +1 -2
  54. package/build/esm/platform/browser/globalThis.js.map +1 -1
  55. package/build/esm/propagation-api.d.ts +4 -0
  56. package/build/esm/propagation-api.js +21 -0
  57. package/build/esm/propagation-api.js.map +1 -0
  58. package/build/esm/trace/NoopTracer.js +3 -3
  59. package/build/esm/trace/NoopTracer.js.map +1 -1
  60. package/build/esm/trace/Sampler.d.ts +1 -0
  61. package/build/esm/trace/Sampler.js.map +1 -1
  62. package/build/esm/trace/SamplingResult.d.ts +2 -0
  63. package/build/esm/trace/SamplingResult.js +1 -0
  64. package/build/esm/trace/SamplingResult.js.map +1 -1
  65. package/build/esm/trace/context-utils.d.ts +4 -0
  66. package/build/esm/trace/context-utils.js +7 -0
  67. package/build/esm/trace/context-utils.js.map +1 -1
  68. package/build/esm/trace-api.d.ts +4 -0
  69. package/build/esm/trace-api.js +21 -0
  70. package/build/esm/trace-api.js.map +1 -0
  71. package/build/esm/version.d.ts +1 -1
  72. package/build/esm/version.js +1 -1
  73. package/build/esm/version.js.map +1 -1
  74. package/build/src/api/context.js +26 -38
  75. package/build/src/api/context.js.map +1 -1
  76. package/build/src/api/diag.d.ts +3 -11
  77. package/build/src/api/diag.js +33 -33
  78. package/build/src/api/diag.js.map +1 -1
  79. package/build/src/api/metrics.d.ts +28 -0
  80. package/build/src/api/metrics.js +61 -0
  81. package/build/src/api/metrics.js.map +1 -0
  82. package/build/src/api/propagation.js +28 -31
  83. package/build/src/api/propagation.js.map +1 -1
  84. package/build/src/api/trace.d.ts +2 -1
  85. package/build/src/api/trace.js +23 -23
  86. package/build/src/api/trace.js.map +1 -1
  87. package/build/src/baggage/context-helpers.js +2 -2
  88. package/build/src/baggage/context-helpers.js.map +1 -1
  89. package/build/src/baggage/internal/baggage-impl.js +21 -30
  90. package/build/src/baggage/internal/baggage-impl.js.map +1 -1
  91. package/build/src/baggage/utils.js +7 -8
  92. package/build/src/baggage/utils.js.map +1 -1
  93. package/build/src/context/NoopContextManager.js +14 -26
  94. package/build/src/context/NoopContextManager.js.map +1 -1
  95. package/build/src/context/context.js +9 -10
  96. package/build/src/context/context.js.map +1 -1
  97. package/build/src/context-api.d.ts +4 -0
  98. package/build/src/{diag/index.js → context-api.js} +7 -13
  99. package/build/src/context-api.js.map +1 -0
  100. package/build/src/diag/ComponentLogger.js +16 -37
  101. package/build/src/diag/ComponentLogger.js.map +1 -1
  102. package/build/src/diag/consoleLogger.js +7 -12
  103. package/build/src/diag/consoleLogger.js.map +1 -1
  104. package/build/src/diag/internal/logLevelLogger.js +2 -2
  105. package/build/src/diag/internal/logLevelLogger.js.map +1 -1
  106. package/build/src/diag/types.d.ts +30 -0
  107. package/build/src/diag/types.js.map +1 -1
  108. package/build/src/diag-api.d.ts +9 -0
  109. package/build/src/diag-api.js +29 -0
  110. package/build/src/diag-api.js.map +1 -0
  111. package/build/src/index.d.ts +44 -48
  112. package/build/src/index.js +49 -56
  113. package/build/src/index.js.map +1 -1
  114. package/build/src/internal/global-utils.d.ts +3 -1
  115. package/build/src/internal/global-utils.js +15 -16
  116. package/build/src/internal/global-utils.js.map +1 -1
  117. package/build/src/internal/semver.js +9 -9
  118. package/build/src/internal/semver.js.map +1 -1
  119. package/build/src/metrics/Meter.d.ts +104 -0
  120. package/build/src/metrics/Meter.js +18 -0
  121. package/build/src/metrics/Meter.js.map +1 -0
  122. package/build/src/metrics/MeterProvider.d.ts +17 -0
  123. package/build/src/metrics/MeterProvider.js +18 -0
  124. package/build/src/metrics/MeterProvider.js.map +1 -0
  125. package/build/src/metrics/Metric.d.ts +97 -0
  126. package/build/src/metrics/Metric.js +25 -0
  127. package/build/src/metrics/Metric.js.map +1 -0
  128. package/build/src/metrics/NoopMeter.d.ts +74 -0
  129. package/build/src/metrics/NoopMeter.js +116 -0
  130. package/build/src/metrics/NoopMeter.js.map +1 -0
  131. package/build/src/metrics/NoopMeterProvider.d.ts +11 -0
  132. package/build/src/metrics/NoopMeterProvider.js +31 -0
  133. package/build/src/metrics/NoopMeterProvider.js.map +1 -0
  134. package/build/src/metrics/ObservableResult.d.ts +31 -0
  135. package/build/src/metrics/ObservableResult.js +18 -0
  136. package/build/src/metrics/ObservableResult.js.map +1 -0
  137. package/build/src/metrics-api.d.ts +4 -0
  138. package/build/src/metrics-api.js +24 -0
  139. package/build/src/metrics-api.js.map +1 -0
  140. package/build/src/platform/browser/globalThis.js +1 -2
  141. package/build/src/platform/browser/globalThis.js.map +1 -1
  142. package/build/src/propagation/NoopTextMapPropagator.js +7 -10
  143. package/build/src/propagation/NoopTextMapPropagator.js.map +1 -1
  144. package/build/src/propagation/TextMapPropagator.js +3 -3
  145. package/build/src/propagation/TextMapPropagator.js.map +1 -1
  146. package/build/src/propagation-api.d.ts +4 -0
  147. package/build/src/propagation-api.js +24 -0
  148. package/build/src/propagation-api.js.map +1 -0
  149. package/build/src/trace/NonRecordingSpan.js +20 -22
  150. package/build/src/trace/NonRecordingSpan.js.map +1 -1
  151. package/build/src/trace/NoopTracer.js +21 -24
  152. package/build/src/trace/NoopTracer.js.map +1 -1
  153. package/build/src/trace/NoopTracerProvider.js +5 -8
  154. package/build/src/trace/NoopTracerProvider.js.map +1 -1
  155. package/build/src/trace/ProxyTracer.js +13 -14
  156. package/build/src/trace/ProxyTracer.js.map +1 -1
  157. package/build/src/trace/ProxyTracerProvider.js +13 -16
  158. package/build/src/trace/ProxyTracerProvider.js.map +1 -1
  159. package/build/src/trace/Sampler.d.ts +1 -0
  160. package/build/src/trace/Sampler.js.map +1 -1
  161. package/build/src/trace/SamplingResult.d.ts +2 -0
  162. package/build/src/trace/SamplingResult.js +1 -0
  163. package/build/src/trace/SamplingResult.js.map +1 -1
  164. package/build/src/trace/context-utils.d.ts +4 -0
  165. package/build/src/trace/context-utils.js +12 -4
  166. package/build/src/trace/context-utils.js.map +1 -1
  167. package/build/src/trace/internal/tracestate-impl.js +33 -35
  168. package/build/src/trace/internal/tracestate-impl.js.map +1 -1
  169. package/build/src/trace/internal/tracestate-validators.js +6 -6
  170. package/build/src/trace/internal/tracestate-validators.js.map +1 -1
  171. package/build/src/trace/internal/utils.js +1 -1
  172. package/build/src/trace/internal/utils.js.map +1 -1
  173. package/build/src/trace/invalid-span-constants.js +1 -1
  174. package/build/src/trace/invalid-span-constants.js.map +1 -1
  175. package/build/src/trace/spancontext-utils.js +4 -4
  176. package/build/src/trace/spancontext-utils.js.map +1 -1
  177. package/build/src/trace-api.d.ts +4 -0
  178. package/build/src/trace-api.js +24 -0
  179. package/build/src/{diag/index.js.map → trace-api.js.map} +1 -1
  180. package/build/src/version.d.ts +1 -1
  181. package/build/src/version.js +1 -1
  182. package/build/src/version.js.map +1 -1
  183. package/package.json +34 -34
  184. package/CHANGELOG.md +0 -204
  185. package/build/esm/diag/index.d.ts +0 -3
  186. package/build/esm/diag/index.js.map +0 -1
  187. package/build/src/diag/index.d.ts +0 -3
@@ -16,7 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DiagComponentLogger = void 0;
19
- var global_utils_1 = require("../internal/global-utils");
19
+ const global_utils_1 = require("../internal/global-utils");
20
20
  /**
21
21
  * Component Logger which is meant to be used as part of any component which
22
22
  * will add automatically additional namespace in front of the log message.
@@ -26,55 +26,34 @@ var global_utils_1 = require("../internal/global-utils");
26
26
  * cLogger.debug('test');
27
27
  * // @opentelemetry/instrumentation-http test
28
28
  */
29
- var DiagComponentLogger = /** @class */ (function () {
30
- function DiagComponentLogger(props) {
29
+ class DiagComponentLogger {
30
+ constructor(props) {
31
31
  this._namespace = props.namespace || 'DiagComponentLogger';
32
32
  }
33
- DiagComponentLogger.prototype.debug = function () {
34
- var args = [];
35
- for (var _i = 0; _i < arguments.length; _i++) {
36
- args[_i] = arguments[_i];
37
- }
33
+ debug(...args) {
38
34
  return logProxy('debug', this._namespace, args);
39
- };
40
- DiagComponentLogger.prototype.error = function () {
41
- var args = [];
42
- for (var _i = 0; _i < arguments.length; _i++) {
43
- args[_i] = arguments[_i];
44
- }
35
+ }
36
+ error(...args) {
45
37
  return logProxy('error', this._namespace, args);
46
- };
47
- DiagComponentLogger.prototype.info = function () {
48
- var args = [];
49
- for (var _i = 0; _i < arguments.length; _i++) {
50
- args[_i] = arguments[_i];
51
- }
38
+ }
39
+ info(...args) {
52
40
  return logProxy('info', this._namespace, args);
53
- };
54
- DiagComponentLogger.prototype.warn = function () {
55
- var args = [];
56
- for (var _i = 0; _i < arguments.length; _i++) {
57
- args[_i] = arguments[_i];
58
- }
41
+ }
42
+ warn(...args) {
59
43
  return logProxy('warn', this._namespace, args);
60
- };
61
- DiagComponentLogger.prototype.verbose = function () {
62
- var args = [];
63
- for (var _i = 0; _i < arguments.length; _i++) {
64
- args[_i] = arguments[_i];
65
- }
44
+ }
45
+ verbose(...args) {
66
46
  return logProxy('verbose', this._namespace, args);
67
- };
68
- return DiagComponentLogger;
69
- }());
47
+ }
48
+ }
70
49
  exports.DiagComponentLogger = DiagComponentLogger;
71
50
  function logProxy(funcName, namespace, args) {
72
- var logger = global_utils_1.getGlobal('diag');
51
+ const logger = (0, global_utils_1.getGlobal)('diag');
73
52
  // shortcut if logger not set
74
53
  if (!logger) {
75
54
  return;
76
55
  }
77
56
  args.unshift(namespace);
78
- return logger[funcName].apply(logger, args);
57
+ return logger[funcName](...args);
79
58
  }
80
59
  //# sourceMappingURL=ComponentLogger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentLogger.js","sourceRoot":"","sources":["../../../src/diag/ComponentLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yDAAqD;AAGrD;;;;;;;;GAQG;AACH;IAGE,6BAAY,KAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,IAAI,qBAAqB,CAAC;IAC7D,CAAC;IAEM,mCAAK,GAAZ;QAAa,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACzB,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,mCAAK,GAAZ;QAAa,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACzB,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,kCAAI,GAAX;QAAY,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACxB,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,kCAAI,GAAX;QAAY,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACxB,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,qCAAO,GAAd;QAAe,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAC3B,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;IACH,0BAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,kDAAmB;AA4BhC,SAAS,QAAQ,CACf,QAA0B,EAC1B,SAAiB,EACjB,IAAS;IAET,IAAM,MAAM,GAAG,wBAAS,CAAC,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAhB,MAAM,EAAe,IAAoC,EAAE;AACpE,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 { getGlobal } from '../internal/global-utils';\nimport { ComponentLoggerOptions, DiagLogger, DiagLogFunction } from './types';\n\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger implements DiagLogger {\n private _namespace: string;\n\n constructor(props: ComponentLoggerOptions) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n\n public debug(...args: any[]): void {\n return logProxy('debug', this._namespace, args);\n }\n\n public error(...args: any[]): void {\n return logProxy('error', this._namespace, args);\n }\n\n public info(...args: any[]): void {\n return logProxy('info', this._namespace, args);\n }\n\n public warn(...args: any[]): void {\n return logProxy('warn', this._namespace, args);\n }\n\n public verbose(...args: any[]): void {\n return logProxy('verbose', this._namespace, args);\n }\n}\n\nfunction logProxy(\n funcName: keyof DiagLogger,\n namespace: string,\n args: any\n): void {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n\n args.unshift(namespace);\n return logger[funcName](...(args as Parameters<DiagLogFunction>));\n}\n"]}
1
+ {"version":3,"file":"ComponentLogger.js","sourceRoot":"","sources":["../../../src/diag/ComponentLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAAqD;AAGrD;;;;;;;;GAQG;AACH,MAAa,mBAAmB;IAG9B,YAAY,KAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,IAAI,qBAAqB,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,GAAG,IAAW;QACzB,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,GAAG,IAAW;QACzB,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAW;QACxB,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAW;QACxB,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,OAAO,CAAC,GAAG,IAAW;QAC3B,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AA1BD,kDA0BC;AAED,SAAS,QAAQ,CACf,QAA0B,EAC1B,SAAiB,EACjB,IAAS;IAET,MAAM,MAAM,GAAG,IAAA,wBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAI,IAAoC,CAAC,CAAC;AACpE,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 { getGlobal } from '../internal/global-utils';\nimport { ComponentLoggerOptions, DiagLogger, DiagLogFunction } from './types';\n\n/**\n * Component Logger which is meant to be used as part of any component which\n * will add automatically additional namespace in front of the log message.\n * It will then forward all message to global diag logger\n * @example\n * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\n * cLogger.debug('test');\n * // @opentelemetry/instrumentation-http test\n */\nexport class DiagComponentLogger implements DiagLogger {\n private _namespace: string;\n\n constructor(props: ComponentLoggerOptions) {\n this._namespace = props.namespace || 'DiagComponentLogger';\n }\n\n public debug(...args: any[]): void {\n return logProxy('debug', this._namespace, args);\n }\n\n public error(...args: any[]): void {\n return logProxy('error', this._namespace, args);\n }\n\n public info(...args: any[]): void {\n return logProxy('info', this._namespace, args);\n }\n\n public warn(...args: any[]): void {\n return logProxy('warn', this._namespace, args);\n }\n\n public verbose(...args: any[]): void {\n return logProxy('verbose', this._namespace, args);\n }\n}\n\nfunction logProxy(\n funcName: keyof DiagLogger,\n namespace: string,\n args: any\n): void {\n const logger = getGlobal('diag');\n // shortcut if logger not set\n if (!logger) {\n return;\n }\n\n args.unshift(namespace);\n return logger[funcName](...(args as Parameters<DiagLogFunction>));\n}\n"]}
@@ -16,7 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DiagConsoleLogger = void 0;
19
- var consoleMap = [
19
+ const consoleMap = [
20
20
  { n: 'error', c: 'error' },
21
21
  { n: 'warn', c: 'warn' },
22
22
  { n: 'info', c: 'info' },
@@ -28,18 +28,14 @@ var consoleMap = [
28
28
  * If you want to limit the amount of logging to a specific level or lower use the
29
29
  * {@link createLogLevelDiagLogger}
30
30
  */
31
- var DiagConsoleLogger = /** @class */ (function () {
32
- function DiagConsoleLogger() {
31
+ class DiagConsoleLogger {
32
+ constructor() {
33
33
  function _consoleFunc(funcName) {
34
- return function () {
35
- var args = [];
36
- for (var _i = 0; _i < arguments.length; _i++) {
37
- args[_i] = arguments[_i];
38
- }
34
+ return function (...args) {
39
35
  if (console) {
40
36
  // Some environments only expose the console when the F12 developer console is open
41
37
  // eslint-disable-next-line no-console
42
- var theFunc = console[funcName];
38
+ let theFunc = console[funcName];
43
39
  if (typeof theFunc !== 'function') {
44
40
  // Not all environments support all functions
45
41
  // eslint-disable-next-line no-console
@@ -52,11 +48,10 @@ var DiagConsoleLogger = /** @class */ (function () {
52
48
  }
53
49
  };
54
50
  }
55
- for (var i = 0; i < consoleMap.length; i++) {
51
+ for (let i = 0; i < consoleMap.length; i++) {
56
52
  this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);
57
53
  }
58
54
  }
59
- return DiagConsoleLogger;
60
- }());
55
+ }
61
56
  exports.DiagConsoleLogger = DiagConsoleLogger;
62
57
  //# sourceMappingURL=consoleLogger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consoleLogger.js","sourceRoot":"","sources":["../../../src/diag/consoleLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,IAAM,UAAU,GAAiD;IAC/D,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE;CAC7B,CAAC;AAEF;;;;GAIG;AACH;IACE;QACE,SAAS,YAAY,CAAC,QAAwB;YAC5C,OAAO;gBAAU,cAAO;qBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;oBAAP,yBAAO;;gBACtB,IAAI,OAAO,EAAE;oBACX,mFAAmF;oBACnF,sCAAsC;oBACtC,IAAI,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAChC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;wBACjC,6CAA6C;wBAC7C,sCAAsC;wBACtC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;qBACvB;oBAED,uBAAuB;oBACvB,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;wBACjC,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;qBACrC;iBACF;YACH,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;IAkCH,wBAAC;AAAD,CAAC,AA3DD,IA2DC;AA3DY,8CAAiB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DiagLogger, DiagLogFunction } from './types';\n\ntype ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace';\nconst consoleMap: { n: keyof DiagLogger; c: ConsoleMapKeys }[] = [\n { n: 'error', c: 'error' },\n { n: 'warn', c: 'warn' },\n { n: 'info', c: 'info' },\n { n: 'debug', c: 'debug' },\n { n: 'verbose', c: 'trace' },\n];\n\n/**\n * A simple Immutable Console based diagnostic logger which will output any messages to the Console.\n * If you want to limit the amount of logging to a specific level or lower use the\n * {@link createLogLevelDiagLogger}\n */\nexport class DiagConsoleLogger implements DiagLogger {\n constructor() {\n function _consoleFunc(funcName: ConsoleMapKeys): DiagLogFunction {\n return function (...args) {\n if (console) {\n // Some environments only expose the console when the F12 developer console is open\n // eslint-disable-next-line no-console\n let theFunc = console[funcName];\n if (typeof theFunc !== 'function') {\n // Not all environments support all functions\n // eslint-disable-next-line no-console\n theFunc = console.log;\n }\n\n // One last final check\n if (typeof theFunc === 'function') {\n return theFunc.apply(console, args);\n }\n }\n };\n }\n\n for (let i = 0; i < consoleMap.length; i++) {\n this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);\n }\n }\n\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n public 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 public 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 public 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. Useful scenarios would be to log the execution\n * order of async operations\n */\n public 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 public verbose!: DiagLogFunction;\n}\n"]}
1
+ {"version":3,"file":"consoleLogger.js","sourceRoot":"","sources":["../../../src/diag/consoleLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,MAAM,UAAU,GAAiD;IAC/D,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE;IACxB,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1B,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAa,iBAAiB;IAC5B;QACE,SAAS,YAAY,CAAC,QAAwB;YAC5C,OAAO,UAAU,GAAG,IAAI;gBACtB,IAAI,OAAO,EAAE;oBACX,mFAAmF;oBACnF,sCAAsC;oBACtC,IAAI,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAChC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;wBACjC,6CAA6C;wBAC7C,sCAAsC;wBACtC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;qBACvB;oBAED,uBAAuB;oBACvB,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;wBACjC,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;qBACrC;iBACF;YACH,CAAC,CAAC;QACJ,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;CAkCF;AA3DD,8CA2DC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DiagLogger, DiagLogFunction } from './types';\n\ntype ConsoleMapKeys = 'error' | 'warn' | 'info' | 'debug' | 'trace';\nconst consoleMap: { n: keyof DiagLogger; c: ConsoleMapKeys }[] = [\n { n: 'error', c: 'error' },\n { n: 'warn', c: 'warn' },\n { n: 'info', c: 'info' },\n { n: 'debug', c: 'debug' },\n { n: 'verbose', c: 'trace' },\n];\n\n/**\n * A simple Immutable Console based diagnostic logger which will output any messages to the Console.\n * If you want to limit the amount of logging to a specific level or lower use the\n * {@link createLogLevelDiagLogger}\n */\nexport class DiagConsoleLogger implements DiagLogger {\n constructor() {\n function _consoleFunc(funcName: ConsoleMapKeys): DiagLogFunction {\n return function (...args) {\n if (console) {\n // Some environments only expose the console when the F12 developer console is open\n // eslint-disable-next-line no-console\n let theFunc = console[funcName];\n if (typeof theFunc !== 'function') {\n // Not all environments support all functions\n // eslint-disable-next-line no-console\n theFunc = console.log;\n }\n\n // One last final check\n if (typeof theFunc === 'function') {\n return theFunc.apply(console, args);\n }\n }\n };\n }\n\n for (let i = 0; i < consoleMap.length; i++) {\n this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);\n }\n }\n\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n public 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 public 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 public 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. Useful scenarios would be to log the execution\n * order of async operations\n */\n public 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 public verbose!: DiagLogFunction;\n}\n"]}
@@ -16,7 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.createLogLevelDiagLogger = void 0;
19
- var types_1 = require("../types");
19
+ const types_1 = require("../types");
20
20
  function createLogLevelDiagLogger(maxLevel, logger) {
21
21
  if (maxLevel < types_1.DiagLogLevel.NONE) {
22
22
  maxLevel = types_1.DiagLogLevel.NONE;
@@ -27,7 +27,7 @@ function createLogLevelDiagLogger(maxLevel, logger) {
27
27
  // In case the logger is null or undefined
28
28
  logger = logger || {};
29
29
  function _filterFunc(funcName, theLevel) {
30
- var theFunc = logger[funcName];
30
+ const theFunc = logger[funcName];
31
31
  if (typeof theFunc === 'function' && maxLevel >= theLevel) {
32
32
  return theFunc.bind(logger);
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logLevelLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/logLevelLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,kCAAqE;AAErE,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,MAAkB;IAElB,IAAI,QAAQ,GAAG,oBAAY,CAAC,IAAI,EAAE;QAChC,QAAQ,GAAG,oBAAY,CAAC,IAAI,CAAC;KAC9B;SAAM,IAAI,QAAQ,GAAG,oBAAY,CAAC,GAAG,EAAE;QACtC,QAAQ,GAAG,oBAAY,CAAC,GAAG,CAAC;KAC7B;IAED,0CAA0C;IAC1C,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,SAAS,WAAW,CAClB,QAA0B,EAC1B,QAAsB;QAEtB,IAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,OAAO,OAAO,KAAK,UAAU,IAAI,QAAQ,IAAI,QAAQ,EAAE;YACzD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,cAAa,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;QAC/C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAY,CAAC,IAAI,CAAC;QAC5C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAY,CAAC,IAAI,CAAC;QAC5C,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,oBAAY,CAAC,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AAhCD,4DAgCC","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 { DiagLogFunction, DiagLogger, DiagLogLevel } from '../types';\n\nexport function createLogLevelDiagLogger(\n maxLevel: DiagLogLevel,\n logger: DiagLogger\n): DiagLogger {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n } else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n\n // In case the logger is null or undefined\n logger = logger || {};\n\n function _filterFunc(\n funcName: keyof DiagLogger,\n theLevel: DiagLogLevel\n ): DiagLogFunction {\n const theFunc = logger[funcName];\n\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () {};\n }\n\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n"]}
1
+ {"version":3,"file":"logLevelLogger.js","sourceRoot":"","sources":["../../../../src/diag/internal/logLevelLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,oCAAqE;AAErE,SAAgB,wBAAwB,CACtC,QAAsB,EACtB,MAAkB;IAElB,IAAI,QAAQ,GAAG,oBAAY,CAAC,IAAI,EAAE;QAChC,QAAQ,GAAG,oBAAY,CAAC,IAAI,CAAC;KAC9B;SAAM,IAAI,QAAQ,GAAG,oBAAY,CAAC,GAAG,EAAE;QACtC,QAAQ,GAAG,oBAAY,CAAC,GAAG,CAAC;KAC7B;IAED,0CAA0C;IAC1C,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtB,SAAS,WAAW,CAClB,QAA0B,EAC1B,QAAsB;QAEtB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,OAAO,OAAO,KAAK,UAAU,IAAI,QAAQ,IAAI,QAAQ,EAAE;YACzD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,cAAa,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;QAC/C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAY,CAAC,IAAI,CAAC;QAC5C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAY,CAAC,IAAI,CAAC;QAC5C,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;QAC/C,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,oBAAY,CAAC,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AAhCD,4DAgCC","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 { DiagLogFunction, DiagLogger, DiagLogLevel } from '../types';\n\nexport function createLogLevelDiagLogger(\n maxLevel: DiagLogLevel,\n logger: DiagLogger\n): DiagLogger {\n if (maxLevel < DiagLogLevel.NONE) {\n maxLevel = DiagLogLevel.NONE;\n } else if (maxLevel > DiagLogLevel.ALL) {\n maxLevel = DiagLogLevel.ALL;\n }\n\n // In case the logger is null or undefined\n logger = logger || {};\n\n function _filterFunc(\n funcName: keyof DiagLogger,\n theLevel: DiagLogLevel\n ): DiagLogFunction {\n const theFunc = logger[funcName];\n\n if (typeof theFunc === 'function' && maxLevel >= theLevel) {\n return theFunc.bind(logger);\n }\n return function () {};\n }\n\n return {\n error: _filterFunc('error', DiagLogLevel.ERROR),\n warn: _filterFunc('warn', DiagLogLevel.WARN),\n info: _filterFunc('info', DiagLogLevel.INFO),\n debug: _filterFunc('debug', DiagLogLevel.DEBUG),\n verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),\n };\n}\n"]}
@@ -67,4 +67,34 @@ export declare enum DiagLogLevel {
67
67
  export interface ComponentLoggerOptions {
68
68
  namespace: string;
69
69
  }
70
+ export interface LoggerOptions {
71
+ /**
72
+ * The {@link DiagLogLevel} used to filter logs sent to the logger.
73
+ *
74
+ * @defaultValue DiagLogLevel.INFO
75
+ */
76
+ logLevel?: DiagLogLevel;
77
+ /**
78
+ * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.
79
+ */
80
+ suppressOverrideMessage?: boolean;
81
+ }
82
+ export interface DiagLoggerApi {
83
+ /**
84
+ * Set the global DiagLogger and DiagLogLevel.
85
+ * If a global diag logger is already set, this will override it.
86
+ *
87
+ * @param logger - The {@link DiagLogger} instance to set as the default logger.
88
+ * @param options - A {@link LoggerOptions} object. If not provided, default values will be set.
89
+ * @returns `true` if the logger was successfully registered, else `false`
90
+ */
91
+ setLogger(logger: DiagLogger, options?: LoggerOptions): boolean;
92
+ /**
93
+ *
94
+ * @param logger - The {@link DiagLogger} instance to set as the default logger.
95
+ * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.
96
+ * @returns `true` if the logger was successfully registered, else `false`
97
+ */
98
+ setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;
99
+ }
70
100
  //# sourceMappingURL=types.d.ts.map
@@ -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,uHAAA,8BAA8B,OAAA;AAKvC,eAAe;AACf,6CAG2B;AAFzB,2GAAA,gBAAgB,OAAA;AAChB,uGAAA,YAAY,OAAA;AAQd,YAAY;AACZ,sDAAyD;AAAhD,kHAAA,iBAAiB,OAAA;AAC1B,sCAKsB;AAFpB,qGAAA,YAAY,OAAA;AAKd,eAAe;AACf,iDAE6B;AAD3B,4GAAA,eAAe,OAAA;AASjB,2CAc0B;AAbxB,mGAAA,SAAS,OAAA;AAmBX,mBAAmB;AACnB,qEAMyC;AAFvC,yHAAA,oBAAoB,OAAA;AACpB,yHAAA,oBAAoB,OAAA;AAUtB,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;AAQtC,wFARO,qBAAO,OAQP;AAPT,yCAAkC;AAQhC,qFARO,eAAI,OAQP;AAPN,+CAAwC;AAQtC,wFARO,qBAAO,OAQP;AAPT,uDAAgD;AAQ9C,4FARO,6BAAW,OAQP;AAPb,2CAAoC;AAQlC,sFARO,iBAAK,OAQP;AAEP,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 {\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 {};