Skip to content

Commit 0d02060

Browse files
committed
update to more detailed errors name
1 parent 6a847b6 commit 0d02060

File tree

1 file changed

+11
-2
lines changed
  • packages/core/src/utils/anthropic-ai

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getCurrentScope } from '../../currentScopes';
22
import { captureException } from '../../exports';
3+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes';
34
import { startSpan } from '../../tracing/trace';
45
import type { Span, SpanAttributeValue } from '../../types-hoist/span';
56
import {
@@ -28,14 +29,14 @@ import type {
2829
AnthropicAiResponse,
2930
} from './types';
3031
import { shouldInstrument } from './utils';
31-
3232
/**
3333
* Extract request attributes from method arguments
3434
*/
3535
function extractRequestAttributes(args: unknown[], methodPath: string): Record<string, unknown> {
3636
const attributes: Record<string, unknown> = {
3737
[GEN_AI_SYSTEM_ATTRIBUTE]: 'anthropic',
3838
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: getFinalOperationName(methodPath),
39+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.anthropic',
3940
};
4041

4142
if (args.length > 0 && typeof args[0] === 'object' && args[0] !== null) {
@@ -168,7 +169,15 @@ function instrumentMethod<T extends unknown[], R>(
168169
addResponseAttributes(span, result, finalOptions.recordOutputs);
169170
return result;
170171
} catch (error) {
171-
captureException(error);
172+
captureException(error, {
173+
mechanism: {
174+
handled: false,
175+
},
176+
type: 'auto.ai.anthropic',
177+
data: {
178+
function: methodPath,
179+
},
180+
});
172181
throw error;
173182
}
174183
},

0 commit comments

Comments
 (0)