Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpx: support capture_headers #719

Merged
merged 6 commits into from
Dec 23, 2024
Merged

httpx: support capture_headers #719

merged 6 commits into from
Dec 23, 2024

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Dec 23, 2024

No description provided.

Copy link

cloudflare-workers-and-pages bot commented Dec 23, 2024

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c7f89f1
Status: ✅  Deploy successful!
Preview URL: https://a695e569.logfire-docs.pages.dev
Branch Preview URL: https://document-httpx-integration.logfire-docs.pages.dev

View logs

Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0d21837) to head (c7f89f1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #719   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          137       138    +1     
  Lines        11059     11088   +29     
  Branches      1546      1548    +2     
=========================================
+ Hits         11059     11088   +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


import httpx
import opentelemetry.sdk.trace

from logfire.integrations.httpx import (
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this under TYPE_CHECKING so that the except ImportError: will still work if logfire.integrations.httpx starts importing from otel

Copy link
Member Author

Choose a reason for hiding this comment

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

It still works like this, cause httpx is supposed to be installed here, and opentelemetry.trace as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm referring to this:

# TODO(Marcelo): When https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3098/ gets merged,
# and the next version of `opentelemetry-instrumentation-httpx` is released, we can just do a reimport:
# from opentelemetry.instrumentation.httpx import RequestInfo as RequestInfo
# from opentelemetry.instrumentation.httpx import ResponseInfo as ResponseInfo
# from opentelemetry.instrumentation.httpx import RequestHook as RequestHook
# from opentelemetry.instrumentation.httpx import ResponseHook as ResponseHook

Copy link
Member Author

Choose a reason for hiding this comment

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

got it

logfire/_internal/integrations/httpx.py Outdated Show resolved Hide resolved
logfire/_internal/main.py Show resolved Hide resolved
@Kludex Kludex requested a review from alexmojaki December 23, 2024 13:19
@Kludex
Copy link
Member Author

Kludex commented Dec 23, 2024

ah, you approved.

I've applied all comments

@Kludex Kludex enabled auto-merge (squash) December 23, 2024 13:20
@Kludex Kludex merged commit 4963b14 into main Dec 23, 2024
17 checks passed
@Kludex Kludex deleted the document-httpx-integration branch December 23, 2024 13:31
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