Skip to content

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

@alexmojaki

Description

@alexmojaki

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions