opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Set HTTP status code attribute for server span

Open bastbu opened this issue 1 year ago • 0 comments
trafficstars

Description

The ASGI middleware previously only recorded the status code on the server span in case one of its child spans ("http send") was recording. With this PR setting the status code on the parent is independent of its child span.

Fixes #2087 Fixes #1876

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x] Added unit test test_status_code_when_send_not_recording

Does This PR Require a Core Repo Change?

  • [ ] Yes.
  • [x] No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [x] Followed the style guidelines of this project
  • [x] Changelogs have been updated
  • [x] Unit tests have been added
  • [ ] Documentation has been updated

bastbu avatar Dec 13 '23 17:12 bastbu