Skip to content

Conversation

@alexander-alderman-webb
Copy link
Contributor

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

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
Copy link

codecov bot commented Nov 12, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
24358 1 24357 1709
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
Copy link

linear bot commented Nov 17, 2025

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review November 17, 2025 14:16
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner November 17, 2025 14:16
Copy link

@cursor cursor bot left a comment

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

def current_stacktrace(
include_local_variables=True, # type: bool
include_source_context=True, # type: bool

Fix in Cursor Fix in Web


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants