Skip to content

docs: document how to exclude URLs from httpx instrumentation#1903

Open
alexmojaki wants to merge 2 commits intomainfrom
claude/slack-session-dBJYT
Open

docs: document how to exclude URLs from httpx instrumentation#1903
alexmojaki wants to merge 2 commits intomainfrom
claude/slack-session-dBJYT

Conversation

@alexmojaki
Copy link
Copy Markdown
Collaborator

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

@alexmojaki alexmojaki force-pushed the claude/slack-session-dBJYT branch from 6661485 to 064d39e Compare May 4, 2026 18:49
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 4, 2026

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

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

View logs

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

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 importing logfire, 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.

Comment thread docs/integrations/http-clients/httpx.md Outdated
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
@alexmojaki alexmojaki force-pushed the claude/slack-session-dBJYT branch from 064d39e to 50945f8 Compare May 4, 2026 18:54
Comment thread docs/plugins/main.py Outdated
- [OpenTelemetry Documentation]({docs_url}#exclude-lists)
"""
if is_http_client:
# http-clients pages already document headers/bodies inline
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

not always true

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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 both integrations/web-frameworks/* and integrations/http-clients/*.
  • Update the otel_docs lookup keys to use full page.file.src_uri paths 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 mentions OTEL_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.

Comment thread docs/plugins/main.py
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]
Comment thread docs/plugins/main.py
@@ -211,12 +217,14 @@ def footer_web_frameworks(markdown: str, page: Page) -> str:
"""
elif not page.file.name == 'wsgi':
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.

3 participants