Skip to content

Conversation

@Kyle-Verhoog
Copy link
Member

@Kyle-Verhoog Kyle-Verhoog commented Nov 17, 2020

Integration

This PR adds a WSGI middleware to be used to trace any WSGI Python web application.

Note: in cases of interrupted streaming requests, which can lead to broken pipe connections and therefore GeneratorExit exceptions in the response spans, the decision was made to prevent the GeneratorExit exceptions from being propagated to the top-level request spans. These exceptions will still be present in the wsgi.response spans.

Links

Checklist

  • Usage and configuration documentation added in __init__.py.
  • Corp docs are updated.
  • Entry added to release notes using reno.
  • Distributed tracing propagation is implemented (if applicable).
  • Global configuration
    • Inherits DD_SERVICE (if applicable).
    • Environment variables are provided for config options.
    • ddtrace.config.
    • Make distributed tracing configurable.
  • Instance configuration
    • Pin overriding.
    • Service name override (if applicable).
  • HTTP (if applicable)
    • 500-level responses are tagged as errors.
    • Determine an appropriate URL to use for the resource
  • Web (if applicable)
    • Request headers specified in the config are stored.
    • Use SpanTypes.WEB for request span of trace.
  • Tests
    • Tests are provided for all of the above.
    • Tests are added to CI (.circleci/config.yml).
    • Functionality is maintained from original library.
    • All Python versions that the library supports are tested.
    • All relevant library versions (including the latest) are tested.
  • Handle builtins.GeneratorExit errors with streaming requests (expected behaviour?) probably have to use span ignored exceptions.
  • Use the set_http_meta helper to set http tags
  • Add equivalent to span_modifier from the ASGI middleware

@Kyle-Verhoog Kyle-Verhoog added this to the 0.45.0 milestone Nov 17, 2020
@Kyle-Verhoog Kyle-Verhoog force-pushed the wsgi branch 5 times, most recently from 3158e77 to b617b54 Compare November 17, 2020 21:22
@Kyle-Verhoog Kyle-Verhoog modified the milestones: 0.46.0, 0.47.0 Jan 14, 2021
@codecov-io
Copy link

codecov-io commented Jan 25, 2021

Codecov Report

Merging #1808 (4181db7) into master (e933d24) will increase coverage by 0.04%.
The diff coverage is 95.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1808      +/-   ##
==========================================
+ Coverage   90.90%   90.94%   +0.04%     
==========================================
  Files         555      559       +4     
  Lines       38819    39063     +244     
==========================================
+ Hits        35287    35527     +240     
- Misses       3532     3536       +4     
Impacted Files Coverage Δ
tests/tracer/test_tracer.py 98.36% <ø> (ø)
ddtrace/contrib/wsgi/wsgi.py 88.76% <88.76%> (ø)
ddtrace/contrib/wsgi/__init__.py 100.00% <100.00%> (ø)
tests/conftest.py 100.00% <100.00%> (ø)
tests/contrib/wsgi/test_wsgi.py 100.00% <100.00%> (ø)
tests/profiling/gevent_fork.py 61.53% <0.00%> (-30.77%) ⬇️
ddtrace/provider.py 87.50% <0.00%> (-8.34%) ⬇️
tests/commands/test_runner.py 0.00% <0.00%> (-8.06%) ⬇️
ddtrace/utils/wrappers.py 38.23% <0.00%> (-5.89%) ⬇️
ddtrace/__init__.py 88.23% <0.00%> (-5.89%) ⬇️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e933d24...4181db7. Read the comment docs.

@Yun-Kim Yun-Kim marked this pull request as ready for review January 27, 2021 19:05
@Yun-Kim Yun-Kim requested a review from a team as a code owner January 27, 2021 19:05
Yun-Kim
Yun-Kim previously approved these changes Jan 27, 2021
Copy link
Member Author

@Kyle-Verhoog Kyle-Verhoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mergify mergify bot merged commit 58ae82c into DataDog:master Jan 28, 2021
@Kyle-Verhoog Kyle-Verhoog deleted the wsgi branch January 28, 2021 00:11
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.

4 participants