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

Starlette: capture custom request response headers in span attributes #1046

Conversation

sanketmehta28
Copy link
Member

@sanketmehta28 sanketmehta28 commented Apr 8, 2022

Description

This PR contains py tests for Starlette framework. Actual code has been merged in this PR: #1004
It also contains the doc update for Startlette framework

Fixes #917

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added below unit tests for request and response headers for both http and websocket applications.

  • Test A: check for request header which is set in OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST env variable, is present in the span as attribute

  • Test B: check for request header which is NOT set in OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST env variable, is NOT present in the span as attribute

  • Test C: check for response header which is set in OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE env variable, is present in the span as attribute

  • Test D: check for response header which is NOT set in OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE env variable, is NOT present in the span as
    attribute

  • Also added test for NoOpTracerProvider as well

Does This PR Require a Core Repo Change?

  • No.

Checklist:

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

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

@sanketmehta28 sanketmehta28 requested a review from a team April 8, 2022 21:19
@sanketmehta28 sanketmehta28 changed the title Startlette: capture custom request response headers in span attributes Starlette: capture custom request response headers in span attributes Apr 8, 2022
@sanketmehta28
Copy link
Member Author

@open-telemetry/python-approvers: Please do review this PR and if it looks fine, please do merge it

@sanketmehta28
Copy link
Member Author

@open-telemetry/python-approvers: All conflicts are resolved. Please do review this

@sanketmehta28
Copy link
Member Author

@lzchen: all your comments are addressed. Please do review and merge this PR

@srikanthccv srikanthccv merged commit 26a8aa1 into open-telemetry:main Apr 18, 2022
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 this pull request may close these issues.

Starlet: Capture request/response headers as span attributes
4 participants