@superblocksteam/telemetry 2.0.0-SNAPSHOT.329be19cb7ca892b

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 (388) hide show
  1. package/LICENSE.txt +87 -0
  2. package/README.md +298 -0
  3. package/dist/browser/console-logging.d.ts +18 -0
  4. package/dist/browser/console-logging.d.ts.map +1 -0
  5. package/dist/browser/console-logging.js +32 -0
  6. package/dist/browser/console-logging.js.map +1 -0
  7. package/dist/browser/early-console-buffer.d.ts +49 -0
  8. package/dist/browser/early-console-buffer.d.ts.map +1 -0
  9. package/dist/browser/early-console-buffer.js +182 -0
  10. package/dist/browser/early-console-buffer.js.map +1 -0
  11. package/dist/browser/index.d.ts +17 -0
  12. package/dist/browser/index.d.ts.map +1 -0
  13. package/dist/browser/index.js +50 -0
  14. package/dist/browser/index.js.map +1 -0
  15. package/dist/browser/init.d.ts +101 -0
  16. package/dist/browser/init.d.ts.map +1 -0
  17. package/dist/browser/init.js +329 -0
  18. package/dist/browser/init.js.map +1 -0
  19. package/dist/browser/instrumentations.d.ts +67 -0
  20. package/dist/browser/instrumentations.d.ts.map +1 -0
  21. package/dist/browser/instrumentations.js +83 -0
  22. package/dist/browser/instrumentations.js.map +1 -0
  23. package/dist/browser/logs.d.ts +55 -0
  24. package/dist/browser/logs.d.ts.map +1 -0
  25. package/dist/browser/logs.js +86 -0
  26. package/dist/browser/logs.js.map +1 -0
  27. package/dist/browser/metrics.d.ts +29 -0
  28. package/dist/browser/metrics.d.ts.map +1 -0
  29. package/dist/browser/metrics.js +49 -0
  30. package/dist/browser/metrics.js.map +1 -0
  31. package/dist/browser/resilient-exporter.d.ts +43 -0
  32. package/dist/browser/resilient-exporter.d.ts.map +1 -0
  33. package/dist/browser/resilient-exporter.js +88 -0
  34. package/dist/browser/resilient-exporter.js.map +1 -0
  35. package/dist/browser/sanitizer.d.ts +35 -0
  36. package/dist/browser/sanitizer.d.ts.map +1 -0
  37. package/dist/browser/sanitizer.js +211 -0
  38. package/dist/browser/sanitizer.js.map +1 -0
  39. package/dist/browser/traced-socket.d.ts +102 -0
  40. package/dist/browser/traced-socket.d.ts.map +1 -0
  41. package/dist/browser/traced-socket.js +203 -0
  42. package/dist/browser/traced-socket.js.map +1 -0
  43. package/dist/common/contracts/tier2-traces.d.ts +116 -0
  44. package/dist/common/contracts/tier2-traces.d.ts.map +1 -0
  45. package/dist/common/contracts/tier2-traces.js +736 -0
  46. package/dist/common/contracts/tier2-traces.js.map +1 -0
  47. package/dist/common/deployment-type.d.ts +18 -0
  48. package/dist/common/deployment-type.d.ts.map +1 -0
  49. package/dist/common/deployment-type.js +30 -0
  50. package/dist/common/deployment-type.js.map +1 -0
  51. package/dist/common/guardrails.d.ts +116 -0
  52. package/dist/common/guardrails.d.ts.map +1 -0
  53. package/dist/common/guardrails.js +189 -0
  54. package/dist/common/guardrails.js.map +1 -0
  55. package/dist/common/index.d.ts +18 -0
  56. package/dist/common/index.d.ts.map +1 -0
  57. package/dist/common/index.js +34 -0
  58. package/dist/common/index.js.map +1 -0
  59. package/dist/common/log-sanitizer.d.ts +170 -0
  60. package/dist/common/log-sanitizer.d.ts.map +1 -0
  61. package/dist/common/log-sanitizer.js +690 -0
  62. package/dist/common/log-sanitizer.js.map +1 -0
  63. package/dist/common/normalize-metric-path.d.ts +2 -0
  64. package/dist/common/normalize-metric-path.d.ts.map +1 -0
  65. package/dist/common/normalize-metric-path.js +22 -0
  66. package/dist/common/normalize-metric-path.js.map +1 -0
  67. package/dist/common/policy-evaluator.d.ts +103 -0
  68. package/dist/common/policy-evaluator.d.ts.map +1 -0
  69. package/dist/common/policy-evaluator.js +200 -0
  70. package/dist/common/policy-evaluator.js.map +1 -0
  71. package/dist/common/resource.d.ts +79 -0
  72. package/dist/common/resource.d.ts.map +1 -0
  73. package/dist/common/resource.js +128 -0
  74. package/dist/common/resource.js.map +1 -0
  75. package/dist/common/tier-hints.d.ts +182 -0
  76. package/dist/common/tier-hints.d.ts.map +1 -0
  77. package/dist/common/tier-hints.js +209 -0
  78. package/dist/common/tier-hints.js.map +1 -0
  79. package/dist/common/trace-sanitizer.d.ts +82 -0
  80. package/dist/common/trace-sanitizer.d.ts.map +1 -0
  81. package/dist/common/trace-sanitizer.js +234 -0
  82. package/dist/common/trace-sanitizer.js.map +1 -0
  83. package/dist/common/traced-socket-types.d.ts +43 -0
  84. package/dist/common/traced-socket-types.d.ts.map +1 -0
  85. package/dist/common/traced-socket-types.js +17 -0
  86. package/dist/common/traced-socket-types.js.map +1 -0
  87. package/dist/index.d.ts +45 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +88 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/lint/forbidden-attributes.d.ts +149 -0
  92. package/dist/lint/forbidden-attributes.d.ts.map +1 -0
  93. package/dist/lint/forbidden-attributes.js +215 -0
  94. package/dist/lint/forbidden-attributes.js.map +1 -0
  95. package/dist/lint/index.d.ts +9 -0
  96. package/dist/lint/index.d.ts.map +1 -0
  97. package/dist/lint/index.js +16 -0
  98. package/dist/lint/index.js.map +1 -0
  99. package/dist/llmobs/index.d.ts +22 -0
  100. package/dist/llmobs/index.d.ts.map +1 -0
  101. package/dist/llmobs/index.js +29 -0
  102. package/dist/llmobs/index.js.map +1 -0
  103. package/dist/llmobs/tier1-exporter.d.ts +146 -0
  104. package/dist/llmobs/tier1-exporter.d.ts.map +1 -0
  105. package/dist/llmobs/tier1-exporter.js +199 -0
  106. package/dist/llmobs/tier1-exporter.js.map +1 -0
  107. package/dist/llmobs/tier2-summarizer.d.ts +268 -0
  108. package/dist/llmobs/tier2-summarizer.d.ts.map +1 -0
  109. package/dist/llmobs/tier2-summarizer.js +656 -0
  110. package/dist/llmobs/tier2-summarizer.js.map +1 -0
  111. package/dist/node/dynamic-attribute-processor.d.ts +43 -0
  112. package/dist/node/dynamic-attribute-processor.d.ts.map +1 -0
  113. package/dist/node/dynamic-attribute-processor.js +79 -0
  114. package/dist/node/dynamic-attribute-processor.js.map +1 -0
  115. package/dist/node/exporters/resilient-exporter.d.ts +91 -0
  116. package/dist/node/exporters/resilient-exporter.d.ts.map +1 -0
  117. package/dist/node/exporters/resilient-exporter.js +136 -0
  118. package/dist/node/exporters/resilient-exporter.js.map +1 -0
  119. package/dist/node/index.d.ts +13 -0
  120. package/dist/node/index.d.ts.map +1 -0
  121. package/dist/node/index.js +32 -0
  122. package/dist/node/index.js.map +1 -0
  123. package/dist/node/init.d.ts +97 -0
  124. package/dist/node/init.d.ts.map +1 -0
  125. package/dist/node/init.js +365 -0
  126. package/dist/node/init.js.map +1 -0
  127. package/dist/node/local-obs-mode.d.ts +17 -0
  128. package/dist/node/local-obs-mode.d.ts.map +1 -0
  129. package/dist/node/local-obs-mode.js +22 -0
  130. package/dist/node/local-obs-mode.js.map +1 -0
  131. package/dist/node/log-processor.d.ts +132 -0
  132. package/dist/node/log-processor.d.ts.map +1 -0
  133. package/dist/node/log-processor.js +397 -0
  134. package/dist/node/log-processor.js.map +1 -0
  135. package/dist/node/metrics-client.d.ts +88 -0
  136. package/dist/node/metrics-client.d.ts.map +1 -0
  137. package/dist/node/metrics-client.js +209 -0
  138. package/dist/node/metrics-client.js.map +1 -0
  139. package/dist/node/safe-logger.d.ts +55 -0
  140. package/dist/node/safe-logger.d.ts.map +1 -0
  141. package/dist/node/safe-logger.js +158 -0
  142. package/dist/node/safe-logger.js.map +1 -0
  143. package/dist/node/sanitizing-processor.d.ts +67 -0
  144. package/dist/node/sanitizing-processor.d.ts.map +1 -0
  145. package/dist/node/sanitizing-processor.js +167 -0
  146. package/dist/node/sanitizing-processor.js.map +1 -0
  147. package/dist/node/service-tracers.d.ts +52 -0
  148. package/dist/node/service-tracers.d.ts.map +1 -0
  149. package/dist/node/service-tracers.js +81 -0
  150. package/dist/node/service-tracers.js.map +1 -0
  151. package/dist/node/traced-socket.d.ts +120 -0
  152. package/dist/node/traced-socket.d.ts.map +1 -0
  153. package/dist/node/traced-socket.js +338 -0
  154. package/dist/node/traced-socket.js.map +1 -0
  155. package/dist/npm-registry/emitter.d.ts +310 -0
  156. package/dist/npm-registry/emitter.d.ts.map +1 -0
  157. package/dist/npm-registry/emitter.js +537 -0
  158. package/dist/npm-registry/emitter.js.map +1 -0
  159. package/dist/npm-registry/index.d.ts +12 -0
  160. package/dist/npm-registry/index.d.ts.map +1 -0
  161. package/dist/npm-registry/index.js +28 -0
  162. package/dist/npm-registry/index.js.map +1 -0
  163. package/dist/npm-registry/sanitize.d.ts +174 -0
  164. package/dist/npm-registry/sanitize.d.ts.map +1 -0
  165. package/dist/npm-registry/sanitize.js +342 -0
  166. package/dist/npm-registry/sanitize.js.map +1 -0
  167. package/dist/npm-registry/spans.d.ts +61 -0
  168. package/dist/npm-registry/spans.d.ts.map +1 -0
  169. package/dist/npm-registry/spans.js +91 -0
  170. package/dist/npm-registry/spans.js.map +1 -0
  171. package/dist/testing/in-memory-exporter.d.ts +179 -0
  172. package/dist/testing/in-memory-exporter.d.ts.map +1 -0
  173. package/dist/testing/in-memory-exporter.js +256 -0
  174. package/dist/testing/in-memory-exporter.js.map +1 -0
  175. package/dist/testing/index.d.ts +9 -0
  176. package/dist/testing/index.d.ts.map +1 -0
  177. package/dist/testing/index.js +21 -0
  178. package/dist/testing/index.js.map +1 -0
  179. package/dist/testing/metrics-capture.d.ts +29 -0
  180. package/dist/testing/metrics-capture.d.ts.map +1 -0
  181. package/dist/testing/metrics-capture.js +74 -0
  182. package/dist/testing/metrics-capture.js.map +1 -0
  183. package/dist/testing/test-init.d.ts +80 -0
  184. package/dist/testing/test-init.d.ts.map +1 -0
  185. package/dist/testing/test-init.js +144 -0
  186. package/dist/testing/test-init.js.map +1 -0
  187. package/dist/types/index.d.ts +84 -0
  188. package/dist/types/index.d.ts.map +1 -0
  189. package/dist/types/index.js +23 -0
  190. package/dist/types/index.js.map +1 -0
  191. package/dist/types/policy.d.ts +92 -0
  192. package/dist/types/policy.d.ts.map +1 -0
  193. package/dist/types/policy.js +125 -0
  194. package/dist/types/policy.js.map +1 -0
  195. package/dist-esm/browser/console-logging.d.ts +18 -0
  196. package/dist-esm/browser/console-logging.d.ts.map +1 -0
  197. package/dist-esm/browser/console-logging.js +27 -0
  198. package/dist-esm/browser/console-logging.js.map +1 -0
  199. package/dist-esm/browser/early-console-buffer.d.ts +49 -0
  200. package/dist-esm/browser/early-console-buffer.d.ts.map +1 -0
  201. package/dist-esm/browser/early-console-buffer.js +180 -0
  202. package/dist-esm/browser/early-console-buffer.js.map +1 -0
  203. package/dist-esm/browser/index.d.ts +17 -0
  204. package/dist-esm/browser/index.d.ts.map +1 -0
  205. package/dist-esm/browser/index.js +22 -0
  206. package/dist-esm/browser/index.js.map +1 -0
  207. package/dist-esm/browser/init.d.ts +101 -0
  208. package/dist-esm/browser/init.d.ts.map +1 -0
  209. package/dist-esm/browser/init.js +319 -0
  210. package/dist-esm/browser/init.js.map +1 -0
  211. package/dist-esm/browser/instrumentations.d.ts +67 -0
  212. package/dist-esm/browser/instrumentations.d.ts.map +1 -0
  213. package/dist-esm/browser/instrumentations.js +79 -0
  214. package/dist-esm/browser/instrumentations.js.map +1 -0
  215. package/dist-esm/browser/logs.d.ts +55 -0
  216. package/dist-esm/browser/logs.d.ts.map +1 -0
  217. package/dist-esm/browser/logs.js +79 -0
  218. package/dist-esm/browser/logs.js.map +1 -0
  219. package/dist-esm/browser/metrics.d.ts +29 -0
  220. package/dist-esm/browser/metrics.d.ts.map +1 -0
  221. package/dist-esm/browser/metrics.js +46 -0
  222. package/dist-esm/browser/metrics.js.map +1 -0
  223. package/dist-esm/browser/resilient-exporter.d.ts +43 -0
  224. package/dist-esm/browser/resilient-exporter.d.ts.map +1 -0
  225. package/dist-esm/browser/resilient-exporter.js +84 -0
  226. package/dist-esm/browser/resilient-exporter.js.map +1 -0
  227. package/dist-esm/browser/sanitizer.d.ts +35 -0
  228. package/dist-esm/browser/sanitizer.d.ts.map +1 -0
  229. package/dist-esm/browser/sanitizer.js +207 -0
  230. package/dist-esm/browser/sanitizer.js.map +1 -0
  231. package/dist-esm/browser/traced-socket.d.ts +102 -0
  232. package/dist-esm/browser/traced-socket.d.ts.map +1 -0
  233. package/dist-esm/browser/traced-socket.js +199 -0
  234. package/dist-esm/browser/traced-socket.js.map +1 -0
  235. package/dist-esm/common/contracts/tier2-traces.d.ts +116 -0
  236. package/dist-esm/common/contracts/tier2-traces.d.ts.map +1 -0
  237. package/dist-esm/common/contracts/tier2-traces.js +725 -0
  238. package/dist-esm/common/contracts/tier2-traces.js.map +1 -0
  239. package/dist-esm/common/deployment-type.d.ts +18 -0
  240. package/dist-esm/common/deployment-type.d.ts.map +1 -0
  241. package/dist-esm/common/deployment-type.js +27 -0
  242. package/dist-esm/common/deployment-type.js.map +1 -0
  243. package/dist-esm/common/guardrails.d.ts +116 -0
  244. package/dist-esm/common/guardrails.d.ts.map +1 -0
  245. package/dist-esm/common/guardrails.js +179 -0
  246. package/dist-esm/common/guardrails.js.map +1 -0
  247. package/dist-esm/common/index.d.ts +18 -0
  248. package/dist-esm/common/index.d.ts.map +1 -0
  249. package/dist-esm/common/index.js +18 -0
  250. package/dist-esm/common/index.js.map +1 -0
  251. package/dist-esm/common/log-sanitizer.d.ts +170 -0
  252. package/dist-esm/common/log-sanitizer.d.ts.map +1 -0
  253. package/dist-esm/common/log-sanitizer.js +672 -0
  254. package/dist-esm/common/log-sanitizer.js.map +1 -0
  255. package/dist-esm/common/normalize-metric-path.d.ts +2 -0
  256. package/dist-esm/common/normalize-metric-path.d.ts.map +1 -0
  257. package/dist-esm/common/normalize-metric-path.js +19 -0
  258. package/dist-esm/common/normalize-metric-path.js.map +1 -0
  259. package/dist-esm/common/policy-evaluator.d.ts +103 -0
  260. package/dist-esm/common/policy-evaluator.d.ts.map +1 -0
  261. package/dist-esm/common/policy-evaluator.js +196 -0
  262. package/dist-esm/common/policy-evaluator.js.map +1 -0
  263. package/dist-esm/common/resource.d.ts +79 -0
  264. package/dist-esm/common/resource.d.ts.map +1 -0
  265. package/dist-esm/common/resource.js +121 -0
  266. package/dist-esm/common/resource.js.map +1 -0
  267. package/dist-esm/common/tier-hints.d.ts +182 -0
  268. package/dist-esm/common/tier-hints.d.ts.map +1 -0
  269. package/dist-esm/common/tier-hints.js +199 -0
  270. package/dist-esm/common/tier-hints.js.map +1 -0
  271. package/dist-esm/common/trace-sanitizer.d.ts +82 -0
  272. package/dist-esm/common/trace-sanitizer.d.ts.map +1 -0
  273. package/dist-esm/common/trace-sanitizer.js +230 -0
  274. package/dist-esm/common/trace-sanitizer.js.map +1 -0
  275. package/dist-esm/common/traced-socket-types.d.ts +43 -0
  276. package/dist-esm/common/traced-socket-types.d.ts.map +1 -0
  277. package/dist-esm/common/traced-socket-types.js +16 -0
  278. package/dist-esm/common/traced-socket-types.js.map +1 -0
  279. package/dist-esm/index.d.ts +45 -0
  280. package/dist-esm/index.d.ts.map +1 -0
  281. package/dist-esm/index.js +56 -0
  282. package/dist-esm/index.js.map +1 -0
  283. package/dist-esm/lint/forbidden-attributes.d.ts +149 -0
  284. package/dist-esm/lint/forbidden-attributes.d.ts.map +1 -0
  285. package/dist-esm/lint/forbidden-attributes.js +210 -0
  286. package/dist-esm/lint/forbidden-attributes.js.map +1 -0
  287. package/dist-esm/lint/index.d.ts +9 -0
  288. package/dist-esm/lint/index.d.ts.map +1 -0
  289. package/dist-esm/lint/index.js +9 -0
  290. package/dist-esm/lint/index.js.map +1 -0
  291. package/dist-esm/llmobs/index.d.ts +22 -0
  292. package/dist-esm/llmobs/index.d.ts.map +1 -0
  293. package/dist-esm/llmobs/index.js +22 -0
  294. package/dist-esm/llmobs/index.js.map +1 -0
  295. package/dist-esm/llmobs/tier1-exporter.d.ts +146 -0
  296. package/dist-esm/llmobs/tier1-exporter.d.ts.map +1 -0
  297. package/dist-esm/llmobs/tier1-exporter.js +193 -0
  298. package/dist-esm/llmobs/tier1-exporter.js.map +1 -0
  299. package/dist-esm/llmobs/tier2-summarizer.d.ts +268 -0
  300. package/dist-esm/llmobs/tier2-summarizer.d.ts.map +1 -0
  301. package/dist-esm/llmobs/tier2-summarizer.js +652 -0
  302. package/dist-esm/llmobs/tier2-summarizer.js.map +1 -0
  303. package/dist-esm/node/dynamic-attribute-processor.d.ts +43 -0
  304. package/dist-esm/node/dynamic-attribute-processor.d.ts.map +1 -0
  305. package/dist-esm/node/dynamic-attribute-processor.js +74 -0
  306. package/dist-esm/node/dynamic-attribute-processor.js.map +1 -0
  307. package/dist-esm/node/exporters/resilient-exporter.d.ts +91 -0
  308. package/dist-esm/node/exporters/resilient-exporter.d.ts.map +1 -0
  309. package/dist-esm/node/exporters/resilient-exporter.js +132 -0
  310. package/dist-esm/node/exporters/resilient-exporter.js.map +1 -0
  311. package/dist-esm/node/index.d.ts +13 -0
  312. package/dist-esm/node/index.d.ts.map +1 -0
  313. package/dist-esm/node/index.js +13 -0
  314. package/dist-esm/node/index.js.map +1 -0
  315. package/dist-esm/node/init.d.ts +97 -0
  316. package/dist-esm/node/init.d.ts.map +1 -0
  317. package/dist-esm/node/init.js +359 -0
  318. package/dist-esm/node/init.js.map +1 -0
  319. package/dist-esm/node/local-obs-mode.d.ts +17 -0
  320. package/dist-esm/node/local-obs-mode.d.ts.map +1 -0
  321. package/dist-esm/node/local-obs-mode.js +19 -0
  322. package/dist-esm/node/local-obs-mode.js.map +1 -0
  323. package/dist-esm/node/log-processor.d.ts +132 -0
  324. package/dist-esm/node/log-processor.d.ts.map +1 -0
  325. package/dist-esm/node/log-processor.js +389 -0
  326. package/dist-esm/node/log-processor.js.map +1 -0
  327. package/dist-esm/node/metrics-client.d.ts +88 -0
  328. package/dist-esm/node/metrics-client.d.ts.map +1 -0
  329. package/dist-esm/node/metrics-client.js +205 -0
  330. package/dist-esm/node/metrics-client.js.map +1 -0
  331. package/dist-esm/node/safe-logger.d.ts +55 -0
  332. package/dist-esm/node/safe-logger.d.ts.map +1 -0
  333. package/dist-esm/node/safe-logger.js +154 -0
  334. package/dist-esm/node/safe-logger.js.map +1 -0
  335. package/dist-esm/node/sanitizing-processor.d.ts +67 -0
  336. package/dist-esm/node/sanitizing-processor.d.ts.map +1 -0
  337. package/dist-esm/node/sanitizing-processor.js +163 -0
  338. package/dist-esm/node/sanitizing-processor.js.map +1 -0
  339. package/dist-esm/node/service-tracers.d.ts +52 -0
  340. package/dist-esm/node/service-tracers.d.ts.map +1 -0
  341. package/dist-esm/node/service-tracers.js +78 -0
  342. package/dist-esm/node/service-tracers.js.map +1 -0
  343. package/dist-esm/node/traced-socket.d.ts +120 -0
  344. package/dist-esm/node/traced-socket.d.ts.map +1 -0
  345. package/dist-esm/node/traced-socket.js +334 -0
  346. package/dist-esm/node/traced-socket.js.map +1 -0
  347. package/dist-esm/npm-registry/emitter.d.ts +310 -0
  348. package/dist-esm/npm-registry/emitter.d.ts.map +1 -0
  349. package/dist-esm/npm-registry/emitter.js +525 -0
  350. package/dist-esm/npm-registry/emitter.js.map +1 -0
  351. package/dist-esm/npm-registry/index.d.ts +12 -0
  352. package/dist-esm/npm-registry/index.d.ts.map +1 -0
  353. package/dist-esm/npm-registry/index.js +12 -0
  354. package/dist-esm/npm-registry/index.js.map +1 -0
  355. package/dist-esm/npm-registry/sanitize.d.ts +174 -0
  356. package/dist-esm/npm-registry/sanitize.d.ts.map +1 -0
  357. package/dist-esm/npm-registry/sanitize.js +331 -0
  358. package/dist-esm/npm-registry/sanitize.js.map +1 -0
  359. package/dist-esm/npm-registry/spans.d.ts +61 -0
  360. package/dist-esm/npm-registry/spans.d.ts.map +1 -0
  361. package/dist-esm/npm-registry/spans.js +86 -0
  362. package/dist-esm/npm-registry/spans.js.map +1 -0
  363. package/dist-esm/package.json +1 -0
  364. package/dist-esm/testing/in-memory-exporter.d.ts +179 -0
  365. package/dist-esm/testing/in-memory-exporter.d.ts.map +1 -0
  366. package/dist-esm/testing/in-memory-exporter.js +250 -0
  367. package/dist-esm/testing/in-memory-exporter.js.map +1 -0
  368. package/dist-esm/testing/index.d.ts +9 -0
  369. package/dist-esm/testing/index.d.ts.map +1 -0
  370. package/dist-esm/testing/index.js +9 -0
  371. package/dist-esm/testing/index.js.map +1 -0
  372. package/dist-esm/testing/metrics-capture.d.ts +29 -0
  373. package/dist-esm/testing/metrics-capture.d.ts.map +1 -0
  374. package/dist-esm/testing/metrics-capture.js +71 -0
  375. package/dist-esm/testing/metrics-capture.js.map +1 -0
  376. package/dist-esm/testing/test-init.d.ts +80 -0
  377. package/dist-esm/testing/test-init.d.ts.map +1 -0
  378. package/dist-esm/testing/test-init.js +137 -0
  379. package/dist-esm/testing/test-init.js.map +1 -0
  380. package/dist-esm/types/index.d.ts +84 -0
  381. package/dist-esm/types/index.d.ts.map +1 -0
  382. package/dist-esm/types/index.js +7 -0
  383. package/dist-esm/types/index.js.map +1 -0
  384. package/dist-esm/types/policy.d.ts +92 -0
  385. package/dist-esm/types/policy.d.ts.map +1 -0
  386. package/dist-esm/types/policy.js +122 -0
  387. package/dist-esm/types/policy.js.map +1 -0
  388. package/package.json +102 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,87 @@
1
+ Superblocks Community Software License
2
+
3
+ This Superblocks Community License Agreement (the “Agreement”) sets forth the terms on which DayZero
4
+ Software, Inc. d/b/a Superblocks (“Superblocks”) makes available certain software made available by Superblocks
5
+ under this Agreement (the “Software”). BY INSTALLING, DOWNLOADING, ACCESSING, USING OR
6
+ DISTRIBUTING ANY OF THE SOFTWARE, YOU AGREE TO THE TERMS AND CONDITIONS OF THIS
7
+ AGREEMENT.IF YOU DO NOT AGREE TO SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE
8
+ SOFTWARE. IF YOU ARE RECEIVING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU
9
+ REPRESENT AND WARRANT THAT YOU HAVE THE ACTUAL AUTHORITY TO AGREE TO THE
10
+ TERMS AND CONDITIONS OF THIS AGREEMENT ON BEHALF OF SUCH ENTITY. “Licensee” means you,
11
+ an individual, or the entity on whose behalf you are receiving the Software.
12
+
13
+ 1. LICENSE GRANT AND CONDITIONS.
14
+
15
+ 1.1 License. Subject to the terms and conditions of this Agreement, Superblocks hereby grants to Licensee a
16
+ non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this
17
+ Agreement to: (a) use the Software; (b) prepare modifications and derivative works of the Software; (c)
18
+ distribute the Software (including without limitation in source code or object code form); and (d) reproduce
19
+ copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the
20
+ License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means making
21
+ available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other similar online
22
+ service that competes with Superblocks’ products or services.
23
+
24
+ 1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the
25
+ following conditions:
26
+
27
+ a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee
28
+ modified the Software.
29
+ b. On each Software copy, Licensee shall reproduce and not remove or alter all Superblocks or third party
30
+ copyright or other proprietary notices contained in the Software, and Licensee must provide the notice
31
+ below with each copy.
32
+
33
+ “This software is made available by DayZero Software, Inc. d/b/a Superblocks, under the terms of the
34
+ Superblocks Community License Agreement. © 2022 DayZero Software, Inc.”
35
+
36
+ 1.3 Licensee Modifications. Licensee may add its own copyright notices to modifications made by Licensee
37
+ and may provide additional or different license terms and conditions for use, reproduction, or distribution of
38
+ Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to
39
+ offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not
40
+ Superblocks, will be responsible for any such obligations.
41
+
42
+ 1.4 No Sublicensing. The License does not include the right to sublicense the Software, however, each recipient
43
+ to which Licensee provides the Software may exercise the Licenses so long as such recipient agrees to the terms
44
+ and conditions of this Agreement.
45
+
46
+ 2. TERM AND TERMINATION. This Agreement will continue unless and until earlier terminated as set forth
47
+ herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will
48
+ terminate automatically and the License will terminate automatically and permanently.
49
+
50
+ 3. INTELLECTUAL PROPERTY. As between the parties, Superblocks will retain all right, title, and interest in
51
+ the Software, and all intellectual property rights therein. Superblocks hereby reserves all rights not expressly
52
+ granted to Licensee in this Agreement. Superblocks hereby reserves all rights in its trademarks and service
53
+ marks, and no licenses therein are granted in this Agreement.
54
+
55
+ 4. DISCLAIMER. SUPERBLOCKS HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND
56
+ CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY
57
+ DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
58
+ PURPOSE, WITH RESPECT TO THE SOFTWARE.
59
+
60
+ 5. LIMITATION OF LIABILITY. SUPERBLOCKS WILL NOT BE LIABLE FOR ANY DAMAGES OF
61
+ ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL,
62
+ SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY
63
+ THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO
64
+ THE EXTENT PERMITTED BY APPLICABLE LAW.
65
+
66
+ 6. GENERAL.
67
+
68
+ 6.1  Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the
69
+ state of California, without reference to its conflict of laws principles. If Licensee is located within the United
70
+ States, all disputes arising out of this Agreement are subject to the exclusive jurisdiction of courts located in San
71
+ Mateo County, California. USA. If Licensee is located outside of the United States, any dispute, controversy or
72
+ claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in
73
+ accordance with the JAMS International Arbitration Rules. The tribunal will consist of one neutral arbitrator.
74
+ The place of arbitration will be Palo Alto, California. The language to be used in the arbitral proceedings will be
75
+ English. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction
76
+ thereof.
77
+
78
+ 6.2.  Assignment. Licensee may not assign its rights under this Agreement to any third party. Superblocks may
79
+ freely assign its rights under this Agreement to any third party.
80
+
81
+ 6.3.  Other.  This Agreement is the entire agreement between the parties regarding the subject matter hereof.
82
+ No amendment or modification of this Agreement will be valid or binding upon the parties unless made in
83
+ writing and signed by the duly authorized representatives of both parties. In the event that any provision,
84
+ including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and
85
+ all licenses and rights granted hereunder will immediately terminate. Waiver by Superblocks of a breach of any
86
+ provision of this Agreement or the failure by Superblocks to exercise any right hereunder will not be construed
87
+ as a waiver of any subsequent breach of that right or as a waiver of any other right.
package/README.md ADDED
@@ -0,0 +1,298 @@
1
+ # @superblocksteam/telemetry
2
+
3
+ Canonical telemetry bootstrap package for all Superblocks services. This package provides policy-aware OpenTelemetry initialization with tier-based routing and sanitization.
4
+
5
+ ## Overview
6
+
7
+ This is the **ONLY approved way** to initialize OpenTelemetry in Superblocks services. Direct usage of `NodeSDK` or `WebTracerProvider` outside this package is prohibited.
8
+
9
+ - **Logging**: Policy-aware log export (severity filtering, sanitization). See [docs/LOGGING.md](docs/LOGGING.md) for what to log at each level and forbidden fields.
10
+
11
+ ## Tiered Telemetry Model
12
+
13
+ | Tier | Description | Egress |
14
+ | ---------- | -------------------------------------------------------------- | ----------------------- |
15
+ | **Tier 1** | Full fidelity debugging (code, prompts, stack traces) | Local only (cloud-prem) |
16
+ | **Tier 2** | Sanitized operational telemetry (latency, errors, token usage) | Exported by default |
17
+ | **Tier 3** | AI experience telemetry (prompts, responses, quality signals) | Exported by default |
18
+
19
+ ## Usage
20
+
21
+ ### Node.js Services
22
+
23
+ ```typescript
24
+ import { initNodeTelemetry } from "@superblocksteam/telemetry/node";
25
+ import { getDefaultPolicy, DeploymentType } from "@superblocksteam/shared";
26
+
27
+ const policy = getDefaultPolicy(DeploymentType.CLOUD_PREM);
28
+
29
+ const telemetry = initNodeTelemetry(
30
+ {
31
+ serviceName: "my-service",
32
+ serviceVersion: "1.0.0",
33
+ environment: process.env.NODE_ENV ?? "development",
34
+ otlpUrl: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
35
+ },
36
+ policy,
37
+ );
38
+
39
+ // Graceful shutdown
40
+ process.on("SIGTERM", async () => {
41
+ await telemetry.shutdown();
42
+ });
43
+ ```
44
+
45
+ ### Browser
46
+
47
+ ```typescript
48
+ import { initBrowserTelemetry } from "@superblocksteam/telemetry/browser";
49
+ import { getDefaultPolicy, DeploymentType } from "@superblocksteam/shared";
50
+
51
+ const policy = getDefaultPolicy(DeploymentType.CLOUD);
52
+
53
+ initBrowserTelemetry(
54
+ {
55
+ serviceName: "superblocks-ui",
56
+ serviceVersion: "1.0.0",
57
+ environment: "production",
58
+ otlpUrl: "https://app.superblocks.com/api/v1/traces",
59
+ },
60
+ policy,
61
+ );
62
+ ```
63
+
64
+ ### Testing
65
+
66
+ ```typescript
67
+ import { initTestTelemetry } from "@superblocksteam/telemetry/testing";
68
+
69
+ describe("MyService", () => {
70
+ const { spanExporter, reset } = initTestTelemetry();
71
+
72
+ beforeEach(() => reset());
73
+
74
+ it("creates expected spans", async () => {
75
+ await myService.doSomething();
76
+
77
+ const spans = spanExporter.getSpans();
78
+ expect(spans).toHaveLength(1);
79
+ expect(spans[0].name).toBe("doSomething");
80
+ });
81
+
82
+ it("does not leak Tier 1 data", async () => {
83
+ await myService.processWithSensitiveData();
84
+
85
+ spanExporter.assertNoAttribute("prompt", /.*/);
86
+ spanExporter.assertNoAttribute("code", /.*/);
87
+ });
88
+ });
89
+ ```
90
+
91
+ ## Tier Policy Hints
92
+
93
+ Use tier policy hints to inform the Collector how to route specific spans. This is useful when the SDK knows something the Collector can't infer from attributes alone.
94
+
95
+ ```typescript
96
+ import { trace } from "@opentelemetry/api";
97
+ import {
98
+ markSensitive,
99
+ markForAIAnalysis,
100
+ markDebugOnly,
101
+ } from "@superblocksteam/telemetry";
102
+
103
+ const tracer = trace.getTracer("my-service");
104
+
105
+ // Span containing secrets — Tier 1 only, never exported
106
+ tracer.startActiveSpan("decrypt_customer_secret", (span) => {
107
+ markSensitive(span);
108
+ // ... decrypt operation
109
+ span.end();
110
+ });
111
+
112
+ // GenAI span for quality analysis — include in Tier 3
113
+ tracer.startActiveSpan("gen_ai.chat", (span) => {
114
+ markForAIAnalysis(span);
115
+ span.setAttribute("gen_ai.system", "anthropic");
116
+ // ... LLM call
117
+ span.end();
118
+ });
119
+
120
+ // High-cardinality debug span — skip export (cost control)
121
+ tracer.startActiveSpan("debug.cache_lookup", (span) => {
122
+ markDebugOnly(span);
123
+ span.setAttribute("cache.key", cacheKey);
124
+ // ... lookup
125
+ span.end();
126
+ });
127
+ ```
128
+
129
+ ### Available Hints
130
+
131
+ | Helper | Hint Value | Effect |
132
+ | ------------------------- | --------------- | -------------------------------- |
133
+ | `markSensitive(span)` | `tier1_only` | Tier 1 only, skip Tier 2/3 |
134
+ | `markForAIAnalysis(span)` | `include_tier3` | Include in Tier 3 (AI analytics) |
135
+ | `markDebugOnly(span)` | `skip_export` | Tier 1 only, skip all export |
136
+
137
+ You can also set hints directly:
138
+
139
+ ```typescript
140
+ import {
141
+ TIER_HINT_ATTRIBUTE,
142
+ TierPolicyHint,
143
+ } from "@superblocksteam/telemetry";
144
+
145
+ span.setAttribute(TIER_HINT_ATTRIBUTE, TierPolicyHint.TIER1_ONLY);
146
+ ```
147
+
148
+ ## NPM Registry Sanitization
149
+
150
+ Telemetry attributes describing npm install attempts (`registry_host`,
151
+ `package_name`, `npm.outcome`) ship out of cloud-prem and must be sanitized
152
+ **at the emit boundary** so customer infrastructure hostnames and registry
153
+ tokens never appear in exported traces, metrics, logs, or audit events.
154
+ Every emitter (the `NpmRegistryEmitter`, P6.3 audit events, any future
155
+ runner) MUST pass values through the helpers in
156
+ [`npm-registry/sanitize.ts`](src/npm-registry/sanitize.ts); the
157
+ dashboard/collector layer is not the right place to sanitize.
158
+
159
+ The metrics emitter and the four named OTel spans live alongside it in
160
+ [`src/npm-registry/`](src/npm-registry/) (`emitter.ts`, `spans.ts`). The
161
+ emitter defines its own **per-path** short outcome enums
162
+ (`install`/`probe`/`lookup`/`config`, e.g. `auth_failed`) — the long-form
163
+ `NPM_OUTCOMES` below stays as the **audit-event** surface
164
+ (`registry_auth_failed`); the divergence is intentional until an explicit
165
+ audit-schema migration. `registry_host` is bucketed on the metric/span path
166
+ but kept **raw** (guarded by `auditNpmRegistryHost`) on per-org log lines.
167
+
168
+ | Attribute | Rule | Helper |
169
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- |
170
+ | `registry_host` | Bucket to `public_npm` / `private` / `unknown`. Raw hostnames never ship. | `bucketNpmRegistryHost` |
171
+ | `package_name_bucket` | Metric destinations: bucket to `public` / `private` / `unknown` / `invalid`. Cardinality-safe; never carries the raw name. | `bucketNpmPackageName` (or `npmAttributesForMetric`) |
172
+ | `package_name` | Audit/log destinations only: emit verbatim (lowercased) if it parses as a valid npm name and is not a known-secret value pattern; else `invalid`. | `sanitizeNpmPackageName` (or `npmAttributesForAudit`) |
173
+ | `npm.outcome` | Audit-surface closed allowlist of 7 values; unknown coerces to `other`. (Metric paths use the shorter per-path enums in `emitter.ts`.) | `normalizeNpmOutcome` |
174
+ | Registry token | Never an attribute. Bucketing strips it from URLs; `tier2-traces` lists token-shaped attribute NAMES as forbidden and `containsForbiddenPattern` rejects token-shaped VALUES (including `npm_<36+>`) smuggled into the package name. | n/a |
175
+
176
+ ### `registry_host`
177
+
178
+ ```
179
+ public_npm | private | unknown
180
+ ```
181
+
182
+ Only `registry.npmjs.org` (case-insensitive, port/path stripped) maps to
183
+ `public_npm`. Everything else — customer Artifactory, JFrog, GitHub
184
+ Packages, anything reachable behind a customer VPN — maps to `private`.
185
+ Empty input or a URL that fails to parse maps to `unknown`. GitHub
186
+ Packages (`npm.pkg.github.com`) is intentionally `private`: customers
187
+ deploy it as their private registry, and a `private` bucket avoids the
188
+ false negative of treating their setup as public.
189
+
190
+ ### `package_name` — decision
191
+
192
+ The right shape is destination-dependent, so the helper exposes both a
193
+ metric-safe bucket and an audit-safe verbatim form. Emitters pick the
194
+ wrapper for their destination; the type system enforces that metric
195
+ emitters never see the raw name.
196
+
197
+ **Metric destinations — `package_name_bucket`**
198
+
199
+ Metric destinations (OTel metric attributes, Datadog tags, span
200
+ attributes that flow into shared metric pipelines) get a four-value
201
+ bucket:
202
+
203
+ ```
204
+ public | private | unknown | invalid
205
+ ```
206
+
207
+ - Cardinality: an OTel metric tagged with the raw package name is
208
+ unbounded — each unique install attempt creates a new time series, and
209
+ on Datadog that translates directly into custom-metric billing.
210
+ - Privacy: metric destinations are typically shared across orgs and
211
+ retained centrally. Emitting `@customer-acme/billing-engine` as a
212
+ metric tag leaks customer-internal package naming to anyone with read
213
+ access to the metric store. Bucketing strips that leak at the source.
214
+ - Mapping: a valid name on `public_npm` is `public`; a valid name on a
215
+ private registry is `private`; a valid name with no/`unknown`
216
+ registry is `unknown`; anything that fails the npm name spec or
217
+ matches a known-secret value pattern is `invalid`.
218
+
219
+ **Audit/log destinations — `package_name`**
220
+
221
+ Audit events and internal logs (per-org event streams, lower volume,
222
+ retained for forensic value) emit the lowercased name verbatim, gated
223
+ by a value-pattern guardrail. The forensic signal — "which package
224
+ failed for org X?" — is exactly the workflow these destinations exist
225
+ to serve; bucketing would destroy it.
226
+
227
+ - Package names are not credentials. The customer already shares them
228
+ with us via app code (which we render and store), install logs, and
229
+ the CVE-visibility surface in the parent project (AGENT-2579).
230
+ - Any input matching a known-secret value pattern
231
+ (`containsForbiddenPattern` from the tier-2 traces contract — GitHub
232
+ PATs, AWS keys, JWTs, Bearer tokens, PEM blocks, **npm registry
233
+ tokens (`npm_<36+>`)**, etc.) is rejected with `invalid`. This is a
234
+ developer-error backstop, not a primary defense; the primary defense
235
+ is that emitters never pass arbitrary strings as `package_name` in
236
+ the first place.
237
+ - Names that fail the npm name spec (`lodash@4.17.21`, `./local`,
238
+ `github:foo/bar`, anything with whitespace or shell metacharacters)
239
+ are rejected with `invalid` — those aren't package names, they're
240
+ install specs, and emitting them as a "package name" would mis-tag
241
+ the audit event.
242
+
243
+ If a future customer has a contractual requirement to redact even
244
+ audit-event names, tighten `sanitizeNpmPackageName` (e.g. hash scoped
245
+ names) rather than adding a parallel emitter — the goal is one place to
246
+ argue about the policy.
247
+
248
+ ### `npm.outcome`
249
+
250
+ Closed enum, allowlist explicit. The first values match the structured
251
+ error from APPS-4179 (P1.2) and APPS-4195 (P1.5); `tls_failed` was added in
252
+ APPS-4381; `other` is the catch-all so dashboards never see free-form
253
+ strings.
254
+
255
+ ```
256
+ success | not_in_registry | registry_unreachable | registry_auth_failed
257
+ | tls_failed | lockfile_url_mismatch | other
258
+ ```
259
+
260
+ This long-form enum is the **audit-event** surface. The metric emitter
261
+ (APPS-4378) uses shorter per-path enums in
262
+ [`emitter.ts`](src/npm-registry/emitter.ts) — install `auth_failed` /
263
+ `unreachable`, probe `ok` / `invalid_response`, etc. — and normalizes the
264
+ long forms to them. Coercion happens at the emit boundary — never at the
265
+ dashboard.
266
+
267
+ ### Source-of-truth + acceptance
268
+
269
+ **Decision (APPS-4190, signed off in #19574):** `package_name` is destination-dependent — bucketed (`package_name_bucket`) for metric destinations, verbatim-lowercased for audit/log destinations. Future P6.2/P6.3 emitters do NOT re-argue this; tighten the helper instead.
270
+
271
+ - Helper: [`packages/telemetry/src/npm-registry/sanitize.ts`](src/npm-registry/sanitize.ts)
272
+ - Tests: [`sanitize.test.ts`](src/npm-registry/sanitize.test.ts) — covers each rule + a token-leak regression that asserts no token-bearing input ever appears in output
273
+ - Forbidden-attribute backstop: `npm.token` / `npm_token` / `npm.registry_token` / `registry_token` in `FORBIDDEN_TIER_2_SPAN_ATTRIBUTES`
274
+ - Ticket: [APPS-4190](https://linear.app/superblocks/issue/APPS-4190) — referenced from downstream tickets (APPS-4189 metrics, APPS-4191 audit events)
275
+
276
+ ## Key Principles
277
+
278
+ 1. **Policy Required** — Cannot initialize telemetry without a `TelemetryPolicy`
279
+ 2. **Tier Enforcement** — Exporters are automatically enabled/disabled based on policy
280
+ 3. **Sanitization at Source** — Tier 2/3 payloads are sanitized before export
281
+ 4. **Fire-and-Forget** — Export failures never block core request paths
282
+ 5. **Consistent Resources** — All services emit standardized resource attributes
283
+
284
+ ## Package Structure
285
+
286
+ ```
287
+ @superblocksteam/telemetry
288
+ ├── /node # Node.js bootstrap (initNodeTelemetry)
289
+ ├── /browser # Browser bootstrap (initBrowserTelemetry)
290
+ ├── /testing # Test utilities (in-memory exporters)
291
+ └── /common # Shared utilities (resource, router, sanitizer)
292
+ ```
293
+
294
+ ## Related Documentation
295
+
296
+ - [O11y Refactor Project](../../engineering/projects/o11y-refactor/README.md)
297
+ - [Telemetry Policy Schema](../../engineering/projects/o11y-refactor/epics/epic-a1-telemetry-policy.md)
298
+ - [Tier 2 Traces Contract](https://github.com/superblocksteam/engineering/blob/main/projects/o11y-refactor/contracts/tier2-traces.v0.2.0.json)
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Console Log Attributes
3
+ *
4
+ * Used to attach structured key-value metadata to console.* calls so the
5
+ * EarlyConsoleBuffer (and the live OTel patch) can forward them as OTEL log
6
+ * record attributes.
7
+ *
8
+ * Usage:
9
+ * import { consoleLogAttributes } from '@superblocksteam/telemetry/browser';
10
+ * console.info("user loaded", consoleLogAttributes({ userId: "abc123" }));
11
+ */
12
+ export declare class ConsoleLogAttributes {
13
+ readonly attributes: Record<string, unknown>;
14
+ constructor(attributes: Record<string, unknown>);
15
+ static create(attrs: Record<string, unknown>): ConsoleLogAttributes;
16
+ }
17
+ export declare const consoleLogAttributes: (attrs: Record<string, unknown>) => ConsoleLogAttributes;
18
+ //# sourceMappingURL=console-logging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logging.d.ts","sourceRoot":"","sources":["../../src/browser/console-logging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,qBAAa,oBAAoB;aACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAAnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE/D,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,oBAAoB;CAGpE;AAGD,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,oBAEF,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Console Log Attributes
4
+ *
5
+ * Used to attach structured key-value metadata to console.* calls so the
6
+ * EarlyConsoleBuffer (and the live OTel patch) can forward them as OTEL log
7
+ * record attributes.
8
+ *
9
+ * Usage:
10
+ * import { consoleLogAttributes } from '@superblocksteam/telemetry/browser';
11
+ * console.info("user loaded", consoleLogAttributes({ userId: "abc123" }));
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.consoleLogAttributes = exports.ConsoleLogAttributes = void 0;
15
+ // The attributes that should be passed to OTEL logs as part of the message context.
16
+ // To use, create an instance of this class and pass it as an argument to console.* methods.
17
+ class ConsoleLogAttributes {
18
+ attributes;
19
+ constructor(attributes) {
20
+ this.attributes = attributes;
21
+ }
22
+ static create(attrs) {
23
+ return new ConsoleLogAttributes(attrs);
24
+ }
25
+ }
26
+ exports.ConsoleLogAttributes = ConsoleLogAttributes;
27
+ // Convenience factory
28
+ const consoleLogAttributes = (attrs) => {
29
+ return new ConsoleLogAttributes(attrs);
30
+ };
31
+ exports.consoleLogAttributes = consoleLogAttributes;
32
+ //# sourceMappingURL=console-logging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logging.js","sourceRoot":"","sources":["../../src/browser/console-logging.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,oFAAoF;AACpF,4FAA4F;AAC5F,MAAa,oBAAoB;IACH;IAA5B,YAA4B,UAAmC;QAAnC,eAAU,GAAV,UAAU,CAAyB;IAAG,CAAC;IAEnE,MAAM,CAAC,MAAM,CAAC,KAA8B;QAC1C,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AAND,oDAMC;AAED,sBAAsB;AACf,MAAM,oBAAoB,GAAG,CAClC,KAA8B,EACR,EAAE;IACxB,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Early Console Buffer
3
+ *
4
+ * Patches console.log/info/debug/warn/error as early as possible (before OTel
5
+ * initialises) to capture logs in a ring buffer. On OTel init, the buffer is
6
+ * flushed to the OTel Logger and all subsequent console calls are forwarded
7
+ * directly.
8
+ *
9
+ * IMPORTANT: Each patched method ALWAYS calls through to the original console
10
+ * method first, so downstream patchers (Datadog RUM, PostHog, etc.) that wrap
11
+ * console after us continue to receive every call.
12
+ */
13
+ import { type Logger } from "@opentelemetry/api-logs";
14
+ declare class EarlyConsoleBuffer {
15
+ private static instance;
16
+ private buffer;
17
+ private maxBufferSize;
18
+ private originalMethods;
19
+ private otelLogger;
20
+ private isPatched;
21
+ private disabled;
22
+ static getInstance(): EarlyConsoleBuffer;
23
+ /**
24
+ * Patch console methods immediately with buffering.
25
+ * Safe to call multiple times — subsequent calls are no-ops.
26
+ */
27
+ patchEarly(): void;
28
+ private patchMethod;
29
+ private bufferLog;
30
+ /**
31
+ * Disable the buffer without forwarding to OTel. Discards buffered entries
32
+ * and removes the buffering wrapper so subsequent console calls go straight
33
+ * to the original methods (no memory leak from the ever-growing ring buffer).
34
+ *
35
+ * Use this when log export is disabled (e.g. on-premise deployments) so the
36
+ * buffer-and-evict path doesn't run indefinitely.
37
+ */
38
+ disable(): void;
39
+ /**
40
+ * Called once OTel is ready. Flushes buffered entries then routes all future
41
+ * console calls directly to the OTel logger.
42
+ */
43
+ enableOpenTelemetry(otelLogger: Logger): void;
44
+ private flushBuffer;
45
+ private sendToOpenTelemetry;
46
+ private formatConsoleArgs;
47
+ }
48
+ export default EarlyConsoleBuffer;
49
+ //# sourceMappingURL=early-console-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"early-console-buffer.d.ts","sourceRoot":"","sources":["../../src/browser/early-console-buffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,yBAAyB,CAAC;AAuBtE,cAAM,kBAAkB;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAE5C,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IAEzB,MAAM,CAAC,WAAW,IAAI,kBAAkB;IAOxC;;;OAGG;IACH,UAAU,IAAI,IAAI;IA4BlB,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,SAAS;IAOjB;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;IAqBf;;;OAGG;IACH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAM7C,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,mBAAmB;IA8B3B,OAAO,CAAC,iBAAiB;CAkB1B;AAED,eAAe,kBAAkB,CAAC"}