Skip to content

Commit acf2929

Browse files
committed
add op to attributes
1 parent 0798558 commit acf2929

File tree

1 file changed

+17
-5
lines changed
  • packages/core/src/utils/langchain

1 file changed

+17
-5
lines changed

packages/core/src/utils/langchain/index.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { captureException } from '../../exports';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes';
33
import { SPAN_STATUS_ERROR } from '../../tracing';
44
import { startSpanManual } from '../../tracing/trace';
55
import type { Span, SpanAttributeValue } from '../../types-hoist/span';
@@ -97,7 +97,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
9797
{
9898
name: `${operationName} ${modelName}`,
9999
op: 'gen_ai.pipeline',
100-
attributes,
100+
attributes: {
101+
...attributes,
102+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.pipeline',
103+
},
101104
},
102105
span => {
103106
spanMap.set(runId, span);
@@ -130,7 +133,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
130133
{
131134
name: `${operationName} ${modelName}`,
132135
op: 'gen_ai.chat',
133-
attributes,
136+
attributes: {
137+
...attributes,
138+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat',
139+
},
134140
},
135141
span => {
136142
spanMap.set(runId, span);
@@ -204,7 +210,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
204210
{
205211
name: `chain ${chainName}`,
206212
op: 'gen_ai.invoke_agent',
207-
attributes,
213+
attributes: {
214+
...attributes,
215+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.invoke_agent',
216+
},
208217
},
209218
span => {
210219
spanMap.set(runId, span);
@@ -273,7 +282,10 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
273282
{
274283
name: `execute_tool ${toolName}`,
275284
op: 'gen_ai.execute_tool',
276-
attributes,
285+
attributes: {
286+
...attributes,
287+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.execute_tool',
288+
},
277289
},
278290
span => {
279291
spanMap.set(runId, span);

0 commit comments

Comments
 (0)