opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

fix(instrumentation-http): add server attributes after they become available

Open pichlermarc opened this issue 1 year ago • 1 comments
trafficstars

Which problem is this PR solving?

While reviewing #5079 I noticed that we don't set http.route and http.response.status code in the server duration metrics, so this PR addresses a few problems:

  • We did not add http.route to the Span on "new" metrics
  • We add the http.route only when DUPLICATE emission is turned on because
    • we also didn't add it to the Span for "new" metrics
    • but we did add it for the "old" metrics and the attribute name happens to match
  • we never added the http.response.status code, because
  • it is not yet determined when we add it (before the request is handled)

NOTE: skipping changelog because this is a bug in an unreleased feature

Supersedes #5079 Related to #5026

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • [x] Added assertions to unit tests

pichlermarc avatar Oct 21 '24 10:10 pichlermarc