Skip to content

Commit

Permalink
Add tags + data passing functionality to @ai_track (#3071)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Pirker <anton.pirker@sentry.io>
  • Loading branch information
colin-sentry and antonpirker authored May 15, 2024
1 parent 0d7a6f7 commit 06efff3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sentry_sdk/ai/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ def wrapped(*args, **kwargs):
# type: (Any, Any) -> Any
curr_pipeline = _ai_pipeline_name.get()
op = span_kwargs.get("op", "ai.run" if curr_pipeline else "ai.pipeline")

with start_span(description=description, op=op, **span_kwargs) as span:
for k, v in kwargs.pop("sentry_tags", {}).items():
span.set_tag(k, v)
for k, v in kwargs.pop("sentry_data", {}).items():
span.set_data(k, v)
if curr_pipeline:
span.set_data("ai.pipeline.name", curr_pipeline)
return f(*args, **kwargs)
Expand Down

0 comments on commit 06efff3

Please sign in to comment.