Skip to content

Conversation

@thetruecpaul
Copy link
Contributor

@thetruecpaul thetruecpaul commented Nov 11, 2025

We've got a couple redundant-implementations of EAP utils, most notably the encode_value function.

This PR unifies these into sentry.utils.eap.

@thetruecpaul thetruecpaul requested a review from a team November 11, 2025 21:39
@thetruecpaul thetruecpaul requested review from a team as code owners November 11, 2025 21:39
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 11, 2025
"sentry.utils.eap_producer",
Topic.SNUBA_ITEMS,
exclude_config_keys=["compression.type", "message.max.bytes"],
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Producer Config Change Impacts Replay Message Behavior

The unified eap_items_producer adds exclude_config_keys=["compression.type", "message.max.bytes"] which changes behavior for code previously using sentry.replays.lib.kafka.eap_producer that didn't exclude these config keys. This could affect message compression and size limits for replay trace items.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

❌ Patch coverage is 98.86364% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/utils/eap.py 97.05% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #103182      +/-   ##
===========================================
- Coverage   80.67%    80.67%   -0.01%     
===========================================
  Files        9241      9242       +1     
  Lines      393627    393598      -29     
  Branches    25053     25053              
===========================================
- Hits       317543    317518      -25     
+ Misses      75622     75618       -4     
  Partials      462       462              

We've got a couple redundant-implementations of EAP utils, most notably the `encode_value` function.

This PR unifies these into `sentry.utils.eap`. Eventually, I'd like this package to handle all of the encoding/ details so users can easily write/query EAP without needing to worry about things.
elif dump_arrays and isinstance(value, (list, tuple, dict)):
return AnyValue(string_value=orjson.dumps(value).decode())
elif expand_arrays and isinstance(value, dict):
return AnyValue(**value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Conflicting Flags Silently Ignore Array Expansion

When both dump_arrays=True and expand_arrays=True are passed with a dict value, the dump_arrays check at line 49 takes precedence over the expand_arrays check at line 51, causing expand_arrays to be silently ignored for dicts. This creates ambiguous behavior where two mutually exclusive flags can both be set but only one is honored.

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

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants