Skip to content

Commit 21bce41

Browse files
authored
Merge branch 'main' into emf_metrics_enable
2 parents bfb8956 + 04b72bb commit 21bce41

File tree

14 files changed

+3937
-323
lines changed

14 files changed

+3937
-323
lines changed

.github/workflows/release-lambda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
aws_region:
1010
description: 'Deploy to aws regions'
1111
required: true
12-
default: 'us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1, af-south-1, ap-east-1, ap-south-2, ap-southeast-3, ap-southeast-4, eu-central-2, eu-south-1, eu-south-2, il-central-1, me-central-1, me-south-1'
12+
default: 'us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1, af-south-1, ap-east-1, ap-south-2, ap-southeast-3, ap-southeast-4, eu-central-2, eu-south-1, eu-south-2, il-central-1, me-central-1, me-south-1, ap-southeast-5, ap-southeast-7, mx-central-1, ca-west-1, cn-north-1, cn-northwest-1'
1313

1414
env:
1515
COMMERCIAL_REGIONS: us-east-1, us-east-2, us-west-1, us-west-2, ap-south-1, ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, eu-north-1, sa-east-1, ap-southeast-5, ap-southeast-7, mx-central-1, ca-west-1, cn-north-1, cn-northwest-1

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,17 @@ def _export_unsampled_span_for_lambda(trace_provider: TracerProvider, resource:
288288
)
289289

290290

291+
def _export_unsampled_span_for_agent_observability(trace_provider: TracerProvider, resource: Resource = None):
292+
if not is_agent_observability_enabled():
293+
return
294+
295+
traces_endpoint = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT)
296+
297+
span_exporter = OTLPAwsSpanExporter(endpoint=traces_endpoint, logger_provider=get_logger_provider())
298+
299+
trace_provider.add_span_processor(BatchUnsampledSpanProcessor(span_exporter=span_exporter))
300+
301+
291302
def _is_defer_to_workers_enabled():
292303
return os.environ.get(OTEL_AWS_PYTHON_DEFER_TO_WORKERS_ENABLED_CONFIG, "false").strip().lower() == "true"
293304

@@ -431,9 +442,14 @@ def _customize_span_processors(provider: TracerProvider, resource: Resource) ->
431442
if _is_lambda_environment():
432443
provider.add_span_processor(AwsLambdaSpanProcessor())
433444

445+
# We always send 100% spans to Genesis platform for agent observability because
446+
# AI applications typically have low throughput traffic patterns and require
447+
# comprehensive monitoring to catch subtle failure modes like hallucinations
448+
# and quality degradation that sampling could miss.
434449
# Add session.id baggage attribute to span attributes to support AI Agent use cases
435450
# enabling session ID tracking in spans.
436451
if is_agent_observability_enabled():
452+
_export_unsampled_span_for_agent_observability(provider, resource)
437453

438454
def session_id_predicate(baggage_key: str) -> bool:
439455
return baggage_key == "session.id"

0 commit comments

Comments
 (0)