I’m running into this issue, but when using capture_message
, and in a situation where it’s not really possible to guarantee that the string is shorter. (Specifically, we have a healthcheck script that runs regularly and needs to output a lot of information when things are in a bad state. It happened to be stuck on an old version of the Python SDK, and we started getting truncated messages when I updated it.)
When digging into the implementation, I ran into this comment:
def strip_string(value, max_length=None):
# ...ommitted code here...
if max_length is None:
# This is intentionally not just the default such that one can patch `MAX_STRING_LENGTH` and affect `strip_string`.
max_length = MAX_STRING_LENGTH
So now I’ve got this at the start of my script, which does work, even though I don’t much like it:
sentry_sdk.utils.MAX_STRING_LENGTH = 2048
Is there a better workaround for this? Is there any planned feature to make this configurable?