@arizeai/phoenix-client 6.11.2 → 6.12.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 CHANGED
@@ -544,6 +544,32 @@ const rootSpans = await getSpans({
544
544
  | `spanKind` | `SpanKindFilter \| SpanKindFilter[]` | Filter by span kind (`LLM`, `CHAIN`, `TOOL`, `RETRIEVER`, etc.) |
545
545
  | `statusCode` | `SpanStatusCode \| SpanStatusCode[]` | Filter by status code (`OK`, `ERROR`, `UNSET`) |
546
546
 
547
+ ### Logging Spans
548
+
549
+ Use `logSpans` to submit spans directly to a project using Phoenix's simplified span structure — the same shape returned by `getSpans`. This is useful for backfilling or migrating spans without going through OpenTelemetry. If your application is already instrumented with OpenTelemetry, export spans via `@arizeai/phoenix-otel` instead.
550
+
551
+ ```ts
552
+ import { logSpans } from "@arizeai/phoenix-client/spans";
553
+
554
+ const result = await logSpans({
555
+ project: { projectName: "my-project" },
556
+ spans: [
557
+ {
558
+ name: "chat_completion",
559
+ context: { trace_id: "abc123", span_id: "def456" },
560
+ span_kind: "LLM",
561
+ start_time: "2024-01-01T00:00:00Z",
562
+ end_time: "2024-01-01T00:00:01Z",
563
+ status_code: "OK",
564
+ attributes: { "llm.model_name": "gpt-4" },
565
+ },
566
+ ],
567
+ });
568
+ console.log(`Queued ${result.totalQueued} of ${result.totalReceived} spans`);
569
+ ```
570
+
571
+ If any span in the request is invalid or a duplicate of a span that already exists, none of the spans are queued and `logSpans` throws a `SpanCreationError` with `invalidSpans` and `duplicateSpans` details.
572
+
547
573
  ## Span Annotations
548
574
 
549
575
  The `spans` export also provides functions for managing span annotations — adding evaluations, feedback, and labels to spans.
@@ -7,4 +7,5 @@ export * from "./getSpans.js";
7
7
  export type { SpanKindFilter, SpanStatusCode } from "../types/spans.js";
8
8
  export * from "./getSpanAnnotations.js";
9
9
  export * from "./deleteSpan.js";
10
+ export * from "./logSpans.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spans/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spans/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -6,4 +6,5 @@ export * from "./logDocumentAnnotations.js";
6
6
  export * from "./getSpans.js";
7
7
  export * from "./getSpanAnnotations.js";
8
8
  export * from "./deleteSpan.js";
9
+ export * from "./logSpans.js";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/spans/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAE3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/spans/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAE3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,94 @@
1
+ import type { paths } from "../__generated__/api/v1.js";
2
+ import type { ClientFn } from "../types/core.js";
3
+ import type { ProjectIdentifier } from "../types/projects.js";
4
+ type CreateSpansRequestData = paths["/v1/projects/{project_identifier}/spans"]["post"]["requestBody"]["content"]["application/json"]["data"];
5
+ /**
6
+ * A span in Phoenix's simplified span structure, as accepted by {@link logSpans}.
7
+ * This is the same shape returned by `getSpans`, which makes it possible to read
8
+ * spans from one project and log them into another.
9
+ */
10
+ export type Span = CreateSpansRequestData[number];
11
+ /** Information about a span that failed validation and was not queued. */
12
+ export interface InvalidSpanInfo {
13
+ spanId: string;
14
+ traceId: string;
15
+ error: string;
16
+ }
17
+ /** Information about a span that was rejected because it already exists. */
18
+ export interface DuplicateSpanInfo {
19
+ spanId: string;
20
+ traceId: string;
21
+ }
22
+ /**
23
+ * Raised by {@link logSpans} when one or more spans in the request are invalid
24
+ * or duplicates. If any span in a request fails, none of the spans in that
25
+ * request are queued.
26
+ */
27
+ export declare class SpanCreationError extends Error {
28
+ readonly invalidSpans: InvalidSpanInfo[];
29
+ readonly duplicateSpans: DuplicateSpanInfo[];
30
+ readonly totalReceived: number;
31
+ readonly totalQueued: number;
32
+ constructor(params: {
33
+ message: string;
34
+ invalidSpans?: InvalidSpanInfo[];
35
+ duplicateSpans?: DuplicateSpanInfo[];
36
+ totalReceived?: number;
37
+ totalQueued?: number;
38
+ });
39
+ /** Number of spans rejected as invalid. */
40
+ get totalInvalid(): number;
41
+ /** Number of spans rejected as duplicates. */
42
+ get totalDuplicates(): number;
43
+ }
44
+ /**
45
+ * Parameters to log spans to a project
46
+ */
47
+ export interface LogSpansParams extends ClientFn {
48
+ /** The project to log spans into */
49
+ project: ProjectIdentifier;
50
+ /** The spans to log */
51
+ spans: Span[];
52
+ }
53
+ /**
54
+ * Statistics about a {@link logSpans} call. When successful, `totalQueued`
55
+ * equals `totalReceived`.
56
+ */
57
+ export interface LogSpansResult {
58
+ totalReceived: number;
59
+ totalQueued: number;
60
+ }
61
+ /**
62
+ * Log spans to a project using Phoenix's simplified span structure.
63
+ *
64
+ * If any span in the request is invalid or a duplicate of a span that already
65
+ * exists, none of the spans in the request are queued and a
66
+ * {@link SpanCreationError} is thrown with details about the failures.
67
+ *
68
+ * @experimental this function is experimental and may change in the future
69
+ *
70
+ * @param params - The parameters to log spans
71
+ * @returns Statistics about the operation. When successful, `totalQueued`
72
+ * equals `totalReceived`.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const result = await logSpans({
77
+ * project: { projectName: "my-project" },
78
+ * spans: [
79
+ * {
80
+ * name: "test",
81
+ * context: { trace_id: "123", span_id: "456" },
82
+ * span_kind: "CHAIN",
83
+ * start_time: "2024-01-01T00:00:00Z",
84
+ * end_time: "2024-01-01T00:00:01Z",
85
+ * status_code: "OK",
86
+ * },
87
+ * ],
88
+ * });
89
+ * console.log(`Queued ${result.totalQueued} spans`);
90
+ * ```
91
+ */
92
+ export declare function logSpans({ client: _client, project, spans, }: LogSpansParams): Promise<LogSpansResult>;
93
+ export {};
94
+ //# sourceMappingURL=logSpans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logSpans.d.ts","sourceRoot":"","sources":["../../../src/spans/logSpans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAM3D,KAAK,sBAAsB,GACzB,KAAK,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W,EAAE,MAAM,CAAC;CACrB;AAoLD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,QAAQ,CAAC,EAC7B,MAAM,EAAE,OAAO,EACf,OAAO,EACP,KAAK,GACN,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CA0B1C"}
@@ -0,0 +1,216 @@
1
+ import { createClient } from "../client.js";
2
+ import { resolveProjectIdentifier } from "../types/projects.js";
3
+ import { formatApiError } from "../utils/apiErrorUtils.js";
4
+ import { isObject } from "../utils/isObject.js";
5
+ import { safelyParseJSON } from "../utils/safelyParseJSON.js";
6
+ /**
7
+ * Raised by {@link logSpans} when one or more spans in the request are invalid
8
+ * or duplicates. If any span in a request fails, none of the spans in that
9
+ * request are queued.
10
+ */
11
+ export class SpanCreationError extends Error {
12
+ invalidSpans;
13
+ duplicateSpans;
14
+ totalReceived;
15
+ totalQueued;
16
+ constructor(params) {
17
+ super(params.message);
18
+ this.name = "SpanCreationError";
19
+ this.invalidSpans = params.invalidSpans ?? [];
20
+ this.duplicateSpans = params.duplicateSpans ?? [];
21
+ this.totalReceived = params.totalReceived ?? 0;
22
+ this.totalQueued = params.totalQueued ?? 0;
23
+ }
24
+ /** Number of spans rejected as invalid. */
25
+ get totalInvalid() {
26
+ return this.invalidSpans.length;
27
+ }
28
+ /** Number of spans rejected as duplicates. */
29
+ get totalDuplicates() {
30
+ return this.duplicateSpans.length;
31
+ }
32
+ }
33
+ const MAX_ERRORS_TO_SHOW = 5;
34
+ function formatLogSpansErrorMessage({ invalidSpans, duplicateSpans, }) {
35
+ const parts = [];
36
+ if (invalidSpans.length > 0) {
37
+ parts.push(`Failed to queue ${invalidSpans.length} invalid spans:`);
38
+ for (const span of invalidSpans.slice(0, MAX_ERRORS_TO_SHOW)) {
39
+ parts.push(` - Span ${span.spanId}: ${span.error}`);
40
+ }
41
+ if (invalidSpans.length > MAX_ERRORS_TO_SHOW) {
42
+ parts.push(` ... and ${invalidSpans.length - MAX_ERRORS_TO_SHOW} more invalid spans`);
43
+ }
44
+ }
45
+ if (duplicateSpans.length > 0) {
46
+ if (parts.length > 0)
47
+ parts.push("");
48
+ parts.push(`Found ${duplicateSpans.length} duplicate spans:`);
49
+ for (const span of duplicateSpans.slice(0, MAX_ERRORS_TO_SHOW)) {
50
+ parts.push(` - Span ${span.spanId}`);
51
+ }
52
+ if (duplicateSpans.length > MAX_ERRORS_TO_SHOW) {
53
+ parts.push(` ... and ${duplicateSpans.length - MAX_ERRORS_TO_SHOW} more duplicates`);
54
+ }
55
+ }
56
+ return parts.join("\n");
57
+ }
58
+ function toSpanIdAndTraceId(item) {
59
+ const record = isObject(item) ? item : {};
60
+ return {
61
+ spanId: typeof record.span_id === "string" ? record.span_id : "unknown",
62
+ traceId: typeof record.trace_id === "string" ? record.trace_id : "unknown",
63
+ };
64
+ }
65
+ function toInvalidSpanInfoList(value) {
66
+ if (!Array.isArray(value))
67
+ return [];
68
+ return value.map((item) => {
69
+ const record = isObject(item) ? item : {};
70
+ return {
71
+ ...toSpanIdAndTraceId(item),
72
+ error: typeof record.error === "string" ? record.error : "Validation error",
73
+ };
74
+ });
75
+ }
76
+ function toDuplicateSpanInfoList(value) {
77
+ if (!Array.isArray(value))
78
+ return [];
79
+ return value.map(toSpanIdAndTraceId);
80
+ }
81
+ /**
82
+ * Builds a {@link SpanCreationError} from already-normalized invalid/duplicate
83
+ * span lists, computing the shared message once.
84
+ */
85
+ function makeSpanCreationError(params) {
86
+ return new SpanCreationError({
87
+ message: formatLogSpansErrorMessage(params),
88
+ ...params,
89
+ });
90
+ }
91
+ /**
92
+ * Builds a {@link SpanCreationError} from a parsed error payload matching the
93
+ * shape returned by the server for invalid/duplicate spans:
94
+ * `{ total_received, total_queued, total_invalid, total_duplicates, invalid_spans, duplicate_spans }`.
95
+ */
96
+ function buildSpanCreationError(payload) {
97
+ return makeSpanCreationError({
98
+ invalidSpans: toInvalidSpanInfoList(payload.invalid_spans),
99
+ duplicateSpans: toDuplicateSpanInfoList(payload.duplicate_spans),
100
+ totalReceived: typeof payload.total_received === "number" ? payload.total_received : 0,
101
+ totalQueued: typeof payload.total_queued === "number" ? payload.total_queued : 0,
102
+ });
103
+ }
104
+ function isSpanCreationErrorPayload(value) {
105
+ return (isObject(value) && ("invalid_spans" in value || "duplicate_spans" in value));
106
+ }
107
+ /**
108
+ * Extracts invalid span info from a FastAPI request-validation error array
109
+ * (returned with a 422 status when a span in the payload is malformed).
110
+ */
111
+ function extractInvalidSpansFromValidationErrors(errors, spans) {
112
+ const invalidSpans = [];
113
+ for (const rawError of errors) {
114
+ if (!isObject(rawError))
115
+ continue;
116
+ const loc = rawError.loc;
117
+ if (!Array.isArray(loc) ||
118
+ loc.length < 3 ||
119
+ loc[0] !== "body" ||
120
+ loc[1] !== "data" ||
121
+ typeof loc[2] !== "number") {
122
+ continue;
123
+ }
124
+ const span = spans[loc[2]];
125
+ if (!span)
126
+ continue;
127
+ const msg = rawError.msg;
128
+ invalidSpans.push({
129
+ spanId: span.context?.span_id ?? "unknown",
130
+ traceId: span.context?.trace_id ?? "unknown",
131
+ error: typeof msg === "string" ? msg : "Validation error",
132
+ });
133
+ }
134
+ return invalidSpans;
135
+ }
136
+ function parseLogSpansError(error, spans) {
137
+ if (isObject(error)) {
138
+ const detail = error.detail;
139
+ if (typeof detail === "string") {
140
+ const { json: parsed } = safelyParseJSON(detail);
141
+ if (isSpanCreationErrorPayload(parsed)) {
142
+ return buildSpanCreationError(parsed);
143
+ }
144
+ }
145
+ else if (Array.isArray(detail)) {
146
+ const invalidSpans = extractInvalidSpansFromValidationErrors(detail, spans);
147
+ if (invalidSpans.length > 0) {
148
+ return makeSpanCreationError({
149
+ invalidSpans,
150
+ duplicateSpans: [],
151
+ totalReceived: spans.length,
152
+ // A FastAPI 422 rejects the entire request body, so no spans are
153
+ // queued — matching the all-or-nothing contract and the 400 path.
154
+ totalQueued: 0,
155
+ });
156
+ }
157
+ }
158
+ else if (isSpanCreationErrorPayload(error)) {
159
+ return buildSpanCreationError(error);
160
+ }
161
+ }
162
+ return new Error(`Failed to log spans: ${formatApiError(error)}`);
163
+ }
164
+ /**
165
+ * Log spans to a project using Phoenix's simplified span structure.
166
+ *
167
+ * If any span in the request is invalid or a duplicate of a span that already
168
+ * exists, none of the spans in the request are queued and a
169
+ * {@link SpanCreationError} is thrown with details about the failures.
170
+ *
171
+ * @experimental this function is experimental and may change in the future
172
+ *
173
+ * @param params - The parameters to log spans
174
+ * @returns Statistics about the operation. When successful, `totalQueued`
175
+ * equals `totalReceived`.
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * const result = await logSpans({
180
+ * project: { projectName: "my-project" },
181
+ * spans: [
182
+ * {
183
+ * name: "test",
184
+ * context: { trace_id: "123", span_id: "456" },
185
+ * span_kind: "CHAIN",
186
+ * start_time: "2024-01-01T00:00:00Z",
187
+ * end_time: "2024-01-01T00:00:01Z",
188
+ * status_code: "OK",
189
+ * },
190
+ * ],
191
+ * });
192
+ * console.log(`Queued ${result.totalQueued} spans`);
193
+ * ```
194
+ */
195
+ export async function logSpans({ client: _client, project, spans, }) {
196
+ const client = _client ?? createClient();
197
+ const projectIdentifier = resolveProjectIdentifier(project);
198
+ const { data, error } = await client.POST("/v1/projects/{project_identifier}/spans", {
199
+ params: {
200
+ path: {
201
+ project_identifier: projectIdentifier,
202
+ },
203
+ },
204
+ body: {
205
+ data: spans,
206
+ },
207
+ });
208
+ if (error) {
209
+ throw parseLogSpansError(error, spans);
210
+ }
211
+ return {
212
+ totalReceived: data?.total_received ?? spans.length,
213
+ totalQueued: data?.total_queued ?? 0,
214
+ };
215
+ }
216
+ //# sourceMappingURL=logSpans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logSpans.js","sourceRoot":"","sources":["../../../src/spans/logSpans.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAA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