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

feat: Support for sum metrics in charts #622

Open
wants to merge 3 commits into
base: warren/metrics-mvp
Choose a base branch
from

Conversation

dhable
Copy link

@dhable dhable commented Feb 19, 2025

Add query rendering support for CTEs and then using a CTE to support HyperDX v1 query logic to get sum metrics working in v2.

Screenshot 2025-02-19 at 2 10 45 PM Screenshot 2025-02-19 at 2 11 03 PM

Ref: HDX-1337

Copy link

changeset-bot bot commented Feb 19, 2025

⚠️ No Changeset found

Latest commit: 915a77c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@dhable dhable force-pushed the dhable/hdx-1337-sum-metrics branch 2 times, most recently from 1754ad5 to fc37b55 Compare February 19, 2025 20:17
@dhable
Copy link
Author

dhable commented Feb 19, 2025

I didn't add a changeset file here. I'm thinking that we would just have a single changeset on the feature branch level.

});

// it('should generate sql for multiple gauge metrics', async () => {
Copy link
Author

Choose a reason for hiding this comment

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

supporting multiple metrics in a single query is another ticket.

Add query rendering support for CTEs and then using a CTE to support
HyperDX v1 query logic to get sum metrics working in v2.

Ref: HDX-1337
@dhable dhable force-pushed the dhable/hdx-1337-sum-metrics branch from fc37b55 to d609fe7 Compare February 19, 2025 21:22
The condidion field on the select object is used by the UI filters.
To avoid mixing the metric name filter with the UI filter, the name
condition has been moved to the `where` condition.
@@ -790,7 +790,7 @@ function translateMetricChartConfig(
any(Attributes) OVER (ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS PrevAttributes,
IF(AggregationTemporality = 1,
Value,IF(Value - PrevValue < 0 AND Attributes = PrevAttributes,Value,
IF(Attributes != PrevAttributes, 0, Value - PrevValue))) as Rate
IF(cityHash64(Attributes) != cityHash64(PrevAttributes), 0, Value - PrevValue))) as Rate
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to actually run this on the subselect first, otherwise we'll be rehashing a lot more than we need to.

@dhable dhable force-pushed the dhable/hdx-1337-sum-metrics branch from dac30e4 to 915a77c Compare February 21, 2025 16:12
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