Skip to content

Commit b1267cf

Browse files
committed
Inline GenAI direct child check
1 parent 705c26a commit b1267cf

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_gen_ai/sampler/http_drop_sampler.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ def should_sample(
3636
trace_state: TraceState = None,
3737
) -> SamplingResult:
3838
gen_ai_span_context = otel_context.get_value(_GEN_AI_SPAN_CONTEXT_KEY, parent_context)
39-
is_direct_gen_ai_child = (
40-
gen_ai_span_context is not None
41-
and trace.get_current_span(parent_context).get_span_context() == gen_ai_span_context
42-
)
4339
if (
4440
kind == SpanKind.CLIENT
45-
and is_direct_gen_ai_child
41+
and gen_ai_span_context is not None
42+
and trace.get_current_span(parent_context).get_span_context() == gen_ai_span_context
4643
and any(
4744
key in (attributes or {}) for key in (SpanAttributes.HTTP_REQUEST_METHOD, SpanAttributes.HTTP_METHOD)
4845
)

0 commit comments

Comments
 (0)