Repository navigation
Allow instrumenting a single httpx client, fix tests for OTel 1.28 - #575
Conversation
Deploying logfire-docs with
|
| Latest commit: |
a85e4c4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1340ee60.logfire-docs.pages.dev |
| Branch Preview URL: | https://alex-otel-1-28.logfire-docs.pages.dev |
|
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? |
| 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.
Pyright was failing to parse this file because of the emojis: microsoft/pyright#9412
There was a problem hiding this comment.
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 |
| name = "logfire" | ||
| version = "2.1.2" | ||
| description = "The best Python observability tool! 🪵🔥" | ||
| description = "The best Python observability tool!" |
Kludex
left a comment
There was a problem hiding this comment.
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.