@cuylabs/agent-a365-observability 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -9
- package/dist/index.d.ts +151 -8
- package/dist/index.js +793 -189
- package/docs/README.md +7 -1
- package/docs/architecture.md +18 -6
- package/docs/lifecycle-and-limits.md +55 -4
- package/docs/microsoft-a365-observability.md +16 -7
- package/docs/microsoft-node-package-comparison.md +75 -0
- package/docs/sdk-and-auth-flow.md +125 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -14,7 +14,9 @@ It does four things:
|
|
|
14
14
|
- wraps each request in Agent 365 baggage so spans include tenant, agent,
|
|
15
15
|
conversation, channel, and caller identity.
|
|
16
16
|
|
|
17
|
-
For the deeper design, read [docs/README.md](./docs/README.md).
|
|
17
|
+
For the deeper design, read [docs/README.md](./docs/README.md). For the full
|
|
18
|
+
SDK and auth flow, read
|
|
19
|
+
[docs/sdk-and-auth-flow.md](./docs/sdk-and-auth-flow.md).
|
|
18
20
|
|
|
19
21
|
## Install
|
|
20
22
|
|
|
@@ -22,14 +24,28 @@ For the deeper design, read [docs/README.md](./docs/README.md).
|
|
|
22
24
|
pnpm add @cuylabs/agent-a365-observability @microsoft/agents-a365-observability @microsoft/agents-a365-runtime
|
|
23
25
|
```
|
|
24
26
|
|
|
27
|
+
Install `@microsoft/agents-a365-observability-hosting` as well when using the
|
|
28
|
+
M365/OBO token-cache helpers.
|
|
29
|
+
|
|
30
|
+
Dependency roles:
|
|
31
|
+
|
|
32
|
+
| Package | Required when | Notes |
|
|
33
|
+
| ---------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `@microsoft/agents-a365-observability` | Always, when exporting to Agent 365 | Owns Microsoft's `ObservabilityManager`, exporter, baggage processor, trace propagation utilities, and optional `OutputScope`. |
|
|
35
|
+
| `@microsoft/agents-a365-runtime` | Always with Microsoft's observability SDK | Provides Microsoft runtime configuration types used by the SDK. |
|
|
36
|
+
| `@microsoft/agents-a365-observability-hosting` | Only for M365/OBO token-cache helpers | Provides `AgenticTokenCache`. It is an optional peer and is lazy-loaded only by OBO helpers. S2S App Service agents do not need it. |
|
|
37
|
+
|
|
25
38
|
## Usage
|
|
26
39
|
|
|
27
40
|
```typescript
|
|
28
41
|
import { createAgent } from "@cuylabs/agent-core";
|
|
29
42
|
import {
|
|
43
|
+
createA365S2STokenResolverFromEnv,
|
|
30
44
|
createA365TracingConfig,
|
|
45
|
+
initA365S2SObservability,
|
|
31
46
|
initA365Observability,
|
|
32
47
|
runWithA365Context,
|
|
48
|
+
runWithA365OutputMessages,
|
|
33
49
|
runWithA365TurnContext,
|
|
34
50
|
} from "@cuylabs/agent-a365-observability";
|
|
35
51
|
|
|
@@ -116,7 +132,15 @@ startup so the Microsoft exporter and token resolver are registered.
|
|
|
116
132
|
|
|
117
133
|
## Shape
|
|
118
134
|
|
|
119
|
-
|
|
135
|
+
This package is the `@cuylabs/agent-core` equivalent of a framework-specific
|
|
136
|
+
Agent 365 observability extension. Microsoft's OpenAI Agents and LangChain
|
|
137
|
+
extension packages patch those harnesses directly so their model/framework
|
|
138
|
+
spans flow through the Agent 365 ObservabilityManager. This package does the
|
|
139
|
+
same kind of adapter work at the agent-core layer: it starts the Microsoft
|
|
140
|
+
ObservabilityManager, feeds agent-core tracing metadata, and wraps each
|
|
141
|
+
agent-core turn with Agent 365 baggage.
|
|
142
|
+
|
|
143
|
+
The integration has four separate pieces:
|
|
120
144
|
|
|
121
145
|
1. `initA365Observability(...)` starts Microsoft's exporter and baggage span
|
|
122
146
|
processor once at host startup.
|
|
@@ -124,6 +148,13 @@ The integration has three separate pieces:
|
|
|
124
148
|
contract.
|
|
125
149
|
3. `runWithA365Context(...)` or `runWithA365TurnContext(...)` binds
|
|
126
150
|
per-request Agent 365 baggage before `agent.chat()` runs.
|
|
151
|
+
4. `createA365S2STokenResolver(...)` provides a reusable service-to-service
|
|
152
|
+
token resolver for Agent 365 Observability API export.
|
|
153
|
+
|
|
154
|
+
The source follows those same boundaries: `auth/` owns Agent 365 S2S token
|
|
155
|
+
resolution, `context/` owns baggage and TurnContext mapping, `runtime/` owns
|
|
156
|
+
Microsoft SDK startup and lazy loading, and `tracing/` owns the agent-core
|
|
157
|
+
tracing config adapter.
|
|
127
158
|
|
|
128
159
|
Use agent-core for portable OpenTelemetry spans:
|
|
129
160
|
|
|
@@ -203,17 +234,169 @@ you need those dimensions.
|
|
|
203
234
|
|
|
204
235
|
For batch export, provide `tokenResolver` in `initA365Observability()`.
|
|
205
236
|
|
|
206
|
-
For
|
|
237
|
+
For non-OBO service-to-service export, use `initA365S2SObservability()` when
|
|
238
|
+
the host should use the Agent 365 CLI generated environment values. The helper
|
|
239
|
+
understands both `A365_OBSERVABILITY_*` names and generated
|
|
240
|
+
`agent365Observability__*` names such as `agent365Observability__tenantId`,
|
|
241
|
+
`agent365Observability__agentId`, `agent365Observability__clientId`, and
|
|
242
|
+
`agent365Observability__clientSecret`.
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
await initA365S2SObservability({
|
|
246
|
+
serviceName: "email-agent-service",
|
|
247
|
+
serviceVersion: "1.0.0",
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The S2S initializer creates the token resolver, enables the Microsoft S2S
|
|
252
|
+
exporter endpoint, and enables the exporter unless configuration overrides it.
|
|
253
|
+
|
|
254
|
+
Use `createA365S2STokenResolverFromEnv()` when you want the resolver only:
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
const tokenResolver = createA365S2STokenResolverFromEnv();
|
|
258
|
+
|
|
259
|
+
await initA365Observability({
|
|
260
|
+
serviceName: "email-agent-service",
|
|
261
|
+
tokenResolver,
|
|
262
|
+
exporterOptions: { useS2SEndpoint: true },
|
|
263
|
+
configuration: { exporterEnabled: true },
|
|
264
|
+
});
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Use `createA365S2STokenResolver()` when you want to pass values explicitly:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
import {
|
|
271
|
+
createA365S2STokenResolver,
|
|
272
|
+
initA365Observability,
|
|
273
|
+
} from "@cuylabs/agent-a365-observability";
|
|
274
|
+
|
|
275
|
+
const tokenResolver = createA365S2STokenResolver({
|
|
276
|
+
tenantId: process.env.A365_OBSERVABILITY_TENANT_ID!,
|
|
277
|
+
agentId: process.env.A365_OBSERVABILITY_AGENT_ID!,
|
|
278
|
+
blueprintClientId: process.env.A365_OBSERVABILITY_CLIENT_ID!,
|
|
279
|
+
blueprintClientSecret: process.env.A365_OBSERVABILITY_CLIENT_SECRET,
|
|
280
|
+
useManagedIdentity:
|
|
281
|
+
process.env.A365_OBSERVABILITY_USE_MANAGED_IDENTITY === "true",
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
await initA365Observability({
|
|
285
|
+
serviceName: "email-agent-service",
|
|
286
|
+
tokenResolver,
|
|
287
|
+
exporterOptions: { useS2SEndpoint: true },
|
|
288
|
+
configuration: { exporterEnabled: true },
|
|
289
|
+
});
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Hosts that want Azure managed identity without taking an Azure dependency in
|
|
293
|
+
this package can pass `managedIdentityAssertionProvider`; the provider should
|
|
294
|
+
return an assertion token for `api://AzureADTokenExchange`.
|
|
295
|
+
|
|
296
|
+
For per-request export, pass `exportToken` to `runWithA365Context()` and enable
|
|
297
|
+
per-request export in startup configuration:
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
await initA365Observability({
|
|
301
|
+
serviceName: "email-agent-service",
|
|
302
|
+
tokenResolver,
|
|
303
|
+
configuration: {
|
|
304
|
+
exporterEnabled: true,
|
|
305
|
+
perRequest: {
|
|
306
|
+
enabled: true,
|
|
307
|
+
maxTraces: 1000,
|
|
308
|
+
maxSpansPerTrace: 5000,
|
|
309
|
+
maxConcurrentExports: 20,
|
|
310
|
+
flushGraceMs: 250,
|
|
311
|
+
maxTraceAgeMs: 30 * 60 * 1000,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Microsoft's current per-request processor reads its tuning options from
|
|
318
|
+
environment-backed configuration. This package applies these explicit startup
|
|
319
|
+
values to the Microsoft environment variables before the SDK starts.
|
|
320
|
+
|
|
321
|
+
## Trace Propagation
|
|
322
|
+
|
|
323
|
+
Use the trace propagation helpers when one agent calls another over HTTP or
|
|
324
|
+
when async work needs to keep a parent span:
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
const headers = await injectA365TraceContextToHeaders({});
|
|
328
|
+
await fetch(agentUrl, { method: "POST", headers });
|
|
329
|
+
|
|
330
|
+
await runWithA365ExtractedTraceContext(req.headers, () =>
|
|
331
|
+
runWithA365Context(context, () => agent.chat(sessionId, text)),
|
|
332
|
+
);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
For queue or callback flows where you persisted the parent span ids, use
|
|
336
|
+
`runWithA365ParentSpanRef(...)`.
|
|
337
|
+
|
|
338
|
+
## Optional Output Spans
|
|
339
|
+
|
|
340
|
+
agent-core records output messages on the agent turn span. If an Agent 365
|
|
341
|
+
deployment needs Microsoft's separate `output_messages` span shape, wrap the
|
|
342
|
+
outgoing delivery path:
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
await runWithA365OutputMessages(
|
|
346
|
+
{
|
|
347
|
+
tenantId,
|
|
348
|
+
agentId,
|
|
349
|
+
conversationId,
|
|
350
|
+
channelName: "msteams",
|
|
351
|
+
messages: ["Done."],
|
|
352
|
+
},
|
|
353
|
+
() => sendMessage("Done."),
|
|
354
|
+
);
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
This is opt-in because outgoing message content is recorded as telemetry.
|
|
358
|
+
|
|
359
|
+
## OBO Token Cache
|
|
360
|
+
|
|
361
|
+
For M365/OBO hosts, use the OBO helpers around Microsoft's
|
|
362
|
+
`AgenticTokenCache`. This is separate from the S2S setup flow.
|
|
363
|
+
|
|
364
|
+
This path requires the optional
|
|
365
|
+
`@microsoft/agents-a365-observability-hosting` peer because `AgenticTokenCache`
|
|
366
|
+
lives in Microsoft's hosting package. The adapter does not load that package
|
|
367
|
+
for S2S startup, S2S token resolution, baggage wrapping, trace propagation, or
|
|
368
|
+
output spans. It is loaded only when an OBO helper is called.
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
await refreshA365OboObservabilityToken({
|
|
372
|
+
agentId,
|
|
373
|
+
tenantId,
|
|
374
|
+
turnContext,
|
|
375
|
+
authorization,
|
|
376
|
+
scopes: ["api://9b975845-388f-4429-889e-eab1ef63949c/.default"],
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
await initA365Observability({
|
|
380
|
+
serviceName: "email-agent-service",
|
|
381
|
+
tokenResolver: createA365OboTokenResolver(),
|
|
382
|
+
configuration: { exporterEnabled: true },
|
|
383
|
+
});
|
|
384
|
+
```
|
|
207
385
|
|
|
208
|
-
##
|
|
386
|
+
## Optional Features
|
|
209
387
|
|
|
210
|
-
|
|
388
|
+
The adapter now exposes the official additive pieces that do not duplicate
|
|
389
|
+
agent-core telemetry:
|
|
211
390
|
|
|
212
|
-
-
|
|
213
|
-
-
|
|
214
|
-
-
|
|
391
|
+
- S2S Observability token resolution, including Agent 365 CLI env aliases;
|
|
392
|
+
- Microsoft trace context propagation helpers;
|
|
393
|
+
- per-request export token and processor configuration;
|
|
394
|
+
- optional Microsoft `OutputScope` output-message spans;
|
|
395
|
+
- OBO token cache helpers for M365 per-user authorization.
|
|
215
396
|
|
|
216
|
-
|
|
397
|
+
Real-time threat protection and chat-history submission are outside
|
|
398
|
+
observability and should live in separate Agent 365 tooling or security
|
|
399
|
+
packages.
|
|
217
400
|
|
|
218
401
|
## Examples
|
|
219
402
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,14 +5,29 @@ type A365Logger = {
|
|
|
5
5
|
info(message: string, ...args: unknown[]): void;
|
|
6
6
|
warn(message: string, ...args: unknown[]): void;
|
|
7
7
|
error(message: string, ...args: unknown[]): void;
|
|
8
|
-
event?(eventName: string, success: boolean, durationMs: number, message?: string, details?: Record<string, string>): void;
|
|
8
|
+
event?(eventName: A365ExporterEventName | (string & {}), success: boolean, durationMs: number, message?: string, details?: Record<string, string>): void;
|
|
9
9
|
};
|
|
10
|
+
declare const A365_EXPORTER_EVENT_NAMES: {
|
|
11
|
+
readonly export: "agent365-export";
|
|
12
|
+
readonly exportGroup: "export-group";
|
|
13
|
+
readonly exportPartitionSpanMissingIdentity: "export-partition-span-missing-identity";
|
|
14
|
+
};
|
|
15
|
+
type A365ExporterEventName = (typeof A365_EXPORTER_EVENT_NAMES)[keyof typeof A365_EXPORTER_EVENT_NAMES];
|
|
10
16
|
type SpanAttributeValue = string | number | boolean | string[] | number[] | boolean[];
|
|
11
17
|
type A365ObservabilityConfiguration = {
|
|
12
18
|
exporterEnabled?: boolean;
|
|
13
19
|
domainOverride?: string | null;
|
|
14
20
|
logLevel?: string;
|
|
15
21
|
authenticationScopes?: string[];
|
|
22
|
+
perRequest?: A365PerRequestExportConfiguration;
|
|
23
|
+
};
|
|
24
|
+
type A365PerRequestExportConfiguration = {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
maxTraces?: number;
|
|
27
|
+
maxSpansPerTrace?: number;
|
|
28
|
+
maxConcurrentExports?: number;
|
|
29
|
+
flushGraceMs?: number;
|
|
30
|
+
maxTraceAgeMs?: number;
|
|
16
31
|
};
|
|
17
32
|
type A365RequestContext = {
|
|
18
33
|
tenantId?: string;
|
|
@@ -130,15 +145,85 @@ type A365TracingConfig = {
|
|
|
130
145
|
spanAttributes?: Record<string, SpanAttributeValue>;
|
|
131
146
|
};
|
|
132
147
|
|
|
148
|
+
declare class A365ObservabilityModuleLoadError extends Error {
|
|
149
|
+
constructor(message: string, options?: ErrorOptions);
|
|
150
|
+
}
|
|
151
|
+
declare class A365ObservabilityHostingModuleLoadError extends Error {
|
|
152
|
+
constructor(message: string, options?: ErrorOptions);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
type A365ManagedIdentityAssertionProvider = () => string | Promise<string>;
|
|
156
|
+
type A365S2STokenResolverLogger = {
|
|
157
|
+
warn(message: string, details?: Record<string, unknown>): void;
|
|
158
|
+
};
|
|
159
|
+
type A365S2STokenResolverOptions = {
|
|
160
|
+
tenantId: string;
|
|
161
|
+
agentId: string;
|
|
162
|
+
blueprintClientId: string;
|
|
163
|
+
blueprintClientSecret?: string;
|
|
164
|
+
useManagedIdentity?: boolean;
|
|
165
|
+
managedIdentityAssertionProvider?: A365ManagedIdentityAssertionProvider;
|
|
166
|
+
allowManagedIdentityClientSecretFallback?: boolean;
|
|
167
|
+
observabilityScope?: string;
|
|
168
|
+
fmiScope?: string;
|
|
169
|
+
refreshSkewMs?: number;
|
|
170
|
+
logger?: A365S2STokenResolverLogger;
|
|
171
|
+
fetch?: typeof fetch;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Creates an Agent 365 S2S Observability API token resolver.
|
|
176
|
+
*
|
|
177
|
+
* The resolver implements the Agent 365 3-hop FMI flow used by non-OBO agents:
|
|
178
|
+
*
|
|
179
|
+
* 1. Blueprint credential or managed-identity assertion -> FMI token targeted at
|
|
180
|
+
* the agent identity through `fmi_path`.
|
|
181
|
+
* 2. Agent identity uses that FMI token as a client assertion.
|
|
182
|
+
* 3. Entra returns an Observability API token for the Agent 365 exporter.
|
|
183
|
+
*/
|
|
184
|
+
declare function createA365S2STokenResolver(options: A365S2STokenResolverOptions): A365TokenResolver;
|
|
185
|
+
|
|
186
|
+
type A365Environment = Record<string, string | undefined>;
|
|
187
|
+
type A365ResolvedObservabilityEnvironment = {
|
|
188
|
+
tenantId?: string;
|
|
189
|
+
agentId?: string;
|
|
190
|
+
agentName?: string;
|
|
191
|
+
agentDescription?: string;
|
|
192
|
+
blueprintClientId?: string;
|
|
193
|
+
blueprintClientSecret?: string;
|
|
194
|
+
useManagedIdentity?: boolean;
|
|
195
|
+
observabilityScope?: string;
|
|
196
|
+
fmiScope?: string;
|
|
197
|
+
configuration: A365ObservabilityConfiguration;
|
|
198
|
+
};
|
|
199
|
+
type A365S2STokenResolverFromEnvOptions = Partial<Omit<A365S2STokenResolverOptions, "tenantId" | "agentId" | "blueprintClientId">> & Partial<Pick<A365S2STokenResolverOptions, "tenantId" | "agentId" | "blueprintClientId">> & {
|
|
200
|
+
env?: A365Environment;
|
|
201
|
+
};
|
|
202
|
+
declare function resolveA365ObservabilityEnvironment(env?: A365Environment): A365ResolvedObservabilityEnvironment;
|
|
203
|
+
declare function createA365S2STokenResolverFromEnv(options?: A365S2STokenResolverFromEnvOptions): A365TokenResolver;
|
|
204
|
+
|
|
205
|
+
type A365AgenticTokenCacheLike = {
|
|
206
|
+
getObservabilityToken(agentId: string, tenantId: string): string | null;
|
|
207
|
+
RefreshObservabilityToken(agentId: string, tenantId: string, turnContext: unknown, authorization: unknown, scopes: string[], authHandlerName?: string): Promise<void>;
|
|
208
|
+
invalidateToken?(agentId: string, tenantId: string): void;
|
|
209
|
+
invalidateAll?(): void;
|
|
210
|
+
};
|
|
211
|
+
|
|
133
212
|
type A365ObservabilityModuleLoader = () => Promise<unknown>;
|
|
134
213
|
type A365ObservabilityRuntimeOptions = {
|
|
135
214
|
/**
|
|
136
|
-
*
|
|
215
|
+
* Loader override for `@microsoft/agents-a365-observability`.
|
|
137
216
|
*
|
|
138
217
|
* Production code normally leaves this unset so the package is loaded lazily
|
|
139
218
|
* only when observability is used.
|
|
140
219
|
*/
|
|
141
220
|
getObservabilityModule?: A365ObservabilityModuleLoader;
|
|
221
|
+
/**
|
|
222
|
+
* Loader override for `@microsoft/agents-a365-observability-hosting`.
|
|
223
|
+
*
|
|
224
|
+
* Only OBO token-cache helpers use this package.
|
|
225
|
+
*/
|
|
226
|
+
getObservabilityHostingModule?: A365ObservabilityModuleLoader;
|
|
142
227
|
};
|
|
143
228
|
type InitA365ObservabilityOptions = A365ObservabilityRuntimeOptions & {
|
|
144
229
|
serviceName: string;
|
|
@@ -154,9 +239,28 @@ type A365ObservabilityHandle = {
|
|
|
154
239
|
shutdown(): Promise<void>;
|
|
155
240
|
};
|
|
156
241
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
242
|
+
type A365AuthorizationLike = {
|
|
243
|
+
exchangeToken(turnContext: unknown, authHandlerName: string, options: {
|
|
244
|
+
scopes: string[];
|
|
245
|
+
}): Promise<{
|
|
246
|
+
token?: string;
|
|
247
|
+
} | undefined>;
|
|
248
|
+
};
|
|
249
|
+
type A365OboTokenCacheOptions = A365ObservabilityRuntimeOptions & {
|
|
250
|
+
cache?: A365AgenticTokenCacheLike;
|
|
251
|
+
};
|
|
252
|
+
type A365RefreshOboObservabilityTokenOptions = A365OboTokenCacheOptions & {
|
|
253
|
+
agentId: string;
|
|
254
|
+
tenantId: string;
|
|
255
|
+
turnContext: unknown;
|
|
256
|
+
authorization: A365AuthorizationLike;
|
|
257
|
+
scopes?: string[];
|
|
258
|
+
authHandlerName?: string;
|
|
259
|
+
};
|
|
260
|
+
declare function createA365OboTokenResolver(options?: A365OboTokenCacheOptions): A365TokenResolver;
|
|
261
|
+
declare function refreshA365OboObservabilityToken(options: A365RefreshOboObservabilityTokenOptions): Promise<void>;
|
|
262
|
+
declare function invalidateA365OboObservabilityToken(agentId: string, tenantId: string, options?: A365OboTokenCacheOptions): Promise<void>;
|
|
263
|
+
declare function invalidateAllA365OboObservabilityTokens(options?: A365OboTokenCacheOptions): Promise<void>;
|
|
160
264
|
|
|
161
265
|
declare const A365_BAGGAGE_KEYS: {
|
|
162
266
|
readonly tenantId: "microsoft.tenant.id";
|
|
@@ -192,8 +296,6 @@ declare const A365_BAGGAGE_KEYS: {
|
|
|
192
296
|
|
|
193
297
|
declare function buildA365BaggagePairs(context: A365RequestContext): Record<string, string>;
|
|
194
298
|
|
|
195
|
-
declare function createA365TracingConfig(options?: A365TracingConfigOptions): A365TracingConfig;
|
|
196
|
-
|
|
197
299
|
declare function createA365ContextFromTurnContext(turnContext: A365TurnContextLike, options?: A365TurnContextOptions): A365RequestContext;
|
|
198
300
|
|
|
199
301
|
declare function runWithA365TurnContext<T>(turnContext: A365TurnContextLike, fn: () => T, runtimeOptions?: A365ObservabilityRuntimeOptions): Promise<Awaited<T>>;
|
|
@@ -203,4 +305,45 @@ declare function initA365Observability(options: InitA365ObservabilityOptions): P
|
|
|
203
305
|
declare function runWithA365Context<T>(requestContext: A365RequestContext, fn: () => T, options?: A365ObservabilityRuntimeOptions): Promise<Awaited<T>>;
|
|
204
306
|
declare function updateA365ExportToken(token: string, options?: A365ObservabilityRuntimeOptions): Promise<boolean>;
|
|
205
307
|
|
|
206
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Microsoft currently reads per-request processor settings through its default
|
|
310
|
+
* env-backed provider. Apply explicit startup options before the SDK starts.
|
|
311
|
+
*/
|
|
312
|
+
declare function applyA365PerRequestEnvironment(configuration: A365PerRequestExportConfiguration | undefined, env?: NodeJS.ProcessEnv): void;
|
|
313
|
+
|
|
314
|
+
type InitA365S2SObservabilityOptions = Omit<InitA365ObservabilityOptions, "tokenResolver"> & {
|
|
315
|
+
s2s?: A365S2STokenResolverFromEnvOptions;
|
|
316
|
+
};
|
|
317
|
+
declare function initA365S2SObservability(options: InitA365S2SObservabilityOptions): Promise<A365ObservabilityHandle>;
|
|
318
|
+
|
|
319
|
+
declare function createA365TracingConfig(options?: A365TracingConfigOptions): A365TracingConfig;
|
|
320
|
+
|
|
321
|
+
type A365HeadersCarrier = Record<string, string | string[] | undefined>;
|
|
322
|
+
type A365MutableHeadersCarrier = Record<string, string>;
|
|
323
|
+
type A365ParentSpanRef = {
|
|
324
|
+
traceId: string;
|
|
325
|
+
spanId: string;
|
|
326
|
+
traceFlags?: number;
|
|
327
|
+
traceState?: unknown;
|
|
328
|
+
isRemote?: boolean;
|
|
329
|
+
};
|
|
330
|
+
type A365TraceContextOptions = A365ObservabilityRuntimeOptions & {
|
|
331
|
+
context?: unknown;
|
|
332
|
+
};
|
|
333
|
+
declare function injectA365TraceContextToHeaders(headers?: A365MutableHeadersCarrier, options?: A365TraceContextOptions): Promise<A365MutableHeadersCarrier>;
|
|
334
|
+
declare function extractA365TraceContextFromHeaders(headers: A365HeadersCarrier, options?: A365TraceContextOptions): Promise<unknown>;
|
|
335
|
+
declare function runWithA365ExtractedTraceContext<T>(headers: A365HeadersCarrier, fn: () => T, options?: A365ObservabilityRuntimeOptions): Promise<Awaited<T>>;
|
|
336
|
+
declare function runWithA365ParentSpanRef<T>(parent: A365ParentSpanRef, fn: () => T, options?: A365ObservabilityRuntimeOptions): Promise<Awaited<T>>;
|
|
337
|
+
declare function createA365ContextWithParentSpanRef(baseContext: unknown, parent: A365ParentSpanRef, options?: A365ObservabilityRuntimeOptions): Promise<unknown>;
|
|
338
|
+
|
|
339
|
+
type A365OutputMessagesParam = string | string[] | Record<string, unknown> | {
|
|
340
|
+
version: string;
|
|
341
|
+
messages: unknown[];
|
|
342
|
+
};
|
|
343
|
+
type A365OutputScopeContext = A365RequestContext & {
|
|
344
|
+
messages: A365OutputMessagesParam;
|
|
345
|
+
parentSpan?: A365ParentSpanRef;
|
|
346
|
+
};
|
|
347
|
+
declare function runWithA365OutputMessages<T>(output: A365OutputScopeContext, fn: () => T, options?: A365ObservabilityRuntimeOptions): Promise<Awaited<T>>;
|
|
348
|
+
|
|
349
|
+
export { type A365ActivityAccountLike, type A365ActivityLike, type A365AuthorizationLike, type A365Environment, type A365ExporterEventName, type A365HeadersCarrier, type A365Logger, type A365ManagedIdentityAssertionProvider, type A365MutableHeadersCarrier, type A365OboTokenCacheOptions, type A365ObservabilityConfiguration, type A365ObservabilityHandle, A365ObservabilityHostingModuleLoadError, A365ObservabilityModuleLoadError, type A365ObservabilityModuleLoader, type A365ObservabilityRuntimeOptions, type A365OutputMessagesParam, type A365OutputScopeContext, type A365ParentSpanRef, type A365PerRequestExportConfiguration, type A365RefreshOboObservabilityTokenOptions, type A365RequestContext, type A365ResolvedObservabilityEnvironment, type A365S2STokenResolverFromEnvOptions, type A365S2STokenResolverLogger, type A365S2STokenResolverOptions, type A365TokenResolver, type A365TraceContextOptions, type A365TracingConfig, type A365TracingConfigOptions, type A365TurnContextLike, type A365TurnContextOptions, A365_BAGGAGE_KEYS, A365_EXPORTER_EVENT_NAMES, type InitA365ObservabilityOptions, type InitA365S2SObservabilityOptions, type SpanAttributeValue, applyA365PerRequestEnvironment, buildA365BaggagePairs, createA365ContextFromTurnContext, createA365ContextWithParentSpanRef, createA365OboTokenResolver, createA365S2STokenResolver, createA365S2STokenResolverFromEnv, createA365TracingConfig, extractA365TraceContextFromHeaders, initA365Observability, initA365S2SObservability, injectA365TraceContextToHeaders, invalidateA365OboObservabilityToken, invalidateAllA365OboObservabilityTokens, refreshA365OboObservabilityToken, resolveA365ObservabilityEnvironment, runWithA365Context, runWithA365ExtractedTraceContext, runWithA365OutputMessages, runWithA365ParentSpanRef, runWithA365TurnContext, updateA365ExportToken };
|