Skip to content

Add excluded_urls to OpenTelemetryMiddleware - #3463

Merged
Kludex merged 12 commits into
mainfrom
add-opentelemetry-excluded-urls
Aug 23, 2026
Merged

Kludex merged 12 commits into
mainfrom
add-opentelemetry-excluded-urls

Conversation

@Kludex

@Kludex Kludex commented Aug 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add an excluded_urls parameter to OpenTelemetryMiddleware
  • accept a sequence of regular expressions or a comma-separated string
  • compile each expression once when constructing the middleware
  • skip spans when an expression matches the full request URL
  • document exclusions for health checks and similar endpoints

Validation

  • ./scripts/check
  • uv run pytest tests/middleware/test_opentelemetry.py

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

@Kludex
Kludex deployed to cloudflare August 23, 2026 06:59 — with GitHub Actions Active
@github-actions

github-actions Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d4f7dea7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread starlette/middleware/opentelemetry.py
@Kludex
Kludex deployed to cloudflare August 23, 2026 07:03 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 07:07 — with GitHub Actions Active
@codspeed

codspeed Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 20.24%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 241 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation test_multipart[file-512KiB] 3.4 ms 4.3 ms -20.24%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing add-opentelemetry-excluded-urls (e5d9445) with main (3b0bc1d)

Open in CodSpeed

@Kludex

Kludex commented Aug 23, 2026 •

Copy link
Copy Markdown
Owner Author

The branch includes the benchmark normalization from #3464, and I reran its benchmark job. CodSpeed still reports one unrelated multipart regression while comparing an AMD EPYC 7763 runner against an Intel Xeon Platinum 8370C runner. The branch diff only contains OpenTelemetry middleware, tests, and documentation, so there is no source change to make; this result needs to be acknowledged as infrastructure noise.

@Kludex
Kludex deployed to cloudflare August 23, 2026 08:15 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 08:19 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 08:26 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 08:31 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 13:21 — with GitHub Actions Active
@Kludex Kludex changed the title Allow excluding URLs from OpenTelemetry tracing Add exclude_urls to OpenTelemetryMiddleware Aug 23, 2026
@Kludex
Kludex deployed to cloudflare August 23, 2026 14:07 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 16:30 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 20:00 — with GitHub Actions Active
@Kludex
Kludex deployed to cloudflare August 23, 2026 20:22 — with GitHub Actions Active
@Kludex Kludex changed the title Add exclude_urls to OpenTelemetryMiddleware Add excluded_urls to OpenTelemetryMiddleware Aug 23, 2026
@Kludex
Kludex merged commit 04d7869 into main Aug 23, 2026
14 checks passed
@Kludex
Kludex deleted the add-opentelemetry-excluded-urls branch August 23, 2026 20:24

This branch was successfully deployed

1 active deployment
cloudflare — e5d9445b Deployed Aug 23, 2026 by Kludex via Docs preview (Cloudflare) #1072
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.

1 participant