-
Notifications
You must be signed in to change notification settings - Fork 177
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
Conversation
🦋 Changeset detectedLatest commit: 1c19271 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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'; |
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.
I don't think we need to import these from globals. did you hit any issues on local ?
packages/api/src/clickhouse/index.ts
Outdated
@@ -704,6 +704,7 @@ export const getMetricsChart = async ({ | |||
startTime: number; // unix in ms | |||
teamId: string; | |||
}) => { | |||
await redisClient.connect(); |
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.
no need for this. redis client should be connected when server starts
@@ -42,4 +43,29 @@ describe('clickhouse', () => { | |||
expect(clickhouse.client.insert).toHaveBeenCalledTimes(2); | |||
expect.assertions(2); | |||
}); | |||
|
|||
it('getMetricsChart', async () => { |
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.
would be awesome to have a bit more descriptive of a test case name
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