-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(metrics): Use 10s granularity in front end [INGEST-249] #29265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
size-limit report
|
…-granularity-10s Conflicts: static/app/views/alerts/incidentRules/triggers/chart/thresholdsChart.tsx
| type Props = Omit<ChartProps, 'series'> & { | ||
| stacked?: boolean; | ||
| series: AreaChartSeries[]; | ||
| stacked?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frontend changes were already approved in #29350.
| return datetime.now(tz=pytz.utc) | ||
|
|
||
|
|
||
| def get_constrained_date_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Swatinem I'm not sure which of the rounding rules in this function should also apply to metrics-based queries, especially the one about real-time queries:
sentry/src/sentry/snuba/sessions_v2.py
Lines 388 to 392 in d6c59c3
| # snuba <-> sentry has a 5 minute cache for *exact* queries, which these | |
| # are because of the way we do our rounding. For that reason we round the end | |
| # of "realtime" queries to one minute into the future to get a one-minute cache instead. | |
| if end > now: | |
| end = to_datetime(ONE_MINUTE * (math.floor(to_timestamp(now) / ONE_MINUTE) + 1)) |
If this is specific to the "sessions" dataset in snuba, it might be better if I created a separate implementation of this function for metrics-based queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this was that raw_query is being cached, keyed on the parameters you pass it (one of those parameters is the start/end times). That’s why this statement is there, to force a change in cache key and thus fetch a fresh dataset.
TBH, I have no idea if that is relevant for metrics-based sessions, probably not? I think you know better than me ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after asking around in slack, there's two caches: one in sentry, one in snuba
snuba cache is i suppose what arpad is talking about.. tbh I am not sure if it ever caches more than 1 minute. sentry cache is disabled by default
I think the code is fine though... I don't get the disjunction between rounding_interval and interval, but rounding by 1h is too much. In any case the end result should probably be that we round the timestamps down to next 10s bucket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both, I will create an additional PR to split the logic for sessions- and metrics-based queries into two separate functions.
| return datetime.now(tz=pytz.utc) | ||
|
|
||
|
|
||
| def get_constrained_date_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this was that raw_query is being cached, keyed on the parameters you pass it (one of those parameters is the start/end times). That’s why this statement is there, to force a change in cache key and thus fetch a fresh dataset.
TBH, I have no idea if that is relevant for metrics-based sessions, probably not? I think you know better than me ;-)
| return datetime.now(tz=pytz.utc) | ||
|
|
||
|
|
||
| def get_constrained_date_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after asking around in slack, there's two caches: one in sentry, one in snuba
snuba cache is i suppose what arpad is talking about.. tbh I am not sure if it ever caches more than 1 minute. sentry cache is disabled by default
I think the code is fine though... I don't get the disjunction between rounding_interval and interval, but rounding by 1h is too much. In any case the end result should probably be that we round the timestamps down to next 10s bucket
Release health stats stored as metrics can be queried with a resolution of up to 10 seconds. With this PR
/sessionsendpoint with an interval of "10s" if the total requested period is < 10 minutes.This can be viewed on the release details page: