Some stack traces are truncated

I have sentry-sdk==0.8.0 installed on a Flask app posting to an onprem 9.1.2 server.

    integrations=[FlaskIntegration(), CeleryIntegration()],
    release=app.config['VERSION'].replace('/', '_'),,

Some errors are truncated which both limits the stack trace and prevents Sentry from rendering a pretty stack trace. My google-fu is failing me, I cannot find any docs about the PII rule !limit. I added send_default_pii=True to try and mitigate this but it doesn’t seem to work.

How do I get sentry SDK to send full stack traces?


A better way to deal with this particular case is to find the code that emits this error and see if you can find a way to avoid stringifying the stacktrace before logging.

For example, log.error("Exception caught: " + traceback.format_exc(...)) causes less data to be sent than log.error("Exception caught", exc_info=True)

1 Like

This makes perfect sense. Thank you!

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?

1 Like

Thanks bro, you helped my life