Skip to content

Commit d787b6b

Browse files
committed
Add a new opcode for top level langchain runs
1 parent 4ee01ec commit d787b6b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sentry_sdk/consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ class OP:
342342
MIDDLEWARE_STARLITE_SEND = "middleware.starlite.send"
343343
OPENAI_CHAT_COMPLETIONS_CREATE = "ai.chat_completions.create.openai"
344344
OPENAI_EMBEDDINGS_CREATE = "ai.embeddings.create.openai"
345+
LANGCHAIN_PIPELINE = "ai.pipeline.langchain"
345346
LANGCHAIN_RUN = "ai.run.langchain"
346347
LANGCHAIN_TOOL = "ai.tool.langchain"
347348
LANGCHAIN_AGENT = "ai.agent.langchain"

sentry_sdk/integrations/langchain.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,11 @@ def on_chain_start(self, serialized, inputs, *, run_id, **kwargs):
275275
span = self._create_span(
276276
run_id,
277277
kwargs.get("parent_run_id"),
278-
op=OP.LANGCHAIN_RUN,
278+
op=(
279+
OP.LANGCHAIN_RUN
280+
if kwargs.get("parent_run_id") is not None
281+
else OP.LANGCHAIN_PIPELINE
282+
),
279283
description=kwargs.get("name") or "Chain execution",
280284
)
281285
metadata = kwargs.get("metadata")

0 commit comments

Comments
 (0)