snok / asgi-correlation-id

Request ID propagation for ASGI apps
MIT License
369 stars 29 forks source link

Make middleware fully configurable #39

Closed sondrelg closed 2 years ago

sondrelg commented 2 years ago

This is mostly a reimplementation of #15, motivated by #38. It will require us to bump a major version, since we are removing some backwards compatibility, but I think it's for the best.

In short, the PR replaces the built-in uuid4 generation and validation with concepts of:

codecov[bot] commented 2 years ago

Codecov Report

Merging #39 (24b5530) into main (0c6fd1e) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #39   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        11           
  Lines          314       353   +39     
=========================================
+ Hits           314       353   +39     
Impacted Files Coverage Δ
asgi_correlation_id/middleware.py 100.00% <100.00%> (ø)
tests/conftest.py 100.00% <100.00%> (ø)
tests/test_extension_celery.py 100.00% <100.00%> (ø)
tests/test_middleware.py 100.00% <100.00%> (ø)

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 0c6fd1e...24b5530. Read the comment docs.

JonasKs commented 2 years ago

Love this! I’ll do a review tomorrow👏

sondrelg commented 2 years ago

Think this addresses your comments @commentator8. If you have time and want to take another look, feel free 🙏

commentator8 commented 2 years ago

@sondrelg You covered all my points and it looks good. The extra defensive if on the transformer was a nice touch :)