@openclaw/diagnostics-otel 2026.6.8 → 2026.6.9-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (819) hide show
  1. package/dist/index.js +98 -0
  2. package/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.d.ts +4 -0
  3. package/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js +6 -0
  4. package/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js.map +1 -1
  5. package/node_modules/@opentelemetry/api-logs/build/esm/api/logs.d.ts +10 -2
  6. package/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js +10 -2
  7. package/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js.map +1 -1
  8. package/node_modules/@opentelemetry/api-logs/build/esm/index.d.ts +1 -1
  9. package/node_modules/@opentelemetry/api-logs/build/esm/index.js +1 -1
  10. package/node_modules/@opentelemetry/api-logs/build/esm/index.js.map +1 -1
  11. package/node_modules/@opentelemetry/api-logs/build/esm/types/LoggerOptions.d.ts +3 -2
  12. package/node_modules/@opentelemetry/api-logs/build/esm/types/LoggerOptions.js.map +1 -1
  13. package/node_modules/@opentelemetry/api-logs/build/esm/types/LoggerProvider.d.ts +7 -3
  14. package/node_modules/@opentelemetry/api-logs/build/esm/types/LoggerProvider.js.map +1 -1
  15. package/node_modules/@opentelemetry/api-logs/build/esm/version.d.ts +1 -1
  16. package/node_modules/@opentelemetry/api-logs/build/esm/version.js +1 -1
  17. package/node_modules/@opentelemetry/api-logs/build/esm/version.js.map +1 -1
  18. package/node_modules/@opentelemetry/api-logs/build/esnext/NoopLogger.d.ts +4 -0
  19. package/node_modules/@opentelemetry/api-logs/build/esnext/NoopLogger.js +6 -0
  20. package/node_modules/@opentelemetry/api-logs/build/esnext/NoopLogger.js.map +1 -1
  21. package/node_modules/@opentelemetry/api-logs/build/esnext/api/logs.d.ts +10 -2
  22. package/node_modules/@opentelemetry/api-logs/build/esnext/api/logs.js +10 -2
  23. package/node_modules/@opentelemetry/api-logs/build/esnext/api/logs.js.map +1 -1
  24. package/node_modules/@opentelemetry/api-logs/build/esnext/index.d.ts +1 -1
  25. package/node_modules/@opentelemetry/api-logs/build/esnext/index.js +1 -1
  26. package/node_modules/@opentelemetry/api-logs/build/esnext/index.js.map +1 -1
  27. package/node_modules/@opentelemetry/api-logs/build/esnext/types/LoggerOptions.d.ts +3 -2
  28. package/node_modules/@opentelemetry/api-logs/build/esnext/types/LoggerOptions.js.map +1 -1
  29. package/node_modules/@opentelemetry/api-logs/build/esnext/types/LoggerProvider.d.ts +7 -3
  30. package/node_modules/@opentelemetry/api-logs/build/esnext/types/LoggerProvider.js.map +1 -1
  31. package/node_modules/@opentelemetry/api-logs/build/esnext/version.d.ts +1 -1
  32. package/node_modules/@opentelemetry/api-logs/build/esnext/version.js +1 -1
  33. package/node_modules/@opentelemetry/api-logs/build/esnext/version.js.map +1 -1
  34. package/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.d.ts +4 -0
  35. package/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js +8 -1
  36. package/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.js.map +1 -1
  37. package/node_modules/@opentelemetry/api-logs/build/src/api/logs.d.ts +10 -2
  38. package/node_modules/@opentelemetry/api-logs/build/src/api/logs.js +10 -2
  39. package/node_modules/@opentelemetry/api-logs/build/src/api/logs.js.map +1 -1
  40. package/node_modules/@opentelemetry/api-logs/build/src/index.d.ts +1 -1
  41. package/node_modules/@opentelemetry/api-logs/build/src/index.js +2 -3
  42. package/node_modules/@opentelemetry/api-logs/build/src/index.js.map +1 -1
  43. package/node_modules/@opentelemetry/api-logs/build/src/types/LoggerOptions.d.ts +3 -2
  44. package/node_modules/@opentelemetry/api-logs/build/src/types/LoggerOptions.js.map +1 -1
  45. package/node_modules/@opentelemetry/api-logs/build/src/types/LoggerProvider.d.ts +7 -3
  46. package/node_modules/@opentelemetry/api-logs/build/src/types/LoggerProvider.js.map +1 -1
  47. package/node_modules/@opentelemetry/api-logs/build/src/version.d.ts +1 -1
  48. package/node_modules/@opentelemetry/api-logs/build/src/version.js +1 -1
  49. package/node_modules/@opentelemetry/api-logs/build/src/version.js.map +1 -1
  50. package/node_modules/@opentelemetry/api-logs/package.json +5 -5
  51. package/node_modules/@opentelemetry/configuration/build/src/EnvironmentConfigFactory.js +23 -26
  52. package/node_modules/@opentelemetry/configuration/build/src/EnvironmentConfigFactory.js.map +1 -1
  53. package/node_modules/@opentelemetry/configuration/build/src/FileConfigFactory.js +3 -155
  54. package/node_modules/@opentelemetry/configuration/build/src/FileConfigFactory.js.map +1 -1
  55. package/node_modules/@opentelemetry/configuration/build/src/generated/types.d.ts +596 -614
  56. package/node_modules/@opentelemetry/configuration/build/src/generated/types.js.map +1 -1
  57. package/node_modules/@opentelemetry/configuration/build/src/index.d.ts +1 -1
  58. package/node_modules/@opentelemetry/configuration/build/src/index.js.map +1 -1
  59. package/node_modules/@opentelemetry/configuration/build/src/utils.d.ts +12 -1
  60. package/node_modules/@opentelemetry/configuration/build/src/utils.js +93 -19
  61. package/node_modules/@opentelemetry/configuration/build/src/utils.js.map +1 -1
  62. package/node_modules/@opentelemetry/configuration/build/src/version.d.ts +1 -1
  63. package/node_modules/@opentelemetry/configuration/build/src/version.js +1 -1
  64. package/node_modules/@opentelemetry/configuration/build/src/version.js.map +1 -1
  65. package/node_modules/@opentelemetry/configuration/package.json +6 -6
  66. package/node_modules/@opentelemetry/context-async-hooks/build/src/version.d.ts +1 -1
  67. package/node_modules/@opentelemetry/context-async-hooks/build/src/version.js +1 -1
  68. package/node_modules/@opentelemetry/context-async-hooks/build/src/version.js.map +1 -1
  69. package/node_modules/@opentelemetry/context-async-hooks/package.json +4 -4
  70. package/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js +14 -20
  71. package/node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js.map +1 -1
  72. package/node_modules/@opentelemetry/core/build/esm/baggage/utils.d.ts +7 -1
  73. package/node_modules/@opentelemetry/core/build/esm/baggage/utils.js +32 -1
  74. package/node_modules/@opentelemetry/core/build/esm/baggage/utils.js.map +1 -1
  75. package/node_modules/@opentelemetry/core/build/esm/common/time.d.ts +7 -2
  76. package/node_modules/@opentelemetry/core/build/esm/common/time.js +10 -3
  77. package/node_modules/@opentelemetry/core/build/esm/common/time.js.map +1 -1
  78. package/node_modules/@opentelemetry/core/build/esm/index.d.ts +1 -1
  79. package/node_modules/@opentelemetry/core/build/esm/index.js +1 -1
  80. package/node_modules/@opentelemetry/core/build/esm/index.js.map +1 -1
  81. package/node_modules/@opentelemetry/core/build/esm/version.d.ts +1 -1
  82. package/node_modules/@opentelemetry/core/build/esm/version.js +1 -1
  83. package/node_modules/@opentelemetry/core/build/esm/version.js.map +1 -1
  84. package/node_modules/@opentelemetry/core/build/esnext/baggage/propagation/W3CBaggagePropagator.js +14 -20
  85. package/node_modules/@opentelemetry/core/build/esnext/baggage/propagation/W3CBaggagePropagator.js.map +1 -1
  86. package/node_modules/@opentelemetry/core/build/esnext/baggage/utils.d.ts +7 -1
  87. package/node_modules/@opentelemetry/core/build/esnext/baggage/utils.js +32 -1
  88. package/node_modules/@opentelemetry/core/build/esnext/baggage/utils.js.map +1 -1
  89. package/node_modules/@opentelemetry/core/build/esnext/common/time.d.ts +7 -2
  90. package/node_modules/@opentelemetry/core/build/esnext/common/time.js +10 -3
  91. package/node_modules/@opentelemetry/core/build/esnext/common/time.js.map +1 -1
  92. package/node_modules/@opentelemetry/core/build/esnext/index.d.ts +1 -1
  93. package/node_modules/@opentelemetry/core/build/esnext/index.js +1 -1
  94. package/node_modules/@opentelemetry/core/build/esnext/index.js.map +1 -1
  95. package/node_modules/@opentelemetry/core/build/esnext/version.d.ts +1 -1
  96. package/node_modules/@opentelemetry/core/build/esnext/version.js +1 -1
  97. package/node_modules/@opentelemetry/core/build/esnext/version.js.map +1 -1
  98. package/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.js +12 -18
  99. package/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.js.map +1 -1
  100. package/node_modules/@opentelemetry/core/build/src/baggage/utils.d.ts +7 -1
  101. package/node_modules/@opentelemetry/core/build/src/baggage/utils.js +33 -1
  102. package/node_modules/@opentelemetry/core/build/src/baggage/utils.js.map +1 -1
  103. package/node_modules/@opentelemetry/core/build/src/common/time.d.ts +7 -2
  104. package/node_modules/@opentelemetry/core/build/src/common/time.js +13 -5
  105. package/node_modules/@opentelemetry/core/build/src/common/time.js.map +1 -1
  106. package/node_modules/@opentelemetry/core/build/src/index.d.ts +1 -1
  107. package/node_modules/@opentelemetry/core/build/src/index.js +3 -1
  108. package/node_modules/@opentelemetry/core/build/src/index.js.map +1 -1
  109. package/node_modules/@opentelemetry/core/build/src/version.d.ts +1 -1
  110. package/node_modules/@opentelemetry/core/build/src/version.js +1 -1
  111. package/node_modules/@opentelemetry/core/build/src/version.js.map +1 -1
  112. package/node_modules/@opentelemetry/core/package.json +6 -6
  113. package/node_modules/@opentelemetry/exporter-logs-otlp-grpc/build/src/version.d.ts +1 -1
  114. package/node_modules/@opentelemetry/exporter-logs-otlp-grpc/build/src/version.js +1 -1
  115. package/node_modules/@opentelemetry/exporter-logs-otlp-grpc/build/src/version.js.map +1 -1
  116. package/node_modules/@opentelemetry/exporter-logs-otlp-grpc/package.json +13 -13
  117. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/version.d.ts +1 -1
  118. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/version.js +1 -1
  119. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/version.js.map +1 -1
  120. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esnext/version.d.ts +1 -1
  121. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esnext/version.js +1 -1
  122. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esnext/version.js.map +1 -1
  123. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/src/version.d.ts +1 -1
  124. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/src/version.js +1 -1
  125. package/node_modules/@opentelemetry/exporter-logs-otlp-http/build/src/version.js.map +1 -1
  126. package/node_modules/@opentelemetry/exporter-logs-otlp-http/package.json +13 -13
  127. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esm/version.d.ts +1 -1
  128. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esm/version.js +1 -1
  129. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esm/version.js.map +1 -1
  130. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esnext/version.d.ts +1 -1
  131. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esnext/version.js +1 -1
  132. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esnext/version.js.map +1 -1
  133. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/src/version.d.ts +1 -1
  134. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/src/version.js +1 -1
  135. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/src/version.js.map +1 -1
  136. package/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json +14 -14
  137. package/node_modules/@opentelemetry/exporter-metrics-otlp-grpc/build/src/version.d.ts +1 -1
  138. package/node_modules/@opentelemetry/exporter-metrics-otlp-grpc/build/src/version.js +1 -1
  139. package/node_modules/@opentelemetry/exporter-metrics-otlp-grpc/build/src/version.js.map +1 -1
  140. package/node_modules/@opentelemetry/exporter-metrics-otlp-grpc/package.json +13 -13
  141. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/version.d.ts +1 -1
  142. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/version.js +1 -1
  143. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/version.js.map +1 -1
  144. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esnext/version.d.ts +1 -1
  145. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esnext/version.js +1 -1
  146. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esnext/version.js.map +1 -1
  147. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/version.d.ts +1 -1
  148. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/version.js +1 -1
  149. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/version.js.map +1 -1
  150. package/node_modules/@opentelemetry/exporter-metrics-otlp-http/package.json +12 -12
  151. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esm/version.d.ts +1 -1
  152. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esm/version.js +1 -1
  153. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esm/version.js.map +1 -1
  154. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esnext/version.d.ts +1 -1
  155. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esnext/version.js +1 -1
  156. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esnext/version.js.map +1 -1
  157. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/version.d.ts +1 -1
  158. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/version.js +1 -1
  159. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/version.js.map +1 -1
  160. package/node_modules/@opentelemetry/exporter-metrics-otlp-proto/package.json +13 -13
  161. package/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusExporter.js +2 -0
  162. package/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusExporter.js.map +1 -1
  163. package/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusSerializer.js +15 -1
  164. package/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusSerializer.js.map +1 -1
  165. package/node_modules/@opentelemetry/exporter-prometheus/build/src/semconv.d.ts +9 -0
  166. package/node_modules/@opentelemetry/exporter-prometheus/build/src/semconv.js +21 -0
  167. package/node_modules/@opentelemetry/exporter-prometheus/build/src/semconv.js.map +1 -0
  168. package/node_modules/@opentelemetry/exporter-prometheus/build/src/version.d.ts +1 -1
  169. package/node_modules/@opentelemetry/exporter-prometheus/build/src/version.js +1 -1
  170. package/node_modules/@opentelemetry/exporter-prometheus/build/src/version.js.map +1 -1
  171. package/node_modules/@opentelemetry/exporter-prometheus/package.json +7 -7
  172. package/node_modules/@opentelemetry/exporter-trace-otlp-grpc/README.md +1 -1
  173. package/node_modules/@opentelemetry/exporter-trace-otlp-grpc/build/src/version.d.ts +1 -1
  174. package/node_modules/@opentelemetry/exporter-trace-otlp-grpc/build/src/version.js +1 -1
  175. package/node_modules/@opentelemetry/exporter-trace-otlp-grpc/build/src/version.js.map +1 -1
  176. package/node_modules/@opentelemetry/exporter-trace-otlp-grpc/package.json +12 -12
  177. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/version.d.ts +1 -1
  178. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/version.js +1 -1
  179. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/version.js.map +1 -1
  180. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esnext/version.d.ts +1 -1
  181. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esnext/version.js +1 -1
  182. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esnext/version.js.map +1 -1
  183. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/src/version.d.ts +1 -1
  184. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/src/version.js +1 -1
  185. package/node_modules/@opentelemetry/exporter-trace-otlp-http/build/src/version.js.map +1 -1
  186. package/node_modules/@opentelemetry/exporter-trace-otlp-http/package.json +12 -12
  187. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esm/version.d.ts +1 -1
  188. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esm/version.js +1 -1
  189. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esm/version.js.map +1 -1
  190. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esnext/version.d.ts +1 -1
  191. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esnext/version.js +1 -1
  192. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esnext/version.js.map +1 -1
  193. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/src/version.d.ts +1 -1
  194. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/src/version.js +1 -1
  195. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/src/version.js.map +1 -1
  196. package/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json +12 -12
  197. package/node_modules/@opentelemetry/exporter-zipkin/build/esm/version.d.ts +1 -1
  198. package/node_modules/@opentelemetry/exporter-zipkin/build/esm/version.js +1 -1
  199. package/node_modules/@opentelemetry/exporter-zipkin/build/esm/version.js.map +1 -1
  200. package/node_modules/@opentelemetry/exporter-zipkin/build/esnext/version.d.ts +1 -1
  201. package/node_modules/@opentelemetry/exporter-zipkin/build/esnext/version.js +1 -1
  202. package/node_modules/@opentelemetry/exporter-zipkin/build/esnext/version.js.map +1 -1
  203. package/node_modules/@opentelemetry/exporter-zipkin/build/src/version.d.ts +1 -1
  204. package/node_modules/@opentelemetry/exporter-zipkin/build/src/version.js +1 -1
  205. package/node_modules/@opentelemetry/exporter-zipkin/build/src/version.js.map +1 -1
  206. package/node_modules/@opentelemetry/exporter-zipkin/package.json +11 -11
  207. package/node_modules/@opentelemetry/instrumentation/build/esm/instrumentation.js +1 -1
  208. package/node_modules/@opentelemetry/instrumentation/build/esm/instrumentation.js.map +1 -1
  209. package/node_modules/@opentelemetry/instrumentation/build/esm/semver.js +2 -2
  210. package/node_modules/@opentelemetry/instrumentation/build/esm/semver.js.map +1 -1
  211. package/node_modules/@opentelemetry/instrumentation/build/esm/version.d.ts +1 -1
  212. package/node_modules/@opentelemetry/instrumentation/build/esm/version.js +1 -1
  213. package/node_modules/@opentelemetry/instrumentation/build/esm/version.js.map +1 -1
  214. package/node_modules/@opentelemetry/instrumentation/build/esnext/instrumentation.js +1 -1
  215. package/node_modules/@opentelemetry/instrumentation/build/esnext/instrumentation.js.map +1 -1
  216. package/node_modules/@opentelemetry/instrumentation/build/esnext/semver.js +2 -2
  217. package/node_modules/@opentelemetry/instrumentation/build/esnext/semver.js.map +1 -1
  218. package/node_modules/@opentelemetry/instrumentation/build/esnext/version.d.ts +1 -1
  219. package/node_modules/@opentelemetry/instrumentation/build/esnext/version.js +1 -1
  220. package/node_modules/@opentelemetry/instrumentation/build/esnext/version.js.map +1 -1
  221. package/node_modules/@opentelemetry/instrumentation/build/src/instrumentation.js +1 -1
  222. package/node_modules/@opentelemetry/instrumentation/build/src/instrumentation.js.map +1 -1
  223. package/node_modules/@opentelemetry/instrumentation/build/src/semver.js +2 -2
  224. package/node_modules/@opentelemetry/instrumentation/build/src/semver.js.map +1 -1
  225. package/node_modules/@opentelemetry/instrumentation/build/src/version.d.ts +1 -1
  226. package/node_modules/@opentelemetry/instrumentation/build/src/version.js +1 -1
  227. package/node_modules/@opentelemetry/instrumentation/build/src/version.js.map +1 -1
  228. package/node_modules/@opentelemetry/instrumentation/hook.mjs +3 -14
  229. package/node_modules/@opentelemetry/instrumentation/package.json +9 -9
  230. package/node_modules/@opentelemetry/otlp-exporter-base/build/esm/version.d.ts +1 -1
  231. package/node_modules/@opentelemetry/otlp-exporter-base/build/esm/version.js +1 -1
  232. package/node_modules/@opentelemetry/otlp-exporter-base/build/esm/version.js.map +1 -1
  233. package/node_modules/@opentelemetry/otlp-exporter-base/build/esnext/version.d.ts +1 -1
  234. package/node_modules/@opentelemetry/otlp-exporter-base/build/esnext/version.js +1 -1
  235. package/node_modules/@opentelemetry/otlp-exporter-base/build/esnext/version.js.map +1 -1
  236. package/node_modules/@opentelemetry/otlp-exporter-base/build/src/version.d.ts +1 -1
  237. package/node_modules/@opentelemetry/otlp-exporter-base/build/src/version.js +1 -1
  238. package/node_modules/@opentelemetry/otlp-exporter-base/build/src/version.js.map +1 -1
  239. package/node_modules/@opentelemetry/otlp-exporter-base/package.json +9 -9
  240. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/configuration/otlp-grpc-env-configuration.js +2 -2
  241. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/configuration/otlp-grpc-env-configuration.js.map +1 -1
  242. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/grpc-exporter-transport.d.ts +1 -0
  243. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/grpc-exporter-transport.js +17 -0
  244. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/grpc-exporter-transport.js.map +1 -1
  245. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/index.d.ts +1 -0
  246. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/index.js +5 -1
  247. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/index.js.map +1 -1
  248. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/version.d.ts +1 -1
  249. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/version.js +1 -1
  250. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/version.js.map +1 -1
  251. package/node_modules/@opentelemetry/otlp-grpc-exporter-base/package.json +10 -10
  252. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.d.ts +6 -3
  253. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js +7 -2
  254. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js.map +1 -1
  255. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/protobuf/common-serializer.d.ts +10 -1
  256. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/protobuf/common-serializer.js +9 -0
  257. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/protobuf/common-serializer.js.map +1 -1
  258. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/protobuf/protobuf-reader.d.ts +5 -1
  259. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/protobuf/protobuf-reader.js +5 -21
  260. package/node_modules/@opentelemetry/otlp-transformer/build/esm/common/protobuf/protobuf-reader.js.map +1 -1
  261. package/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.d.ts +0 -3
  262. package/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js +6 -10
  263. package/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js.map +1 -1
  264. package/node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/internal.js +1 -1
  265. package/node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/internal.js.map +1 -1
  266. package/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js +1 -1
  267. package/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js.map +1 -1
  268. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/internal.d.ts +6 -3
  269. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/internal.js +7 -2
  270. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/internal.js.map +1 -1
  271. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/protobuf/common-serializer.d.ts +10 -1
  272. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/protobuf/common-serializer.js +9 -0
  273. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/protobuf/common-serializer.js.map +1 -1
  274. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/protobuf/protobuf-reader.d.ts +5 -1
  275. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/protobuf/protobuf-reader.js +5 -21
  276. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/common/protobuf/protobuf-reader.js.map +1 -1
  277. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/logs/internal.d.ts +0 -3
  278. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/logs/internal.js +6 -10
  279. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/logs/internal.js.map +1 -1
  280. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/metrics/internal.js +1 -1
  281. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/metrics/internal.js.map +1 -1
  282. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js +1 -1
  283. package/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js.map +1 -1
  284. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/internal.d.ts +6 -3
  285. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/internal.js +7 -2
  286. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/internal.js.map +1 -1
  287. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/protobuf/common-serializer.d.ts +10 -1
  288. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/protobuf/common-serializer.js +9 -0
  289. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/protobuf/common-serializer.js.map +1 -1
  290. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/protobuf/protobuf-reader.d.ts +5 -1
  291. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/protobuf/protobuf-reader.js +5 -21
  292. package/node_modules/@opentelemetry/otlp-transformer/build/src/common/protobuf/protobuf-reader.js.map +1 -1
  293. package/node_modules/@opentelemetry/otlp-transformer/build/src/logs/internal.d.ts +0 -3
  294. package/node_modules/@opentelemetry/otlp-transformer/build/src/logs/internal.js +6 -11
  295. package/node_modules/@opentelemetry/otlp-transformer/build/src/logs/internal.js.map +1 -1
  296. package/node_modules/@opentelemetry/otlp-transformer/build/src/metrics/internal.js +1 -1
  297. package/node_modules/@opentelemetry/otlp-transformer/build/src/metrics/internal.js.map +1 -1
  298. package/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js +1 -1
  299. package/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js.map +1 -1
  300. package/node_modules/@opentelemetry/otlp-transformer/package.json +13 -13
  301. package/node_modules/@opentelemetry/propagator-b3/build/esm/version.d.ts +1 -1
  302. package/node_modules/@opentelemetry/propagator-b3/build/esm/version.js +1 -1
  303. package/node_modules/@opentelemetry/propagator-b3/build/esm/version.js.map +1 -1
  304. package/node_modules/@opentelemetry/propagator-b3/build/esnext/version.d.ts +1 -1
  305. package/node_modules/@opentelemetry/propagator-b3/build/esnext/version.js +1 -1
  306. package/node_modules/@opentelemetry/propagator-b3/build/esnext/version.js.map +1 -1
  307. package/node_modules/@opentelemetry/propagator-b3/build/src/version.d.ts +1 -1
  308. package/node_modules/@opentelemetry/propagator-b3/build/src/version.js +1 -1
  309. package/node_modules/@opentelemetry/propagator-b3/build/src/version.js.map +1 -1
  310. package/node_modules/@opentelemetry/propagator-b3/package.json +6 -6
  311. package/node_modules/@opentelemetry/propagator-jaeger/build/esm/version.d.ts +1 -1
  312. package/node_modules/@opentelemetry/propagator-jaeger/build/esm/version.js +1 -1
  313. package/node_modules/@opentelemetry/propagator-jaeger/build/esm/version.js.map +1 -1
  314. package/node_modules/@opentelemetry/propagator-jaeger/build/esnext/version.d.ts +1 -1
  315. package/node_modules/@opentelemetry/propagator-jaeger/build/esnext/version.js +1 -1
  316. package/node_modules/@opentelemetry/propagator-jaeger/build/esnext/version.js.map +1 -1
  317. package/node_modules/@opentelemetry/propagator-jaeger/build/src/version.d.ts +1 -1
  318. package/node_modules/@opentelemetry/propagator-jaeger/build/src/version.js +1 -1
  319. package/node_modules/@opentelemetry/propagator-jaeger/build/src/version.js.map +1 -1
  320. package/node_modules/@opentelemetry/propagator-jaeger/package.json +7 -7
  321. package/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js +2 -2
  322. package/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js.map +1 -1
  323. package/node_modules/@opentelemetry/resources/build/esm/version.d.ts +1 -1
  324. package/node_modules/@opentelemetry/resources/build/esm/version.js +1 -1
  325. package/node_modules/@opentelemetry/resources/build/esm/version.js.map +1 -1
  326. package/node_modules/@opentelemetry/resources/build/esnext/detectors/EnvDetector.js +2 -2
  327. package/node_modules/@opentelemetry/resources/build/esnext/detectors/EnvDetector.js.map +1 -1
  328. package/node_modules/@opentelemetry/resources/build/esnext/version.d.ts +1 -1
  329. package/node_modules/@opentelemetry/resources/build/esnext/version.js +1 -1
  330. package/node_modules/@opentelemetry/resources/build/esnext/version.js.map +1 -1
  331. package/node_modules/@opentelemetry/resources/build/src/detectors/EnvDetector.js +2 -2
  332. package/node_modules/@opentelemetry/resources/build/src/detectors/EnvDetector.js.map +1 -1
  333. package/node_modules/@opentelemetry/resources/build/src/version.d.ts +1 -1
  334. package/node_modules/@opentelemetry/resources/build/src/version.js +1 -1
  335. package/node_modules/@opentelemetry/resources/build/src/version.js.map +1 -1
  336. package/node_modules/@opentelemetry/resources/package.json +5 -5
  337. package/node_modules/@opentelemetry/sdk-logs/README.md +3 -0
  338. package/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.d.ts +4 -3
  339. package/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js +5 -57
  340. package/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js.map +1 -1
  341. package/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.d.ts +4 -4
  342. package/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js +5 -5
  343. package/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js.map +1 -1
  344. package/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js +12 -5
  345. package/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js.map +1 -1
  346. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js +6 -3
  347. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js.map +1 -1
  348. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/ReadableLogRecord.d.ts +4 -1
  349. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/ReadableLogRecord.js.map +1 -1
  350. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/SdkLogRecord.d.ts +7 -0
  351. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/SdkLogRecord.js.map +1 -1
  352. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js +0 -1
  353. package/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js.map +1 -1
  354. package/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.d.ts +6 -1
  355. package/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js +62 -1
  356. package/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js.map +1 -1
  357. package/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.d.ts +21 -2
  358. package/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js +112 -3
  359. package/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js.map +1 -1
  360. package/node_modules/@opentelemetry/sdk-logs/build/esm/version.d.ts +1 -1
  361. package/node_modules/@opentelemetry/sdk-logs/build/esm/version.js +1 -1
  362. package/node_modules/@opentelemetry/sdk-logs/build/esm/version.js.map +1 -1
  363. package/node_modules/@opentelemetry/sdk-logs/build/esnext/LogRecordImpl.d.ts +4 -3
  364. package/node_modules/@opentelemetry/sdk-logs/build/esnext/LogRecordImpl.js +5 -57
  365. package/node_modules/@opentelemetry/sdk-logs/build/esnext/LogRecordImpl.js.map +1 -1
  366. package/node_modules/@opentelemetry/sdk-logs/build/esnext/Logger.d.ts +4 -4
  367. package/node_modules/@opentelemetry/sdk-logs/build/esnext/Logger.js +5 -5
  368. package/node_modules/@opentelemetry/sdk-logs/build/esnext/Logger.js.map +1 -1
  369. package/node_modules/@opentelemetry/sdk-logs/build/esnext/LoggerProvider.js +12 -5
  370. package/node_modules/@opentelemetry/sdk-logs/build/esnext/LoggerProvider.js.map +1 -1
  371. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/BatchLogRecordProcessorBase.js +6 -3
  372. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/BatchLogRecordProcessorBase.js.map +1 -1
  373. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/ReadableLogRecord.d.ts +4 -1
  374. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/ReadableLogRecord.js.map +1 -1
  375. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/SdkLogRecord.d.ts +7 -0
  376. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/SdkLogRecord.js.map +1 -1
  377. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/SimpleLogRecordProcessor.js +0 -1
  378. package/node_modules/@opentelemetry/sdk-logs/build/esnext/export/SimpleLogRecordProcessor.js.map +1 -1
  379. package/node_modules/@opentelemetry/sdk-logs/build/esnext/internal/utils.d.ts +6 -1
  380. package/node_modules/@opentelemetry/sdk-logs/build/esnext/internal/utils.js +62 -1
  381. package/node_modules/@opentelemetry/sdk-logs/build/esnext/internal/utils.js.map +1 -1
  382. package/node_modules/@opentelemetry/sdk-logs/build/esnext/utils/validation.d.ts +21 -2
  383. package/node_modules/@opentelemetry/sdk-logs/build/esnext/utils/validation.js +112 -3
  384. package/node_modules/@opentelemetry/sdk-logs/build/esnext/utils/validation.js.map +1 -1
  385. package/node_modules/@opentelemetry/sdk-logs/build/esnext/version.d.ts +1 -1
  386. package/node_modules/@opentelemetry/sdk-logs/build/esnext/version.js +1 -1
  387. package/node_modules/@opentelemetry/sdk-logs/build/esnext/version.js.map +1 -1
  388. package/node_modules/@opentelemetry/sdk-logs/build/src/LogRecordImpl.d.ts +4 -3
  389. package/node_modules/@opentelemetry/sdk-logs/build/src/LogRecordImpl.js +4 -56
  390. package/node_modules/@opentelemetry/sdk-logs/build/src/LogRecordImpl.js.map +1 -1
  391. package/node_modules/@opentelemetry/sdk-logs/build/src/Logger.d.ts +4 -4
  392. package/node_modules/@opentelemetry/sdk-logs/build/src/Logger.js +5 -5
  393. package/node_modules/@opentelemetry/sdk-logs/build/src/Logger.js.map +1 -1
  394. package/node_modules/@opentelemetry/sdk-logs/build/src/LoggerProvider.js +11 -4
  395. package/node_modules/@opentelemetry/sdk-logs/build/src/LoggerProvider.js.map +1 -1
  396. package/node_modules/@opentelemetry/sdk-logs/build/src/export/BatchLogRecordProcessorBase.js +6 -3
  397. package/node_modules/@opentelemetry/sdk-logs/build/src/export/BatchLogRecordProcessorBase.js.map +1 -1
  398. package/node_modules/@opentelemetry/sdk-logs/build/src/export/ReadableLogRecord.d.ts +4 -1
  399. package/node_modules/@opentelemetry/sdk-logs/build/src/export/ReadableLogRecord.js.map +1 -1
  400. package/node_modules/@opentelemetry/sdk-logs/build/src/export/SdkLogRecord.d.ts +7 -0
  401. package/node_modules/@opentelemetry/sdk-logs/build/src/export/SdkLogRecord.js.map +1 -1
  402. package/node_modules/@opentelemetry/sdk-logs/build/src/export/SimpleLogRecordProcessor.js +0 -1
  403. package/node_modules/@opentelemetry/sdk-logs/build/src/export/SimpleLogRecordProcessor.js.map +1 -1
  404. package/node_modules/@opentelemetry/sdk-logs/build/src/internal/utils.d.ts +6 -1
  405. package/node_modules/@opentelemetry/sdk-logs/build/src/internal/utils.js +62 -1
  406. package/node_modules/@opentelemetry/sdk-logs/build/src/internal/utils.js.map +1 -1
  407. package/node_modules/@opentelemetry/sdk-logs/build/src/utils/validation.d.ts +21 -2
  408. package/node_modules/@opentelemetry/sdk-logs/build/src/utils/validation.js +115 -4
  409. package/node_modules/@opentelemetry/sdk-logs/build/src/utils/validation.js.map +1 -1
  410. package/node_modules/@opentelemetry/sdk-logs/build/src/version.d.ts +1 -1
  411. package/node_modules/@opentelemetry/sdk-logs/build/src/version.js +1 -1
  412. package/node_modules/@opentelemetry/sdk-logs/build/src/version.js.map +1 -1
  413. package/node_modules/@opentelemetry/sdk-logs/package.json +11 -11
  414. package/node_modules/@opentelemetry/sdk-metrics/build/esm/MeterProvider.d.ts +6 -1
  415. package/node_modules/@opentelemetry/sdk-metrics/build/esm/MeterProvider.js +4 -0
  416. package/node_modules/@opentelemetry/sdk-metrics/build/esm/MeterProvider.js.map +1 -1
  417. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.d.ts +9 -0
  418. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js +19 -0
  419. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js.map +1 -1
  420. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReaderMetrics.d.ts +12 -0
  421. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReaderMetrics.js +36 -0
  422. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReaderMetrics.js.map +1 -0
  423. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js +2 -0
  424. package/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js.map +1 -1
  425. package/node_modules/@opentelemetry/sdk-metrics/build/esm/semconv.d.ts +82 -0
  426. package/node_modules/@opentelemetry/sdk-metrics/build/esm/semconv.js +91 -0
  427. package/node_modules/@opentelemetry/sdk-metrics/build/esm/semconv.js.map +1 -0
  428. package/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js +0 -3
  429. package/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js.map +1 -1
  430. package/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js +0 -1
  431. package/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js.map +1 -1
  432. package/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js +0 -2
  433. package/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js.map +1 -1
  434. package/node_modules/@opentelemetry/sdk-metrics/build/esm/version.d.ts +1 -1
  435. package/node_modules/@opentelemetry/sdk-metrics/build/esm/version.js +1 -1
  436. package/node_modules/@opentelemetry/sdk-metrics/build/esm/version.js.map +1 -1
  437. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/MeterProvider.d.ts +6 -1
  438. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/MeterProvider.js +4 -0
  439. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/MeterProvider.js.map +1 -1
  440. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.d.ts +9 -0
  441. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.js +19 -0
  442. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReader.js.map +1 -1
  443. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReaderMetrics.d.ts +12 -0
  444. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReaderMetrics.js +36 -0
  445. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/MetricReaderMetrics.js.map +1 -0
  446. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/PeriodicExportingMetricReader.js +2 -0
  447. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/export/PeriodicExportingMetricReader.js.map +1 -1
  448. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/semconv.d.ts +82 -0
  449. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/semconv.js +91 -0
  450. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/semconv.js.map +1 -0
  451. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.js +0 -3
  452. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/DeltaMetricProcessor.js.map +1 -1
  453. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.js +0 -1
  454. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/HashMap.js.map +1 -1
  455. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.js +0 -2
  456. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/state/TemporalMetricProcessor.js.map +1 -1
  457. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.d.ts +1 -1
  458. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.js +1 -1
  459. package/node_modules/@opentelemetry/sdk-metrics/build/esnext/version.js.map +1 -1
  460. package/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.d.ts +6 -1
  461. package/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.js +4 -0
  462. package/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.js.map +1 -1
  463. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.d.ts +9 -0
  464. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js +19 -0
  465. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.js.map +1 -1
  466. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReaderMetrics.d.ts +12 -0
  467. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReaderMetrics.js +40 -0
  468. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReaderMetrics.js.map +1 -0
  469. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js +2 -0
  470. package/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.js.map +1 -1
  471. package/node_modules/@opentelemetry/sdk-metrics/build/src/semconv.d.ts +82 -0
  472. package/node_modules/@opentelemetry/sdk-metrics/build/src/semconv.js +94 -0
  473. package/node_modules/@opentelemetry/sdk-metrics/build/src/semconv.js.map +1 -0
  474. package/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js +0 -3
  475. package/node_modules/@opentelemetry/sdk-metrics/build/src/state/DeltaMetricProcessor.js.map +1 -1
  476. package/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js +0 -1
  477. package/node_modules/@opentelemetry/sdk-metrics/build/src/state/HashMap.js.map +1 -1
  478. package/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js +0 -2
  479. package/node_modules/@opentelemetry/sdk-metrics/build/src/state/TemporalMetricProcessor.js.map +1 -1
  480. package/node_modules/@opentelemetry/sdk-metrics/build/src/version.d.ts +1 -1
  481. package/node_modules/@opentelemetry/sdk-metrics/build/src/version.js +1 -1
  482. package/node_modules/@opentelemetry/sdk-metrics/build/src/version.js.map +1 -1
  483. package/node_modules/@opentelemetry/sdk-metrics/package.json +10 -10
  484. package/node_modules/@opentelemetry/sdk-node/README.md +1 -0
  485. package/node_modules/@opentelemetry/sdk-node/build/src/index.d.ts +0 -1
  486. package/node_modules/@opentelemetry/sdk-node/build/src/index.js +1 -3
  487. package/node_modules/@opentelemetry/sdk-node/build/src/index.js.map +1 -1
  488. package/node_modules/@opentelemetry/sdk-node/build/src/sdk.js +3 -3
  489. package/node_modules/@opentelemetry/sdk-node/build/src/sdk.js.map +1 -1
  490. package/node_modules/@opentelemetry/sdk-node/build/src/start.js +2 -2
  491. package/node_modules/@opentelemetry/sdk-node/build/src/start.js.map +1 -1
  492. package/node_modules/@opentelemetry/sdk-node/build/src/utils.d.ts +1 -1
  493. package/node_modules/@opentelemetry/sdk-node/build/src/utils.js +175 -103
  494. package/node_modules/@opentelemetry/sdk-node/build/src/utils.js.map +1 -1
  495. package/node_modules/@opentelemetry/sdk-node/build/src/version.d.ts +1 -1
  496. package/node_modules/@opentelemetry/sdk-node/build/src/version.js +1 -1
  497. package/node_modules/@opentelemetry/sdk-node/build/src/version.js.map +1 -1
  498. package/node_modules/@opentelemetry/sdk-node/package.json +30 -29
  499. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.d.ts +3 -0
  500. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js +10 -1
  501. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js.map +1 -1
  502. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.d.ts +3 -0
  503. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js +23 -0
  504. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js.map +1 -1
  505. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.d.ts +8 -0
  506. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js +10 -0
  507. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js.map +1 -1
  508. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/inspect.d.ts +32 -0
  509. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/inspect.js +53 -0
  510. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/inspect.js.map +1 -0
  511. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.d.ts +1 -1
  512. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js +1 -1
  513. package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js.map +1 -1
  514. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/BasicTracerProvider.d.ts +3 -0
  515. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/BasicTracerProvider.js +10 -1
  516. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/BasicTracerProvider.js.map +1 -1
  517. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/Span.d.ts +3 -0
  518. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/Span.js +23 -0
  519. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/Span.js.map +1 -1
  520. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/Tracer.d.ts +8 -0
  521. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/Tracer.js +10 -0
  522. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/Tracer.js.map +1 -1
  523. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/inspect.d.ts +32 -0
  524. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/inspect.js +53 -0
  525. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/inspect.js.map +1 -0
  526. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.d.ts +1 -1
  527. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.js +1 -1
  528. package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.js.map +1 -1
  529. package/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.d.ts +3 -0
  530. package/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.js +10 -1
  531. package/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.js.map +1 -1
  532. package/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.d.ts +3 -0
  533. package/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.js +23 -0
  534. package/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.js.map +1 -1
  535. package/node_modules/@opentelemetry/sdk-trace-base/build/src/Tracer.d.ts +8 -0
  536. package/node_modules/@opentelemetry/sdk-trace-base/build/src/Tracer.js +10 -0
  537. package/node_modules/@opentelemetry/sdk-trace-base/build/src/Tracer.js.map +1 -1
  538. package/node_modules/@opentelemetry/sdk-trace-base/build/src/inspect.d.ts +32 -0
  539. package/node_modules/@opentelemetry/sdk-trace-base/build/src/inspect.js +58 -0
  540. package/node_modules/@opentelemetry/sdk-trace-base/build/src/inspect.js.map +1 -0
  541. package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.d.ts +1 -1
  542. package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.js +1 -1
  543. package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.js.map +1 -1
  544. package/node_modules/@opentelemetry/sdk-trace-base/package.json +9 -9
  545. package/node_modules/@opentelemetry/sdk-trace-node/build/src/version.d.ts +1 -1
  546. package/node_modules/@opentelemetry/sdk-trace-node/build/src/version.js +1 -1
  547. package/node_modules/@opentelemetry/sdk-trace-node/build/src/version.js.map +1 -1
  548. package/node_modules/@opentelemetry/sdk-trace-node/package.json +8 -8
  549. package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
  550. package/node_modules/@protobufjs/aspromise/README.md +13 -0
  551. package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
  552. package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
  553. package/node_modules/@protobufjs/aspromise/package.json +21 -0
  554. package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
  555. package/node_modules/@protobufjs/base64/LICENSE +26 -0
  556. package/node_modules/@protobufjs/base64/README.md +19 -0
  557. package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
  558. package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
  559. package/node_modules/@protobufjs/base64/package.json +21 -0
  560. package/node_modules/@protobufjs/base64/tests/index.js +46 -0
  561. package/node_modules/@protobufjs/codegen/LICENSE +26 -0
  562. package/node_modules/@protobufjs/codegen/README.md +49 -0
  563. package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
  564. package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -113
  565. package/node_modules/@protobufjs/codegen/package.json +13 -0
  566. package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
  567. package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
  568. package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
  569. package/node_modules/@protobufjs/eventemitter/README.md +22 -0
  570. package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
  571. package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
  572. package/node_modules/@protobufjs/eventemitter/package.json +21 -0
  573. package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
  574. package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
  575. package/node_modules/@protobufjs/fetch/LICENSE +26 -0
  576. package/node_modules/@protobufjs/fetch/README.md +13 -0
  577. package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
  578. package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
  579. package/node_modules/@protobufjs/fetch/package.json +27 -0
  580. package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
  581. package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
  582. package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
  583. package/node_modules/@protobufjs/float/LICENSE +26 -0
  584. package/node_modules/@protobufjs/float/README.md +102 -0
  585. package/node_modules/@protobufjs/float/bench/index.js +87 -0
  586. package/node_modules/@protobufjs/float/bench/suite.js +46 -0
  587. package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
  588. package/node_modules/@protobufjs/float/package.json +26 -0
  589. package/node_modules/@protobufjs/float/tests/index.js +100 -0
  590. package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
  591. package/node_modules/@protobufjs/inquire/LICENSE +26 -0
  592. package/node_modules/@protobufjs/inquire/README.md +13 -0
  593. package/node_modules/{protobufjs/src/util/inquire.d.ts → @protobufjs/inquire/index.d.ts} +10 -10
  594. package/node_modules/{protobufjs/src/util/inquire.js → @protobufjs/inquire/index.js} +38 -38
  595. package/node_modules/@protobufjs/inquire/package.json +21 -0
  596. package/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
  597. package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
  598. package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
  599. package/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
  600. package/node_modules/@protobufjs/inquire/tests/index.js +20 -0
  601. package/node_modules/@protobufjs/path/LICENSE +26 -0
  602. package/node_modules/@protobufjs/path/README.md +19 -0
  603. package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
  604. package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -72
  605. package/node_modules/@protobufjs/path/package.json +21 -0
  606. package/node_modules/@protobufjs/path/tests/index.js +60 -0
  607. package/node_modules/@protobufjs/pool/.npmignore +3 -0
  608. package/node_modules/@protobufjs/pool/LICENSE +26 -0
  609. package/node_modules/@protobufjs/pool/README.md +13 -0
  610. package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
  611. package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
  612. package/node_modules/@protobufjs/pool/package.json +21 -0
  613. package/node_modules/@protobufjs/pool/tests/index.js +33 -0
  614. package/node_modules/@protobufjs/utf8/LICENSE +26 -0
  615. package/node_modules/@protobufjs/utf8/README.md +20 -0
  616. package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
  617. package/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -130
  618. package/node_modules/@protobufjs/utf8/package.json +21 -0
  619. package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
  620. package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
  621. package/node_modules/@protobufjs/utf8/tests/index.js +74 -0
  622. package/node_modules/@types/node/LICENSE +21 -0
  623. package/node_modules/@types/node/README.md +15 -0
  624. package/node_modules/@types/node/assert/strict.d.ts +59 -0
  625. package/node_modules/@types/node/assert.d.ts +950 -0
  626. package/node_modules/@types/node/async_hooks.d.ts +711 -0
  627. package/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  628. package/node_modules/@types/node/buffer.d.ts +1765 -0
  629. package/node_modules/@types/node/child_process.d.ts +1366 -0
  630. package/node_modules/@types/node/cluster.d.ts +432 -0
  631. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  632. package/node_modules/@types/node/console.d.ts +93 -0
  633. package/node_modules/@types/node/constants.d.ts +14 -0
  634. package/node_modules/@types/node/crypto.d.ts +4058 -0
  635. package/node_modules/@types/node/dgram.d.ts +537 -0
  636. package/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
  637. package/node_modules/@types/node/dns/promises.d.ts +497 -0
  638. package/node_modules/@types/node/dns.d.ts +876 -0
  639. package/node_modules/@types/node/domain.d.ts +150 -0
  640. package/node_modules/@types/node/events.d.ts +1008 -0
  641. package/node_modules/@types/node/fs/promises.d.ts +1468 -0
  642. package/node_modules/@types/node/fs.d.ts +4780 -0
  643. package/node_modules/@types/node/globals.d.ts +150 -0
  644. package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  645. package/node_modules/@types/node/http.d.ts +2147 -0
  646. package/node_modules/@types/node/http2.d.ts +2485 -0
  647. package/node_modules/@types/node/https.d.ts +400 -0
  648. package/node_modules/@types/node/index.d.ts +117 -0
  649. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  650. package/node_modules/@types/node/inspector.d.ts +264 -0
  651. package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  652. package/node_modules/@types/node/module.d.ts +755 -0
  653. package/node_modules/@types/node/net.d.ts +970 -0
  654. package/node_modules/@types/node/os.d.ts +498 -0
  655. package/node_modules/@types/node/package.json +155 -0
  656. package/node_modules/@types/node/path/posix.d.ts +8 -0
  657. package/node_modules/@types/node/path/win32.d.ts +8 -0
  658. package/node_modules/@types/node/path.d.ts +178 -0
  659. package/node_modules/@types/node/perf_hooks.d.ts +612 -0
  660. package/node_modules/@types/node/process.d.ts +2204 -0
  661. package/node_modules/@types/node/punycode.d.ts +89 -0
  662. package/node_modules/@types/node/querystring.d.ts +139 -0
  663. package/node_modules/@types/node/quic.d.ts +897 -0
  664. package/node_modules/@types/node/readline/promises.d.ts +158 -0
  665. package/node_modules/@types/node/readline.d.ts +507 -0
  666. package/node_modules/@types/node/repl.d.ts +420 -0
  667. package/node_modules/@types/node/sea.d.ts +47 -0
  668. package/node_modules/@types/node/sqlite.d.ts +1068 -0
  669. package/node_modules/@types/node/stream/consumers.d.ts +114 -0
  670. package/node_modules/@types/node/stream/iter.d.ts +301 -0
  671. package/node_modules/@types/node/stream/promises.d.ts +211 -0
  672. package/node_modules/@types/node/stream/web.d.ts +300 -0
  673. package/node_modules/@types/node/stream.d.ts +1774 -0
  674. package/node_modules/@types/node/string_decoder.d.ts +27 -0
  675. package/node_modules/@types/node/test/reporters.d.ts +59 -0
  676. package/node_modules/@types/node/test.d.ts +2279 -0
  677. package/node_modules/@types/node/timers/promises.d.ts +93 -0
  678. package/node_modules/@types/node/timers.d.ts +149 -0
  679. package/node_modules/@types/node/tls.d.ts +1193 -0
  680. package/node_modules/@types/node/trace_events.d.ts +103 -0
  681. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  682. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  683. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  684. package/node_modules/@types/node/ts5.6/index.d.ts +119 -0
  685. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  686. package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
  687. package/node_modules/@types/node/tty.d.ts +225 -0
  688. package/node_modules/@types/node/url.d.ts +556 -0
  689. package/node_modules/@types/node/util/types.d.ts +558 -0
  690. package/node_modules/@types/node/util.d.ts +1677 -0
  691. package/node_modules/@types/node/v8.d.ts +980 -0
  692. package/node_modules/@types/node/vm.d.ts +1136 -0
  693. package/node_modules/@types/node/wasi.d.ts +131 -0
  694. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  695. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  696. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  697. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  698. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  699. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  700. package/node_modules/@types/node/web-globals/events.d.ts +106 -0
  701. package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  702. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  703. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  704. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  705. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  706. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  707. package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  708. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  709. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  710. package/node_modules/@types/node/worker_threads.d.ts +671 -0
  711. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  712. package/node_modules/@types/node/zlib.d.ts +589 -0
  713. package/node_modules/protobufjs/README.md +556 -263
  714. package/node_modules/protobufjs/dist/light/protobuf.js +1569 -1919
  715. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  716. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  717. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  718. package/node_modules/protobufjs/dist/minimal/protobuf.js +906 -1132
  719. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  720. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  721. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  722. package/node_modules/protobufjs/dist/protobuf.js +1576 -1993
  723. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  724. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  725. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  726. package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
  727. package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
  728. package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
  729. package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
  730. package/node_modules/protobufjs/index.d.ts +720 -834
  731. package/node_modules/protobufjs/package.json +44 -20
  732. package/node_modules/protobufjs/src/converter.js +36 -60
  733. package/node_modules/protobufjs/src/decoder.js +53 -124
  734. package/node_modules/protobufjs/src/encoder.js +2 -10
  735. package/node_modules/protobufjs/src/enum.js +3 -8
  736. package/node_modules/protobufjs/src/field.js +11 -13
  737. package/node_modules/protobufjs/src/index-light.js +1 -1
  738. package/node_modules/protobufjs/src/mapfield.js +0 -1
  739. package/node_modules/protobufjs/src/message.js +11 -5
  740. package/node_modules/protobufjs/src/method.js +4 -5
  741. package/node_modules/protobufjs/src/namespace.js +3 -10
  742. package/node_modules/protobufjs/src/object.js +20 -20
  743. package/node_modules/protobufjs/src/oneof.js +0 -3
  744. package/node_modules/protobufjs/src/parse.js +16 -78
  745. package/node_modules/protobufjs/src/reader.js +31 -136
  746. package/node_modules/protobufjs/src/reader_buffer.js +3 -24
  747. package/node_modules/protobufjs/src/root.js +3 -7
  748. package/node_modules/protobufjs/src/roots.js +1 -1
  749. package/node_modules/protobufjs/src/service.js +6 -13
  750. package/node_modules/protobufjs/src/tokenize.js +1 -6
  751. package/node_modules/protobufjs/src/type.js +30 -44
  752. package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
  753. package/node_modules/protobufjs/src/util/minimal.js +12 -36
  754. package/node_modules/protobufjs/src/util.js +17 -6
  755. package/node_modules/protobufjs/src/verifier.js +6 -6
  756. package/node_modules/protobufjs/src/wrappers.js +1 -0
  757. package/node_modules/protobufjs/src/writer.js +16 -42
  758. package/node_modules/protobufjs/src/writer_buffer.js +1 -18
  759. package/node_modules/protobufjs/tsconfig.json +5 -3
  760. package/node_modules/undici-types/LICENSE +21 -0
  761. package/node_modules/undici-types/README.md +6 -0
  762. package/node_modules/undici-types/agent.d.ts +32 -0
  763. package/node_modules/undici-types/api.d.ts +43 -0
  764. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  765. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  766. package/node_modules/undici-types/cache.d.ts +36 -0
  767. package/node_modules/undici-types/client-stats.d.ts +15 -0
  768. package/node_modules/undici-types/client.d.ts +123 -0
  769. package/node_modules/undici-types/connector.d.ts +36 -0
  770. package/node_modules/undici-types/content-type.d.ts +21 -0
  771. package/node_modules/undici-types/cookies.d.ts +30 -0
  772. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  773. package/node_modules/undici-types/dispatcher.d.ts +279 -0
  774. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  775. package/node_modules/undici-types/errors.d.ts +177 -0
  776. package/node_modules/undici-types/eventsource.d.ts +66 -0
  777. package/node_modules/undici-types/fetch.d.ts +211 -0
  778. package/node_modules/undici-types/formdata.d.ts +108 -0
  779. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  780. package/node_modules/undici-types/global-origin.d.ts +7 -0
  781. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  782. package/node_modules/undici-types/handlers.d.ts +15 -0
  783. package/node_modules/undici-types/header.d.ts +160 -0
  784. package/node_modules/undici-types/index.d.ts +91 -0
  785. package/node_modules/undici-types/interceptors.d.ts +80 -0
  786. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  787. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  788. package/node_modules/undici-types/mock-client.d.ts +27 -0
  789. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  790. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  791. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  792. package/node_modules/undici-types/package.json +55 -0
  793. package/node_modules/undici-types/patch.d.ts +29 -0
  794. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  795. package/node_modules/undici-types/pool.d.ts +41 -0
  796. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  797. package/node_modules/undici-types/readable.d.ts +68 -0
  798. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  799. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  800. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  801. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  802. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  803. package/node_modules/undici-types/util.d.ts +18 -0
  804. package/node_modules/undici-types/utility.d.ts +7 -0
  805. package/node_modules/undici-types/webidl.d.ts +347 -0
  806. package/node_modules/undici-types/websocket.d.ts +188 -0
  807. package/npm-shrinkwrap.json +294 -204
  808. package/package.json +13 -13
  809. package/node_modules/protobufjs/ext/README.md +0 -81
  810. package/node_modules/protobufjs/ext/descriptor.d.ts +0 -86
  811. package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -409
  812. package/node_modules/protobufjs/ext/descriptor.js +0 -1266
  813. package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
  814. package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -11
  815. package/node_modules/protobufjs/ext/textformat.js +0 -1235
  816. package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
  817. package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
  818. package/node_modules/protobufjs/src/typescript.js +0 -25
  819. /package/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/logs/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,oBAAoB,CAAC;AAK5B,MAAM,UAAU,8BAA8B,CAC5C,UAA+B,EAC/B,OAAgB;IAEhB,OAAO;QACL,YAAY,EAAE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC;KAC5D,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CACxB,UAA+B;IAE/B,MAAM,WAAW,GAGb,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;QAC/B,MAAM,EACJ,QAAQ,EACR,oBAAoB,EAAE,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,GAC7D,GAAG,MAAM,CAAC;QAEX,IAAI,MAAM,GAAG,WAAW,CAAC,GAAG,C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SAAS,EAAE,iBAAiB,CAAC,SAAS;SACvC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,GAAsB,EAAE,OAAgB;IAC3D,OAAO;QACL,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;QAC9C,oBAAoB,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC;QAC9D,cAAc,EAAE,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC;QACpD,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACnC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;QACpD,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;QAClD,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,UAAU;QAClC,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;QACpE,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,cAA0C;IAE1C,OAAO,cAAmE,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,UAAyB,EACzB,OAAgB;IAEhB,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CACvC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAC1C,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReadableLogRecord } from '@opentelemetry/sdk-logs';\nimport type {\n ESeverityNumber,\n IExportLogsServiceRequest,\n ILogRecord,\n IResourceLogs,\n} from './internal-types';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAnyValue,\n toKeyValue,\n} from '../common/internal';\nimport type { SeverityNumber } from '@opentelemetry/api-logs';\nimport type { IKeyValue } from '../common/internal-types';\nimport type { LogAttributes } from '@opentelemetry/api-logs';\n\nexport function createExportLogsServiceRequest(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IExportLogsServiceRequest {\n return {\n resourceLogs: logRecordsToResourceLogs(logRecords, encoder),\n };\n}\n\nfunction createResourceMap(\n logRecords: ReadableLogRecord[]\n): Map<Resource, Map<string, ReadableLogRecord[]>> {\n const resourceMap: Map<\n Resource,\n Map<string, ReadableLogRecord[]>\n > = new Map();\n\n for (const record of logRecords) {\n const {\n resource,\n instrumentationScope: { name, version = '', schemaUrl = '' },\n } = record;\n\n let ismMap = resourceMap.get(resource);\n if (!ismMap) {\n ismMap = new Map();\n resourceMap.set(resource, ismMap);\n }\n\n const ismKey = `${name}@${version}:${schemaUrl}`;\n let records = ismMap.get(ismKey);\n if (!records) {\n records = [];\n ismMap.set(ismKey, records);\n }\n records.push(record);\n }\n return resourceMap;\n}\n\nfunction logRecordsToResourceLogs(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IResourceLogs[] {\n const resourceMap = createResourceMap(logRecords);\n return Array.from(resourceMap, ([resource, ismMap]) => {\n const processedResource = createResource(resource, encoder);\n return {\n resource: processedResource,\n scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {\n return {\n scope: createInstrumentationScope(scopeLogs[0].instrumentationScope),\n logRecords: scopeLogs.map(log => toLogRecord(log, encoder)),\n schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl,\n };\n }),\n schemaUrl: processedResource.schemaUrl,\n };\n });\n}\n\nfunction toLogRecord(log: ReadableLogRecord, encoder: Encoder): ILogRecord {\n return {\n timeUnixNano: encoder.encodeHrTime(log.hrTime),\n observedTimeUnixNano: encoder.encodeHrTime(log.hrTimeObserved),\n severityNumber: toSeverityNumber(log.severityNumber),\n severityText: log.severityText,\n body: toAnyValue(log.body, encoder),\n eventName: log.eventName,\n attributes: toLogAttributes(log.attributes, encoder),\n droppedAttributesCount: log.droppedAttributesCount,\n flags: log.spanContext?.traceFlags,\n traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),\n spanId: encoder.encodeOptionalSpanContext(log.spanContext?.spanId),\n };\n}\n\nfunction toSeverityNumber(\n severityNumber: SeverityNumber | undefined\n): ESeverityNumber | undefined {\n return severityNumber as number | undefined as ESeverityNumber | undefined;\n}\n\nexport function toLogAttributes(\n attributes: LogAttributes,\n encoder: Encoder\n): IKeyValue[] {\n return Object.keys(attributes).map(key =>\n toKeyValue(key, attributes[key], encoder)\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/logs/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,UAAU,EACV,YAAY,GACb,MAAM,oBAAoB,CAAC;AAG5B,MAAM,UAAU,8BAA8B,CAC5C,UAA+B,EAC/B,OAAgB;IAEhB,OAAO;QACL,YAAY,EAAE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC;KAC5D,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CACxB,UAA+B;IAK/B,MAAM,WAAW,GAGb,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;QAC/B,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAElD,IAAI,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACnB,WAAW,CAAC,GAAG,CAAC,QAAQ,EA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AAM,CAAC;QAC9C,oBAAoB,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC;QAC9D,cAAc,EAAE,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC;QACpD,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACnC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;QACjD,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;QAClD,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,UAAU;QAClC,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;QACpE,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,cAA0C;IAE1C,OAAO,cAAmE,CAAC;AAC7E,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReadableLogRecord } from '@opentelemetry/sdk-logs';\nimport type {\n ESeverityNumber,\n IExportLogsServiceRequest,\n ILogRecord,\n IResourceLogs,\n} from './internal-types';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAnyValue,\n toAttributes,\n} from '../common/internal';\nimport type { SeverityNumber } from '@opentelemetry/api-logs';\n\nexport function createExportLogsServiceRequest(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IExportLogsServiceRequest {\n return {\n resourceLogs: logRecordsToResourceLogs(logRecords, encoder),\n };\n}\n\nfunction createResourceMap(\n logRecords: ReadableLogRecord[]\n): Map<\n Resource,\n Map<ReadableLogRecord['instrumentationScope'], ReadableLogRecord[]>\n> {\n const resourceMap: Map<\n Resource,\n Map<ReadableLogRecord['instrumentationScope'], ReadableLogRecord[]>\n > = new Map();\n\n for (const record of logRecords) {\n const { resource, instrumentationScope } = record;\n\n let ismMap = resourceMap.get(resource);\n if (!ismMap) {\n ismMap = new Map();\n resourceMap.set(resource, ismMap);\n }\n\n let records = ismMap.get(instrumentationScope);\n if (!records) {\n records = [];\n ismMap.set(instrumentationScope, records);\n }\n records.push(record);\n }\n return resourceMap;\n}\n\nfunction logRecordsToResourceLogs(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IResourceLogs[] {\n const resourceMap = createResourceMap(logRecords);\n return Array.from(resourceMap, ([resource, ismMap]) => {\n const processedResource = createResource(resource, encoder);\n return {\n resource: processedResource,\n scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {\n return {\n scope: createInstrumentationScope(\n scopeLogs[0].instrumentationScope,\n encoder\n ),\n logRecords: scopeLogs.map(log => toLogRecord(log, encoder)),\n schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl,\n };\n }),\n schemaUrl: processedResource.schemaUrl,\n };\n });\n}\n\nfunction toLogRecord(log: ReadableLogRecord, encoder: Encoder): ILogRecord {\n return {\n timeUnixNano: encoder.encodeHrTime(log.hrTime),\n observedTimeUnixNano: encoder.encodeHrTime(log.hrTimeObserved),\n severityNumber: toSeverityNumber(log.severityNumber),\n severityText: log.severityText,\n body: toAnyValue(log.body, encoder),\n eventName: log.eventName,\n attributes: toAttributes(log.attributes, encoder),\n droppedAttributesCount: log.droppedAttributesCount,\n flags: log.spanContext?.traceFlags,\n traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),\n spanId: encoder.encodeOptionalSpanContext(log.spanContext?.spanId),\n };\n}\n\nfunction toSeverityNumber(\n severityNumber: SeverityNumber | undefined\n): ESeverityNumber | undefined {\n return severityNumber as number | undefined as ESeverityNumber | undefined;\n}\n"]}
@@ -16,7 +16,7 @@ export function toResourceMetrics(resourceMetrics, encoder) {
16
16
  }
17
17
  export function toScopeMetrics(scopeMetrics, encoder) {
18
18
  return Array.from(scopeMetrics.map(metrics => ({
19
- scope: createInstrumentationScope(metrics.scope),
19
+ scope: createInstrumentationScope(metrics.scope, encoder),
20
20
  metrics: metrics.metrics.map(metricData => toMetric(metricData, encoder)),
21
21
  schemaUrl: metrics.scope.schemaUrl,
22
22
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/metrics/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,OAAO,EACL,sBAAsB,EACtB,aAAa,GACd,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,MAAM,UAAU,iBAAiB,CAC/B,eAAgC,EAChC,OAAgB;IAEhB,MAAM,iBAAiB,GAAG,cAAc,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,OAAO;QACL,QAAQ,EAAE,iBAAiB;QAC3B,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,YAAY,EAAE,cAAc,CAAC,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC;KACpE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,YAA4B,EAC5B,OAAgB;IAEhB,OAAO,KAAK,CAAC,IAAI,CACf,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC3B,KAAK,EAAE,0BAA0B,CAAC,OAAO,CAAC,KAAK,CAAC;QAChD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACzE,SAAS,EAAE,OAAO,CAAC,KA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C,CAC/C,eAAkC,EAClC,OAAgB;IAEhB,OAAO;QACL,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAC7C,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ValueType } from '@opentelemetry/api';\nimport type {\n DataPoint,\n ExponentialHistogram,\n Histogram,\n MetricData,\n ResourceMetrics,\n ScopeMetrics,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporality,\n DataPointType,\n} from '@opentelemetry/sdk-metrics';\nimport type {\n IExponentialHistogramDataPoint,\n IExportMetricsServiceRequest,\n IHistogramDataPoint,\n IMetric,\n INumberDataPoint,\n IResourceMetrics,\n IScopeMetrics,\n} from './internal-types';\nimport { EAggregationTemporality } from './internal-types';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAttributes,\n} from '../common/internal';\n\nexport function toResourceMetrics(\n resourceMetrics: ResourceMetrics,\n encoder: Encoder\n): IResourceMetrics {\n const processedResource = createResource(resourceMetrics.resource, encoder);\n return {\n resource: processedResource,\n schemaUrl: processedResource.schemaUrl,\n scopeMetrics: toScopeMetrics(resourceMetrics.scopeMetrics, encoder),\n };\n}\n\nexport function toScopeMetrics(\n scopeMetrics: ScopeMetrics[],\n encoder: Encoder\n): IScopeMetrics[] {\n return Array.from(\n scopeMetrics.map(metrics => ({\n scope: createInstrumentationScope(metrics.scope),\n metrics: metrics.metrics.map(metricData => toMetric(metricData, encoder)),\n schemaUrl: metrics.scope.schemaUrl,\n }))\n );\n}\n\nexport function toMetric(metricData: MetricData, encoder: Encoder): IMetric {\n const out: IMetric = {\n name: metricData.descriptor.name,\n description: metricData.descriptor.description,\n unit: metricData.descriptor.unit,\n };\n\n const aggregationTemporality = toAggregationTemporality(\n metricData.aggregationTemporality\n );\n\n switch (metricData.dataPointType) {\n case DataPointType.SUM:\n out.sum = {\n aggregationTemporality,\n isMonotonic: metricData.isMonotonic,\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.GAUGE:\n out.gauge = {\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.HISTOGRAM:\n out.histogram = {\n aggregationTemporality,\n dataPoints: toHistogramDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.EXPONENTIAL_HISTOGRAM:\n out.exponentialHistogram = {\n aggregationTemporality,\n dataPoints: toExponentialHistogramDataPoints(metricData, encoder),\n };\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoint(\n dataPoint:\n | DataPoint<number>\n | DataPoint<Histogram>\n | DataPoint<ExponentialHistogram>,\n valueType: ValueType,\n encoder: Encoder\n) {\n const out: INumberDataPoint = {\n attributes: toAttributes(dataPoint.attributes, encoder),\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n\n switch (valueType) {\n case ValueType.INT:\n out.asInt = dataPoint.value as number;\n break;\n case ValueType.DOUBLE:\n out.asDouble = dataPoint.value as number;\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): INumberDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n return toSingularDataPoint(\n dataPoint,\n metricData.descriptor.valueType,\n encoder\n );\n });\n}\n\nfunction toHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as Histogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n bucketCounts: histogram.buckets.counts,\n explicitBounds: histogram.buckets.boundaries,\n count: histogram.count,\n sum: histogram.sum,\n min: histogram.min,\n max: histogram.max,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toExponentialHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IExponentialHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as ExponentialHistogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n count: histogram.count,\n min: histogram.min,\n max: histogram.max,\n sum: histogram.sum,\n positive: {\n offset: histogram.positive.offset,\n bucketCounts: histogram.positive.bucketCounts,\n },\n negative: {\n offset: histogram.negative.offset,\n bucketCounts: histogram.negative.bucketCounts,\n },\n scale: histogram.scale,\n zeroCount: histogram.zeroCount,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toAggregationTemporality(\n temporality: AggregationTemporality\n): EAggregationTemporality {\n switch (temporality) {\n case AggregationTemporality.DELTA:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA;\n case AggregationTemporality.CUMULATIVE:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE;\n }\n}\n\nexport function createExportMetricsServiceRequest(\n resourceMetrics: ResourceMetrics[],\n encoder: Encoder\n): IExportMetricsServiceRequest {\n return {\n resourceMetrics: resourceMetrics.map(metrics =>\n toResourceMetrics(metrics, encoder)\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/metrics/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,OAAO,EACL,sBAAsB,EACtB,aAAa,GACd,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,MAAM,UAAU,iBAAiB,CAC/B,eAAgC,EAChC,OAAgB;IAEhB,MAA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R,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM;gBACjC,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,YAAY;aAC9C;YACD,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,iBAAiB,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC;YAC5D,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC;SACtD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,wBAAwB,CAC/B,WAAmC;IAEnC,QAAQ,WAAW,EAAE;QACnB,KAAK,sBAAsB,CAAC,KAAK;YAC/B,OAAO,uBAAuB,CAAC,6BAA6B,CAAC;QAC/D,KAAK,sBAAsB,CAAC,UAAU;YACpC,OAAO,uBAAuB,CAAC,kCAAkC,CAAC;KACrE;AACH,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,eAAkC,EAClC,OAAgB;IAEhB,OAAO;QACL,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAC7C,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ValueType } from '@opentelemetry/api';\nimport type {\n DataPoint,\n ExponentialHistogram,\n Histogram,\n MetricData,\n ResourceMetrics,\n ScopeMetrics,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporality,\n DataPointType,\n} from '@opentelemetry/sdk-metrics';\nimport type {\n IExponentialHistogramDataPoint,\n IExportMetricsServiceRequest,\n IHistogramDataPoint,\n IMetric,\n INumberDataPoint,\n IResourceMetrics,\n IScopeMetrics,\n} from './internal-types';\nimport { EAggregationTemporality } from './internal-types';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAttributes,\n} from '../common/internal';\n\nexport function toResourceMetrics(\n resourceMetrics: ResourceMetrics,\n encoder: Encoder\n): IResourceMetrics {\n const processedResource = createResource(resourceMetrics.resource, encoder);\n return {\n resource: processedResource,\n schemaUrl: processedResource.schemaUrl,\n scopeMetrics: toScopeMetrics(resourceMetrics.scopeMetrics, encoder),\n };\n}\n\nexport function toScopeMetrics(\n scopeMetrics: ScopeMetrics[],\n encoder: Encoder\n): IScopeMetrics[] {\n return Array.from(\n scopeMetrics.map(metrics => ({\n scope: createInstrumentationScope(metrics.scope, encoder),\n metrics: metrics.metrics.map(metricData => toMetric(metricData, encoder)),\n schemaUrl: metrics.scope.schemaUrl,\n }))\n );\n}\n\nexport function toMetric(metricData: MetricData, encoder: Encoder): IMetric {\n const out: IMetric = {\n name: metricData.descriptor.name,\n description: metricData.descriptor.description,\n unit: metricData.descriptor.unit,\n };\n\n const aggregationTemporality = toAggregationTemporality(\n metricData.aggregationTemporality\n );\n\n switch (metricData.dataPointType) {\n case DataPointType.SUM:\n out.sum = {\n aggregationTemporality,\n isMonotonic: metricData.isMonotonic,\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.GAUGE:\n out.gauge = {\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.HISTOGRAM:\n out.histogram = {\n aggregationTemporality,\n dataPoints: toHistogramDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.EXPONENTIAL_HISTOGRAM:\n out.exponentialHistogram = {\n aggregationTemporality,\n dataPoints: toExponentialHistogramDataPoints(metricData, encoder),\n };\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoint(\n dataPoint:\n | DataPoint<number>\n | DataPoint<Histogram>\n | DataPoint<ExponentialHistogram>,\n valueType: ValueType,\n encoder: Encoder\n) {\n const out: INumberDataPoint = {\n attributes: toAttributes(dataPoint.attributes, encoder),\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n\n switch (valueType) {\n case ValueType.INT:\n out.asInt = dataPoint.value as number;\n break;\n case ValueType.DOUBLE:\n out.asDouble = dataPoint.value as number;\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): INumberDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n return toSingularDataPoint(\n dataPoint,\n metricData.descriptor.valueType,\n encoder\n );\n });\n}\n\nfunction toHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as Histogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n bucketCounts: histogram.buckets.counts,\n explicitBounds: histogram.buckets.boundaries,\n count: histogram.count,\n sum: histogram.sum,\n min: histogram.min,\n max: histogram.max,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toExponentialHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IExponentialHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as ExponentialHistogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n count: histogram.count,\n min: histogram.min,\n max: histogram.max,\n sum: histogram.sum,\n positive: {\n offset: histogram.positive.offset,\n bucketCounts: histogram.positive.bucketCounts,\n },\n negative: {\n offset: histogram.negative.offset,\n bucketCounts: histogram.negative.bucketCounts,\n },\n scale: histogram.scale,\n zeroCount: histogram.zeroCount,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toAggregationTemporality(\n temporality: AggregationTemporality\n): EAggregationTemporality {\n switch (temporality) {\n case AggregationTemporality.DELTA:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA;\n case AggregationTemporality.CUMULATIVE:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE;\n }\n}\n\nexport function createExportMetricsServiceRequest(\n resourceMetrics: ResourceMetrics[],\n encoder: Encoder\n): IExportMetricsServiceRequest {\n return {\n resourceMetrics: resourceMetrics.map(metrics =>\n toResourceMetrics(metrics, encoder)\n ),\n };\n}\n"]}
@@ -103,7 +103,7 @@ function spanRecordsToResourceSpans(readableSpans, encoder) {
103
103
  if (scopeSpans.length > 0) {
104
104
  const spans = scopeSpans.map(readableSpan => sdkSpanToOtlpSpan(readableSpan, encoder));
105
105
  scopeResourceSpans.push({
106
- scope: createInstrumentationScope(scopeSpans[0].instrumentationScope),
106
+ scope: createInstrumentationScope(scopeSpans[0].instrumentationScope, encoder),
107
107
  spans: spans,
108
108
  schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl,
109
109
  });
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/trace/internal.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAW5B,uDAAuD;AACvD,MAAM,qCAAqC,GAAG,KAAK,CAAC;AACpD,MAAM,iCAAiC,GAAG,KAAK,CAAC;AAEhD;;;GAGG;AACH,SAAS,kBAAkB,CAAC,UAAkB,EAAE,QAAkB;IAChE,gDAAgD;IAChD,IAAI,KAAK,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,qCAAqC,CAAC;IACxE,IAAI,QAAQ,EAAE;QACZ,KAAK,IAAI,iCAAiC,CAAC;KAC5C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAkB,EAAE,OAAgB;IACpE,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,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AAW,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;YACrB,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC;YAClC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAC1C,iBAAiB,CAAC,YAAY,EAAE,OAAO,CAAC,CACzC,CAAC;gBAEF,kBAAkB,CAAC,IAAI,CAAC;oBACtB,KAAK,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;oBACrE,KAAK,EAAE,KAAK;oBACZ,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,SAAS;iBACxD,CAAC,CAAC;aACJ;YACD,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;SAC/B;QACD,MAAM,iBAAiB,GAAG,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,gBAAgB,GAAmB;YACvC,QAAQ,EAAE,iBAAiB;YAC3B,UAAU,EAAE,kBAAkB;YAC9B,SAAS,EAAE,iBAAiB,CAAC,SAAS;SACvC,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3B,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;KAC9B;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Link } from '@opentelemetry/api';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAttributes,\n} from '../common/internal';\nimport type {\n EStatusCode,\n IEvent,\n IExportTraceServiceRequest,\n ILink,\n IResourceSpans,\n IScopeSpans,\n ISpan,\n} from './internal-types';\n\n// Span flags constants matching the OTLP specification\nconst SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x100;\nconst SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x200;\n\n/**\n * Builds the 32-bit span flags value combining the low 8-bit W3C TraceFlags\n * with the HAS_IS_REMOTE and IS_REMOTE bits according to the OTLP spec.\n */\nfunction buildSpanFlagsFrom(traceFlags: number, isRemote?: boolean): number {\n // low 8 bits are W3C TraceFlags (e.g., sampled)\n let flags = (traceFlags & 0xff) | SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK;\n if (isRemote) {\n flags |= SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK;\n }\n return flags;\n}\n\nexport function sdkSpanToOtlpSpan(span: ReadableSpan, encoder: Encoder): ISpan {\n const ctx = span.spanContext();\n const status = span.status;\n const parentSpanId = span.parentSpanContext?.spanId\n ? encoder.encodeSpanContext(span.parentSpanContext?.spanId)\n : undefined;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: parentSpanId,\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes, encoder),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code as unknown as EStatusCode,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n flags: buildSpanFlagsFrom(ctx.traceFlags, span.parentSpanContext?.isRemote),\n };\n}\n\nexport function toOtlpLink(link: Link, encoder: Encoder): ILink {\n return {\n attributes: link.attributes ? toAttributes(link.attributes, encoder) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n flags: buildSpanFlagsFrom(link.context.traceFlags, link.context.isRemote),\n };\n}\n\nexport function toOtlpSpanEvent(\n timedEvent: TimedEvent,\n encoder: Encoder\n): IEvent {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes, encoder)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\n\nexport function createExportTraceServiceRequest(\n spans: ReadableSpan[],\n encoder: Encoder\n): IExportTraceServiceRequest {\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\n\nfunction createResourceMap(readableSpans: ReadableSpan[]) {\n const resourceMap: Map<Resource, Map<string, ReadableSpan[]>> = new Map();\n for (const record of readableSpans) {\n let ilsMap = resourceMap.get(record.resource);\n\n if (!ilsMap) {\n ilsMap = new Map();\n resourceMap.set(record.resource, ilsMap);\n }\n\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationScopeKey = `${record.instrumentationScope.name}@${\n record.instrumentationScope.version || ''\n }:${record.instrumentationScope.schemaUrl || ''}`;\n let records = ilsMap.get(instrumentationScopeKey);\n\n if (!records) {\n records = [];\n ilsMap.set(instrumentationScopeKey, records);\n }\n\n records.push(record);\n }\n\n return resourceMap;\n}\n\nfunction spanRecordsToResourceSpans(\n readableSpans: ReadableSpan[],\n encoder: Encoder\n): IResourceSpans[] {\n const resourceMap = createResourceMap(readableSpans);\n const out: IResourceSpans[] = [];\n\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans: IScopeSpans[] = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const spans = scopeSpans.map(readableSpan =>\n sdkSpanToOtlpSpan(readableSpan, encoder)\n );\n\n scopeResourceSpans.push({\n scope: createInstrumentationScope(scopeSpans[0].instrumentationScope),\n spans: spans,\n schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n const processedResource = createResource(resource, encoder);\n const transformedSpans: IResourceSpans = {\n resource: processedResource,\n scopeSpans: scopeResourceSpans,\n schemaUrl: processedResource.schemaUrl,\n };\n\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n\n return out;\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/trace/internal.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAW5B,uDAAuD;AACvD,MAAM,qCAAqC,GAAG,KAAK,CAAC;AACpD,MAAM,iCAAiC,GAAG,KAAK,CAAC;AAEhD;;;GAGG;AACH,SAAS,kBAAkB,CAAC,UAAkB,EAAE,QAAkB;IAChE,gDAAgD;IAChD,IAAI,KAAK,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,qCAAqC,CAAC;IACxE,IAAI,QAAQ,EAAE;QACZ,KAAK,IAAI,iCAAiC,CAAC;KAC5C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAkB,EAAE,OAAgB;IACpE,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,EAAE,MAAM;QACjD,CAAC,CAAC,OAAO,CAAC,iB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C,IAAI,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;YACrB,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC;YAClC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAC1C,iBAAiB,CAAC,YAAY,EAAE,OAAO,CAAC,CACzC,CAAC;gBAEF,kBAAkB,CAAC,IAAI,CAAC;oBACtB,KAAK,EAAE,0BAA0B,CAC/B,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,EAClC,OAAO,CACR;oBACD,KAAK,EAAE,KAAK;oBACZ,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,SAAS;iBACxD,CAAC,CAAC;aACJ;YACD,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;SAC/B;QACD,MAAM,iBAAiB,GAAG,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,gBAAgB,GAAmB;YACvC,QAAQ,EAAE,iBAAiB;YAC3B,UAAU,EAAE,kBAAkB;YAC9B,SAAS,EAAE,iBAAiB,CAAC,SAAS;SACvC,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3B,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;KAC9B;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Link } from '@opentelemetry/api';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAttributes,\n} from '../common/internal';\nimport type {\n EStatusCode,\n IEvent,\n IExportTraceServiceRequest,\n ILink,\n IResourceSpans,\n IScopeSpans,\n ISpan,\n} from './internal-types';\n\n// Span flags constants matching the OTLP specification\nconst SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x100;\nconst SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x200;\n\n/**\n * Builds the 32-bit span flags value combining the low 8-bit W3C TraceFlags\n * with the HAS_IS_REMOTE and IS_REMOTE bits according to the OTLP spec.\n */\nfunction buildSpanFlagsFrom(traceFlags: number, isRemote?: boolean): number {\n // low 8 bits are W3C TraceFlags (e.g., sampled)\n let flags = (traceFlags & 0xff) | SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK;\n if (isRemote) {\n flags |= SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK;\n }\n return flags;\n}\n\nexport function sdkSpanToOtlpSpan(span: ReadableSpan, encoder: Encoder): ISpan {\n const ctx = span.spanContext();\n const status = span.status;\n const parentSpanId = span.parentSpanContext?.spanId\n ? encoder.encodeSpanContext(span.parentSpanContext?.spanId)\n : undefined;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: parentSpanId,\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes, encoder),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code as unknown as EStatusCode,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n flags: buildSpanFlagsFrom(ctx.traceFlags, span.parentSpanContext?.isRemote),\n };\n}\n\nexport function toOtlpLink(link: Link, encoder: Encoder): ILink {\n return {\n attributes: link.attributes ? toAttributes(link.attributes, encoder) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n flags: buildSpanFlagsFrom(link.context.traceFlags, link.context.isRemote),\n };\n}\n\nexport function toOtlpSpanEvent(\n timedEvent: TimedEvent,\n encoder: Encoder\n): IEvent {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes, encoder)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\n\nexport function createExportTraceServiceRequest(\n spans: ReadableSpan[],\n encoder: Encoder\n): IExportTraceServiceRequest {\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\n\nfunction createResourceMap(readableSpans: ReadableSpan[]) {\n const resourceMap: Map<Resource, Map<string, ReadableSpan[]>> = new Map();\n for (const record of readableSpans) {\n let ilsMap = resourceMap.get(record.resource);\n\n if (!ilsMap) {\n ilsMap = new Map();\n resourceMap.set(record.resource, ilsMap);\n }\n\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationScopeKey = `${record.instrumentationScope.name}@${\n record.instrumentationScope.version || ''\n }:${record.instrumentationScope.schemaUrl || ''}`;\n let records = ilsMap.get(instrumentationScopeKey);\n\n if (!records) {\n records = [];\n ilsMap.set(instrumentationScopeKey, records);\n }\n\n records.push(record);\n }\n\n return resourceMap;\n}\n\nfunction spanRecordsToResourceSpans(\n readableSpans: ReadableSpan[],\n encoder: Encoder\n): IResourceSpans[] {\n const resourceMap = createResourceMap(readableSpans);\n const out: IResourceSpans[] = [];\n\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans: IScopeSpans[] = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const spans = scopeSpans.map(readableSpan =>\n sdkSpanToOtlpSpan(readableSpan, encoder)\n );\n\n scopeResourceSpans.push({\n scope: createInstrumentationScope(\n scopeSpans[0].instrumentationScope,\n encoder\n ),\n spans: spans,\n schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n const processedResource = createResource(resource, encoder);\n const transformedSpans: IResourceSpans = {\n resource: processedResource,\n scopeSpans: scopeResourceSpans,\n schemaUrl: processedResource.schemaUrl,\n };\n\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n\n return out;\n}\n"]}
@@ -1,11 +1,14 @@
1
1
  import type { IAnyValue, IInstrumentationScope, IKeyValue, Resource } from './internal-types';
2
- import type { Attributes } from '@opentelemetry/api';
3
2
  import type { InstrumentationScope } from '@opentelemetry/core';
4
3
  import type { Resource as ISdkResource } from '@opentelemetry/resources';
5
4
  import type { Encoder } from './utils';
5
+ import type { LogAttributes } from '@opentelemetry/api-logs';
6
6
  export declare function createResource(resource: ISdkResource, encoder: Encoder): Resource;
7
- export declare function createInstrumentationScope(scope: InstrumentationScope): IInstrumentationScope;
8
- export declare function toAttributes(attributes: Attributes, encoder: Encoder): IKeyValue[];
7
+ export declare function createInstrumentationScope(scope: InstrumentationScope & {
8
+ attributes?: LogAttributes;
9
+ droppedAttributesCount?: number;
10
+ }, encoder: Encoder): IInstrumentationScope;
11
+ export declare function toAttributes(attributes: LogAttributes, encoder: Encoder): IKeyValue[];
9
12
  export declare function toKeyValue(key: string, value: unknown, encoder: Encoder): IKeyValue;
10
13
  export declare function toAnyValue(value: unknown, encoder: Encoder): IAnyValue;
11
14
  //# sourceMappingURL=internal.d.ts.map
@@ -12,11 +12,16 @@ function createResource(resource, encoder) {
12
12
  return result;
13
13
  }
14
14
  exports.createResource = createResource;
15
- function createInstrumentationScope(scope) {
16
- return {
15
+ function createInstrumentationScope(scope, encoder) {
16
+ const result = {
17
17
  name: scope.name,
18
18
  version: scope.version,
19
19
  };
20
+ if (scope.attributes && Object.keys(scope.attributes).length > 0) {
21
+ result.attributes = toAttributes(scope.attributes, encoder);
22
+ result.droppedAttributesCount = scope.droppedAttributesCount ?? 0;
23
+ }
24
+ return result;
20
25
  }
21
26
  exports.createInstrumentationScope = createInstrumentationScope;
22
27
  function toAttributes(attributes, encoder) {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/common/internal.ts"],"names":[],"mappings":";;;AAeA,SAAgB,cAAc,CAC5B,QAAsB,EACtB,OAAgB;IAEhB,MAAM,MAAM,GAAa;QACvB,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QACtD,sBAAsB,EAAE,CAAC;KAC1B,CAAC;IAEF,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IACrC,IAAI,SAAS,IAAI,SAAS,KAAK,EAAE;QAAE,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAEhE,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wCAaC;AAED,SAAgB,0BAA0B,CACxC,KAA2B;IAE3B,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AAPD,gEAOC;AAED,SAAgB,YAAY,CAC1B,UAAsB,EACtB,OAAgB;IAEhB,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CACvC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAC1C,CAAC;AACJ,CAAC;AAPD,oCAOC;AAED,SAAgB,UAAU,CACxB,GAAW,EACX,KAAc,EACd,OAAgB;IAEhB,OAAO;QACL,GAAG,EAAE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,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,CAAC,CAAC,CAAC,GAAG;gBACV,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;gBACZ,KAAK,EAAE,UAAU,CAAE,KAAiC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;aACxE,CAAC;SACH;QACD,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;KACpC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AA9BD,gCA8BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type {\n IAnyValue,\n IInstrumentationScope,\n IKeyValue,\n Resource,\n} from './internal-types';\nimport type { Attributes } from '@opentelemetry/api';\nimport type { InstrumentationScope } from '@opentelemetry/core';\nimport type { Resource as ISdkResource } from '@opentelemetry/resources';\nimport type { Encoder } from './utils';\n\nexport function createResource(\n resource: ISdkResource,\n encoder: Encoder\n): Resource {\n const result: Resource = {\n attributes: toAttributes(resource.attributes, encoder),\n droppedAttributesCount: 0,\n };\n\n const schemaUrl = resource.schemaUrl;\n if (schemaUrl && schemaUrl !== '') result.schemaUrl = schemaUrl;\n\n return result;\n}\n\nexport function createInstrumentationScope(\n scope: InstrumentationScope\n): IInstrumentationScope {\n return {\n name: scope.name,\n version: scope.version,\n };\n}\n\nexport function toAttributes(\n attributes: Attributes,\n encoder: Encoder\n): IKeyValue[] {\n return Object.keys(attributes).map(key =>\n toKeyValue(key, attributes[key], encoder)\n );\n}\n\nexport function toKeyValue(\n key: string,\n value: unknown,\n encoder: Encoder\n): IKeyValue {\n return {\n key: key,\n value: toAnyValue(value, encoder),\n };\n}\n\nexport function toAnyValue(value: unknown, encoder: Encoder): IAnyValue {\n const t = typeof value;\n if (t === 'string') return { stringValue: value as string };\n if (t === 'number') {\n if (!Number.isInteger(value)) return { doubleValue: value as number };\n return { intValue: value as number };\n }\n if (t === 'boolean') return { boolValue: value as boolean };\n if (value instanceof Uint8Array)\n return { bytesValue: encoder.encodeUint8Array(value) };\n if (Array.isArray(value)) {\n const values: IAnyValue[] = new Array(value.length);\n for (let i = 0; i < value.length; i++) {\n values[i] = toAnyValue(value[i], encoder);\n }\n return { arrayValue: { values } };\n }\n if (t === 'object' && value != null) {\n const keys = Object.keys(value);\n const values: IKeyValue[] = new Array(keys.length);\n for (let i = 0; i < keys.length; i++) {\n values[i] = {\n key: keys[i],\n value: toAnyValue((value as Record<string, unknown>)[keys[i]], encoder),\n };\n }\n return { kvlistValue: { values } };\n }\n\n return {};\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/common/internal.ts"],"names":[],"mappings":";;;AAeA,SAAgB,cAAc,CAC5B,QAAsB,EACtB,OAAgB;IAEhB,MAAM,MAAM,GAAa;QACvB,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QACtD,sBAAsB,EAAE,CAAC;KAC1B,CAAC;IAEF,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IACrC,IAAI,SAAS,IAAI,SAAS,KAAK,EAAE;QAAE,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAEhE,OAAO,MAAM,CAAC;AAChB,CAAC;AAbD,wCAaC;AAED,SAAgB,0BAA0B,CACxC,KAGC,EACD,OAAgB;IAEhB,MAAM,MAAM,GAA0B;QACpC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;IAEF,IAAI,KAAK,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAChE,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAA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pD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;SAC3C;QACD,OAAO,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;KACnC;IACD,IAAI,CAAC,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,MAAM,GAAgB,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,CAAC,CAAC,CAAC,GAAG;gBACV,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;gBACZ,KAAK,EAAE,UAAU,CAAE,KAAiC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;aACxE,CAAC;SACH;QACD,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;KACpC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AA9BD,gCA8BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type {\n IAnyValue,\n IInstrumentationScope,\n IKeyValue,\n Resource,\n} from './internal-types';\nimport type { InstrumentationScope } from '@opentelemetry/core';\nimport type { Resource as ISdkResource } from '@opentelemetry/resources';\nimport type { Encoder } from './utils';\nimport type { LogAttributes } from '@opentelemetry/api-logs';\n\nexport function createResource(\n resource: ISdkResource,\n encoder: Encoder\n): Resource {\n const result: Resource = {\n attributes: toAttributes(resource.attributes, encoder),\n droppedAttributesCount: 0,\n };\n\n const schemaUrl = resource.schemaUrl;\n if (schemaUrl && schemaUrl !== '') result.schemaUrl = schemaUrl;\n\n return result;\n}\n\nexport function createInstrumentationScope(\n scope: InstrumentationScope & {\n attributes?: LogAttributes;\n droppedAttributesCount?: number;\n },\n encoder: Encoder\n): IInstrumentationScope {\n const result: IInstrumentationScope = {\n name: scope.name,\n version: scope.version,\n };\n\n if (scope.attributes && Object.keys(scope.attributes).length > 0) {\n result.attributes = toAttributes(scope.attributes, encoder);\n result.droppedAttributesCount = scope.droppedAttributesCount ?? 0;\n }\n\n return result;\n}\n\nexport function toAttributes(\n attributes: LogAttributes,\n encoder: Encoder\n): IKeyValue[] {\n return Object.keys(attributes).map(key =>\n toKeyValue(key, attributes[key], encoder)\n );\n}\n\nexport function toKeyValue(\n key: string,\n value: unknown,\n encoder: Encoder\n): IKeyValue {\n return {\n key: key,\n value: toAnyValue(value, encoder),\n };\n}\n\nexport function toAnyValue(value: unknown, encoder: Encoder): IAnyValue {\n const t = typeof value;\n if (t === 'string') return { stringValue: value as string };\n if (t === 'number') {\n if (!Number.isInteger(value)) return { doubleValue: value as number };\n return { intValue: value as number };\n }\n if (t === 'boolean') return { boolValue: value as boolean };\n if (value instanceof Uint8Array)\n return { bytesValue: encoder.encodeUint8Array(value) };\n if (Array.isArray(value)) {\n const values: IAnyValue[] = new Array(value.length);\n for (let i = 0; i < value.length; i++) {\n values[i] = toAnyValue(value[i], encoder);\n }\n return { arrayValue: { values } };\n }\n if (t === 'object' && value != null) {\n const keys = Object.keys(value);\n const values: IKeyValue[] = new Array(keys.length);\n for (let i = 0; i < keys.length; i++) {\n values[i] = {\n key: keys[i],\n value: toAnyValue((value as Record<string, unknown>)[keys[i]], encoder),\n };\n }\n return { kvlistValue: { values } };\n }\n\n return {};\n}\n"]}
@@ -33,7 +33,16 @@ export declare function writeAnyValue(writer: IProtobufWriter, value: AnyValue):
33
33
  * 1 name string (wire type 2)
34
34
  * 2 version string (wire type 2)
35
35
  */
36
- export declare function writeInstrumentationScope(writer: IProtobufWriter, scope: InstrumentationScope, fieldNumber: number): void;
36
+ export declare function writeInstrumentationScope(writer: IProtobufWriter, scope: InstrumentationScope &
37
+ /**
38
+ * Additional properties that are currently only part of the logs-specific type.
39
+ * Once InstrumentationScope also includes `attributes` and `droppedAttributesCount`,
40
+ * we should remove these extensions.
41
+ */
42
+ {
43
+ attributes?: LogAttributes;
44
+ droppedAttributesCount?: number;
45
+ }, fieldNumber: number): void;
37
46
  /**
38
47
  * Write a Resource message and its enclosing tag.
39
48
  *
@@ -182,6 +182,15 @@ function writeInstrumentationScope(writer, scope, fieldNumber) {
182
182
  writer.writeTag(2, 2);
183
183
  writer.writeString(scope.version);
184
184
  }
185
+ if (scope.attributes) {
186
+ // attributes (field 3, repeated KeyValue)
187
+ writeAttributes(writer, scope.attributes, 3);
188
+ }
189
+ if (scope.droppedAttributesCount) {
190
+ // dropped_attributes_count (field 4, uint32)
191
+ writer.writeTag(4, 0);
192
+ writer.writeVarint(scope.droppedAttributesCount);
193
+ }
185
194
  writer.finishLengthDelimited(start, writer.pos - startPos);
186
195
  }
187
196
  exports.writeInstrumentationScope = writeInstrumentationScope;
@@ -1 +1 @@
1
- {"version":3,"file":"common-serializer.js","sourceRoot":"","sources":["../../../../src/common/protobuf/common-serializer.ts"],"names":[],"mappings":";;;AAUA;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAClC,UAA2B,EAC3B,MAAc;IAEd,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAExB,4FAA4F;IAC5F,EAAE;IACF,qEAAqE;IACrE,+EAA+E;IAC/E,mDAAmD;IACnD,EAAE;IACF,2EAA2E;IAC3E,6BAA6B;IAC7B,0CAA0C;IAC1C,6DAA6D;IAC7D,6DAA6D;IAC7D,EAAE;IACF,kBAAkB;IAClB,oBAAoB;IACpB,sCAAsC;IACtC,+BAA+B;IAE/B,MAAM,cAAc,G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AAE,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KACnC;IAED,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC;AAC7D,CAAC;AApBD,8DAoBC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAC3B,MAAuB,EACvB,QAAkB,EAClB,WAAmB;IAEnB,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC;IAEpC,0CAA0C;IAC1C,IAAI,QAAQ,CAAC,UAAU,EAAE;QACvB,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;KACjD;IAED,+EAA+E;IAC/E,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtB,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAEtB,MAAM,CAAC,qBAAqB,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,GAAG,gBAAgB,CAAC,CAAC;AAC7E,CAAC;AAnBD,sCAmBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Attributes, HrTime } from '@opentelemetry/api';\nimport type { AnyValue, LogAttributes } from '@opentelemetry/api-logs';\nimport type { InstrumentationScope } from '@opentelemetry/core';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { IProtobufWriter } from './i-protobuf-writer';\n\n/**\n * Write HrTime [seconds, nanoseconds] directly as fixed64 to the serializer.\n * Converts to nanoseconds and writes as 64-bit little-endian integer without allocations.\n *\n * HrTime represents: total_nanos = seconds * 1_000_000_000 + nanoseconds\n * We need to split this into low (bits 0-31) and high (bits 32-63).\n *\n * @param serializer - The protobuf writer\n * @param hrTime - HrTime tuple [seconds, nanoseconds]\n */\nexport function writeHrTimeAsFixed64(\n serializer: IProtobufWriter,\n hrTime: HrTime\n): void {\n const seconds = hrTime[0];\n const nanos = hrTime[1];\n\n // Calculate total nanoseconds (seconds * 1_000_000_000 + nanos) split into [low32, high32].\n //\n // We cannot use `seconds * 1e9` directly because for Unix timestamps\n // (seconds > ~9_007_199) the product exceeds Number.MAX_SAFE_INTEGER and loses\n // integer precision in IEEE 754 double arithmetic.\n //\n // So we split `seconds` into its lower 16 bits and remaining upper bits so\n // every multiplication stays\n // within the safe-integer range (< 2^53):\n // secondsLower16Bits * 1e9 <= 65535 * 1e9 ≈ 6.55e13 < 2^53\n // secondsUpperBits * 1e9 <= 65535 * 1e9 ≈ 6.55e13 < 2^53\n //\n // Then recombine:\n // seconds * 1e9 =\n // secondsUpperBits * 1e9 * 2^16 +\n // secondsLower16Bits * 1e9\n\n const nanosPerSecond = 1_000_000_000;\n // Split `seconds` into low 16 bits and the remaining upper bits.\n // This avoids the signed 32-bit seconds limit behind the Year 2038 problem:\n // the practical limit here is the encoded fixed64 range. Callers must keep\n // `seconds * 1e9 + nanos` within uint64, i.e. up to\n // [18_446_744_073, 709_551_615]. Beyond that, the serialized value wraps.\n const secondsLower16Bits = seconds & 0xffff; // bits 0-15 of seconds\n const secondsUpperBits = (seconds / 0x10000) >>> 0; // bits 16+ of seconds\n\n const nanosFromLower16Bits = secondsLower16Bits * nanosPerSecond; // exact integer, < 2^53\n const nanosFromUpperBits = secondsUpperBits * nanosPerSecond; // exact integer, < 2^53\n\n // Split the lower-16-bit contribution into [low32, high32].\n const lower16ContributionLow32 = nanosFromLower16Bits >>> 0;\n const lower16ContributionHigh32 = Math.floor(\n nanosFromLower16Bits / 0x100000000\n );\n\n // The upper-bits contribution is shifted left by 16 bits when recombined.\n const upperBitsContributionLow32 =\n ((nanosFromUpperBits & 0xffff) * 0x10000) >>> 0;\n const upperBitsContributionHigh32 = (nanosFromUpperBits / 0x10000) >>> 0;\n\n // Add the two contributions plus the sub-second nanoseconds with carry propagation.\n const low32WithCarry =\n lower16ContributionLow32 + upperBitsContributionLow32 + nanos;\n const totalLow = low32WithCarry >>> 0;\n const carry = Math.floor(low32WithCarry / 0x100000000); // 0, 1, or 2\n const totalHigh =\n (lower16ContributionHigh32 + upperBitsContributionHigh32 + carry) >>> 0;\n\n serializer.writeFixed64(totalLow, totalHigh);\n}\n\n/**\n * Write Attributes directly to protobuf as repeated KeyValue\n */\nexport function writeAttributes(\n writer: IProtobufWriter,\n attributes: Attributes | LogAttributes,\n fieldNumber: number\n): void {\n for (const key in attributes) {\n if (!Object.prototype.hasOwnProperty.call(attributes, key)) {\n continue;\n }\n const value = attributes[key];\n writer.writeTag(fieldNumber, 2); // repeated KeyValue attributes (field varies, length-delimited)\n const kvStart = writer.startLengthDelimited();\n const startPos = writer.pos;\n writeKeyValue(writer, key, value);\n writer.finishLengthDelimited(kvStart, writer.pos - startPos);\n }\n}\n\n/**\n * Write a KeyValue pair directly to protobuf\n */\nexport function writeKeyValue(\n writer: IProtobufWriter,\n key: string,\n value: AnyValue\n): void {\n writer.writeTag(1, 2); // KeyValue.key (field 1, string, length-delimited)\n writer.writeString(key);\n writer.writeTag(2, 2); // KeyValue.value (field 2, AnyValue, length-delimited)\n const valueStart = writer.startLengthDelimited();\n const startPos = writer.pos;\n writeAnyValue(writer, value);\n writer.finishLengthDelimited(valueStart, writer.pos - startPos);\n}\n\n// int64 range bounds for int_value vs double_value encoding.\n// -(2^63) is the signed int64 minimum; 2^63 is one past the maximum.\n// Both are exact IEEE 754 doubles (powers of two), so comparisons are precise.\nconst MIN_64_BIT_INT = -(2 ** 63);\nconst MAX_64_BIT_INT = 2 ** 63;\n\n/**\n * Write an AnyValue directly from raw attribute value to protobuf\n */\nexport function writeAnyValue(writer: IProtobufWriter, value: AnyValue): void {\n const t = typeof value;\n if (t === 'string') {\n writer.writeTag(1, 2); // AnyValue.string_value (field 1, length-delimited)\n writer.writeString(value as string);\n } else if (t === 'boolean') {\n writer.writeTag(2, 0); // AnyValue.bool_value (field 2, varint)\n writer.writeVarint((value as boolean) ? 1 : 0);\n } else if (t === 'number') {\n const numValue = value as number;\n // Encode as int_value (int64) when the number is an integer within the int64\n // range. Number.isSafeInteger() would be too conservative — integers beyond\n // 2^53-1 that are exactly representable in IEEE 754 (e.g. powers of two)\n // still fit in int64 and must not be downgraded to double_value.\n if (\n Number.isInteger(numValue) &&\n numValue >= MIN_64_BIT_INT &&\n numValue < MAX_64_BIT_INT\n ) {\n writer.writeTag(3, 0); // AnyValue.int_value (field 3, varint)\n writer.writeVarint(numValue);\n } else {\n writer.writeTag(4, 1); // AnyValue.double_value (field 4, fixed64)\n writer.writeDouble(numValue);\n }\n } else if (value instanceof Uint8Array) {\n writer.writeTag(7, 2); // AnyValue.bytes_value (field 7, length-delimited)\n writer.writeBytes(value);\n } else if (Array.isArray(value)) {\n writer.writeTag(5, 2); // AnyValue.array_value (field 5, ArrayValue, length-delimited)\n const arrayStart = writer.startLengthDelimited();\n const arrayStartPos = writer.pos;\n for (const item of value) {\n writer.writeTag(1, 2); // ArrayValue.values (field 1, AnyValue, length-delimited)\n const itemStart = writer.startLengthDelimited();\n const itemStartPos = writer.pos;\n writeAnyValue(writer, item);\n writer.finishLengthDelimited(itemStart, writer.pos - itemStartPos);\n }\n writer.finishLengthDelimited(arrayStart, writer.pos - arrayStartPos);\n } else if (t === 'object' && value != null) {\n writer.writeTag(6, 2); // AnyValue.kvlist_value (field 6, KeyValueList, length-delimited)\n const kvlistStart = writer.startLengthDelimited();\n const kvlistStartPos = writer.pos;\n const obj = value as Record<string, AnyValue>;\n for (const k in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, k)) {\n continue;\n }\n const v = obj[k];\n writer.writeTag(1, 2); // KeyValueList.values (field 1, KeyValue, length-delimited)\n const kvStart = writer.startLengthDelimited();\n const kvStartPos = writer.pos;\n writer.writeTag(1, 2); // KeyValue.key (field 1, string, length-delimited)\n writer.writeString(k);\n writer.writeTag(2, 2); // KeyValue.value (field 2, AnyValue, length-delimited)\n const valueStart = writer.startLengthDelimited();\n const valueStartPos = writer.pos;\n writeAnyValue(writer, v);\n writer.finishLengthDelimited(valueStart, writer.pos - valueStartPos);\n writer.finishLengthDelimited(kvStart, writer.pos - kvStartPos);\n }\n writer.finishLengthDelimited(kvlistStart, writer.pos - kvlistStartPos);\n }\n // Else: unsupported type, write nothing\n}\n\n/**\n * Write an InstrumentationScope message.\n *\n * Proto fields (InstrumentationScope):\n * 1 name string (wire type 2)\n * 2 version string (wire type 2)\n */\nexport function writeInstrumentationScope(\n writer: IProtobufWriter,\n scope: InstrumentationScope,\n fieldNumber: number\n): void {\n writer.writeTag(fieldNumber, 2);\n const start = writer.startLengthDelimited();\n const startPos = writer.pos;\n\n // name (field 1, string)\n writer.writeTag(1, 2);\n writer.writeString(scope.name);\n\n // version (field 2, string) - skip if empty\n if (scope.version) {\n writer.writeTag(2, 2);\n writer.writeString(scope.version);\n }\n\n writer.finishLengthDelimited(start, writer.pos - startPos);\n}\n\n/**\n * Write a Resource message and its enclosing tag.\n *\n * Proto fields (Resource):\n * 1 attributes repeated KeyValue (wire type 2)\n * 2 dropped_attributes_count uint32 (wire type 0)\n */\nexport function writeResource(\n writer: IProtobufWriter,\n resource: Resource,\n fieldNumber: number\n): void {\n writer.writeTag(fieldNumber, 2);\n const resourceStart = writer.startLengthDelimited();\n const resourceStartPos = writer.pos;\n\n // attributes (field 1, repeated KeyValue)\n if (resource.attributes) {\n writeAttributes(writer, resource.attributes, 1);\n }\n\n // dropped_attributes_count (field 2, uint32) - set to 0 as we don't track this\n writer.writeTag(2, 0);\n writer.writeVarint(0);\n\n writer.finishLengthDelimited(resourceStart, writer.pos - resourceStartPos);\n}\n"]}
1
+ {"version":3,"file":"common-serializer.js","sourceRoot":"","sources":["../../../../src/common/protobuf/common-serializer.ts"],"names":[],"mappings":";;;AAUA;;;;;;;;;GASG;AACH,SAAgB,o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E,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;KACjD;IAED,+EAA+E;IAC/E,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtB,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAEtB,MAAM,CAAC,qBAAqB,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,GAAG,gBAAgB,CAAC,CAAC;AAC7E,CAAC;AAnBD,sCAmBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Attributes, HrTime } from '@opentelemetry/api';\nimport type { AnyValue, LogAttributes } from '@opentelemetry/api-logs';\nimport type { InstrumentationScope } from '@opentelemetry/core';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { IProtobufWriter } from './i-protobuf-writer';\n\n/**\n * Write HrTime [seconds, nanoseconds] directly as fixed64 to the serializer.\n * Converts to nanoseconds and writes as 64-bit little-endian integer without allocations.\n *\n * HrTime represents: total_nanos = seconds * 1_000_000_000 + nanoseconds\n * We need to split this into low (bits 0-31) and high (bits 32-63).\n *\n * @param serializer - The protobuf writer\n * @param hrTime - HrTime tuple [seconds, nanoseconds]\n */\nexport function writeHrTimeAsFixed64(\n serializer: IProtobufWriter,\n hrTime: HrTime\n): void {\n const seconds = hrTime[0];\n const nanos = hrTime[1];\n\n // Calculate total nanoseconds (seconds * 1_000_000_000 + nanos) split into [low32, high32].\n //\n // We cannot use `seconds * 1e9` directly because for Unix timestamps\n // (seconds > ~9_007_199) the product exceeds Number.MAX_SAFE_INTEGER and loses\n // integer precision in IEEE 754 double arithmetic.\n //\n // So we split `seconds` into its lower 16 bits and remaining upper bits so\n // every multiplication stays\n // within the safe-integer range (< 2^53):\n // secondsLower16Bits * 1e9 <= 65535 * 1e9 ≈ 6.55e13 < 2^53\n // secondsUpperBits * 1e9 <= 65535 * 1e9 ≈ 6.55e13 < 2^53\n //\n // Then recombine:\n // seconds * 1e9 =\n // secondsUpperBits * 1e9 * 2^16 +\n // secondsLower16Bits * 1e9\n\n const nanosPerSecond = 1_000_000_000;\n // Split `seconds` into low 16 bits and the remaining upper bits.\n // This avoids the signed 32-bit seconds limit behind the Year 2038 problem:\n // the practical limit here is the encoded fixed64 range. Callers must keep\n // `seconds * 1e9 + nanos` within uint64, i.e. up to\n // [18_446_744_073, 709_551_615]. Beyond that, the serialized value wraps.\n const secondsLower16Bits = seconds & 0xffff; // bits 0-15 of seconds\n const secondsUpperBits = (seconds / 0x10000) >>> 0; // bits 16+ of seconds\n\n const nanosFromLower16Bits = secondsLower16Bits * nanosPerSecond; // exact integer, < 2^53\n const nanosFromUpperBits = secondsUpperBits * nanosPerSecond; // exact integer, < 2^53\n\n // Split the lower-16-bit contribution into [low32, high32].\n const lower16ContributionLow32 = nanosFromLower16Bits >>> 0;\n const lower16ContributionHigh32 = Math.floor(\n nanosFromLower16Bits / 0x100000000\n );\n\n // The upper-bits contribution is shifted left by 16 bits when recombined.\n const upperBitsContributionLow32 =\n ((nanosFromUpperBits & 0xffff) * 0x10000) >>> 0;\n const upperBitsContributionHigh32 = (nanosFromUpperBits / 0x10000) >>> 0;\n\n // Add the two contributions plus the sub-second nanoseconds with carry propagation.\n const low32WithCarry =\n lower16ContributionLow32 + upperBitsContributionLow32 + nanos;\n const totalLow = low32WithCarry >>> 0;\n const carry = Math.floor(low32WithCarry / 0x100000000); // 0, 1, or 2\n const totalHigh =\n (lower16ContributionHigh32 + upperBitsContributionHigh32 + carry) >>> 0;\n\n serializer.writeFixed64(totalLow, totalHigh);\n}\n\n/**\n * Write Attributes directly to protobuf as repeated KeyValue\n */\nexport function writeAttributes(\n writer: IProtobufWriter,\n attributes: Attributes | LogAttributes,\n fieldNumber: number\n): void {\n for (const key in attributes) {\n if (!Object.prototype.hasOwnProperty.call(attributes, key)) {\n continue;\n }\n const value = attributes[key];\n writer.writeTag(fieldNumber, 2); // repeated KeyValue attributes (field varies, length-delimited)\n const kvStart = writer.startLengthDelimited();\n const startPos = writer.pos;\n writeKeyValue(writer, key, value);\n writer.finishLengthDelimited(kvStart, writer.pos - startPos);\n }\n}\n\n/**\n * Write a KeyValue pair directly to protobuf\n */\nexport function writeKeyValue(\n writer: IProtobufWriter,\n key: string,\n value: AnyValue\n): void {\n writer.writeTag(1, 2); // KeyValue.key (field 1, string, length-delimited)\n writer.writeString(key);\n writer.writeTag(2, 2); // KeyValue.value (field 2, AnyValue, length-delimited)\n const valueStart = writer.startLengthDelimited();\n const startPos = writer.pos;\n writeAnyValue(writer, value);\n writer.finishLengthDelimited(valueStart, writer.pos - startPos);\n}\n\n// int64 range bounds for int_value vs double_value encoding.\n// -(2^63) is the signed int64 minimum; 2^63 is one past the maximum.\n// Both are exact IEEE 754 doubles (powers of two), so comparisons are precise.\nconst MIN_64_BIT_INT = -(2 ** 63);\nconst MAX_64_BIT_INT = 2 ** 63;\n\n/**\n * Write an AnyValue directly from raw attribute value to protobuf\n */\nexport function writeAnyValue(writer: IProtobufWriter, value: AnyValue): void {\n const t = typeof value;\n if (t === 'string') {\n writer.writeTag(1, 2); // AnyValue.string_value (field 1, length-delimited)\n writer.writeString(value as string);\n } else if (t === 'boolean') {\n writer.writeTag(2, 0); // AnyValue.bool_value (field 2, varint)\n writer.writeVarint((value as boolean) ? 1 : 0);\n } else if (t === 'number') {\n const numValue = value as number;\n // Encode as int_value (int64) when the number is an integer within the int64\n // range. Number.isSafeInteger() would be too conservative — integers beyond\n // 2^53-1 that are exactly representable in IEEE 754 (e.g. powers of two)\n // still fit in int64 and must not be downgraded to double_value.\n if (\n Number.isInteger(numValue) &&\n numValue >= MIN_64_BIT_INT &&\n numValue < MAX_64_BIT_INT\n ) {\n writer.writeTag(3, 0); // AnyValue.int_value (field 3, varint)\n writer.writeVarint(numValue);\n } else {\n writer.writeTag(4, 1); // AnyValue.double_value (field 4, fixed64)\n writer.writeDouble(numValue);\n }\n } else if (value instanceof Uint8Array) {\n writer.writeTag(7, 2); // AnyValue.bytes_value (field 7, length-delimited)\n writer.writeBytes(value);\n } else if (Array.isArray(value)) {\n writer.writeTag(5, 2); // AnyValue.array_value (field 5, ArrayValue, length-delimited)\n const arrayStart = writer.startLengthDelimited();\n const arrayStartPos = writer.pos;\n for (const item of value) {\n writer.writeTag(1, 2); // ArrayValue.values (field 1, AnyValue, length-delimited)\n const itemStart = writer.startLengthDelimited();\n const itemStartPos = writer.pos;\n writeAnyValue(writer, item);\n writer.finishLengthDelimited(itemStart, writer.pos - itemStartPos);\n }\n writer.finishLengthDelimited(arrayStart, writer.pos - arrayStartPos);\n } else if (t === 'object' && value != null) {\n writer.writeTag(6, 2); // AnyValue.kvlist_value (field 6, KeyValueList, length-delimited)\n const kvlistStart = writer.startLengthDelimited();\n const kvlistStartPos = writer.pos;\n const obj = value as Record<string, AnyValue>;\n for (const k in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, k)) {\n continue;\n }\n const v = obj[k];\n writer.writeTag(1, 2); // KeyValueList.values (field 1, KeyValue, length-delimited)\n const kvStart = writer.startLengthDelimited();\n const kvStartPos = writer.pos;\n writer.writeTag(1, 2); // KeyValue.key (field 1, string, length-delimited)\n writer.writeString(k);\n writer.writeTag(2, 2); // KeyValue.value (field 2, AnyValue, length-delimited)\n const valueStart = writer.startLengthDelimited();\n const valueStartPos = writer.pos;\n writeAnyValue(writer, v);\n writer.finishLengthDelimited(valueStart, writer.pos - valueStartPos);\n writer.finishLengthDelimited(kvStart, writer.pos - kvStartPos);\n }\n writer.finishLengthDelimited(kvlistStart, writer.pos - kvlistStartPos);\n }\n // Else: unsupported type, write nothing\n}\n\n/**\n * Write an InstrumentationScope message.\n *\n * Proto fields (InstrumentationScope):\n * 1 name string (wire type 2)\n * 2 version string (wire type 2)\n */\nexport function writeInstrumentationScope(\n writer: IProtobufWriter,\n scope: InstrumentationScope &\n /**\n * Additional properties that are currently only part of the logs-specific type.\n * Once InstrumentationScope also includes `attributes` and `droppedAttributesCount`,\n * we should remove these extensions.\n */\n {\n attributes?: LogAttributes;\n droppedAttributesCount?: number;\n },\n fieldNumber: number\n): void {\n writer.writeTag(fieldNumber, 2);\n const start = writer.startLengthDelimited();\n const startPos = writer.pos;\n\n // name (field 1, string)\n writer.writeTag(1, 2);\n writer.writeString(scope.name);\n\n // version (field 2, string) - skip if empty\n if (scope.version) {\n writer.writeTag(2, 2);\n writer.writeString(scope.version);\n }\n\n if (scope.attributes) {\n // attributes (field 3, repeated KeyValue)\n writeAttributes(writer, scope.attributes, 3);\n }\n\n if (scope.droppedAttributesCount) {\n // dropped_attributes_count (field 4, uint32)\n writer.writeTag(4, 0);\n writer.writeVarint(scope.droppedAttributesCount);\n }\n\n writer.finishLengthDelimited(start, writer.pos - startPos);\n}\n\n/**\n * Write a Resource message and its enclosing tag.\n *\n * Proto fields (Resource):\n * 1 attributes repeated KeyValue (wire type 2)\n * 2 dropped_attributes_count uint32 (wire type 0)\n */\nexport function writeResource(\n writer: IProtobufWriter,\n resource: Resource,\n fieldNumber: number\n): void {\n writer.writeTag(fieldNumber, 2);\n const resourceStart = writer.startLengthDelimited();\n const resourceStartPos = writer.pos;\n\n // attributes (field 1, repeated KeyValue)\n if (resource.attributes) {\n writeAttributes(writer, resource.attributes, 1);\n }\n\n // dropped_attributes_count (field 2, uint32) - set to 0 as we don't track this\n writer.writeTag(2, 0);\n writer.writeVarint(0);\n\n writer.finishLengthDelimited(resourceStart, writer.pos - resourceStartPos);\n}\n"]}
@@ -31,7 +31,11 @@ export declare class ProtobufReader {
31
31
  /**
32
32
  * Skip an unknown field.
33
33
  * Handles wire types 0 (varint), 1 (64-bit), 2 (length-delimited),
34
- * 3 (start-group), 4 (end-group), and 5 (32-bit).
34
+ * and 5 (32-bit).
35
+ *
36
+ * Wire types 3 and 4 (start-group / end-group) are deprecated in proto3
37
+ * and are not used by any OpenTelemetry proto definition. Encountering
38
+ * them is treated as an error.
35
39
  */
36
40
  skip(wireType: number): void;
37
41
  }
@@ -70,7 +70,11 @@ class ProtobufReader {
70
70
  /**
71
71
  * Skip an unknown field.
72
72
  * Handles wire types 0 (varint), 1 (64-bit), 2 (length-delimited),
73
- * 3 (start-group), 4 (end-group), and 5 (32-bit).
73
+ * and 5 (32-bit).
74
+ *
75
+ * Wire types 3 and 4 (start-group / end-group) are deprecated in proto3
76
+ * and are not used by any OpenTelemetry proto definition. Encountering
77
+ * them is treated as an error.
74
78
  */
75
79
  skip(wireType) {
76
80
  switch (wireType) {
@@ -83,26 +87,6 @@ class ProtobufReader {
83
87
  case 2: // length-delimited
84
88
  this.readBytes();
85
89
  break;
86
- case 3: // start group (deprecated)
87
- // We should never encounter this, but let's handle it gracefully in case we do:
88
- // Read nested tags until matching end-group (wire type 4) is found.
89
- // Groups can be nested, so continue until the end-group for this
90
- // start-group is encountered.
91
- while (!this.isAtEnd()) {
92
- const { wireType: nestedWireType } = this.readTag();
93
- if (nestedWireType === 4) {
94
- // matched end-group for this start-group
95
- break;
96
- }
97
- // recursive skip also handles nested groups
98
- this.skip(nestedWireType);
99
- }
100
- break;
101
- case 4: // end group
102
- // End-group should be handled by the start-group logic above.
103
- // When encountered directly in skip, treat it as a no-op (it signals
104
- // termination of the enclosing group).
105
- break;
106
90
  case 5: // 32-bit fixed
107
91
  this.pos += 4;
108
92
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"protobuf-reader.js","sourceRoot":"","sources":["../../../../src/common/protobuf/protobuf-reader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;GAQG;AACH,MAAa,cAAc;IACzB,GAAG,GAAW,CAAC,CAAC;IACC,IAAI,CAAa;IACjB,YAAY,CAE3B;IAEF,YAAY,GAAe;QACzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,kFAAkF;IACl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copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Minimal binary protobuf reader.\n * Only implements the wire-types that we currently need; this is not intended\n * to be a general-purpose protobuf reader.\n *\n * Since the values we parse are generally small and not very nested, it's public\n * interface does not enforce the same low-allocation philosophy that ProtobufWriter does.\n * If this is needed in the future, we should refactor this to fit the use-case.\n */\nexport class ProtobufReader {\n pos: number = 0;\n private readonly _buf: Uint8Array;\n private readonly _textDecoder: {\n decode: (input?: Uint8Array | null) => string;\n };\n\n constructor(buf: Uint8Array) {\n this._buf = buf;\n this._textDecoder = new TextDecoder();\n }\n\n isAtEnd(): boolean {\n return this.pos >= this._buf.length;\n }\n\n /** Read a varint and decode it as a tag, returning field number and wire type. */\n readTag(): { fieldNumber: number; wireType: number } {\n const raw = this.readVarint();\n return { fieldNumber: raw >>> 3, wireType: raw & 0x7 };\n }\n\n /**\n * Read a base-128 varint.\n * Returns a JS `number`; precision above 2^53 is silently lost.\n * Throws if the buffer is truncated mid-varint.\n */\n readVarint(): number {\n let result = 0;\n let shift = 0;\n let terminated = false;\n while (this.pos < this._buf.length) {\n const b = this._buf[this.pos++];\n result += (b & 0x7f) * Math.pow(2, shift);\n shift += 7;\n if ((b & 0x80) === 0) {\n terminated = true;\n break;\n }\n }\n if (!terminated) {\n throw new Error(\n 'Truncated buffer: unexpected end of data while reading varint'\n );\n }\n return result;\n }\n\n /** Read a length-delimited byte sequence (bytes field or embedded message). */\n readBytes(): Uint8Array {\n const len = this.readVarint();\n if (this.pos + len > this._buf.length) {\n throw new Error(\n `Truncated buffer: expected ${len} bytes at position ${this.pos}, but only ${this._buf.length - this.pos} available`\n );\n }\n const slice = this._buf.subarray(this.pos, this.pos + len);\n this.pos += len;\n return slice;\n }\n\n /** Read a length-delimited UTF-8 string. */\n readString(): string {\n return this._textDecoder.decode(this.readBytes());\n }\n\n /**\n * Skip an unknown field.\n * Handles wire types 0 (varint), 1 (64-bit), 2 (length-delimited),\n * 3 (start-group), 4 (end-group), and 5 (32-bit).\n */\n skip(wireType: number): void {\n switch (wireType) {\n case 0: // varint\n this.readVarint();\n break;\n case 1: // 64-bit fixed\n this.pos += 8;\n break;\n case 2: // length-delimited\n this.readBytes();\n break;\n case 3: // start group (deprecated)\n // We should never encounter this, but let's handle it gracefully in case we do:\n // Read nested tags until matching end-group (wire type 4) is found.\n // Groups can be nested, so continue until the end-group for this\n // start-group is encountered.\n while (!this.isAtEnd()) {\n const { wireType: nestedWireType } = this.readTag();\n if (nestedWireType === 4) {\n // matched end-group for this start-group\n break;\n }\n // recursive skip also handles nested groups\n this.skip(nestedWireType);\n }\n break;\n case 4: // end group\n // End-group should be handled by the start-group logic above.\n // When encountered directly in skip, treat it as a no-op (it signals\n // termination of the enclosing group).\n break;\n case 5: // 32-bit fixed\n this.pos += 4;\n break;\n default:\n throw new Error(`Unknown wire type ${wireType}, cannot safely skip`);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"protobuf-reader.js","sourceRoot":"","sources":["../../../../src/common/protobuf/protobuf-reader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;GAQG;AACH,MAAa,cAAc;IACzB,GAAG,GAAW,CAAC,CAAC;IACC,IAAI,CAAa;IACjB,YAAY,CAE3B;IAEF,YAAY,GAAe;QACzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,kFAAkF;IAClF,OAAO;QACL,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9B,OAAO,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,UAAU;QACR,IAAI,MAAM,G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CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,QAAgB;QACnB,QAAQ,QAAQ,EAAE;YAChB,KAAK,CAAC,EAAE,SAAS;gBACf,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;YACR,KAAK,CAAC,EAAE,eAAe;gBACrB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;gBACd,MAAM;YACR,KAAK,CAAC,EAAE,mBAAmB;gBACzB,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,MAAM;YACR,KAAK,CAAC,EAAE,eAAe;gBACrB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;gBACd,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,sBAAsB,CAAC,CAAC;SACxE;IACH,CAAC;CACF;AA7FD,wCA6FC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Minimal binary protobuf reader.\n * Only implements the wire-types that we currently need; this is not intended\n * to be a general-purpose protobuf reader.\n *\n * Since the values we parse are generally small and not very nested, it's public\n * interface does not enforce the same low-allocation philosophy that ProtobufWriter does.\n * If this is needed in the future, we should refactor this to fit the use-case.\n */\nexport class ProtobufReader {\n pos: number = 0;\n private readonly _buf: Uint8Array;\n private readonly _textDecoder: {\n decode: (input?: Uint8Array | null) => string;\n };\n\n constructor(buf: Uint8Array) {\n this._buf = buf;\n this._textDecoder = new TextDecoder();\n }\n\n isAtEnd(): boolean {\n return this.pos >= this._buf.length;\n }\n\n /** Read a varint and decode it as a tag, returning field number and wire type. */\n readTag(): { fieldNumber: number; wireType: number } {\n const raw = this.readVarint();\n return { fieldNumber: raw >>> 3, wireType: raw & 0x7 };\n }\n\n /**\n * Read a base-128 varint.\n * Returns a JS `number`; precision above 2^53 is silently lost.\n * Throws if the buffer is truncated mid-varint.\n */\n readVarint(): number {\n let result = 0;\n let shift = 0;\n let terminated = false;\n while (this.pos < this._buf.length) {\n const b = this._buf[this.pos++];\n result += (b & 0x7f) * Math.pow(2, shift);\n shift += 7;\n if ((b & 0x80) === 0) {\n terminated = true;\n break;\n }\n }\n if (!terminated) {\n throw new Error(\n 'Truncated buffer: unexpected end of data while reading varint'\n );\n }\n return result;\n }\n\n /** Read a length-delimited byte sequence (bytes field or embedded message). */\n readBytes(): Uint8Array {\n const len = this.readVarint();\n if (this.pos + len > this._buf.length) {\n throw new Error(\n `Truncated buffer: expected ${len} bytes at position ${this.pos}, but only ${this._buf.length - this.pos} available`\n );\n }\n const slice = this._buf.subarray(this.pos, this.pos + len);\n this.pos += len;\n return slice;\n }\n\n /** Read a length-delimited UTF-8 string. */\n readString(): string {\n return this._textDecoder.decode(this.readBytes());\n }\n\n /**\n * Skip an unknown field.\n * Handles wire types 0 (varint), 1 (64-bit), 2 (length-delimited),\n * and 5 (32-bit).\n *\n * Wire types 3 and 4 (start-group / end-group) are deprecated in proto3\n * and are not used by any OpenTelemetry proto definition. Encountering\n * them is treated as an error.\n */\n skip(wireType: number): void {\n switch (wireType) {\n case 0: // varint\n this.readVarint();\n break;\n case 1: // 64-bit fixed\n this.pos += 8;\n break;\n case 2: // length-delimited\n this.readBytes();\n break;\n case 5: // 32-bit fixed\n this.pos += 4;\n break;\n default:\n throw new Error(`Unknown wire type ${wireType}, cannot safely skip`);\n }\n }\n}\n"]}
@@ -1,8 +1,5 @@
1
1
  import type { ReadableLogRecord } from '@opentelemetry/sdk-logs';
2
2
  import type { IExportLogsServiceRequest } from './internal-types';
3
3
  import type { Encoder } from '../common/utils';
4
- import type { IKeyValue } from '../common/internal-types';
5
- import type { LogAttributes } from '@opentelemetry/api-logs';
6
4
  export declare function createExportLogsServiceRequest(logRecords: ReadableLogRecord[], encoder: Encoder): IExportLogsServiceRequest;
7
- export declare function toLogAttributes(attributes: LogAttributes, encoder: Encoder): IKeyValue[];
8
5
  //# sourceMappingURL=internal.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toLogAttributes = exports.createExportLogsServiceRequest = void 0;
7
+ exports.createExportLogsServiceRequest = void 0;
8
8
  const internal_1 = require("../common/internal");
9
9
  function createExportLogsServiceRequest(logRecords, encoder) {
10
10
  return {
@@ -15,17 +15,16 @@ exports.createExportLogsServiceRequest = createExportLogsServiceRequest;
15
15
  function createResourceMap(logRecords) {
16
16
  const resourceMap = new Map();
17
17
  for (const record of logRecords) {
18
- const { resource, instrumentationScope: { name, version = '', schemaUrl = '' }, } = record;
18
+ const { resource, instrumentationScope } = record;
19
19
  let ismMap = resourceMap.get(resource);
20
20
  if (!ismMap) {
21
21
  ismMap = new Map();
22
22
  resourceMap.set(resource, ismMap);
23
23
  }
24
- const ismKey = `${name}@${version}:${schemaUrl}`;
25
- let records = ismMap.get(ismKey);
24
+ let records = ismMap.get(instrumentationScope);
26
25
  if (!records) {
27
26
  records = [];
28
- ismMap.set(ismKey, records);
27
+ ismMap.set(instrumentationScope, records);
29
28
  }
30
29
  records.push(record);
31
30
  }
@@ -39,7 +38,7 @@ function logRecordsToResourceLogs(logRecords, encoder) {
39
38
  resource: processedResource,
40
39
  scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {
41
40
  return {
42
- scope: (0, internal_1.createInstrumentationScope)(scopeLogs[0].instrumentationScope),
41
+ scope: (0, internal_1.createInstrumentationScope)(scopeLogs[0].instrumentationScope, encoder),
43
42
  logRecords: scopeLogs.map(log => toLogRecord(log, encoder)),
44
43
  schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl,
45
44
  };
@@ -56,7 +55,7 @@ function toLogRecord(log, encoder) {
56
55
  severityText: log.severityText,
57
56
  body: (0, internal_1.toAnyValue)(log.body, encoder),
58
57
  eventName: log.eventName,
59
- attributes: toLogAttributes(log.attributes, encoder),
58
+ attributes: (0, internal_1.toAttributes)(log.attributes, encoder),
60
59
  droppedAttributesCount: log.droppedAttributesCount,
61
60
  flags: log.spanContext?.traceFlags,
62
61
  traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),
@@ -66,8 +65,4 @@ function toLogRecord(log, encoder) {
66
65
  function toSeverityNumber(severityNumber) {
67
66
  return severityNumber;
68
67
  }
69
- function toLogAttributes(attributes, encoder) {
70
- return Object.keys(attributes).map(key => (0, internal_1.toKeyValue)(key, attributes[key], encoder));
71
- }
72
- exports.toLogAttributes = toLogAttributes;
73
68
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/logs/internal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,iDAK4B;AAK5B,SAAgB,8BAA8B,CAC5C,UAA+B,EAC/B,OAAgB;IAEhB,OAAO;QACL,YAAY,EAAE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC;KAC5D,CAAC;AACJ,CAAC;AAPD,wEAOC;AAED,SAAS,iBAAiB,CACxB,UAA+B;IAE/B,MAAM,WAAW,GAGb,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;QAC/B,MAAM,EACJ,QAAQ,EACR,oBAAoB,EAAE,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,GAC7D,GAAG,MAAM,CAAC;QAEX,IAAI,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACnB,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SACnC;QAED,MAAM,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;QACjD,IAAI,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GA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pD,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,IAAI,EAAE,IAAA,qBAAU,EAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACnC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC;QACpD,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;QAClD,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,UAAU;QAClC,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;QACpE,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,cAA0C;IAE1C,OAAO,cAAmE,CAAC;AAC7E,CAAC;AAED,SAAgB,eAAe,CAC7B,UAAyB,EACzB,OAAgB;IAEhB,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CACvC,IAAA,qBAAU,EAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAC1C,CAAC;AACJ,CAAC;AAPD,0CAOC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReadableLogRecord } from '@opentelemetry/sdk-logs';\nimport type {\n ESeverityNumber,\n IExportLogsServiceRequest,\n ILogRecord,\n IResourceLogs,\n} from './internal-types';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAnyValue,\n toKeyValue,\n} from '../common/internal';\nimport type { SeverityNumber } from '@opentelemetry/api-logs';\nimport type { IKeyValue } from '../common/internal-types';\nimport type { LogAttributes } from '@opentelemetry/api-logs';\n\nexport function createExportLogsServiceRequest(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IExportLogsServiceRequest {\n return {\n resourceLogs: logRecordsToResourceLogs(logRecords, encoder),\n };\n}\n\nfunction createResourceMap(\n logRecords: ReadableLogRecord[]\n): Map<Resource, Map<string, ReadableLogRecord[]>> {\n const resourceMap: Map<\n Resource,\n Map<string, ReadableLogRecord[]>\n > = new Map();\n\n for (const record of logRecords) {\n const {\n resource,\n instrumentationScope: { name, version = '', schemaUrl = '' },\n } = record;\n\n let ismMap = resourceMap.get(resource);\n if (!ismMap) {\n ismMap = new Map();\n resourceMap.set(resource, ismMap);\n }\n\n const ismKey = `${name}@${version}:${schemaUrl}`;\n let records = ismMap.get(ismKey);\n if (!records) {\n records = [];\n ismMap.set(ismKey, records);\n }\n records.push(record);\n }\n return resourceMap;\n}\n\nfunction logRecordsToResourceLogs(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IResourceLogs[] {\n const resourceMap = createResourceMap(logRecords);\n return Array.from(resourceMap, ([resource, ismMap]) => {\n const processedResource = createResource(resource, encoder);\n return {\n resource: processedResource,\n scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {\n return {\n scope: createInstrumentationScope(scopeLogs[0].instrumentationScope),\n logRecords: scopeLogs.map(log => toLogRecord(log, encoder)),\n schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl,\n };\n }),\n schemaUrl: processedResource.schemaUrl,\n };\n });\n}\n\nfunction toLogRecord(log: ReadableLogRecord, encoder: Encoder): ILogRecord {\n return {\n timeUnixNano: encoder.encodeHrTime(log.hrTime),\n observedTimeUnixNano: encoder.encodeHrTime(log.hrTimeObserved),\n severityNumber: toSeverityNumber(log.severityNumber),\n severityText: log.severityText,\n body: toAnyValue(log.body, encoder),\n eventName: log.eventName,\n attributes: toLogAttributes(log.attributes, encoder),\n droppedAttributesCount: log.droppedAttributesCount,\n flags: log.spanContext?.traceFlags,\n traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),\n spanId: encoder.encodeOptionalSpanContext(log.spanContext?.spanId),\n };\n}\n\nfunction toSeverityNumber(\n severityNumber: SeverityNumber | undefined\n): ESeverityNumber | undefined {\n return severityNumber as number | undefined as ESeverityNumber | undefined;\n}\n\nexport function toLogAttributes(\n attributes: LogAttributes,\n encoder: Encoder\n): IKeyValue[] {\n return Object.keys(attributes).map(key =>\n toKeyValue(key, attributes[key], encoder)\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/logs/internal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,iDAK4B;AAG5B,SAAgB,8BAA8B,CAC5C,UAA+B,EAC/B,OAAgB;IAEhB,OAAO;QACL,YAAY,EAAE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC;KAC5D,CAAC;AACJ,CAAC;AAPD,wEAOC;AAED,SAAS,iBAAiB,CACxB,UAA+B;IAK/B,MAAM,WAAW,GAGb,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;QAC/B,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAElD,IAAI,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACnB,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SACnC;QAED,IAAI,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;SAC3C;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,wBAAwB,CAC/B,UAA+B,EAC/B,OAAgB;IAEhB,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AC;QACjD,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;QAClD,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,UAAU;QAClC,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;QACpE,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,cAA0C;IAE1C,OAAO,cAAmE,CAAC;AAC7E,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReadableLogRecord } from '@opentelemetry/sdk-logs';\nimport type {\n ESeverityNumber,\n IExportLogsServiceRequest,\n ILogRecord,\n IResourceLogs,\n} from './internal-types';\nimport type { Resource } from '@opentelemetry/resources';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAnyValue,\n toAttributes,\n} from '../common/internal';\nimport type { SeverityNumber } from '@opentelemetry/api-logs';\n\nexport function createExportLogsServiceRequest(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IExportLogsServiceRequest {\n return {\n resourceLogs: logRecordsToResourceLogs(logRecords, encoder),\n };\n}\n\nfunction createResourceMap(\n logRecords: ReadableLogRecord[]\n): Map<\n Resource,\n Map<ReadableLogRecord['instrumentationScope'], ReadableLogRecord[]>\n> {\n const resourceMap: Map<\n Resource,\n Map<ReadableLogRecord['instrumentationScope'], ReadableLogRecord[]>\n > = new Map();\n\n for (const record of logRecords) {\n const { resource, instrumentationScope } = record;\n\n let ismMap = resourceMap.get(resource);\n if (!ismMap) {\n ismMap = new Map();\n resourceMap.set(resource, ismMap);\n }\n\n let records = ismMap.get(instrumentationScope);\n if (!records) {\n records = [];\n ismMap.set(instrumentationScope, records);\n }\n records.push(record);\n }\n return resourceMap;\n}\n\nfunction logRecordsToResourceLogs(\n logRecords: ReadableLogRecord[],\n encoder: Encoder\n): IResourceLogs[] {\n const resourceMap = createResourceMap(logRecords);\n return Array.from(resourceMap, ([resource, ismMap]) => {\n const processedResource = createResource(resource, encoder);\n return {\n resource: processedResource,\n scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {\n return {\n scope: createInstrumentationScope(\n scopeLogs[0].instrumentationScope,\n encoder\n ),\n logRecords: scopeLogs.map(log => toLogRecord(log, encoder)),\n schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl,\n };\n }),\n schemaUrl: processedResource.schemaUrl,\n };\n });\n}\n\nfunction toLogRecord(log: ReadableLogRecord, encoder: Encoder): ILogRecord {\n return {\n timeUnixNano: encoder.encodeHrTime(log.hrTime),\n observedTimeUnixNano: encoder.encodeHrTime(log.hrTimeObserved),\n severityNumber: toSeverityNumber(log.severityNumber),\n severityText: log.severityText,\n body: toAnyValue(log.body, encoder),\n eventName: log.eventName,\n attributes: toAttributes(log.attributes, encoder),\n droppedAttributesCount: log.droppedAttributesCount,\n flags: log.spanContext?.traceFlags,\n traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),\n spanId: encoder.encodeOptionalSpanContext(log.spanContext?.spanId),\n };\n}\n\nfunction toSeverityNumber(\n severityNumber: SeverityNumber | undefined\n): ESeverityNumber | undefined {\n return severityNumber as number | undefined as ESeverityNumber | undefined;\n}\n"]}
@@ -20,7 +20,7 @@ function toResourceMetrics(resourceMetrics, encoder) {
20
20
  exports.toResourceMetrics = toResourceMetrics;
21
21
  function toScopeMetrics(scopeMetrics, encoder) {
22
22
  return Array.from(scopeMetrics.map(metrics => ({
23
- scope: (0, internal_1.createInstrumentationScope)(metrics.scope),
23
+ scope: (0, internal_1.createInstrumentationScope)(metrics.scope, encoder),
24
24
  metrics: metrics.metrics.map(metricData => toMetric(metricData, encoder)),
25
25
  schemaUrl: metrics.scope.schemaUrl,
26
26
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/metrics/internal.ts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GAAG,EAAE,SAAS,CAAC,GAAG;YAClB,GAAG,EAAE,SAAS,CAAC,GAAG;YAClB,QAAQ,EAAE;gBACR,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM;gBACjC,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,YAAY;aAC9C;YACD,QAAQ,EAAE;gBACR,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM;gBACjC,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,YAAY;aAC9C;YACD,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,iBAAiB,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC;YAC5D,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC;SACtD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,wBAAwB,CAC/B,WAAmC;IAEnC,QAAQ,WAAW,EAAE;QACnB,KAAK,oCAAsB,CAAC,KAAK;YAC/B,OAAO,wCAAuB,CAAC,6BAA6B,CAAC;QAC/D,KAAK,oCAAsB,CAAC,UAAU;YACpC,OAAO,wCAAuB,CAAC,kCAAkC,CAAC;KACrE;AACH,CAAC;AAED,SAAgB,iCAAiC,CAC/C,eAAkC,EAClC,OAAgB;IAEhB,OAAO;QACL,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAC7C,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC;KACF,CAAC;AACJ,CAAC;AATD,8EASC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ValueType } from '@opentelemetry/api';\nimport type {\n DataPoint,\n ExponentialHistogram,\n Histogram,\n MetricData,\n ResourceMetrics,\n ScopeMetrics,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporality,\n DataPointType,\n} from '@opentelemetry/sdk-metrics';\nimport type {\n IExponentialHistogramDataPoint,\n IExportMetricsServiceRequest,\n IHistogramDataPoint,\n IMetric,\n INumberDataPoint,\n IResourceMetrics,\n IScopeMetrics,\n} from './internal-types';\nimport { EAggregationTemporality } from './internal-types';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAttributes,\n} from '../common/internal';\n\nexport function toResourceMetrics(\n resourceMetrics: ResourceMetrics,\n encoder: Encoder\n): IResourceMetrics {\n const processedResource = createResource(resourceMetrics.resource, encoder);\n return {\n resource: processedResource,\n schemaUrl: processedResource.schemaUrl,\n scopeMetrics: toScopeMetrics(resourceMetrics.scopeMetrics, encoder),\n };\n}\n\nexport function toScopeMetrics(\n scopeMetrics: ScopeMetrics[],\n encoder: Encoder\n): IScopeMetrics[] {\n return Array.from(\n scopeMetrics.map(metrics => ({\n scope: createInstrumentationScope(metrics.scope),\n metrics: metrics.metrics.map(metricData => toMetric(metricData, encoder)),\n schemaUrl: metrics.scope.schemaUrl,\n }))\n );\n}\n\nexport function toMetric(metricData: MetricData, encoder: Encoder): IMetric {\n const out: IMetric = {\n name: metricData.descriptor.name,\n description: metricData.descriptor.description,\n unit: metricData.descriptor.unit,\n };\n\n const aggregationTemporality = toAggregationTemporality(\n metricData.aggregationTemporality\n );\n\n switch (metricData.dataPointType) {\n case DataPointType.SUM:\n out.sum = {\n aggregationTemporality,\n isMonotonic: metricData.isMonotonic,\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.GAUGE:\n out.gauge = {\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.HISTOGRAM:\n out.histogram = {\n aggregationTemporality,\n dataPoints: toHistogramDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.EXPONENTIAL_HISTOGRAM:\n out.exponentialHistogram = {\n aggregationTemporality,\n dataPoints: toExponentialHistogramDataPoints(metricData, encoder),\n };\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoint(\n dataPoint:\n | DataPoint<number>\n | DataPoint<Histogram>\n | DataPoint<ExponentialHistogram>,\n valueType: ValueType,\n encoder: Encoder\n) {\n const out: INumberDataPoint = {\n attributes: toAttributes(dataPoint.attributes, encoder),\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n\n switch (valueType) {\n case ValueType.INT:\n out.asInt = dataPoint.value as number;\n break;\n case ValueType.DOUBLE:\n out.asDouble = dataPoint.value as number;\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): INumberDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n return toSingularDataPoint(\n dataPoint,\n metricData.descriptor.valueType,\n encoder\n );\n });\n}\n\nfunction toHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as Histogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n bucketCounts: histogram.buckets.counts,\n explicitBounds: histogram.buckets.boundaries,\n count: histogram.count,\n sum: histogram.sum,\n min: histogram.min,\n max: histogram.max,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toExponentialHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IExponentialHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as ExponentialHistogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n count: histogram.count,\n min: histogram.min,\n max: histogram.max,\n sum: histogram.sum,\n positive: {\n offset: histogram.positive.offset,\n bucketCounts: histogram.positive.bucketCounts,\n },\n negative: {\n offset: histogram.negative.offset,\n bucketCounts: histogram.negative.bucketCounts,\n },\n scale: histogram.scale,\n zeroCount: histogram.zeroCount,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toAggregationTemporality(\n temporality: AggregationTemporality\n): EAggregationTemporality {\n switch (temporality) {\n case AggregationTemporality.DELTA:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA;\n case AggregationTemporality.CUMULATIVE:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE;\n }\n}\n\nexport function createExportMetricsServiceRequest(\n resourceMetrics: ResourceMetrics[],\n encoder: Encoder\n): IExportMetricsServiceRequest {\n return {\n resourceMetrics: resourceMetrics.map(metrics =>\n toResourceMetrics(metrics, encoder)\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/metrics/internal.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,4CAA+C;AAS/C,4DAGoC;AAUpC,qDAA2D;AAE3D,iDAI4B;AAE5B,SAAgB,iBAAiB,CAC/B,eAAgC,EAChC,OAAgB;IAEhB,MAAM,iBAAiB,GAAG,IAAA,yBAAc,EAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,OAAO;QACL,QAAQ,EAAE,iBAAiB;QAC3B,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,YAAY,EAAE,cAAc,CAAC,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC;KACpE,CAAC;AACJ,CAAC;AAVD,8CAUC;AAED,SAAgB,cAAc,CAC5B,YAA4B,EAC5B,OAAgB;IAEhB,OAAO,KAAK,CAAC,IAAI,CACf,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC3B,KAAK,EAAE,IAAA,qCAA0B,EAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;QACzD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC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AC,UAAU;YACpC,OAAO,wCAAuB,CAAC,kCAAkC,CAAC;KACrE;AACH,CAAC;AAED,SAAgB,iCAAiC,CAC/C,eAAkC,EAClC,OAAgB;IAEhB,OAAO;QACL,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAC7C,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACpC;KACF,CAAC;AACJ,CAAC;AATD,8EASC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ValueType } from '@opentelemetry/api';\nimport type {\n DataPoint,\n ExponentialHistogram,\n Histogram,\n MetricData,\n ResourceMetrics,\n ScopeMetrics,\n} from '@opentelemetry/sdk-metrics';\nimport {\n AggregationTemporality,\n DataPointType,\n} from '@opentelemetry/sdk-metrics';\nimport type {\n IExponentialHistogramDataPoint,\n IExportMetricsServiceRequest,\n IHistogramDataPoint,\n IMetric,\n INumberDataPoint,\n IResourceMetrics,\n IScopeMetrics,\n} from './internal-types';\nimport { EAggregationTemporality } from './internal-types';\nimport type { Encoder } from '../common/utils';\nimport {\n createInstrumentationScope,\n createResource,\n toAttributes,\n} from '../common/internal';\n\nexport function toResourceMetrics(\n resourceMetrics: ResourceMetrics,\n encoder: Encoder\n): IResourceMetrics {\n const processedResource = createResource(resourceMetrics.resource, encoder);\n return {\n resource: processedResource,\n schemaUrl: processedResource.schemaUrl,\n scopeMetrics: toScopeMetrics(resourceMetrics.scopeMetrics, encoder),\n };\n}\n\nexport function toScopeMetrics(\n scopeMetrics: ScopeMetrics[],\n encoder: Encoder\n): IScopeMetrics[] {\n return Array.from(\n scopeMetrics.map(metrics => ({\n scope: createInstrumentationScope(metrics.scope, encoder),\n metrics: metrics.metrics.map(metricData => toMetric(metricData, encoder)),\n schemaUrl: metrics.scope.schemaUrl,\n }))\n );\n}\n\nexport function toMetric(metricData: MetricData, encoder: Encoder): IMetric {\n const out: IMetric = {\n name: metricData.descriptor.name,\n description: metricData.descriptor.description,\n unit: metricData.descriptor.unit,\n };\n\n const aggregationTemporality = toAggregationTemporality(\n metricData.aggregationTemporality\n );\n\n switch (metricData.dataPointType) {\n case DataPointType.SUM:\n out.sum = {\n aggregationTemporality,\n isMonotonic: metricData.isMonotonic,\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.GAUGE:\n out.gauge = {\n dataPoints: toSingularDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.HISTOGRAM:\n out.histogram = {\n aggregationTemporality,\n dataPoints: toHistogramDataPoints(metricData, encoder),\n };\n break;\n case DataPointType.EXPONENTIAL_HISTOGRAM:\n out.exponentialHistogram = {\n aggregationTemporality,\n dataPoints: toExponentialHistogramDataPoints(metricData, encoder),\n };\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoint(\n dataPoint:\n | DataPoint<number>\n | DataPoint<Histogram>\n | DataPoint<ExponentialHistogram>,\n valueType: ValueType,\n encoder: Encoder\n) {\n const out: INumberDataPoint = {\n attributes: toAttributes(dataPoint.attributes, encoder),\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n\n switch (valueType) {\n case ValueType.INT:\n out.asInt = dataPoint.value as number;\n break;\n case ValueType.DOUBLE:\n out.asDouble = dataPoint.value as number;\n break;\n }\n\n return out;\n}\n\nfunction toSingularDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): INumberDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n return toSingularDataPoint(\n dataPoint,\n metricData.descriptor.valueType,\n encoder\n );\n });\n}\n\nfunction toHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as Histogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n bucketCounts: histogram.buckets.counts,\n explicitBounds: histogram.buckets.boundaries,\n count: histogram.count,\n sum: histogram.sum,\n min: histogram.min,\n max: histogram.max,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toExponentialHistogramDataPoints(\n metricData: MetricData,\n encoder: Encoder\n): IExponentialHistogramDataPoint[] {\n return metricData.dataPoints.map(dataPoint => {\n const histogram = dataPoint.value as ExponentialHistogram;\n return {\n attributes: toAttributes(dataPoint.attributes, encoder),\n count: histogram.count,\n min: histogram.min,\n max: histogram.max,\n sum: histogram.sum,\n positive: {\n offset: histogram.positive.offset,\n bucketCounts: histogram.positive.bucketCounts,\n },\n negative: {\n offset: histogram.negative.offset,\n bucketCounts: histogram.negative.bucketCounts,\n },\n scale: histogram.scale,\n zeroCount: histogram.zeroCount,\n startTimeUnixNano: encoder.encodeHrTime(dataPoint.startTime),\n timeUnixNano: encoder.encodeHrTime(dataPoint.endTime),\n };\n });\n}\n\nfunction toAggregationTemporality(\n temporality: AggregationTemporality\n): EAggregationTemporality {\n switch (temporality) {\n case AggregationTemporality.DELTA:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA;\n case AggregationTemporality.CUMULATIVE:\n return EAggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE;\n }\n}\n\nexport function createExportMetricsServiceRequest(\n resourceMetrics: ResourceMetrics[],\n encoder: Encoder\n): IExportMetricsServiceRequest {\n return {\n resourceMetrics: resourceMetrics.map(metrics =>\n toResourceMetrics(metrics, encoder)\n ),\n };\n}\n"]}
@@ -110,7 +110,7 @@ function spanRecordsToResourceSpans(readableSpans, encoder) {
110
110
  if (scopeSpans.length > 0) {
111
111
  const spans = scopeSpans.map(readableSpan => sdkSpanToOtlpSpan(readableSpan, encoder));
112
112
  scopeResourceSpans.push({
113
- scope: (0, internal_1.createInstrumentationScope)(scopeSpans[0].instrumentationScope),
113
+ scope: (0, internal_1.createInstrumentationScope)(scopeSpans[0].instrumentationScope, encoder),
114
114
  spans: spans,
115
115
  schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl,
116
116
  });