|
1 | 1 | import { captureException } from '../../exports'; |
2 | | -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; |
| 2 | +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; |
3 | 3 | import { SPAN_STATUS_ERROR } from '../../tracing'; |
4 | 4 | import { startSpanManual } from '../../tracing/trace'; |
5 | 5 | import type { Span, SpanAttributeValue } from '../../types-hoist/span'; |
@@ -97,7 +97,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): |
97 | 97 | { |
98 | 98 | name: `${operationName} ${modelName}`, |
99 | 99 | op: 'gen_ai.pipeline', |
100 | | - attributes, |
| 100 | + attributes: { |
| 101 | + ...attributes, |
| 102 | + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.pipeline', |
| 103 | + }, |
101 | 104 | }, |
102 | 105 | span => { |
103 | 106 | spanMap.set(runId, span); |
@@ -130,7 +133,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): |
130 | 133 | { |
131 | 134 | name: `${operationName} ${modelName}`, |
132 | 135 | op: 'gen_ai.chat', |
133 | | - attributes, |
| 136 | + attributes: { |
| 137 | + ...attributes, |
| 138 | + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', |
| 139 | + }, |
134 | 140 | }, |
135 | 141 | span => { |
136 | 142 | spanMap.set(runId, span); |
@@ -204,7 +210,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): |
204 | 210 | { |
205 | 211 | name: `chain ${chainName}`, |
206 | 212 | op: 'gen_ai.invoke_agent', |
207 | | - attributes, |
| 213 | + attributes: { |
| 214 | + ...attributes, |
| 215 | + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.invoke_agent', |
| 216 | + }, |
208 | 217 | }, |
209 | 218 | span => { |
210 | 219 | spanMap.set(runId, span); |
@@ -273,7 +282,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): |
273 | 282 | { |
274 | 283 | name: `execute_tool ${toolName}`, |
275 | 284 | op: 'gen_ai.execute_tool', |
276 | | - attributes, |
| 285 | + attributes: { |
| 286 | + ...attributes, |
| 287 | + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.execute_tool', |
| 288 | + }, |
277 | 289 | }, |
278 | 290 | span => { |
279 | 291 | spanMap.set(runId, span); |
|
0 commit comments