sentry-python
sentry-python copied to clipboard
Do not trim large extra data?
Version 0.8.0 introduced trimming of large data. Is it possible to optionally not to trim extra data which I specify with scope.set_extra(...)
?
That's not possible right now, but for now you can monkeypatch these two constants if you need to: https://github.com/getsentry/sentry-python/blob/e9a469be8f8589d3e97efdf870044216fd5680cb/sentry_sdk/serializer.py#L29-L30
Also related: https://github.com/getsentry/sentry-python/issues/344 https://github.com/getsentry/sentry-python/issues/335
I have tried monkey patching but still I get a log message that is 512 characters.
# Monkey patch to increase log message limit
from sentry_sdk import utils
utils.MAX_STRING_LENGTH = 10000
utils.slim_string.__defaults__ = (10000,)
@Siecje seems there's some rotten code in that file, you need to do the same defaults dance for utils.strip_string
, which seems to be duplicated logic
# Monkey patch to increase log message limit
from sentry_sdk import utils
utils.MAX_STRING_LENGTH = 10000
utils.slim_string.__defaults__ = (10000,)
utils.strip_string.__defaults__ = (10000,)
I will refactor this to only use one function, and make it so that you only have to set the constant. Sorry for the inconvenience
I'm monkey-patching this, but it would be great if the size of the extra data follows what is described in the Data Handling section of Sentry Docs (https://docs.sentry.io/development/sdk-dev/data-handling/).
Any plans on the fix? This really impacts the debugging experience
I'm monkey-patching this, but it would be great if the size of the extra data follows what is described in the Data Handling section of Sentry Docs (https://docs.sentry.io/development/sdk-dev/data-handling/).
New url for the docs: https://develop.sentry.dev/sdk/data-handling/
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
We are still using this currently.
What is the point of debugging with Sentry if some keys of a dictionary get trimmed?
~Is there a way to have the SDK include more than 10 local variable captures?~
To be clear you can capture more local variables by monkeypatching as described above:
from sentry_sdk import utils, serializer
# Capture up to 20 local variables per frame
# Ref: https://github.com/getsentry/sentry-python/issues/377#issuecomment-497446149
serializer.MAX_DATABAG_BREADTH = 20
Would it be possible to at least show in the UI whether some data has been truncated? Seeing a dictionary that looks complete in the UI, with completely valid syntax, but which secretly has had some of its keys trimmed away results in a hilariously confusing debugging experience for anyone not aware of these limits. As far as I can see there is no indication anywhere in the sentry UI that the data you're looking at is just a subset of the actual data.
With the current UI, it would often be better to just send no data at all, since you can't trust it.
Seeing a dictionary that looks complete in the UI, with completely valid syntax, but which secretly has had some of its keys trimmed away results in a hilariously confusing debugging experience
100 times this.
I landed on this issue page after being gaslighted by Sentry UI that "I don't actually have duplicates in my data" while the error message clearly said that there ARE duplicates.
What it appeared to be is that Sentry just showed me the first half of the data and threw away the part I actually needed to see - with no indication in the UI at all.
This is not what a professional tool would be expected to do by any means.
This utils.MAX_STRING_LENGTH
was changed by #2171 and documented now: https://docs.sentry.io/platforms/python/configuration/options/#max-value-length
The issue appears to have been fixed, closing