1
>
/*---------------------------------------------------------------------------------------------
spanData.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
/**
7
>
* Minimal, SDK-agnostic types for completed OTel spans.
8
>
*
9
>
* These mirror the shape used by the Copilot extension (kept in sync with
10
>
* `extensions/copilot/src/platform/otel/common/otelService.ts`) so the same
11
>
* bridge processor can be ported to the Agent Host without dragging in the
12
>
* extension's full `IOTelService` surface.
13
>
*/
14
>
15
>
export const enum SpanStatusCode {
16
>
UNSET = 0,
17
>
OK = 1,
18
>
ERROR = 2,
19
>
}
20
>
21
>
/**
22
>
* Serializable snapshot of a completed span.
23
>
* Contains all in-memory attributes (including content attributes regardless of captureContent).
24
>
*/
25
>
export interface ICompletedSpanData {
26
>
readonly name: string;
27
>
readonly spanId: string;
28
>
readonly traceId: string;
29
>
readonly parentSpanId?: string;
30
>
readonly startTime: number; // milliseconds since epoch
31
>
readonly endTime: number; // milliseconds since epoch
32
>
readonly status: { readonly code: SpanStatusCode; readonly message?: string };
33
>
readonly attributes: Readonly<Record<string, string | number | boolean | string[]>>;
34
>
readonly events: readonly ISpanEventRecord[];
35
>
}
36
>
37
>
/**
38
>
* A single event on a span.
39
>
*/
40
>
export interface ISpanEventRecord {
41
>
readonly name: string;
42
>
readonly timestamp: number; // milliseconds since epoch
43
>
readonly attributes?: Readonly<Record<string, string | number | boolean | string[]>>;
44
>
}