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

http.target missing from Django duration metric attributes in old semconv #2745

Closed
alexmojaki opened this issue Jul 26, 2024 · 2 comments · Fixed by #2746
Closed

http.target missing from Django duration metric attributes in old semconv #2745

alexmojaki opened this issue Jul 26, 2024 · 2 comments · Fixed by #2746
Assignees

Comments

@alexmojaki
Copy link
Contributor

In #2624 I added the http.target attribute to duration metrics. In #2714 by @lzchen it was accidentally removed when not opted in to the new semconv. This can be seen by adding print(point.attributes["http.target"]) here:

if isinstance(point, HistogramDataPoint):
self.assertEqual(point.count, 3)
histrogram_data_point_seen = True
self.assertAlmostEqual(
duration, point.sum, delta=100
)

Adding SpanAttributes.HTTP_TARGET to _server_duration_attrs_old fixes this particular case but breaks others, e.g. http.target starts appearing in starlette metrics with high cardinality values (i.e. the actual path, not the template).

I strongly suggest that these tests assert the actual concrete values of the metrics data as much as possible. Right now they're very lenient and tied to the implementation which allowed this regression to pass through.

@lzchen
Copy link
Contributor

lzchen commented Jul 26, 2024

@alexmojaki

Apologies for the oversight. The instrumentations today support multiple "old" conventions (e.g. most instrumentations support v1.11 but others support v1.20 and others have a mixture of different attributes). In order to better consolidate the old semconvs and encourage migration to new semconv, we have decided to discourage adding any contributions for "old" semconv. This and this were made exceptions and the regression only occurred for django because we just happened to be working on the same change at similar times :). Hopefully with this new guidance these semantic conventions mixups won't happen again.

I've put up a PR to fix the regression. I do realize the solution is a bit hacky but since this SHOULD be a one-off we don't really want to change _server_duration_attrs_old as you have outlined above.

@alexmojaki
Copy link
Contributor Author

Thanks @lzchen!

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 a pull request may close this issue.

2 participants