-
Notifications
You must be signed in to change notification settings - Fork 555
Open
Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.33.0
Steps to Reproduce
import os
import sentry_sdk
from langchain_aws import ChatBedrockConverse
from sentry_sdk.ai.monitoring import ai_track
from sentry_sdk.integrations.langchain import LangchainIntegration
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
environment="localhost",
traces_sample_rate=1.0,
integrations=[LangchainIntegration()],
)
@ai_track("Bug demo", op="ai.run")
def run_llm():
llm = ChatBedrockConverse(
region_name="eu-west-1",
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
model="eu.amazon.nova-lite-v1:0",
max_tokens=1,
)
llm.invoke('hello')
if __name__ == "__main__":
run_llm()
Expected Result
The llm call is traced with "ai.run"
operation name
Actual Result
Traceback (most recent call last):
File ".../sentry_bug.py", line 29, in <module>
run_llm()
File ".../.venv/lib/python3.12/site-packages/sentry_sdk/ai/monitoring.py", line 37, in sync_wrapped
with start_span(name=description, op=op, **span_kwargs) as span:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sentry_sdk.api.start_span() got multiple values for keyword argument 'op'
The issue is caused in the following code:
sentry-python/sentry_sdk/ai/monitoring.py
Lines 35 to 37 in 34dcba4
op = span_kwargs.get("op", "ai.run" if curr_pipeline else "ai.pipeline") | |
with start_span(name=description, op=op, **span_kwargs) as span: |
Metadata
Metadata
Assignees
Type
Projects
Status
Waiting for: Product Owner