Skip to content
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

perf(metrics): tune histogram metric query #712

Open
wants to merge 3 commits into
base: v2
Choose a base branch
from

Conversation

dhable
Copy link

@dhable dhable commented Mar 25, 2025

Moves grouping, filtering and limits for the histogram query into the initial selection CTE. This reduces the memory usage required for query.

Ref: HDX-1518

Moves grouping, filtering and limits for the histogram query into the initial
selection CTE. This reduces the memory usage required for query.

Ref: HDX-1518
Copy link

changeset-bot bot commented Mar 25, 2025

🦋 Changeset detected

Latest commit: 5c81adf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

END AS Point
FROM ${renderFrom({ from: { ...from, tableName: metricTables[MetricsDataType.Histogram] } })} HistogramTable
WHERE ${where}
GROUP BY ${concatChSql(',', [chSql`AttributesHash`, groupBy])}
Copy link
Contributor

Choose a reason for hiding this comment

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

we run into problems here if we try to group by granularity before calculating rate, usually when we start setting granularity to be something like looking back 14d and then we'll do something like 12h granularity, and with rates only having 12h granularity we run into huge errors with counter resets making the metric virtually useless.

In v1 I believe we've had success with doing our rate calculations first and then doing the percentile interpolation, I'm wondering what's the issue we're running into here, is it for some reason the rate calculations on arrays are really memory expensive?

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.

2 participants