Group captured warnings under separate issues#1324
Conversation
d08cfb1 to
31df6c5
Compare
|
Hey @mnito thanks for the easy to review PR! As I understand it: this PR makes sure, that our |
31df6c5 to
1bf01ad
Compare
Prior to https://bugs.python.org/issue46557 being addressed, warnings captured by logging.captureWarnings(True) were logged with logger.warning("%s", s) which caused them to be grouped under the same issue. This change adds special handling for creating separate issues for captured warnings arriving with the %s format string by using args[0] as the message instead of the msg arg. Refer to: https://docs.python.org/3/library/logging.html#logging.captureWarnings
1bf01ad to
dc1c7fd
Compare
|
@mnito I have made some cosmetic changes to your branch to make it more readable |
|
I have one question @mnito can we check for messages from warnings module in another way other than |
Maybe the intent isn’t clear here, but the check for “%s” is important to this change. Even before this change, logged warnings were always captured by the Sentry SDK — however they are grouped under a single issue due to “%s” always being the logged string and the actual message being the first arg (this behavior is within CPython’s logging library). I changed that behavior in an approved change to CPython itself, but this change is a workaround for Python versions that won’t have that change since it likely won’t be backported. |
|
Thanks for the clarification @mnito! Now I get it! If all the checks pass we can merge this! |
|
@mnito could you format the See: |
|
Yeah I can take care of it at lunchtime. If you are motivated to get it through now you should just be able to run |
Done ✅ |
Fixed the |
|
Uh yeah! 👍 |
|
This is merged now @mnito Thanks for your contribution! It will be released with the next version of the SDK (probably in 1-2 weeks) |
|
Sounds good. Thanks! |
Prior to https://bugs.python.org/issue46557 being addressed, warnings captured by logging.captureWarnings(True) were logged with logger.warning("%s", s) which caused them to be grouped under the sameissue. This change adds special handling for creating separate issues for captured warnings arriving with the %s format string by using args[0] as the message instead of the msg arg.
Refer to: https://docs.python.org/3/library/logging.html#logging.captureWarnings