Skip to content

Conversation

@jasonyuezhang
Copy link
Owner

Allows queries for more specific start/end date ranges


Copied from getsentry#103779
Original PR: getsentry#103779

@propel-test-bot
Copy link

Add explicit start / end date-range support to Seer Explorer RPCs

This PR extends the Explorer helper RPCs execute_table_query and execute_timeseries_query so callers can supply explicit start and end datetimes in addition to the existing stats_period parameter. A new private function _validate_date_params enforces mutual-exclusion and completeness rules, and both query builders now forward the new fields to the Events / Events-Stats API.
A large test file is updated to cover the new behaviour (valid ranges, error cases, interaction with stats_period). The change is copied from upstream getsentry#103779.

Key Changes

• Added _validate_date_params in src/sentry/seer/explorer/tools.py to enforce: (a) at least one date selector present, (b) stats_period XOR (start AND end).
• Updated execute_table_query signature to accept start, end, stats_period: Optional, and call _validate_date_params; parameters are propagated to the outgoing API request body.
• Updated execute_timeseries_query with the same date-range handling and validation.
• Enhanced 400-error branch with logger.exception to surface bad-request diagnostics.
• Extensive additions to tests/sentry/seer/explorer/test_tools.py: helper _get_utc_iso_without_timezone, new unit tests that: (1) supply explicit start/end; (2) assert correct inclusion/exclusion of data; (3) verify ValueError when both selector styles are mixed. Legacy @pytest.mark.django_db decorators removed where unnecessary.

Affected Areas

src/sentry/seer/explorer/tools.py RPC helpers
• Test suite tests/sentry/seer/explorer/test_tools.py

This summary was automatically generated by @propel-code-bot

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