Skip to content

Conversation

@liustve
Copy link
Contributor

@liustve liustve commented Aug 29, 2025

Description of changes:
Starlette Instrumentor utilizes the OpenTelemetryMiddleware instrumentation to capture all events generated by ASGI Request received, Response headers sent (http.response.start), Response body sent (http.response.body) which leads to a lot of span noises for streaming events:
image

Luckily, the upstream OpenTelemetryMiddleware provides a configuration in the constructor to suppress these instrumentations: https://github.com/open-telemetry/opentelemetry-python-contrib/blob/51da0a766e5d3cbc746189e10c9573163198cfcd/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py#L573

Enabling this for Agent Observability to help filter out noise.
image

Related issue for removing the need for this patch in the long term, using the proposed OTEL_PYTHON_STARLETTE_EXCLUDED_SPANS environment variable:
open-telemetry/opentelemetry-python-contrib#3725

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@liustve liustve requested a review from a team as a code owner August 29, 2025 00:24
@liustve liustve changed the title Remove http receive/send spans from Starlette Instrumentor Suppress http receive/send spans from Starlette Instrumentor for Agent Observability Aug 29, 2025
@liustve liustve force-pushed the suppress-starlette branch from 7d07715 to 1e35cc6 Compare August 29, 2025 19:56
@liustve liustve merged commit 8fd3f21 into main Sep 15, 2025
21 of 22 checks passed
@liustve liustve deleted the suppress-starlette branch September 15, 2025 17:06
wangzlei pushed a commit to aws-observability/application-signals-demo that referenced this pull request Oct 2, 2025
…nt (#155)

*Description of changes:*
- The latest ADOT release includes a fix to suppress noisy POST
/invocations spans. Updating the requirements.txt to use this version
helps reduce the volume of these spans. ref:
aws-observability/aws-otel-python-instrumentation#464

- Modify the traffic generator to generate and include a SESSION_ID in
the InvokeAgent call, following the best practices outlined by the
Bedrock AgentCore runtime. ref:
https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-invoke-agent.html#runtime-invoke-session-management

- Specify the region when creating the boto3 Bedrock AgentCore client,
as it is a required parameter.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants