Reading traceparent from request headers
In my API when testing passing traceparent via request headers, the traceparent header was not being picked up and subsequently a new one was being generated.
It appears to be that when __call__ is triggered (Due to a request) in the ASGITracingMiddleware the headers are read as bytes rather than a string and as a result when attempting to match the header name in the headers it will evaulate as false, resulting in None being returned. Here is the code i'm referring to - https://github.com/elastic/apm-agent-python/blob/main/elasticapm/utils/disttracing.py#L142
Not sure if this is intentional or not, and if so if there's any workarounds here, I've not found anything in your docs with regards to configuration at least 🤔
In my API I am using ASGITracingMiddleware for a quart application.
Please let me know if you need anymore information
@matHope thanks for reporting, what http header are you passing to the quart app?
Its "traceparent" with whatever traceparentId you'd like to provide
It appears to be that when call is triggered (Due to a request) in the ASGITracingMiddleware the headers are read as bytes rather than a string and as a result when attempting to match the header name in the headers it will evaulate as false, resulting in None being returned. Here is the code i'm referring to - https://github.com/elastic/apm-agent-python/blob/main/elasticapm/utils/disttracing.py#L142
That was it, good analysis!