-
Notifications
You must be signed in to change notification settings - Fork 78
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
Allow instrumenting a single httpx client, fix tests for OTel 1.28 #575
Conversation
Deploying logfire-docs with Cloudflare Pages
|
The failure is a key error here: @pytest.mark.anyio
async def test_httpx_instrumentation(exporter: TestExporter):
# The purpose of this mock transport is to ensure that the traceparent header is provided
# without needing to actually make a network request
def handler(request: Request):
return httpx.Response(200, headers=request.headers)
transport = httpx.MockTransport(handler)
with logfire.span('test span') as span:
assert span.context
trace_id = span.context.trace_id
with httpx.Client(transport=transport) as client:
response = client.get('https://example.org/')
# Validation of context propagation: ensure that the traceparent header contains the trace ID
print(list(response.headers.keys()))
> traceparent_header = response.headers['traceparent'] It looks like the |
Could this be related to #529? |
@@ -5,7 +5,7 @@ build-backend = "hatchling.build" | |||
[project] | |||
name = "logfire" | |||
version = "2.1.2" | |||
description = "The best Python observability tool! 🪵🔥" | |||
description = "The best Python observability tool!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pyright was failing to parse this file because of the emojis: microsoft/pyright#9412
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is closed, upgrading pyright should allow reverting this.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #575 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 133 133
Lines 10257 10263 +6
Branches 1399 1399
=========================================
+ Hits 10257 10263 +6 ☔ View full report in Codecov by Sentry. |
Yes, OTEL fixed #529, and in the process that broke tests, but in a test-specific way. They now patch the |
@@ -5,7 +5,7 @@ build-backend = "hatchling.build" | |||
[project] | |||
name = "logfire" | |||
version = "2.1.2" | |||
description = "The best Python observability tool! 🪵🔥" | |||
description = "The best Python observability tool!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to test with AsyncClient
as well?
But all good. Thanks.
I've created #581 to document this. I can handle that. 👍 |
No description provided.