@microsoft/opentelemetry 0.1.0-alpha.2 → 0.1.0-alpha.3

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 (260) hide show
  1. package/dist/commonjs/a365/configuration/A365Configuration.d.ts +42 -0
  2. package/dist/commonjs/a365/configuration/A365Configuration.d.ts.map +1 -0
  3. package/dist/commonjs/a365/configuration/A365Configuration.js +162 -0
  4. package/dist/commonjs/a365/configuration/A365Configuration.js.map +1 -0
  5. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.d.ts +53 -0
  6. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.d.ts.map +1 -0
  7. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.js +5 -0
  8. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.js.map +1 -0
  9. package/dist/commonjs/a365/configuration/index.d.ts +3 -0
  10. package/dist/commonjs/a365/configuration/index.d.ts.map +1 -0
  11. package/dist/commonjs/a365/configuration/index.js +9 -0
  12. package/dist/commonjs/a365/configuration/index.js.map +1 -0
  13. package/dist/commonjs/a365/constants.d.ts +76 -0
  14. package/dist/commonjs/a365/constants.d.ts.map +1 -0
  15. package/dist/commonjs/a365/constants.js +99 -0
  16. package/dist/commonjs/a365/constants.js.map +1 -0
  17. package/dist/commonjs/a365/context/tokenContext.d.ts +25 -0
  18. package/dist/commonjs/a365/context/tokenContext.d.ts.map +1 -0
  19. package/dist/commonjs/a365/context/tokenContext.js +67 -0
  20. package/dist/commonjs/a365/context/tokenContext.js.map +1 -0
  21. package/dist/commonjs/a365/context.d.ts +31 -0
  22. package/dist/commonjs/a365/context.d.ts.map +1 -0
  23. package/dist/commonjs/a365/context.js +109 -0
  24. package/dist/commonjs/a365/context.js.map +1 -0
  25. package/dist/commonjs/a365/contracts.d.ts +250 -0
  26. package/dist/commonjs/a365/contracts.d.ts.map +1 -0
  27. package/dist/commonjs/a365/contracts.js +52 -0
  28. package/dist/commonjs/a365/contracts.js.map +1 -0
  29. package/dist/commonjs/a365/exporter/Agent365Exporter.d.ts +25 -0
  30. package/dist/commonjs/a365/exporter/Agent365Exporter.d.ts.map +1 -0
  31. package/dist/commonjs/a365/exporter/Agent365Exporter.js +220 -0
  32. package/dist/commonjs/a365/exporter/Agent365Exporter.js.map +1 -0
  33. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.d.ts +43 -0
  34. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.d.ts.map +1 -0
  35. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.js +30 -0
  36. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.js.map +1 -0
  37. package/dist/commonjs/a365/exporter/ExporterEventNames.d.ts +9 -0
  38. package/dist/commonjs/a365/exporter/ExporterEventNames.d.ts.map +1 -0
  39. package/dist/commonjs/a365/exporter/ExporterEventNames.js +15 -0
  40. package/dist/commonjs/a365/exporter/ExporterEventNames.js.map +1 -0
  41. package/dist/commonjs/a365/exporter/index.d.ts +6 -0
  42. package/dist/commonjs/a365/exporter/index.d.ts.map +1 -0
  43. package/dist/commonjs/a365/exporter/index.js +15 -0
  44. package/dist/commonjs/a365/exporter/index.js.map +1 -0
  45. package/dist/commonjs/a365/exporter/utils.d.ts +41 -0
  46. package/dist/commonjs/a365/exporter/utils.d.ts.map +1 -0
  47. package/dist/commonjs/a365/exporter/utils.js +410 -0
  48. package/dist/commonjs/a365/exporter/utils.js.map +1 -0
  49. package/dist/commonjs/a365/index.d.ts +16 -0
  50. package/dist/commonjs/a365/index.d.ts.map +1 -0
  51. package/dist/commonjs/a365/index.js +54 -0
  52. package/dist/commonjs/a365/index.js.map +1 -0
  53. package/dist/commonjs/a365/message-utils.d.ts +42 -0
  54. package/dist/commonjs/a365/message-utils.d.ts.map +1 -0
  55. package/dist/commonjs/a365/message-utils.js +116 -0
  56. package/dist/commonjs/a365/message-utils.js.map +1 -0
  57. package/dist/commonjs/a365/middleware/BaggageBuilder.d.ts +112 -0
  58. package/dist/commonjs/a365/middleware/BaggageBuilder.d.ts.map +1 -0
  59. package/dist/commonjs/a365/middleware/BaggageBuilder.js +249 -0
  60. package/dist/commonjs/a365/middleware/BaggageBuilder.js.map +1 -0
  61. package/dist/commonjs/a365/middleware/index.d.ts +2 -0
  62. package/dist/commonjs/a365/middleware/index.d.ts.map +1 -0
  63. package/dist/commonjs/a365/middleware/index.js +9 -0
  64. package/dist/commonjs/a365/middleware/index.js.map +1 -0
  65. package/dist/commonjs/a365/processors/A365SpanProcessor.d.ts +32 -0
  66. package/dist/commonjs/a365/processors/A365SpanProcessor.d.ts.map +1 -0
  67. package/dist/commonjs/a365/processors/A365SpanProcessor.js +104 -0
  68. package/dist/commonjs/a365/processors/A365SpanProcessor.js.map +1 -0
  69. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.d.ts +44 -0
  70. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.d.ts.map +1 -0
  71. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.js +260 -0
  72. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.js.map +1 -0
  73. package/dist/commonjs/a365/processors/index.d.ts +5 -0
  74. package/dist/commonjs/a365/processors/index.d.ts.map +1 -0
  75. package/dist/commonjs/a365/processors/index.js +13 -0
  76. package/dist/commonjs/a365/processors/index.js.map +1 -0
  77. package/dist/commonjs/a365/processors/util.d.ts +10 -0
  78. package/dist/commonjs/a365/processors/util.d.ts.map +1 -0
  79. package/dist/commonjs/a365/processors/util.js +56 -0
  80. package/dist/commonjs/a365/processors/util.js.map +1 -0
  81. package/dist/commonjs/a365/scopes/ExecuteToolScope.d.ts +24 -0
  82. package/dist/commonjs/a365/scopes/ExecuteToolScope.d.ts.map +1 -0
  83. package/dist/commonjs/a365/scopes/ExecuteToolScope.js +60 -0
  84. package/dist/commonjs/a365/scopes/ExecuteToolScope.js.map +1 -0
  85. package/dist/commonjs/a365/scopes/InferenceScope.d.ts +29 -0
  86. package/dist/commonjs/a365/scopes/InferenceScope.d.ts.map +1 -0
  87. package/dist/commonjs/a365/scopes/InferenceScope.js +75 -0
  88. package/dist/commonjs/a365/scopes/InferenceScope.js.map +1 -0
  89. package/dist/commonjs/a365/scopes/InvokeAgentScope.d.ts +25 -0
  90. package/dist/commonjs/a365/scopes/InvokeAgentScope.d.ts.map +1 -0
  91. package/dist/commonjs/a365/scopes/InvokeAgentScope.js +84 -0
  92. package/dist/commonjs/a365/scopes/InvokeAgentScope.js.map +1 -0
  93. package/dist/commonjs/a365/scopes/OpenTelemetryScope.d.ts +59 -0
  94. package/dist/commonjs/a365/scopes/OpenTelemetryScope.d.ts.map +1 -0
  95. package/dist/commonjs/a365/scopes/OpenTelemetryScope.js +199 -0
  96. package/dist/commonjs/a365/scopes/OpenTelemetryScope.js.map +1 -0
  97. package/dist/commonjs/a365/scopes/OutputScope.d.ts +26 -0
  98. package/dist/commonjs/a365/scopes/OutputScope.d.ts.map +1 -0
  99. package/dist/commonjs/a365/scopes/OutputScope.js +73 -0
  100. package/dist/commonjs/a365/scopes/OutputScope.js.map +1 -0
  101. package/dist/commonjs/a365/scopes/index.d.ts +6 -0
  102. package/dist/commonjs/a365/scopes/index.d.ts.map +1 -0
  103. package/dist/commonjs/a365/scopes/index.js +16 -0
  104. package/dist/commonjs/a365/scopes/index.js.map +1 -0
  105. package/dist/commonjs/a365/utils/utils.d.ts +6 -0
  106. package/dist/commonjs/a365/utils/utils.d.ts.map +1 -0
  107. package/dist/commonjs/a365/utils/utils.js +14 -0
  108. package/dist/commonjs/a365/utils/utils.js.map +1 -0
  109. package/dist/commonjs/azureMonitor/metrics/quickpulse/types.d.ts +1 -1
  110. package/dist/commonjs/azureMonitor/traces/handler.d.ts.map +1 -1
  111. package/dist/commonjs/azureMonitor/traces/handler.js +8 -2
  112. package/dist/commonjs/azureMonitor/traces/handler.js.map +1 -1
  113. package/dist/commonjs/distro/distro.d.ts +1 -1
  114. package/dist/commonjs/distro/distro.d.ts.map +1 -1
  115. package/dist/commonjs/distro/distro.js +44 -92
  116. package/dist/commonjs/distro/distro.js.map +1 -1
  117. package/dist/commonjs/distro/types.d.ts +2 -1
  118. package/dist/commonjs/distro/types.d.ts.map +1 -1
  119. package/dist/commonjs/index.d.ts +5 -0
  120. package/dist/commonjs/index.d.ts.map +1 -1
  121. package/dist/commonjs/index.js +33 -1
  122. package/dist/commonjs/index.js.map +1 -1
  123. package/dist/commonjs/package.json +1 -0
  124. package/dist/commonjs/shared/jsonConfig.d.ts +2 -1
  125. package/dist/commonjs/shared/jsonConfig.d.ts.map +1 -1
  126. package/dist/commonjs/shared/module.js +15 -11
  127. package/dist/commonjs/shared/module.js.map +1 -1
  128. package/dist/commonjs/types.d.ts +4 -30
  129. package/dist/commonjs/types.d.ts.map +1 -1
  130. package/dist/commonjs/types.js +1 -1
  131. package/dist/commonjs/types.js.map +1 -1
  132. package/dist/esm/a365/configuration/A365Configuration.d.ts +42 -0
  133. package/dist/esm/a365/configuration/A365Configuration.d.ts.map +1 -0
  134. package/dist/esm/a365/configuration/A365Configuration.js +158 -0
  135. package/dist/esm/a365/configuration/A365Configuration.js.map +1 -0
  136. package/dist/esm/a365/configuration/A365ConfigurationOptions.d.ts +53 -0
  137. package/dist/esm/a365/configuration/A365ConfigurationOptions.d.ts.map +1 -0
  138. package/dist/esm/a365/configuration/A365ConfigurationOptions.js +4 -0
  139. package/dist/esm/a365/configuration/A365ConfigurationOptions.js.map +1 -0
  140. package/dist/esm/a365/configuration/index.d.ts +3 -0
  141. package/dist/esm/a365/configuration/index.d.ts.map +1 -0
  142. package/dist/esm/a365/configuration/index.js +4 -0
  143. package/dist/esm/a365/configuration/index.js.map +1 -0
  144. package/dist/esm/a365/constants.d.ts +76 -0
  145. package/dist/esm/a365/constants.d.ts.map +1 -0
  146. package/dist/esm/a365/constants.js +95 -0
  147. package/dist/esm/a365/constants.js.map +1 -0
  148. package/dist/esm/a365/context/tokenContext.d.ts +25 -0
  149. package/dist/esm/a365/context/tokenContext.d.ts.map +1 -0
  150. package/dist/esm/a365/context/tokenContext.js +62 -0
  151. package/dist/esm/a365/context/tokenContext.js.map +1 -0
  152. package/dist/esm/a365/context.d.ts +31 -0
  153. package/dist/esm/a365/context.d.ts.map +1 -0
  154. package/dist/esm/a365/context.js +101 -0
  155. package/dist/esm/a365/context.js.map +1 -0
  156. package/dist/esm/a365/contracts.d.ts +250 -0
  157. package/dist/esm/a365/contracts.d.ts.map +1 -0
  158. package/dist/esm/a365/contracts.js +49 -0
  159. package/dist/esm/a365/contracts.js.map +1 -0
  160. package/dist/esm/a365/exporter/Agent365Exporter.d.ts +25 -0
  161. package/dist/esm/a365/exporter/Agent365Exporter.d.ts.map +1 -0
  162. package/dist/esm/a365/exporter/Agent365Exporter.js +216 -0
  163. package/dist/esm/a365/exporter/Agent365Exporter.js.map +1 -0
  164. package/dist/esm/a365/exporter/Agent365ExporterOptions.d.ts +43 -0
  165. package/dist/esm/a365/exporter/Agent365ExporterOptions.d.ts.map +1 -0
  166. package/dist/esm/a365/exporter/Agent365ExporterOptions.js +26 -0
  167. package/dist/esm/a365/exporter/Agent365ExporterOptions.js.map +1 -0
  168. package/dist/esm/a365/exporter/ExporterEventNames.d.ts +9 -0
  169. package/dist/esm/a365/exporter/ExporterEventNames.d.ts.map +1 -0
  170. package/dist/esm/a365/exporter/ExporterEventNames.js +12 -0
  171. package/dist/esm/a365/exporter/ExporterEventNames.js.map +1 -0
  172. package/dist/esm/a365/exporter/index.d.ts +6 -0
  173. package/dist/esm/a365/exporter/index.d.ts.map +1 -0
  174. package/dist/esm/a365/exporter/index.js +7 -0
  175. package/dist/esm/a365/exporter/index.js.map +1 -0
  176. package/dist/esm/a365/exporter/utils.d.ts +41 -0
  177. package/dist/esm/a365/exporter/utils.d.ts.map +1 -0
  178. package/dist/esm/a365/exporter/utils.js +398 -0
  179. package/dist/esm/a365/exporter/utils.js.map +1 -0
  180. package/dist/esm/a365/index.d.ts +16 -0
  181. package/dist/esm/a365/index.d.ts.map +1 -0
  182. package/dist/esm/a365/index.js +20 -0
  183. package/dist/esm/a365/index.js.map +1 -0
  184. package/dist/esm/a365/message-utils.d.ts +42 -0
  185. package/dist/esm/a365/message-utils.d.ts.map +1 -0
  186. package/dist/esm/a365/message-utils.js +107 -0
  187. package/dist/esm/a365/message-utils.js.map +1 -0
  188. package/dist/esm/a365/middleware/BaggageBuilder.d.ts +112 -0
  189. package/dist/esm/a365/middleware/BaggageBuilder.d.ts.map +1 -0
  190. package/dist/esm/a365/middleware/BaggageBuilder.js +244 -0
  191. package/dist/esm/a365/middleware/BaggageBuilder.js.map +1 -0
  192. package/dist/esm/a365/middleware/index.d.ts +2 -0
  193. package/dist/esm/a365/middleware/index.d.ts.map +1 -0
  194. package/dist/esm/a365/middleware/index.js +4 -0
  195. package/dist/esm/a365/middleware/index.js.map +1 -0
  196. package/dist/esm/a365/processors/A365SpanProcessor.d.ts +32 -0
  197. package/dist/esm/a365/processors/A365SpanProcessor.d.ts.map +1 -0
  198. package/dist/esm/a365/processors/A365SpanProcessor.js +100 -0
  199. package/dist/esm/a365/processors/A365SpanProcessor.js.map +1 -0
  200. package/dist/esm/a365/processors/PerRequestSpanProcessor.d.ts +44 -0
  201. package/dist/esm/a365/processors/PerRequestSpanProcessor.d.ts.map +1 -0
  202. package/dist/esm/a365/processors/PerRequestSpanProcessor.js +256 -0
  203. package/dist/esm/a365/processors/PerRequestSpanProcessor.js.map +1 -0
  204. package/dist/esm/a365/processors/index.d.ts +5 -0
  205. package/dist/esm/a365/processors/index.d.ts.map +1 -0
  206. package/dist/esm/a365/processors/index.js +6 -0
  207. package/dist/esm/a365/processors/index.js.map +1 -0
  208. package/dist/esm/a365/processors/util.d.ts +10 -0
  209. package/dist/esm/a365/processors/util.d.ts.map +1 -0
  210. package/dist/esm/a365/processors/util.js +53 -0
  211. package/dist/esm/a365/processors/util.js.map +1 -0
  212. package/dist/esm/a365/scopes/ExecuteToolScope.d.ts +24 -0
  213. package/dist/esm/a365/scopes/ExecuteToolScope.d.ts.map +1 -0
  214. package/dist/esm/a365/scopes/ExecuteToolScope.js +56 -0
  215. package/dist/esm/a365/scopes/ExecuteToolScope.js.map +1 -0
  216. package/dist/esm/a365/scopes/InferenceScope.d.ts +29 -0
  217. package/dist/esm/a365/scopes/InferenceScope.d.ts.map +1 -0
  218. package/dist/esm/a365/scopes/InferenceScope.js +71 -0
  219. package/dist/esm/a365/scopes/InferenceScope.js.map +1 -0
  220. package/dist/esm/a365/scopes/InvokeAgentScope.d.ts +25 -0
  221. package/dist/esm/a365/scopes/InvokeAgentScope.d.ts.map +1 -0
  222. package/dist/esm/a365/scopes/InvokeAgentScope.js +80 -0
  223. package/dist/esm/a365/scopes/InvokeAgentScope.js.map +1 -0
  224. package/dist/esm/a365/scopes/OpenTelemetryScope.d.ts +59 -0
  225. package/dist/esm/a365/scopes/OpenTelemetryScope.d.ts.map +1 -0
  226. package/dist/esm/a365/scopes/OpenTelemetryScope.js +195 -0
  227. package/dist/esm/a365/scopes/OpenTelemetryScope.js.map +1 -0
  228. package/dist/esm/a365/scopes/OutputScope.d.ts +26 -0
  229. package/dist/esm/a365/scopes/OutputScope.d.ts.map +1 -0
  230. package/dist/esm/a365/scopes/OutputScope.js +69 -0
  231. package/dist/esm/a365/scopes/OutputScope.js.map +1 -0
  232. package/dist/esm/a365/scopes/index.d.ts +6 -0
  233. package/dist/esm/a365/scopes/index.d.ts.map +1 -0
  234. package/dist/esm/a365/scopes/index.js +8 -0
  235. package/dist/esm/a365/scopes/index.js.map +1 -0
  236. package/dist/esm/a365/utils/utils.d.ts +6 -0
  237. package/dist/esm/a365/utils/utils.d.ts.map +1 -0
  238. package/dist/esm/a365/utils/utils.js +11 -0
  239. package/dist/esm/a365/utils/utils.js.map +1 -0
  240. package/dist/esm/azureMonitor/metrics/quickpulse/types.d.ts +1 -1
  241. package/dist/esm/azureMonitor/traces/handler.d.ts.map +1 -1
  242. package/dist/esm/azureMonitor/traces/handler.js +5 -1
  243. package/dist/esm/azureMonitor/traces/handler.js.map +1 -1
  244. package/dist/esm/distro/distro.d.ts +1 -1
  245. package/dist/esm/distro/distro.d.ts.map +1 -1
  246. package/dist/esm/distro/distro.js +44 -92
  247. package/dist/esm/distro/distro.js.map +1 -1
  248. package/dist/esm/distro/types.d.ts +2 -1
  249. package/dist/esm/distro/types.d.ts.map +1 -1
  250. package/dist/esm/index.d.ts +5 -0
  251. package/dist/esm/index.d.ts.map +1 -1
  252. package/dist/esm/index.js +4 -0
  253. package/dist/esm/index.js.map +1 -1
  254. package/dist/esm/shared/jsonConfig.d.ts +2 -1
  255. package/dist/esm/shared/jsonConfig.d.ts.map +1 -1
  256. package/dist/esm/types.d.ts +4 -30
  257. package/dist/esm/types.d.ts.map +1 -1
  258. package/dist/esm/types.js +1 -1
  259. package/dist/esm/types.js.map +1 -1
  260. package/package.json +3 -4
@@ -0,0 +1,42 @@
1
+ import type { A365Options, ClusterCategory, A365BaggageOptions, A365HostingOptions } from "./A365ConfigurationOptions.js";
2
+ /**
3
+ * Environment variable names for A365 configuration.
4
+ * These match the upstream Agent365-nodejs conventions.
5
+ */
6
+ export declare const A365_ENV_VARS: {
7
+ readonly EXPORTER_ENABLED: "ENABLE_A365_OBSERVABILITY_EXPORTER";
8
+ readonly PER_REQUEST_EXPORT: "ENABLE_A365_OBSERVABILITY_PER_REQUEST_EXPORT";
9
+ readonly AUTH_SCOPES: "A365_OBSERVABILITY_SCOPES_OVERRIDE";
10
+ readonly DOMAIN: "A365_OBSERVABILITY_DOMAIN_OVERRIDE";
11
+ readonly CLUSTER_CATEGORY: "CLUSTER_CATEGORY";
12
+ };
13
+ /**
14
+ * Resolved A365 configuration.
15
+ *
16
+ * Merges values from four sources (lowest to highest precedence):
17
+ * 1. Defaults
18
+ * 2. Programmatic options (`A365Options`)
19
+ * 3. JSON config (`applicationinsights.json` → `a365` key)
20
+ * 4. Environment variables (see `A365_ENV_VARS`)
21
+ */
22
+ export declare class A365Configuration {
23
+ /** Whether A365 observability is enabled. */
24
+ readonly enabled: boolean;
25
+ /** Token resolver callback for A365 service authentication. */
26
+ readonly tokenResolver?: (agentId: string, tenantId: string) => string | Promise<string>;
27
+ /** Cluster category. */
28
+ readonly clusterCategory: ClusterCategory;
29
+ /** Domain override for the A365 observability service. */
30
+ readonly domainOverride?: string;
31
+ /** OAuth scopes for A365 service authentication. */
32
+ readonly authScopes: string[];
33
+ /** Whether to use per-request export mode. */
34
+ readonly perRequestExport: boolean;
35
+ /** Baggage options. */
36
+ readonly baggage: Required<A365BaggageOptions>;
37
+ /** Hosting options. */
38
+ readonly hosting: Required<A365HostingOptions>;
39
+ constructor(options?: A365Options);
40
+ private _warnIfOptionsSetButDisabled;
41
+ }
42
+ //# sourceMappingURL=A365Configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A365Configuration.d.ts","sourceRoot":"","sources":["../../../../src/a365/configuration/A365Configuration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAwBvC;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAmBX;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,6CAA6C;IAC7C,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC,+DAA+D;IAC/D,SAAgB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhG,wBAAwB;IACxB,SAAgB,eAAe,EAAE,eAAe,CAAC;IAEjD,0DAA0D;IAC1D,SAAgB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExC,oDAAoD;IACpD,SAAgB,UAAU,EAAE,MAAM,EAAE,CAAC;IAErC,8CAA8C;IAC9C,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAE1C,uBAAuB;IACvB,SAAgB,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEtD,uBAAuB;IACvB,SAAgB,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;gBAE1C,OAAO,CAAC,EAAE,WAAW;IAiFjC,OAAO,CAAC,4BAA4B;CAgBrC"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.A365Configuration = exports.A365_ENV_VARS = void 0;
6
+ const index_js_1 = require("../../shared/logging/index.js");
7
+ const jsonConfig_js_1 = require("../../shared/jsonConfig.js");
8
+ /**
9
+ * Parse an environment variable as a boolean.
10
+ * Recognizes 'true', '1', 'yes', 'on' (case-insensitive) as true and
11
+ * 'false', '0', 'no', 'off' as false. Unset, empty, or unrecognized values
12
+ * are ignored and return undefined so they do not override an existing
13
+ * configuration value.
14
+ */
15
+ function parseEnvBoolean(envValue) {
16
+ if (!envValue)
17
+ return undefined;
18
+ const normalized = envValue.trim().toLowerCase();
19
+ if (!normalized)
20
+ return undefined;
21
+ if (["true", "1", "yes", "on"].includes(normalized)) {
22
+ return true;
23
+ }
24
+ if (["false", "0", "no", "off"].includes(normalized)) {
25
+ return false;
26
+ }
27
+ return undefined;
28
+ }
29
+ /**
30
+ * Environment variable names for A365 configuration.
31
+ * These match the upstream Agent365-nodejs conventions.
32
+ */
33
+ exports.A365_ENV_VARS = {
34
+ EXPORTER_ENABLED: "ENABLE_A365_OBSERVABILITY_EXPORTER",
35
+ PER_REQUEST_EXPORT: "ENABLE_A365_OBSERVABILITY_PER_REQUEST_EXPORT",
36
+ AUTH_SCOPES: "A365_OBSERVABILITY_SCOPES_OVERRIDE",
37
+ DOMAIN: "A365_OBSERVABILITY_DOMAIN_OVERRIDE",
38
+ CLUSTER_CATEGORY: "CLUSTER_CATEGORY",
39
+ };
40
+ const DEFAULT_AUTH_SCOPE = "https://api.powerplatform.com/.default";
41
+ const VALID_CLUSTER_CATEGORIES = new Set([
42
+ "local",
43
+ "dev",
44
+ "test",
45
+ "preprod",
46
+ "firstrelease",
47
+ "prod",
48
+ "gov",
49
+ "high",
50
+ "dod",
51
+ "mooncake",
52
+ "ex",
53
+ "rx",
54
+ ]);
55
+ /**
56
+ * Resolved A365 configuration.
57
+ *
58
+ * Merges values from four sources (lowest to highest precedence):
59
+ * 1. Defaults
60
+ * 2. Programmatic options (`A365Options`)
61
+ * 3. JSON config (`applicationinsights.json` → `a365` key)
62
+ * 4. Environment variables (see `A365_ENV_VARS`)
63
+ */
64
+ class A365Configuration {
65
+ /** Whether A365 observability is enabled. */
66
+ enabled;
67
+ /** Token resolver callback for A365 service authentication. */
68
+ tokenResolver;
69
+ /** Cluster category. */
70
+ clusterCategory;
71
+ /** Domain override for the A365 observability service. */
72
+ domainOverride;
73
+ /** OAuth scopes for A365 service authentication. */
74
+ authScopes;
75
+ /** Whether to use per-request export mode. */
76
+ perRequestExport;
77
+ /** Baggage options. */
78
+ baggage;
79
+ /** Hosting options. */
80
+ hosting;
81
+ constructor(options) {
82
+ // 1. Set defaults
83
+ let enabled = false;
84
+ let clusterCategory = "prod";
85
+ let domainOverride = options?.domainOverride;
86
+ let authScopes = options?.authScopes ?? [DEFAULT_AUTH_SCOPE];
87
+ let perRequestExport = false;
88
+ // 2. Apply programmatic options
89
+ if (options) {
90
+ enabled = options.enabled ?? enabled;
91
+ clusterCategory = options.clusterCategory ?? clusterCategory;
92
+ perRequestExport = options.perRequestExport ?? perRequestExport;
93
+ }
94
+ // 3. Apply JSON config (takes precedence over programmatic options)
95
+ const jsonA365 = jsonConfig_js_1.JsonConfig.getInstance().a365;
96
+ if (jsonA365) {
97
+ enabled = jsonA365.enabled ?? enabled;
98
+ clusterCategory = jsonA365.clusterCategory ?? clusterCategory;
99
+ domainOverride = jsonA365.domainOverride ?? domainOverride;
100
+ perRequestExport = jsonA365.perRequestExport ?? perRequestExport;
101
+ if (jsonA365.authScopes) {
102
+ authScopes = jsonA365.authScopes;
103
+ }
104
+ }
105
+ // 4. Apply environment variable overrides (highest precedence)
106
+ const envEnabled = parseEnvBoolean(process.env[exports.A365_ENV_VARS.EXPORTER_ENABLED]);
107
+ if (envEnabled !== undefined) {
108
+ enabled = envEnabled;
109
+ }
110
+ const envPerRequest = parseEnvBoolean(process.env[exports.A365_ENV_VARS.PER_REQUEST_EXPORT]);
111
+ if (envPerRequest !== undefined) {
112
+ perRequestExport = envPerRequest;
113
+ }
114
+ const envScopes = process.env[exports.A365_ENV_VARS.AUTH_SCOPES]?.trim();
115
+ if (envScopes) {
116
+ authScopes = envScopes.split(/\s+/).filter(Boolean);
117
+ }
118
+ const envDomain = process.env[exports.A365_ENV_VARS.DOMAIN]?.trim();
119
+ if (envDomain) {
120
+ domainOverride = envDomain.replace(/\/+$/, "");
121
+ }
122
+ const envCluster = process.env[exports.A365_ENV_VARS.CLUSTER_CATEGORY]?.toLowerCase();
123
+ if (envCluster && VALID_CLUSTER_CATEGORIES.has(envCluster)) {
124
+ clusterCategory = envCluster;
125
+ }
126
+ else if (envCluster) {
127
+ index_js_1.Logger.getInstance().warn(`Invalid ${exports.A365_ENV_VARS.CLUSTER_CATEGORY} value '${envCluster}'. Using default cluster category.`);
128
+ }
129
+ // Assign resolved values
130
+ this.enabled = enabled;
131
+ this.tokenResolver = options?.tokenResolver;
132
+ this.clusterCategory = clusterCategory;
133
+ this.domainOverride = domainOverride;
134
+ this.authScopes = authScopes;
135
+ this.perRequestExport = perRequestExport;
136
+ this.baggage = {
137
+ propagationEnabled: jsonA365?.baggage?.propagationEnabled ?? options?.baggage?.propagationEnabled ?? true,
138
+ enrichSpans: jsonA365?.baggage?.enrichSpans ?? options?.baggage?.enrichSpans ?? true,
139
+ };
140
+ this.hosting = {
141
+ enabled: jsonA365?.hosting?.enabled ?? options?.hosting?.enabled ?? false,
142
+ };
143
+ // Warn when A365-scoped options are set but A365 is not enabled
144
+ if (!this.enabled) {
145
+ this._warnIfOptionsSetButDisabled(options);
146
+ }
147
+ }
148
+ _warnIfOptionsSetButDisabled(options) {
149
+ if (!options)
150
+ return;
151
+ const hasNonTrivialOptions = options.tokenResolver !== undefined ||
152
+ options.domainOverride !== undefined ||
153
+ options.perRequestExport !== undefined ||
154
+ options.hosting?.enabled === true;
155
+ if (hasNonTrivialOptions) {
156
+ index_js_1.Logger.getInstance().warn("A365 configuration options are set but A365 is not enabled. " +
157
+ "Set `a365.enabled: true` or `ENABLE_A365_OBSERVABILITY_EXPORTER=true` to enable.");
158
+ }
159
+ }
160
+ }
161
+ exports.A365Configuration = A365Configuration;
162
+ //# sourceMappingURL=A365Configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A365Configuration.js","sourceRoot":"","sources":["../../../../src/a365/configuration/A365Configuration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAQlC,4DAAuD;AACvD,8DAAwD;AAExD;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,QAA4B;IACnD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACjD,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACU,QAAA,aAAa,GAAG;IAC3B,gBAAgB,EAAE,oCAAoC;IACtD,kBAAkB,EAAE,8CAA8C;IAClE,WAAW,EAAE,oCAAoC;IACjD,MAAM,EAAE,oCAAoC;IAC5C,gBAAgB,EAAE,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AO,CAAC,gBAAgB,KAAK,SAAS;YACtC,OAAO,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QAEpC,IAAI,oBAAoB,EAAE,CAAC;YACzB,iBAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CACvB,8DAA8D;gBAC5D,kFAAkF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA1HD,8CA0HC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Cluster categories for A365 service endpoint resolution.
3
+ * Mirrors the ClusterCategory enum from Agent365-nodejs.
4
+ */
5
+ export type ClusterCategory = "local" | "dev" | "test" | "preprod" | "firstrelease" | "prod" | "gov" | "high" | "dod" | "mooncake" | "ex" | "rx";
6
+ /**
7
+ * A365 observability configuration options.
8
+ *
9
+ * These are the public-facing options passed via the `a365` scope
10
+ * of {@link MicrosoftOpenTelemetryOptions}.
11
+ */
12
+ export interface A365Options {
13
+ /** Enable A365 observability. When false, no A365 components are created. */
14
+ enabled?: boolean;
15
+ /**
16
+ * Token resolver for authenticating with the A365 observability service.
17
+ * Called with (agentId, tenantId) extracted from span attributes.
18
+ * Must return a bearer token string or a promise resolving to one.
19
+ */
20
+ tokenResolver?: (agentId: string, tenantId: string) => string | Promise<string>;
21
+ /** Cluster category for the A365 service endpoint. */
22
+ clusterCategory?: ClusterCategory;
23
+ /** Override the A365 observability service domain. */
24
+ domainOverride?: string;
25
+ /** OAuth scopes for A365 service authentication. */
26
+ authScopes?: string[];
27
+ /**
28
+ * Use per-request export mode (buffer spans per trace, export on root completion).
29
+ * When false, uses standard batch export.
30
+ * @default false
31
+ */
32
+ perRequestExport?: boolean;
33
+ /** Baggage propagation and span enrichment options. */
34
+ baggage?: A365BaggageOptions;
35
+ /** Hosting middleware options (requires @microsoft/agents-hosting). */
36
+ hosting?: A365HostingOptions;
37
+ }
38
+ /** Baggage propagation and span enrichment options. */
39
+ export interface A365BaggageOptions {
40
+ /** Enable baggage propagation from request headers to span context. */
41
+ propagationEnabled?: boolean;
42
+ /** Copy baggage items to span attributes. */
43
+ enrichSpans?: boolean;
44
+ }
45
+ /** Hosting middleware options. */
46
+ export interface A365HostingOptions {
47
+ /**
48
+ * Enable hosting middleware integration (baggage middleware, output logging, etc.).
49
+ * Requires `@microsoft/agents-hosting` as an optional peer dependency.
50
+ */
51
+ enabled?: boolean;
52
+ }
53
+ //# sourceMappingURL=A365ConfigurationOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A365ConfigurationOptions.d.ts","sourceRoot":"","sources":["../../../../src/a365/configuration/A365ConfigurationOptions.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,KAAK,GACL,MAAM,GACN,SAAS,GACT,cAAc,GACd,MAAM,GACN,KAAK,GACL,MAAM,GACN,KAAK,GACL,UAAU,GACV,IAAI,GACJ,IAAI,CAAC;AAET;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhF,sDAAsD;IACtD,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC,sDAAsD;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,uDAAuD;IACvD,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B,uEAAuE;IACvE,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=A365ConfigurationOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"A365ConfigurationOptions.js","sourceRoot":"","sources":["../../../../src/a365/configuration/A365ConfigurationOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
@@ -0,0 +1,3 @@
1
+ export { A365Configuration, A365_ENV_VARS } from "./A365Configuration.js";
2
+ export type { A365Options, ClusterCategory, A365BaggageOptions, A365HostingOptions, } from "./A365ConfigurationOptions.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/a365/configuration/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,YAAY,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.A365_ENV_VARS = exports.A365Configuration = void 0;
6
+ var A365Configuration_js_1 = require("./A365Configuration.js");
7
+ Object.defineProperty(exports, "A365Configuration", { enumerable: true, get: function () { return A365Configuration_js_1.A365Configuration; } });
8
+ Object.defineProperty(exports, "A365_ENV_VARS", { enumerable: true, get: function () { return A365Configuration_js_1.A365_ENV_VARS; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/a365/configuration/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+DAA0E;AAAjE,yHAAA,iBAAiB,OAAA;AAAE,qHAAA,aAAa,OAAA"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * OpenTelemetry constants for A365 observability.
3
+ *
4
+ * Attribute keys follow OTel gen-ai semantic conventions plus
5
+ * Microsoft-specific extensions under the `microsoft.*` namespace.
6
+ *
7
+ * Adapted from microsoft/Agent365-nodejs agents-a365-observability/src/tracing/constants.ts
8
+ */
9
+ export declare class OpenTelemetryConstants {
10
+ static readonly INVOKE_AGENT_OPERATION_NAME = "invoke_agent";
11
+ static readonly EXECUTE_TOOL_OPERATION_NAME = "execute_tool";
12
+ static readonly OUTPUT_MESSAGES_OPERATION_NAME = "output_messages";
13
+ static readonly CHAT_OPERATION_NAME = "chat";
14
+ static readonly ERROR_TYPE_KEY = "error.type";
15
+ static readonly ERROR_TYPE_CANCELLED = "TaskCanceledException";
16
+ static readonly ERROR_MESSAGE_KEY = "error.message";
17
+ static readonly AZ_NAMESPACE_KEY = "az.namespace";
18
+ static readonly SERVER_ADDRESS_KEY = "server.address";
19
+ static readonly SERVER_PORT_KEY = "server.port";
20
+ static readonly SOURCE_NAME = "Agent365Sdk";
21
+ static readonly GEN_AI_OPERATION_NAME_KEY = "gen_ai.operation.name";
22
+ static readonly GEN_AI_REQUEST_MODEL_KEY = "gen_ai.request.model";
23
+ static readonly GEN_AI_RESPONSE_MODEL_KEY = "gen_ai.response.model";
24
+ static readonly GEN_AI_RESPONSE_FINISH_REASONS_KEY = "gen_ai.response.finish_reasons";
25
+ static readonly GEN_AI_PROVIDER_NAME_KEY = "gen_ai.provider.name";
26
+ static readonly GEN_AI_USAGE_INPUT_TOKENS_KEY = "gen_ai.usage.input_tokens";
27
+ static readonly GEN_AI_USAGE_OUTPUT_TOKENS_KEY = "gen_ai.usage.output_tokens";
28
+ static readonly GEN_AI_SYSTEM_INSTRUCTIONS_KEY = "gen_ai.system_instructions";
29
+ static readonly GEN_AI_INPUT_MESSAGES_KEY = "gen_ai.input.messages";
30
+ static readonly GEN_AI_OUTPUT_MESSAGES_KEY = "gen_ai.output.messages";
31
+ static readonly A365_MESSAGES_SCHEMA_VERSION_KEY = "microsoft.a365.messages.schema_version";
32
+ static readonly GEN_AI_AGENT_ID_KEY = "gen_ai.agent.id";
33
+ static readonly GEN_AI_AGENT_NAME_KEY = "gen_ai.agent.name";
34
+ static readonly GEN_AI_AGENT_DESCRIPTION_KEY = "gen_ai.agent.description";
35
+ static readonly GEN_AI_AGENT_VERSION_KEY = "gen_ai.agent.version";
36
+ static readonly GEN_AI_AGENT_PLATFORM_ID_KEY = "microsoft.a365.agent.platform.id";
37
+ static readonly GEN_AI_AGENT_THOUGHT_PROCESS_KEY = "microsoft.a365.agent.thought.process";
38
+ static readonly GEN_AI_ICON_URI_KEY = "gen_ai.agent365.icon_uri";
39
+ static readonly GEN_AI_CONVERSATION_ID_KEY = "gen_ai.conversation.id";
40
+ static readonly GEN_AI_CONVERSATION_ITEM_LINK_KEY = "microsoft.conversation.item.link";
41
+ static readonly SESSION_ID_KEY = "microsoft.session.id";
42
+ static readonly SESSION_DESCRIPTION_KEY = "microsoft.session.description";
43
+ static readonly GEN_AI_TOOL_CALL_ID_KEY = "gen_ai.tool.call.id";
44
+ static readonly GEN_AI_TOOL_NAME_KEY = "gen_ai.tool.name";
45
+ static readonly GEN_AI_TOOL_DESCRIPTION_KEY = "gen_ai.tool.description";
46
+ static readonly GEN_AI_TOOL_ARGS_KEY = "gen_ai.tool.call.arguments";
47
+ static readonly GEN_AI_TOOL_CALL_RESULT_KEY = "gen_ai.tool.call.result";
48
+ static readonly GEN_AI_TOOL_TYPE_KEY = "gen_ai.tool.type";
49
+ static readonly TENANT_ID_KEY = "microsoft.tenant.id";
50
+ static readonly USER_ID_KEY = "user.id";
51
+ static readonly USER_NAME_KEY = "user.name";
52
+ static readonly USER_EMAIL_KEY = "user.email";
53
+ static readonly GEN_AI_CALLER_CLIENT_IP_KEY = "client.address";
54
+ static readonly GEN_AI_CALLER_AGENT_USER_ID_KEY = "microsoft.a365.caller.agent.user.id";
55
+ static readonly GEN_AI_CALLER_AGENT_EMAIL_KEY = "microsoft.a365.caller.agent.user.email";
56
+ static readonly GEN_AI_CALLER_AGENT_NAME_KEY = "microsoft.a365.caller.agent.name";
57
+ static readonly GEN_AI_CALLER_AGENT_ID_KEY = "microsoft.a365.caller.agent.id";
58
+ static readonly GEN_AI_CALLER_AGENT_APPLICATION_ID_KEY = "microsoft.a365.caller.agent.blueprint.id";
59
+ static readonly GEN_AI_CALLER_AGENT_PLATFORM_ID_KEY = "microsoft.a365.caller.agent.platform.id";
60
+ static readonly GEN_AI_CALLER_AGENT_VERSION_KEY = "microsoft.a365.caller.agent.version";
61
+ static readonly GEN_AI_AGENT_AUID_KEY = "microsoft.agent.user.id";
62
+ static readonly GEN_AI_AGENT_EMAIL_KEY = "microsoft.agent.user.email";
63
+ static readonly GEN_AI_AGENT_BLUEPRINT_ID_KEY = "microsoft.a365.agent.blueprint.id";
64
+ static readonly CHANNEL_NAME_KEY = "microsoft.channel.name";
65
+ static readonly CHANNEL_LINK_KEY = "microsoft.channel.link";
66
+ static readonly CUSTOM_PARENT_SPAN_ID_KEY = "custom.parent.span.id";
67
+ static readonly CUSTOM_SPAN_NAME_KEY = "custom.span.name";
68
+ static readonly SERVICE_NAME_KEY = "service.name";
69
+ static readonly TELEMETRY_SDK_NAME_KEY = "telemetry.sdk.name";
70
+ static readonly TELEMETRY_SDK_LANGUAGE_KEY = "telemetry.sdk.language";
71
+ static readonly TELEMETRY_SDK_VERSION_KEY = "telemetry.sdk.version";
72
+ static readonly TELEMETRY_SDK_NAME_VALUE = "A365ObservabilitySDK";
73
+ static readonly TELEMETRY_SDK_LANGUAGE_VALUE = "nodejs";
74
+ static readonly TELEMETRY_SDK_VERSION_VALUE = "0.1.0";
75
+ }
76
+ //# source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BAAuB,oBAAoB,sBAAsB;IACjE,gBAAuB,2BAA2B,6BAA6B;IAC/E,gBAAuB,oBAAoB,gCAAgC;IAC3E,gBAAuB,2BAA2B,6BAA6B;IAC/E,gBAAuB,oBAAoB,sBAAsB;IAGjE,gBAAuB,aAAa,yBAAyB;IAG7D,gBAAuB,WAAW,aAAa;IAC/C,gBAAuB,aAAa,eAAe;IACnD,gBAAuB,cAAc,gBAAgB;IACrD,gBAAuB,2BAA2B,oBAAoB;IAGtE,gBAAuB,+BAA+B,yCAAyC;IAC/F,gBAAuB,6BAA6B,4CAA4C;IAChG,gBAAuB,4BAA4B,sCAAsC;IACzF,gBAAuB,0BAA0B,oCAAoC;IACrF,gBAAuB,sCAAsC,8CAChB;IAC7C,gBAAuB,mCAAmC,6CACd;IAC5C,gBAAuB,+BAA+B,yCAAyC;IAG/F,gBAAuB,qBAAqB,6BAA6B;IACzE,gBAAuB,sBAAsB,gCAAgC;IAC7E,gBAAuB,6BAA6B,uCAAuC;IAG3F,gBAAuB,gBAAgB,4BAA4B;IACnE,gBAAuB,gBAAgB,4BAA4B;IAGnE,gBAAuB,yBAAyB,2BAA2B;IAC3E,gBAAuB,oBAAoB,sBAAsB;IAGjE,gBAAuB,gBAAgB,kBAAkB;IAGzD,gBAAuB,sBAAsB,wBAAwB;IACrE,gBAAuB,0BAA0B,4BAA4B;IAC7E,gBAAuB,yBAAyB,2BAA2B;IAC3E,gBAAuB,wBAAwB,0BAA0B;IACzE,gBAAuB,4BAA4B,YAAY;IAC/D,gBAAuB,2BAA2B,WAAW;CAC9D"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.OpenTelemetryConstants = void 0;
6
+ /**
7
+ * OpenTelemetry constants for A365 observability.
8
+ *
9
+ * Attribute keys follow OTel gen-ai semantic conventions plus
10
+ * Microsoft-specific extensions under the `microsoft.*` namespace.
11
+ *
12
+ * Adapted from microsoft/Agent365-nodejs agents-a365-observability/src/tracing/constants.ts
13
+ */
14
+ class OpenTelemetryConstants {
15
+ // ── Span operation names ──────────────────────────────────────────
16
+ static INVOKE_AGENT_OPERATION_NAME = "invoke_agent";
17
+ static EXECUTE_TOOL_OPERATION_NAME = "execute_tool";
18
+ static OUTPUT_MESSAGES_OPERATION_NAME = "output_messages";
19
+ static CHAT_OPERATION_NAME = "chat";
20
+ // ── Standard OTel semantic conventions ────────────────────────────
21
+ static ERROR_TYPE_KEY = "error.type";
22
+ static ERROR_TYPE_CANCELLED = "TaskCanceledException";
23
+ static ERROR_MESSAGE_KEY = "error.message";
24
+ static AZ_NAMESPACE_KEY = "az.namespace";
25
+ static SERVER_ADDRESS_KEY = "server.address";
26
+ static SERVER_PORT_KEY = "server.port";
27
+ // ── Source / SDK identity ─────────────────────────────────────────
28
+ static SOURCE_NAME = "Agent365Sdk";
29
+ // ── GenAI core attributes ────────────────────────────────────────
30
+ static GEN_AI_OPERATION_NAME_KEY = "gen_ai.operation.name";
31
+ static GEN_AI_REQUEST_MODEL_KEY = "gen_ai.request.model";
32
+ static GEN_AI_RESPONSE_MODEL_KEY = "gen_ai.response.model";
33
+ static GEN_AI_RESPONSE_FINISH_REASONS_KEY = "gen_ai.response.finish_reasons";
34
+ static GEN_AI_PROVIDER_NAME_KEY = "gen_ai.provider.name";
35
+ // ── GenAI usage ──────────────────────────────────────────────────
36
+ static GEN_AI_USAGE_INPUT_TOKENS_KEY = "gen_ai.usage.input_tokens";
37
+ static GEN_AI_USAGE_OUTPUT_TOKENS_KEY = "gen_ai.usage.output_tokens";
38
+ // ── GenAI message attributes ─────────────────────────────────────
39
+ static GEN_AI_SYSTEM_INSTRUCTIONS_KEY = "gen_ai.system_instructions";
40
+ static GEN_AI_INPUT_MESSAGES_KEY = "gen_ai.input.messages";
41
+ static GEN_AI_OUTPUT_MESSAGES_KEY = "gen_ai.output.messages";
42
+ static A365_MESSAGES_SCHEMA_VERSION_KEY = "microsoft.a365.messages.schema_version";
43
+ // ── GenAI agent attributes ───────────────────────────────────────
44
+ static GEN_AI_AGENT_ID_KEY = "gen_ai.agent.id";
45
+ static GEN_AI_AGENT_NAME_KEY = "gen_ai.agent.name";
46
+ static GEN_AI_AGENT_DESCRIPTION_KEY = "gen_ai.agent.description";
47
+ static GEN_AI_AGENT_VERSION_KEY = "gen_ai.agent.version";
48
+ static GEN_AI_AGENT_PLATFORM_ID_KEY = "microsoft.a365.agent.platform.id";
49
+ static GEN_AI_AGENT_THOUGHT_PROCESS_KEY = "microsoft.a365.agent.thought.process";
50
+ static GEN_AI_ICON_URI_KEY = "gen_ai.agent365.icon_uri";
51
+ // ── GenAI conversation / session ─────────────────────────────────
52
+ static GEN_AI_CONVERSATION_ID_KEY = "gen_ai.conversation.id";
53
+ static GEN_AI_CONVERSATION_ITEM_LINK_KEY = "microsoft.conversation.item.link";
54
+ static SESSION_ID_KEY = "microsoft.session.id";
55
+ static SESSION_DESCRIPTION_KEY = "microsoft.session.description";
56
+ // ── GenAI tool attributes ────────────────────────────────────────
57
+ static GEN_AI_TOOL_CALL_ID_KEY = "gen_ai.tool.call.id";
58
+ static GEN_AI_TOOL_NAME_KEY = "gen_ai.tool.name";
59
+ static GEN_AI_TOOL_DESCRIPTION_KEY = "gen_ai.tool.description";
60
+ static GEN_AI_TOOL_ARGS_KEY = "gen_ai.tool.call.arguments";
61
+ static GEN_AI_TOOL_CALL_RESULT_KEY = "gen_ai.tool.call.result";
62
+ static GEN_AI_TOOL_TYPE_KEY = "gen_ai.tool.type";
63
+ // ── Tenant ───────────────────────────────────────────────────────
64
+ static TENANT_ID_KEY = "microsoft.tenant.id";
65
+ // ── Human caller dimensions (OTel user.* namespace) ──────────────
66
+ static USER_ID_KEY = "user.id";
67
+ static USER_NAME_KEY = "user.name";
68
+ static USER_EMAIL_KEY = "user.email";
69
+ static GEN_AI_CALLER_CLIENT_IP_KEY = "client.address";
70
+ // ── Agent-to-Agent caller dimensions ─────────────────────────────
71
+ static GEN_AI_CALLER_AGENT_USER_ID_KEY = "microsoft.a365.caller.agent.user.id";
72
+ static GEN_AI_CALLER_AGENT_EMAIL_KEY = "microsoft.a365.caller.agent.user.email";
73
+ static GEN_AI_CALLER_AGENT_NAME_KEY = "microsoft.a365.caller.agent.name";
74
+ static GEN_AI_CALLER_AGENT_ID_KEY = "microsoft.a365.caller.agent.id";
75
+ static GEN_AI_CALLER_AGENT_APPLICATION_ID_KEY = "microsoft.a365.caller.agent.blueprint.id";
76
+ static GEN_AI_CALLER_AGENT_PLATFORM_ID_KEY = "microsoft.a365.caller.agent.platform.id";
77
+ static GEN_AI_CALLER_AGENT_VERSION_KEY = "microsoft.a365.caller.agent.version";
78
+ // ── Baggage keys ─────────────────────────────────────────────────
79
+ static GEN_AI_AGENT_AUID_KEY = "microsoft.agent.user.id";
80
+ static GEN_AI_AGENT_EMAIL_KEY = "microsoft.agent.user.email";
81
+ static GEN_AI_AGENT_BLUEPRINT_ID_KEY = "microsoft.a365.agent.blueprint.id";
82
+ // ── Channel dimensions ───────────────────────────────────────────
83
+ static CHANNEL_NAME_KEY = "microsoft.channel.name";
84
+ static CHANNEL_LINK_KEY = "microsoft.channel.link";
85
+ // ── Custom parent / span name ────────────────────────────────────
86
+ static CUSTOM_PARENT_SPAN_ID_KEY = "custom.parent.span.id";
87
+ static CUSTOM_SPAN_NAME_KEY = "custom.span.name";
88
+ // ── Service attributes ───────────────────────────────────────────
89
+ static SERVICE_NAME_KEY = "service.name";
90
+ // ── Telemetry SDK attributes ─────────────────────────────────────
91
+ static TELEMETRY_SDK_NAME_KEY = "telemetry.sdk.name";
92
+ static TELEMETRY_SDK_LANGUAGE_KEY = "telemetry.sdk.language";
93
+ static TELEMETRY_SDK_VERSION_KEY = "telemetry.sdk.version";
94
+ static TELEMETRY_SDK_NAME_VALUE = "A365ObservabilitySDK";
95
+ static TELEMETRY_SDK_LANGUAGE_VALUE = "nodejs";
96
+ static TELEMETRY_SDK_VERSION_VALUE = "0.1.0";
97
+ }
98
+ exports.OpenTelemetryConstants = OpenTelemetryConstants;
99
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/a365/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;;;;;;GAOG;AACH,MAAa,sBAAsB;IACjC,qEAAqE;IAC9D,MAAM,CAAU,2BAA2B,GAAG,cAAc,CAAC;IAC7D,MAAM,CAAU,2BAA2B,GAAG,cAAc,CAAC;IAC7D,MAAM,CAAU,8BAA8B,GAAG,iBAAiB,CAAC;IACnE,MAAM,CAAU,mBAAmB,GAAG,MAAM,CAAC;IAEpD,qEAAqE;IAC9D,MAAM,CAAU,cAAc,GAAG,YAAY,CAAC;IAC9C,MAAM,CAAU,oBAAoB,GAAG,uBAAuB,CAAC;IAC/D,MAAM,CAAU,iBAAiB,GAAG,eAAe,CAAC;IACpD,MAAM,CAAU,gBAAgB,GAAG,cAAc,CAAC;IAClD,MAAM,CAAU,kBAAkB,GAAG,gBAAgB,CAAC;IACtD,MAAM,CAAU,eAAe,GAAG,aAAa,CAAC;IAEvD,qEAAqE;IAC9D,MAAM,CAAU,WAAW,GAAG,aAAa,CAAC;IAEnD,oEAAoE;IAC7D,MAAM,CAAU,yBAAyB,GAAG,uBAAuB,CAAC;IACpE,MAAM,CAAU,wBAAwB,GAAG,sBAAsB,CAAC;IAClE,MAAM,CAAU,yBAAyB,GAAG,uBAAuB,CAAC;IACpE,MAAM,CAAU,kCAAkC,GAAG,gCAAgC,CAAC;IACtF,MAAM,CAAU,wBAAwB,GAAG,sBAAsB,CAAC;IAEzE,oEAAoE;IAC7D,MAAM,CAAU,6BAA6B,GAAG,2BAA2B,CAAC;IAC5E,MAAM,CAAU,8BAA8B,GAAG,4BAA4B,CAAC;IAErF,oEAAoE;IAC7D,MAAM,CAAU,8BAA8B,GAAG,4BAA4B,CAAC;IAC9E,MAAM,CAAU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E,oEAAoE;IAC7D,MAAM,CAAU,+BAA+B,GAAG,qCAAqC,CAAC;IACxF,MAAM,CAAU,6BAA6B,GAAG,wCAAwC,CAAC;IACzF,MAAM,CAAU,4BAA4B,GAAG,kCAAkC,CAAC;IAClF,MAAM,CAAU,0BAA0B,GAAG,gCAAgC,CAAC;IAC9E,MAAM,CAAU,sCAAsC,GAC3D,0CAA0C,CAAC;IACtC,MAAM,CAAU,mCAAmC,GACxD,yCAAyC,CAAC;IACrC,MAAM,CAAU,+BAA+B,GAAG,qCAAqC,CAAC;IAE/F,oEAAoE;IAC7D,MAAM,CAAU,qBAAqB,GAAG,yBAAyB,CAAC;IAClE,MAAM,CAAU,sBAAsB,GAAG,4BAA4B,CAAC;IACtE,MAAM,CAAU,6BAA6B,GAAG,mCAAmC,CAAC;IAE3F,oEAAoE;IAC7D,MAAM,CAAU,gBAAgB,GAAG,wBAAwB,CAAC;IAC5D,MAAM,CAAU,gBAAgB,GAAG,wBAAwB,CAAC;IAEnE,oEAAoE;IAC7D,MAAM,CAAU,yBAAyB,GAAG,uBAAuB,CAAC;IACpE,MAAM,CAAU,oBAAoB,GAAG,kBAAkB,CAAC;IAEjE,oEAAoE;IAC7D,MAAM,CAAU,gBAAgB,GAAG,cAAc,CAAC;IAEzD,oEAAoE;IAC7D,MAAM,CAAU,sBAAsB,GAAG,oBAAoB,CAAC;IAC9D,MAAM,CAAU,0BAA0B,GAAG,wBAAwB,CAAC;IACtE,MAAM,CAAU,yBAAyB,GAAG,uBAAuB,CAAC;IACpE,MAAM,CAAU,wBAAwB,GAAG,sBAAsB,CAAC;IAClE,MAAM,CAAU,4BAA4B,GAAG,QAAQ,CAAC;IACxD,MAAM,CAAU,2BAA2B,GAAG,OAAO,CAAC;;AArG/D,wDAsGC"}
@@ -0,0 +1,25 @@
1
+ import type { Context } from "@opentelemetry/api";
2
+ /**
3
+ * Run a function within a Context that carries the per-request export token.
4
+ * This keeps the token only in OTel Context (ALS), never in any registry.
5
+ *
6
+ * The token can be updated later via `updateExportToken()` before the trace
7
+ * is flushed — useful when the callback is long-running and the original
8
+ * token may expire before export.
9
+ */
10
+ export declare function runWithExportToken<T>(token: string, fn: () => T): T;
11
+ /**
12
+ * Update the export token in the active OTel Context.
13
+ * Call this to refresh the token before ending the root span when the
14
+ * original token may have expired during a long-running request.
15
+ *
16
+ * Must be called within the same async context created by `runWithExportToken`.
17
+ * @param token The fresh token to use for export.
18
+ * @returns true if the token was updated successfully, false if no token holder was found.
19
+ */
20
+ export declare function updateExportToken(token: string): boolean;
21
+ /**
22
+ * Retrieve the per-request export token from a given OTel Context (or the active one).
23
+ */
24
+ export declare function getExportToken(ctx?: Context): string | undefined;
25
+ //# sourceMappingURL=tokenContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenContext.d.ts","sourceRoot":"","sources":["../../../../src/a365/context/tokenContext.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAclD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAKnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAWxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,OAA0B,GAAG,MAAM,GAAG,SAAS,CAUlF"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.runWithExportToken = runWithExportToken;
6
+ exports.updateExportToken = updateExportToken;
7
+ exports.getExportToken = getExportToken;
8
+ /**
9
+ * Per-request export token context propagation.
10
+ *
11
+ * Uses OpenTelemetry Context (backed by AsyncLocalStorage) to carry and
12
+ * refresh a per-request bearer token that the PerRequestSpanProcessor
13
+ * restores at export time.
14
+ *
15
+ * Adapted from microsoft/Agent365-nodejs agents-a365-observability/src/tracing/context/token-context.ts
16
+ */
17
+ const api_1 = require("@opentelemetry/api");
18
+ const index_js_1 = require("../../shared/logging/index.js");
19
+ const EXPORT_TOKEN_KEY = (0, api_1.createContextKey)("a365_export_token");
20
+ /**
21
+ * Run a function within a Context that carries the per-request export token.
22
+ * This keeps the token only in OTel Context (ALS), never in any registry.
23
+ *
24
+ * The token can be updated later via `updateExportToken()` before the trace
25
+ * is flushed — useful when the callback is long-running and the original
26
+ * token may expire before export.
27
+ */
28
+ function runWithExportToken(token, fn) {
29
+ const holder = { token };
30
+ const ctxWithToken = api_1.context.active().setValue(EXPORT_TOKEN_KEY, holder);
31
+ index_js_1.Logger.getInstance().info("[TokenContext] Running function with export token in context.");
32
+ return api_1.context.with(ctxWithToken, fn);
33
+ }
34
+ /**
35
+ * Update the export token in the active OTel Context.
36
+ * Call this to refresh the token before ending the root span when the
37
+ * original token may have expired during a long-running request.
38
+ *
39
+ * Must be called within the same async context created by `runWithExportToken`.
40
+ * @param token The fresh token to use for export.
41
+ * @returns true if the token was updated successfully, false if no token holder was found.
42
+ */
43
+ function updateExportToken(token) {
44
+ const value = api_1.context.active().getValue(EXPORT_TOKEN_KEY);
45
+ if (value && typeof value === "object" && "token" in value) {
46
+ value.token = token;
47
+ index_js_1.Logger.getInstance().info("[TokenContext] Export token updated in context.");
48
+ return true;
49
+ }
50
+ index_js_1.Logger.getInstance().warn("[TokenContext] updateExportToken called but no token holder found in active context. Was runWithExportToken called?");
51
+ return false;
52
+ }
53
+ /**
54
+ * Retrieve the per-request export token from a given OTel Context (or the active one).
55
+ */
56
+ function getExportToken(ctx = api_1.context.active()) {
57
+ const value = ctx.getValue(EXPORT_TOKEN_KEY);
58
+ if (value && typeof value === "object" && "token" in value) {
59
+ return value.token;
60
+ }
61
+ // Backward compat: support raw string values from older callers
62
+ if (typeof value === "string") {
63
+ return value;
64
+ }
65
+ return undefined;
66
+ }
67
+ //# sourceMappingURL=tokenContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenContext.js","sourceRoot":"","sources":["../../../../src/a365/context/tokenContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmClC,gDAKC;AAWD,8CAWC;AAKD,wCAUC;AA3ED;;;;;;;;GAQG;AAEH,4CAA+D;AAE/D,4DAAuD;AAEvD,MAAM,gBAAgB,GAAG,IAAA,sBAAgB,EAAC,mBAAmB,CAAC,CAAC;AAW/D;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAI,KAAa,EAAE,EAAW;IAC9D,MAAM,MAAM,GAAgB,EAAE,KAAK,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,aAAO,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACzE,iBAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;IAC3F,OAAO,aAAO,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,MAAM,KAAK,GAAG,aAAO,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC1D,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;QAC1D,KAAqB,CAAC,KAAK,GAAG,KAAK,CAAC;QACrC,iBAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,iBAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CACvB,qHAAqH,CACtH,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAe,aAAO,CAAC,MAAM,EAAE;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;QAC3D,OAAQ,KAAqB,CAAC,KAAK,CAAC;IACtC,CAAC;IACD,gEAAgE;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { Context } from "@opentelemetry/api";
2
+ import type { ParentSpanRef } from "./contracts.js";
3
+ /** Type guard to distinguish a ParentSpanRef from an OTel Context. */
4
+ export declare function isParentSpanRef(value: unknown): value is ParentSpanRef;
5
+ /**
6
+ * Creates a new Context with an explicit parent span reference.
7
+ * This allows child spans to be correctly parented even when async context is broken.
8
+ */
9
+ export declare function createContextWithParentSpanRef(base: Context, parent: ParentSpanRef): Context;
10
+ /**
11
+ * Runs a callback within a context that has an explicit parent span reference.
12
+ */
13
+ export declare function runWithParentSpanRef<T>(parent: ParentSpanRef, callback: () => T): T;
14
+ /** Carrier type for HTTP headers. */
15
+ export type HeadersCarrier = Record<string, string | string[] | undefined>;
16
+ /**
17
+ * Injects the current trace context (`traceparent`/`tracestate` headers) into
18
+ * the provided headers object using the globally registered W3C propagator.
19
+ */
20
+ export declare function injectContextToHeaders(headers: Record<string, string>, ctx?: Context): Record<string, string>;
21
+ /**
22
+ * Extracts trace context from incoming HTTP headers using the globally
23
+ * registered W3C propagator.
24
+ */
25
+ export declare function extractContextFromHeaders(headers: HeadersCarrier, baseCtx?: Context): Context;
26
+ /**
27
+ * Extracts trace context from incoming HTTP headers and runs the callback
28
+ * within that context.
29
+ */
30
+ export declare function runWithExtractedTraceContext<T>(headers: HeadersCarrier, callback: () => T): T;
31
+ //# sourceMappingURL=context.d.ts.map