Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ sentryTest('should capture Supabase authentication errors', async ({ getLocalTes
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
status: 'unknown_error',
status: 'internal_error',
data: expect.objectContaining({
'sentry.op': 'db',
'sentry.origin': 'auto.db.supabase',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ test('API route transaction includes nest pipe span for invalid request', async
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
op: 'middleware.nestjs',
origin: 'auto.middleware.nestjs',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ test('API route transaction includes nest pipe span for invalid request', async
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
op: 'middleware.nestjs',
origin: 'auto.middleware.nestjs',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ test('API route transaction includes nest pipe span for invalid request', async
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
op: 'middleware.nestjs',
origin: 'auto.middleware.nestjs',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ test('API route transaction includes nest pipe span for invalid request', async
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
op: 'middleware.nestjs',
origin: 'auto.middleware.nestjs',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test.describe('Edge runtime', () => {
expect(routehandlerError.tags?.['my-isolated-tag']).toBe(true);
expect(routehandlerError.tags?.['my-global-scope-isolated-tag']).not.toBeDefined();

expect(routehandlerTransaction.contexts?.trace?.status).toBe('unknown_error');
expect(routehandlerTransaction.contexts?.trace?.status).toBe('internal_error');
expect(routehandlerTransaction.contexts?.trace?.op).toBe('http.server');

expect(routehandlerError.exception?.values?.[0].value).toBe('route-handler-edge-error');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('Faulty edge routes', async ({ request }) => {
]);

test.step('should create transactions with the right fields', () => {
expect(edgerouteTransaction.contexts?.trace?.status).toBe('unknown_error');
expect(edgerouteTransaction.contexts?.trace?.status).toBe('internal_error');
expect(edgerouteTransaction.contexts?.trace?.op).toBe('http.server');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test('Faulty middlewares', async ({ request }) => {

await test.step('should record transactions', async () => {
const middlewareTransaction = await middlewareTransactionPromise;
expect(middlewareTransaction.contexts?.trace?.status).toBe('unknown_error');
expect(middlewareTransaction.contexts?.trace?.status).toBe('internal_error');
expect(middlewareTransaction.contexts?.trace?.op).toBe('http.server.middleware');
expect(middlewareTransaction.contexts?.runtime?.name).toBe('vercel-edge');
expect(middlewareTransaction.transaction_info?.source).toBe('url');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ test('Sends an API route transaction for an errored route', async ({ baseURL })
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
measurements: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ test('Sends an API route transaction for an errored route', async ({ baseURL })
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
measurements: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ test('Sends an API route transaction for an errored route', async ({ baseURL })
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
measurements: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ test('Sends an API route transaction for an errored route', async ({ baseURL })
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
status: 'unknown_error',
status: 'internal_error',
measurements: {},
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('should create spans for fs operations that take target argument', async ()
expect.objectContaining({
description: 'fs.readFile',
op: 'file',
status: 'unknown_error',
status: 'internal_error',
data: {
fs_error: expect.stringMatching('ENOENT: no such file or directory,'),
path_argument: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Anthropic integration', () => {
description: 'messages error-model',
op: 'gen_ai.messages',
origin: 'auto.ai.anthropic',
status: 'unknown_error',
status: 'internal_error',
}),
// Third span - token counting (no response.text because recordOutputs=false by default)
expect.objectContaining({
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('Anthropic integration', () => {
description: 'messages error-model',
op: 'gen_ai.messages',
origin: 'auto.ai.anthropic',
status: 'unknown_error',
status: 'internal_error',
}),
// Third span - token counting with PII (response.text is present because sendDefaultPii=true enables recordOutputs)
expect.objectContaining({
Expand Down Expand Up @@ -465,7 +465,7 @@ describe('Anthropic integration', () => {
expect.objectContaining({
description: 'messages invalid-format',
op: 'gen_ai.messages',
status: 'unknown_error',
status: 'internal_error',
data: expect.objectContaining({
'gen_ai.request.model': 'invalid-format',
}),
Expand All @@ -474,7 +474,7 @@ describe('Anthropic integration', () => {
expect.objectContaining({
description: 'models nonexistent-model',
op: 'gen_ai.models',
status: 'unknown_error',
status: 'internal_error',
data: expect.objectContaining({
'gen_ai.request.model': 'nonexistent-model',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('GraphQL/Apollo Tests', () => {
'sentry.origin': 'auto.graphql.otel.graphql',
},
description: 'mutation Mutation',
status: 'unknown_error',
status: 'internal_error',
origin: 'auto.graphql.otel.graphql',
}),
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Google GenAI integration', () => {
description: 'models error-model',
op: 'gen_ai.models',
origin: 'auto.ai.google_genai',
status: 'unknown_error',
status: 'internal_error',
}),
]),
};
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('Google GenAI integration', () => {
description: 'models error-model',
op: 'gen_ai.models',
origin: 'auto.ai.google_genai',
status: 'unknown_error',
status: 'internal_error',
}),
]),
};
Expand Down Expand Up @@ -351,7 +351,7 @@ describe('Google GenAI integration', () => {
description: 'models blocked-model stream-response',
op: 'gen_ai.models',
origin: 'auto.ai.google_genai',
status: 'unknown_error',
status: 'internal_error',
}),
// Fifth span - error handling for streaming
expect.objectContaining({
Expand Down Expand Up @@ -450,7 +450,7 @@ describe('Google GenAI integration', () => {
description: 'models blocked-model stream-response',
op: 'gen_ai.models',
origin: 'auto.ai.google_genai',
status: 'unknown_error',
status: 'internal_error',
}),
// Fifth span - error handling for streaming with PII
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('OpenAI integration', () => {
description: 'chat error-model',
op: 'gen_ai.chat',
origin: 'auto.ai.openai',
status: 'unknown_error',
status: 'internal_error',
}),
// Fourth span - chat completions streaming
expect.objectContaining({
Expand Down Expand Up @@ -219,7 +219,7 @@ describe('OpenAI integration', () => {
description: 'chat error-model',
op: 'gen_ai.chat',
origin: 'auto.ai.openai',
status: 'unknown_error',
status: 'internal_error',
}),
// Fourth span - chat completions streaming with PII
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('postgresjs auto instrumentation', () => {
}),
description: `SELECT * FROM "User" WHERE "email" = '${NON_EXISTING_TEST_EMAIL}'`,
op: 'db',
status: 'unknown_error',
status: 'internal_error',
origin: 'auto.db.otel.postgres',
parent_span_id: expect.any(String),
span_id: expect.any(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ describe('Vercel AI integration', () => {
description: 'generateText',
op: 'gen_ai.invoke_agent',
origin: 'auto.vercelai.otel',
status: 'unknown_error',
status: 'internal_error',
}),
expect.objectContaining({
data: {
Expand Down Expand Up @@ -486,7 +486,7 @@ describe('Vercel AI integration', () => {
description: 'execute_tool getWeather',
op: 'gen_ai.execute_tool',
origin: 'auto.vercelai.otel',
status: 'unknown_error',
status: 'internal_error',
}),
]),

Expand Down Expand Up @@ -563,7 +563,7 @@ describe('Vercel AI integration', () => {
description: 'generateText',
op: 'gen_ai.invoke_agent',
origin: 'auto.vercelai.otel',
status: 'unknown_error',
status: 'internal_error',
}),
expect.objectContaining({
data: {
Expand Down Expand Up @@ -607,7 +607,7 @@ describe('Vercel AI integration', () => {
description: 'execute_tool getWeather',
op: 'gen_ai.execute_tool',
origin: 'auto.vercelai.otel',
status: 'unknown_error',
status: 'internal_error',
}),
]),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ describe('Vercel AI integration (V5)', () => {
description: 'execute_tool getWeather',
op: 'gen_ai.execute_tool',
origin: 'auto.vercelai.otel',
status: 'unknown_error',
status: 'internal_error',
}),
]),
};
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/tracing/spanstatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const SPAN_STATUS_ERROR = 2;
* Converts a HTTP status code into a sentry status with a message.
*
* @param httpStatus The HTTP response status code.
* @returns The span status or unknown_error.
* @returns The span status or internal_error.
*/
// https://develop.sentry.dev/sdk/event-payloads/span/
export function getSpanStatusFromHttpCode(httpStatus: number): SpanStatus {
Expand Down Expand Up @@ -51,7 +51,7 @@ export function getSpanStatusFromHttpCode(httpStatus: number): SpanStatus {
}
}

return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
return { code: SPAN_STATUS_ERROR, message: 'internal_error' };
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/anthropic-ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function addPrivateRequestAttributes(span: Span, params: Record<string, unknown>
*/
function handleResponseError(span: Span, response: AnthropicAiResponse): void {
if (response.error) {
span.setStatus({ code: SPAN_STATUS_ERROR, message: response.error.type || 'unknown_error' });
span.setStatus({ code: SPAN_STATUS_ERROR, message: response.error.type || 'internal_error' });

captureException(response.error, {
mechanism: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/anthropic-ai/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function isErrorEvent(event: AnthropicAiStreamingEvent, span: Span): boolean {
// If the event is an error, set the span status and capture the error
// These error events are not rejected by the API by default, but are sent as metadata of the response
if (event.type === 'error') {
span.setStatus({ code: SPAN_STATUS_ERROR, message: event.error?.type ?? 'unknown_error' });
span.setStatus({ code: SPAN_STATUS_ERROR, message: event.error?.type ?? 'internal_error' });
captureException(event.error, {
mechanism: {
handled: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/spanUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export function getStatusMessage(status: SpanStatus | undefined): string | undef
return 'ok';
}

return status.message || 'unknown_error';
return status.message || 'internal_error';
}

const CHILD_SPANS_FIELD = '_sentryChildSpans';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/lib/tracing/spanstatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ describe('setHttpStatus', () => {
expect(data).toMatchObject({ 'http.response.status_code': code });
});

it("doesn't set the status for an unknown http status code", () => {
it('defaults to internal_error', () => {
const span = new SentrySpan({ name: 'test' });

setHttpStatus(span, 600);

const { status: spanStatus, data } = spanToJSON(span);

expect(spanStatus).toBeUndefined();
expect(spanStatus).toBe('internal_error');
expect(data).toMatchObject({ 'http.response.status_code': 600 });
});
});
2 changes: 1 addition & 1 deletion packages/node/src/integrations/tracing/postgresjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class PostgresJsInstrumentation extends InstrumentationBase<PostgresJsIns
code: SPAN_STATUS_ERROR,
// This message is the error message from the rejectArgs, when available
// e.g "relation 'User' does not exist"
message: rejectArgs?.[0]?.message || 'unknown_error',
message: rejectArgs?.[0]?.message || 'internal_error',
});

const result = Reflect.apply(rejectTarget, rejectThisArg, rejectArgs);
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry/src/utils/mapStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function mapStatus(span: AbstractSpan): SpanStatus {
if (status.message && isStatusErrorMessageValid(status.message)) {
return { code: SPAN_STATUS_ERROR, message: status.message };
} else {
return { code: SPAN_STATUS_ERROR, message: 'unknown_error' };
return { code: SPAN_STATUS_ERROR, message: 'internal_error' };
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry/test/utils/mapStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('mapStatus', () => {
[501, undefined, { code: SPAN_STATUS_ERROR, message: 'unimplemented' }],
[503, undefined, { code: SPAN_STATUS_ERROR, message: 'unavailable' }],
[504, undefined, { code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' }],
[999, undefined, { code: SPAN_STATUS_ERROR, message: 'unknown_error' }],
[999, undefined, { code: SPAN_STATUS_ERROR, message: 'internal_error' }],

// grpc codes
[undefined, '1', { code: SPAN_STATUS_ERROR, message: 'cancelled' }],
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('mapStatus', () => {
it('returns error status when span already has error status without message', () => {
const span = createSpan('test-span');
span.setStatus({ code: 2 }); // ERROR
expect(mapStatus(span)).toEqual({ code: SPAN_STATUS_ERROR, message: 'unknown_error' });
expect(mapStatus(span)).toEqual({ code: SPAN_STATUS_ERROR, message: 'internal_error' });
});

it('infers error status form attributes when span already has error status without message', () => {
Expand Down