docs: document how to exclude URLs from httpx instrumentation#1903
Open
alexmojaki wants to merge 2 commits intomainfrom
Open
docs: document how to exclude URLs from httpx instrumentation#1903alexmojaki wants to merge 2 commits intomainfrom
alexmojaki wants to merge 2 commits intomainfrom
Conversation
6661485 to
064d39e
Compare
Deploying logfire-docs with
|
| Latest commit: |
60c671d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://98b5b539.logfire-docs.pages.dev |
| Branch Preview URL: | https://claude-slack-session-dbjyt.logfire-docs.pages.dev |
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 5/5
- This looks low risk to merge: the only finding is a documentation wording issue with low severity (3/10) and moderate confidence, not a runtime code defect.
- In
docs/integrations/http-clients/httpx.md, the guidance is slightly over-restrictive; excluded-URL env vars need to be set before HTTPX instrumentation initializes, rather than strictly before importinglogfire, which could otherwise mislead setup timing. - Pay close attention to
docs/integrations/http-clients/httpx.md- clarify initialization timing so users don’t apply unnecessary import-order constraints.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/integrations/http-clients/httpx.md">
<violation number="1" location="docs/integrations/http-clients/httpx.md:212">
P3: The note is too strict: excluded-URL env vars need to be set before HTTPX instrumentation is initialized, not necessarily before importing `logfire`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Extend the footer plugin (previously only handling web-frameworks) to also append the "Excluding URLs from instrumentation" section to http-clients pages (httpx, requests, aiohttp client). This documents that the OTEL_PYTHON_EXCLUDED_URLS / OTEL_PYTHON_<NAME>_EXCLUDED_URLS env vars work for httpx and other HTTP clients. https://pydantic.slack.com/archives/C0813FX362E/p1777920240120479?thread_ts=1777908609.723969&cid=C0813FX362E https://claude.ai/code/session_014EHscpJJvgG55uWiXDc9Ex
064d39e to
50945f8
Compare
alexmojaki
commented
May 4, 2026
| - [OpenTelemetry Documentation]({docs_url}#exclude-lists) | ||
| """ | ||
| if is_http_client: | ||
| # http-clients pages already document headers/bodies inline |
requests.md doesn't actually document headers/bodies inline, so the justification comment was inaccurate. The behavior is still correct: the linked headers anchor is server-specific. https://claude.ai/code/session_014EHscpJJvgG55uWiXDc9Ex
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the MkDocs plugin that post-processes integration pages to append a standardized documentation footer about excluding URLs from OpenTelemetry instrumentation, expanding it to cover HTTP client integrations (e.g., HTTPX) in addition to web frameworks.
Changes:
- Replace the web-framework-only footer with a new
footer_excluded_urls_and_headers()that applies to bothintegrations/web-frameworks/*andintegrations/http-clients/*. - Update the
otel_docslookup keys to use fullpage.file.src_uripaths and add OTel doc links for HTTP client integrations. - For HTTP client pages, append only the “Excluding URLs from instrumentation” section (omit the headers-capture section intended for server frameworks).
Comments suppressed due to low confidence (1)
docs/plugins/main.py:210
- The injected "Excluding URLs from instrumentation" section doesn't actually explain how to use
OTEL_PYTHON_EXCLUDED_URLS/OTEL_PYTHON_HTTPX_EXCLUDED_URLS; it only links to the web-frameworks quick guide (which uses a FastAPI-specific example) and to upstream OTel docs. If the goal is to document HTTPX exclusions on the HTTP client pages, consider adding a short, client-focused sentence here (or linking to a more generic config page) that explicitly mentionsOTEL_PYTHON_HTTPX_EXCLUDED_URLS.
exclude_lists = """
## Excluding URLs from instrumentation
- [Quick guide](../web-frameworks/index.md#excluding-urls-from-instrumentation)
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| is_http_client = page.file.src_uri.startswith('integrations/http-clients/') | ||
| if not (is_web_framework or is_http_client): | ||
| return markdown | ||
| docs_url = otel_docs[page.file.src_uri] |
| @@ -211,12 +217,14 @@ def footer_web_frameworks(markdown: str, page: Page) -> str: | |||
| """ | |||
| elif not page.file.name == 'wsgi': | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a section explaining how to use OTEL_PYTHON_EXCLUDED_URLS and OTEL_PYTHON_HTTPX_EXCLUDED_URLS environment variables to exclude certain domains/URLs from httpx instrumentation.
https://claude.ai/code/session_014EHscpJJvgG55uWiXDc9Ex