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

Add more hooks to support structlog contextvars #36

Merged
merged 6 commits into from
Aug 25, 2022
Merged

Conversation

kafonek
Copy link
Contributor

@kafonek kafonek commented Aug 25, 2022

context_hook that's called by inbound worker, outbound worker, and poll worker during their respective while True loops. Intended to be used to set structlog.contextvars.bind_contextvars in application code. Can be defined as class methods or attached to an instance.

Related PA issue https://github.com/noteable-io/planar-ally/pull/243

@kafonek
Copy link
Contributor Author

kafonek commented Aug 25, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2022

Codecov Report

Merging #36 (bab9cef) into main (c95f327) will decrease coverage by 0.81%.
The diff coverage is 89.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
- Coverage   95.71%   94.89%   -0.82%     
==========================================
  Files           8        8              
  Lines         467      490      +23     
==========================================
+ Hits          447      465      +18     
- Misses         20       25       +5     
Impacted Files Coverage Δ
sending/backends/websocket.py 90.62% <87.50%> (-0.95%) ⬇️
sending/base.py 93.49% <92.30%> (-1.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 c95f327...bab9cef. Read the comment docs.

@kafonek kafonek marked this pull request as ready for review August 25, 2022 19:16
@kafonek kafonek requested a review from a team August 25, 2022 19:16
Copy link
Contributor

@tizz98 tizz98 left a comment

Choose a reason for hiding this comment

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

Generally looks good. I wonder if a future refactor could use something like event emitter pattern rather than defining hook functions (https://pypi.org/project/PyEventEmitter/)

CHANGELOG.md Show resolved Hide resolved
@kafonek kafonek merged commit 292e2d0 into main Aug 25, 2022
@kafonek kafonek deleted the mrk/context_hook branch August 25, 2022 20:23
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.

3 participants