[Prometheus Receiver] Add test to validate StaleNaNs, NormalNaNs, and +-Inf are correctly passed through #6087
Labels
ci-cd
CI, CD, testing, build issues
comp:prometheus
Prometheus related issues
comp: receiver
Receiver
Stale
Is your feature request related to a problem? Please describe.
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:
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 forStaleNaN
, 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:
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
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
The text was updated successfully, but these errors were encountered: