switch opentelemetry span names for litestar from `/some/resource/123…#130
switch opentelemetry span names for litestar from `/some/resource/123…#130vrslev merged 4 commits intocommunity-of-python:mainfrom
Conversation
…` to `/some/resource/{resource_id}`
|
It would be nice to see some tests. |
|
I think this kind of stuff should be done in Litestar itself though |
Looks like it is more OpenTelemetry staff like FastAPI or Django instrumentation. But there is no Litestar instrumentation for OpenTelemetry yet. Also I'm not sure, that this is excellent span name builder for any Litestar user, looks like this is more our vision of right span names. Decision for everybody must be more flexible and generic and I have no time to implement it right now. |
|
Method in span name is not compliant to the spec: open-telemetry/opentelemetry-python-contrib#3769 |
|
let's remove methods from span names, and merge) |
|
Privately chatted, decided to keep the method in span name |
In the base scenario open telemetry use scope.path as span.name param. But for endpoints with some id as a part of the route (for example
/some/resource/123) there will be a span for every resource_id. First of all, that will be a problem for analytic of your spans. But the second one, it will garbage your span collector with unlimited span names. That's why this PR switch opentelemetry span names for litestar from/some/resource/123to/some/resource/{resource_id}.