sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Do not trim large extra data?

Open decaz opened this issue 5 years ago • 10 comments

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(...)?

decaz avatar May 29 '19 08:05 decaz

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

untitaker avatar May 30 '19 19:05 untitaker

Also related: https://github.com/getsentry/sentry-python/issues/344 https://github.com/getsentry/sentry-python/issues/335

untitaker avatar May 30 '19 19:05 untitaker

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 avatar Aug 06 '19 19:08 Siecje

@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

untitaker avatar Aug 07 '19 10:08 untitaker

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/).

fmors avatar Mar 05 '20 15:03 fmors

Any plans on the fix? This really impacts the debugging experience

DataGreed avatar Jul 28 '20 15:07 DataGreed

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/

dromer avatar Nov 02 '20 19:11 dromer

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 🥀

github-actions[bot] avatar Dec 23 '21 15:12 github-actions[bot]

We are still using this currently.

dromer avatar Dec 23 '21 17:12 dromer

What is the point of debugging with Sentry if some keys of a dictionary get trimmed?

wieczorek1990 avatar Sep 07 '22 10:09 wieczorek1990

~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

mecampbellsoup avatar Dec 07 '22 15:12 mecampbellsoup

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.

stianjensen avatar Jun 26 '23 15:06 stianjensen

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.

KristobalJunta avatar Jul 28 '23 15:07 KristobalJunta

This utils.MAX_STRING_LENGTH was changed by #2171 and documented now: https://docs.sentry.io/platforms/python/configuration/options/#max-value-length

arischow avatar Sep 04 '23 01:09 arischow

The issue appears to have been fixed, closing

szokeasaurusrex avatar Oct 25 '23 08:10 szokeasaurusrex