Skip to content

Commit c3584ab

Browse files
LuizDMMnirga
andauthored
fix(sagemaker): add should_send_prompts checks (#3072)
Co-authored-by: Nir Gazit <[email protected]>
1 parent 3745161 commit c3584ab

File tree

1 file changed

+4
-3
lines changed
  • packages/opentelemetry-instrumentation-sagemaker/opentelemetry/instrumentation/sagemaker

1 file changed

+4
-3
lines changed

packages/opentelemetry-instrumentation-sagemaker/opentelemetry/instrumentation/sagemaker/span_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22

3+
from opentelemetry.instrumentation.sagemaker.utils import should_send_prompts
34
from opentelemetry.semconv_ai import (
45
SpanAttributes,
56
)
@@ -25,7 +26,7 @@ def _set_span_attribute(span, name, value):
2526

2627

2728
def set_stream_response_attributes(span, response_body):
28-
if not span.is_recording():
29+
if not span.is_recording() or not should_send_prompts():
2930
return
3031

3132
_set_span_attribute(
@@ -42,7 +43,7 @@ def set_call_span_attributes(span, kwargs, response):
4243

4344

4445
def set_call_request_attributes(span, kwargs):
45-
if not span.is_recording():
46+
if not span.is_recording() or not should_send_prompts():
4647
return
4748

4849
raw_request = kwargs.get("Body")
@@ -53,7 +54,7 @@ def set_call_request_attributes(span, kwargs):
5354

5455

5556
def set_call_response_attributes(span, raw_response):
56-
if not span.is_recording():
57+
if not span.is_recording() or not should_send_prompts():
5758
return
5859
response_body = _try_parse_json(raw_response)
5960

0 commit comments

Comments
 (0)