feat(data-collection): create DataCollection option in client#6702
feat(data-collection): create DataCollection option in client#6702ericapisani wants to merge 20 commits into
2 issues
code-review: Found 2 issues (2 low)
Low
`_http_headers_from_value` handles invalid `http_headers` values inconsistently (silent fallback vs. unhelpful TypeError) - `sentry_sdk/data_collection.py:185-200`
Unlike _kvcb_from_value, which raises a clear ValueError for invalid modes, _http_headers_from_value does not validate its input type. When data_collection={"http_headers": "off"} (a string), the "request" in val / "response" in val checks become substring searches that return False, silently falling back to deny_list for both directions with no warning — masking a likely user misconfiguration. A non-iterable value such as False would instead raise TypeError: argument of type 'bool' is not iterable, giving no actionable hint that data_collection.http_headers must be a dict. Consider adding an isinstance(val, dict) guard that raises a consistent ValueError/TypeError referencing the option, matching _kvcb_from_value's validation.
DeprecationWarning stacklevel points to internal SDK code instead of user call site - `sentry_sdk/data_collection.py:253`
The stacklevel=2 in warnings.warn points to _get_options (internal SDK code) rather than the user's sentry_sdk.init() call site, making the deprecation warning confusing and unhelpful. A value of 4 or 5 is needed to surface it at the correct frame.
⏱ 10m 10s · 4.2M in / 86.8k out · $3.78