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

feat(core): Expose MAX_EVENT_SIZE_BYTES constant in SentryOptions

Open SudoPlz opened this issue 2 months ago • 0 comments

:scroll: Description

Exposed the MAX_EVENT_SIZE_BYTES constant as a public field in SentryOptions to allow SDK consumers to access the maximum event size limit (1MB). Previously, this constant was private in the internal EventSizeLimitingUtils class, making it inaccessible to consumers who need to know the size limit for their own calculations or validations.

The constant has been moved from EventSizeLimitingUtils to SentryOptions and EventSizeLimitingUtils now references it via static import.

:bulb: Motivation and Context

SDK consumers implementing custom event handling (e.g., in OnOversizedEventCallback) need access to the maximum event size limit to perform their own size calculations and validations. Without this constant being publicly accessible, consumers would have to hardcode the value or duplicate it, which is error-prone and breaks if the limit changes.

:green_heart: How did you test it?

  • Verified that SentryOptions.MAX_EVENT_SIZE_BYTES is accessible from external code
  • Confirmed that EventSizeLimitingUtils continues to work correctly with the constant reference
  • Ran existing tests to ensure no regressions

:pencil: Checklist

  • [ ] I added GH Issue ID & Linear ID
  • [ ] I added tests to verify the changes.
  • [x] No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • [ ] I updated the docs if needed.
  • [ ] I updated the wizard if needed.
  • [ ] Review from the native team if needed.
  • [x] No breaking change or entry added to the changelog.
  • [x] No breaking change for hybrid SDKs or communicated to hybrid SDKs.

:crystal_ball: Next steps

  • Consider adding documentation or examples showing how consumers can use this constant in their OnOversizedEventCallback implementations

SudoPlz avatar Dec 11 '25 14:12 SudoPlz