Skip to content

Commit 68eddb2

Browse files
committed
.
1 parent 5ddec04 commit 68eddb2

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

dev-packages/node-integration-tests/suites/tracing/google-genai/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ describe('Google GenAI integration', () => {
376376
description: 'generate_content blocked-model',
377377
op: 'gen_ai.generate_content',
378378
origin: 'auto.ai.google_genai',
379-
status: 'permission_denied',
379+
status: 'internal_error',
380380
}),
381381
// Fifth span - error handling for streaming
382382
expect.objectContaining({
@@ -475,7 +475,7 @@ describe('Google GenAI integration', () => {
475475
description: 'generate_content blocked-model',
476476
op: 'gen_ai.generate_content',
477477
origin: 'auto.ai.google_genai',
478-
status: 'permission_denied',
478+
status: 'internal_error',
479479
}),
480480
// Fifth span - error handling for streaming with PII
481481
expect.objectContaining({

packages/core/src/tracing/anthropic-ai/streaming.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '../ai/gen-ai-attributes';
1212
import { setTokenUsageAttributes } from '../ai/utils';
1313
import type { AnthropicAiStreamingEvent } from './types';
14-
import { mapAnthropicErrorToStatus } from './utils';
14+
import { mapAnthropicErrorToStatusMessage } from './utils';
1515

1616
/**
1717
* State object used to accumulate information from a stream of Anthropic AI events.
@@ -60,7 +60,7 @@ function isErrorEvent(event: AnthropicAiStreamingEvent, span: Span): boolean {
6060
// If the event is an error, set the span status and capture the error
6161
// These error events are not rejected by the API by default, but are sent as metadata of the response
6262
if (event.type === 'error') {
63-
span.setStatus({ code: SPAN_STATUS_ERROR, message: mapAnthropicErrorToStatus(event.error?.type) });
63+
span.setStatus({ code: SPAN_STATUS_ERROR, message: mapAnthropicErrorToStatusMessage(event.error?.type) });
6464
captureException(event.error, {
6565
mechanism: {
6666
handled: false,

packages/core/src/tracing/anthropic-ai/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const ANTHROPIC_ERROR_TYPE_TO_SPAN_STATUS: Record<string, string> = {
5656
* Map an Anthropic API error type to a SpanStatusType value.
5757
* @see https://docs.anthropic.com/en/api/errors#error-shapes
5858
*/
59-
export function mapAnthropicErrorToStatus(errorType: string | undefined): string {
59+
export function mapAnthropicErrorToStatusMessage(errorType: string | undefined): string {
6060
if (!errorType) {
6161
return 'internal_error';
6262
}
@@ -69,7 +69,7 @@ export function mapAnthropicErrorToStatus(errorType: string | undefined): string
6969
*/
7070
export function handleResponseError(span: Span, response: AnthropicAiResponse): void {
7171
if (response.error) {
72-
span.setStatus({ code: SPAN_STATUS_ERROR, message: mapAnthropicErrorToStatus(response.error.type) });
72+
span.setStatus({ code: SPAN_STATUS_ERROR, message: mapAnthropicErrorToStatusMessage(response.error.type) });
7373

7474
captureException(response.error, {
7575
mechanism: {

0 commit comments

Comments
 (0)