-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
Restore default behaviour of returning nil/absent metrics as NaN #1288
Restore default behaviour of returning nil/absent metrics as NaN #1288
Conversation
I tested this to see if it fixes #1138, and it seems like it does: I am using this config: ---
apiVersion: v1alpha1
discovery:
jobs:
- type: AWS/DDoSProtection
metrics:
- name: DDoSDetected
statistics: [ SampleCount ]
addCloudwatchTimestamp: true
period: 300
length: 300
regions:
- eu-west-1
- type: AWS/ApiGateway
metrics:
- name: 5XXError
statistics: [ SampleCount ]
addCloudwatchTimestamp: true
period: 300
length: 300
regions:
- eu-west-1 On the master branch, this give me (trimmed for clarity):
with this branch, I get:
which is the same as with previous versions like If I remove
and on this branch:
which is the same as with previous versions like |
This will be solved differently in #1289, closing |
Reopening per discussion in #1289 (#1289 (comment)). Will aim to get the bugfix and tests merged and handle the refactor in a later PR. |
54d2d80
to
245d834
Compare
Linting failures seem to be new between The failures seem to be in files I haven't touched ( |
Can you please rebase? The linter errors have been fixed in #1295 |
245d834
to
4f565b7
Compare
The `$` in the Makefile was being interpreted by `make`, and running the incorrect command `go test -v -bench=^-race -count=1 ./...`
4f565b7
to
3310336
Compare
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.
LGTM, left just some comments around tests.
The default value for MetricDataResult.Datapoint was 0, so all metrics without datapoints were being returned as if they had a datapoint with the value 0, regardless of the nilToZero flag. Making this field a pointer allows the v1 and v2 clients to return nil when there is no data.
3310336
to
dd03081
Compare
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.
Great work! 🚀
…metheus-community#1288) Co-authored-by: Cristian Greco <[email protected]>
…metheus-community#1288) Co-authored-by: Cristian Greco <[email protected]>
* Bump github.com/aws/aws-sdk-go from 1.49.16 to 1.49.17 (prometheus-community#1267) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add IPAM metrics support (prometheus-community#1168) Co-authored-by: Cristian Greco <[email protected]> * Bump github.com/aws/aws-sdk-go from 1.49.17 to 1.49.19 (prometheus-community#1275) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the aws-sdk-v2 group with 1 update (prometheus-community#1274) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Greco <[email protected]> * Prepare changelog for v0.56.0 (prometheus-community#1273) * Bump github.com/aws/aws-sdk-go from 1.49.19 to 1.49.21 (prometheus-community#1277) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github.com/prometheus/common from 0.45.0 to 0.46.0 (prometheus-community#1276) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Optionally include context labels (account, region, customTags) on info metrics (prometheus-community#1249) Co-authored-by: Cristian Greco <[email protected]> * Simplify associator usage (prometheus-community#1280) Co-authored-by: Cristian Greco <[email protected]> * Fix race condition in scraper registry usage (prometheus-community#1281) * Refactor dimensions regexp usage for discovery jobs (prometheus-community#1279) * Bump the aws-sdk-v2 group with 1 update (prometheus-community#1282) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Greco <[email protected]> * Bump github.com/aws/aws-sdk-go from 1.49.21 to 1.50.0 (prometheus-community#1283) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Greco <[email protected]> * Improve usability and performance of searchTags (prometheus-community#1270) Co-authored-by: Cristian Greco <[email protected]> * Fix lint issues for golangci-lint 1.56.1 (prometheus-community#1295) * Bump alpine from 3.19.0 to 3.19.1 (prometheus-community#1287) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Greco <[email protected]> * Add serverless ElastiCache support (prometheus-community#1254) Co-authored-by: Cristian Greco <[email protected]> * Fix elasticache serverless test after merge (prometheus-community#1299) * Restore default behaviour of returning nil/absent metrics as NaN (prometheus-community#1288) Co-authored-by: Cristian Greco <[email protected]> * Bump the aws-sdk-v2 group with 5 updates (prometheus-community#1297) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Greco <[email protected]> * Bump github.com/aws/aws-sdk-go from 1.50.0 to 1.50.10 (prometheus-community#1291) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Greco <[email protected]> * Update build tools and CI to go 1.22 (prometheus-community#1301) * chore: update version * chore: update test to support historical data * chore: fix return * chore: fix git missing for test * chore: cgo for test * chore: don't use cgo --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: pkubicsek-sb <[email protected]> Co-authored-by: Cristian Greco <[email protected]> Co-authored-by: kgeckhart <[email protected]> Co-authored-by: Nicholas Hinds <[email protected]>
The default value for
MetricDataResult.Datapoint
was 0, so all metrics without datapoints were being returned as if they had a datapoint with the value 0, regardless of thenilToZero
flag.Making this field a pointer allows the v1 and v2 clients to return
nil
when there is no data, which eventually gets passed through to the existing code for handlingnil
datapoints and thenilToZero
flag.Fixes #1242
Might be related to #1138