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

[Prometheus Receiver] Add test to validate StaleNaNs, NormalNaNs, and +-Inf are correctly passed through #6087

Closed
3 tasks
PaurushGarg opened this issue Nov 1, 2021 · 2 comments
Labels
ci-cd CI, CD, testing, build issues comp:prometheus Prometheus related issues comp: receiver Receiver Stale

Comments

@PaurushGarg
Copy link
Member

PaurushGarg commented Nov 1, 2021

Is your feature request related to a problem? Please describe.

In addition to standard numerical values, Nan, +Inf, and -Inf are valid values representing not a number, positive infinity, and negative infinity respectively.

In order to verify that the Prometheus receiver is functioning as expected for Prometheus to OTLP data transformations, a new test is needed to validate that the StaleNaN, NormalNaN, and +-Inf are correctly handled by Prometheus Receiver and is transformed to OTLP data.

Describe the solution you'd like
Add new following testcases:

  • TestCase 1: Validate StaleNaN

Prometheus Receiver should assign metric a StaleNaN value, if the metric is missing in the current scrape but was present in the previous scrape. In order to validate the Prometheus Receiver for StaleNaN, provide testdata as described, and configure Prometheus Receiver to scrape this testdata.

Expected behavior: The metric with StaleNaN value should work the same way as metrics with standard numerical values. The only difference is that metric value of OTLP data should be StaleNaN. This can verified using IsStaleNaN(v float64) method.

  • TestCase 2: Validate NormalNaN

  • Create testdata with default metrics and their values set as NormalNaN.
    For Example:

var normalNaNPage1 = `
# HELP go_threads Number of OS threads created
# TYPE go_threads gauge
go_threads NaN

Expected behavior: The metric with NomralNaN value should work the same way as metrics with standard numerical values. The only difference is that metric value of OTLP data should be NormalNaN. This can verified using value.NormalNaN.

  • TestCase 3: Validate +-Inf

  • Create testdata with default metrics and their values set as Inf and -Inf.
    For Example: Testdata to validate Inf

var InfPage1 = `
# HELP go_threads Number of OS threads created
# TYPE go_threads gauge
go_threads +Inf

Expected behavior: The metric with +-Inf value should work the same way as metrics with standard numerical values. The only difference is that metric value of OTLP data should be +-Inf. This can verified using math.IsInf(f float64, sign int).

Additional context
Related to open-telemetry/prometheus-interoperability-spec#57
cc: @alolita @Aneurysm9

@alolita alolita added comp:prometheus Prometheus related issues ci-cd CI, CD, testing, build issues comp: receiver Receiver labels Nov 2, 2021
@PaurushGarg
Copy link
Member Author

@alolita please assign this issue to me. I would like to work on this one.

@PaurushGarg PaurushGarg changed the title Add test to validate StaleNaNs, NomralNaNs, and +-Inf are correctly passed through the Prometheus Receiver [Prometheus Receiver] Add test to validate StaleNaNs, NomralNaNs, and +-Inf are correctly passed through Nov 22, 2021
@PaurushGarg PaurushGarg changed the title [Prometheus Receiver] Add test to validate StaleNaNs, NomralNaNs, and +-Inf are correctly passed through [Prometheus Receiver] Add test to validate StaleNaNs, NormalNaNs, and +-Inf are correctly passed through Dec 7, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2022

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Nov 7, 2022
povilasv referenced this issue in coralogix/opentelemetry-collector-contrib Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cd CI, CD, testing, build issues comp:prometheus Prometheus related issues comp: receiver Receiver Stale
Projects
None yet
Development

No branches or pull requests

3 participants