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

Fixing returning NaN when rate metrics change / reset counter #121

Merged
merged 13 commits into from
Dec 5, 2023
Merged

Fixing returning NaN when rate metrics change / reset counter #121

merged 13 commits into from
Dec 5, 2023

Conversation

jaggederest
Copy link
Contributor

fixes #120

Intended to handle the case where a nonsensical rate would be returned (e.g. massively negative) or the metric _string_attributes change mid-query, to either clamp to zero or filter out possible NaN being currently returned. This should create cleaner graphs for rate metrics, allowing the rate to interpolate over missing data instead of creating a gap in the graph

Copy link

changeset-bot bot commented Nov 21, 2023

🦋 Changeset detected

Latest commit: 1c19271

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

This PR includes changesets to release 2 packages
Name Type
@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

@@ -1,4 +1,5 @@
import * as clickhouse from '..';
import { describe, beforeEach, jest, it, expect } from '@jest/globals';
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to import these from globals. did you hit any issues on local ?

@@ -704,6 +704,7 @@ export const getMetricsChart = async ({
startTime: number; // unix in ms
teamId: string;
}) => {
await redisClient.connect();
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for this. redis client should be connected when server starts

@jaggederest jaggederest marked this pull request as ready for review November 27, 2023 23:00
@@ -42,4 +43,29 @@ describe('clickhouse', () => {
expect(clickhouse.client.insert).toHaveBeenCalledTimes(2);
expect.assertions(2);
});

it('getMetricsChart', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be awesome to have a bit more descriptive of a test case name

@kodiakhq kodiakhq bot merged commit 141fce0 into hyperdxio:main Dec 5, 2023
4 checks passed
@jaggederest jaggederest deleted the jag/nan_rate_fix branch December 5, 2023 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HDX-134] Metrics need to handle counter restarts and related edge cases better
3 participants