Skip to content

feat: Remove string truncation for events - #5095

Merged
alexander-alderman-webb merged 6 commits into
major/3.0from
webb/remove-max-value-length
Nov 28, 2025
Merged

feat: Remove string truncation for events#5095
alexander-alderman-webb merged 6 commits into
major/3.0from
webb/remove-max-value-length

Conversation

@alexander-alderman-webb

@alexander-alderman-webbalexander-alderman-webb commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

Description

Remove the default string limit applied when serializing envelopes.

The max_value_length parameter is now optionally None, in which case there is no string truncation. The default value is changed to None.

The change follows on from raising the limit in #4632.

Replaces DEFAULT_MAX_VALUE_LENGTH with the 1024 literal in tests, which was the original limit.

Issues

Closes#4988
Closes PY-1916

Reminders

@codecov

codecovBot commented Nov 12, 2025

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completedFailedPassedSkipped
243581243571709
View the top 1 failed test(s) by shortest run time
tests.tracing.test_decorator::test_trace_decorator_async_no_trx
Stack Traces | 0.053s run time
tests/tracing/test_decorator.py:81: in test_trace_decorator_async_no_trx
fake_debug.assert_called_once_with(
.../hostedtoolcache/Python/3.14.0.../x64/lib/python3.14/unittest/mock.py:996: in assert_called_once_with
raise AssertionError(msg)
E AssertionError: Expected 'mock' to be called once. Called 3 times.
E Calls: [call('[Monitor] health check negative, downsampling with a factor of %d', 10),
E call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep'),
E call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'test_decorator.my_async_example_function'),
E call('[Monitor] health check negative, downsampling with a factor of %d', 10),
E call('Cannot create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep')].

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@linear

linearBot commented Nov 17, 2025

Copy link
Copy Markdown

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review November 17, 2025 14:16

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Truncation Limit Ignored for Local Variables

The serialize() call for local variables doesn't pass through the max_value_length parameter from serialize_frame(), causing local variables to never be truncated even when users explicitly set max_value_length. This breaks the intended truncation behavior for stack frame local variables.

sentry_sdk/utils.py#L620-L624

defcurrent_stacktrace(
include_local_variables=True, # type: bool
include_source_context=True, # type: bool

Fix in CursorFix in Web


@alexander-alderman-webb
alexander-alderman-webb merged commit df8fec6 into major/3.0Nov 28, 2025
122 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/remove-max-value-length branch November 28, 2025 12:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@alexander-alderman-webb@sentrivana