Skip to content

promql engine does not return expected results with mixed floats+histograms #14172

@jhesketh

Description

@jhesketh

What did you do?

I am testing the behavior (with promqltest) of querying a series that has both floats and histograms.

For example:

load 1m
	mixed_metric 1 2 3 {{schema:0 sum:5 count:4 buckets:[1 2 1]}} {{schema:0 sum:8 count:6 buckets:[1 4 1]}} 4 5 {{schema:0 sum:18 count:10 buckets:[3 4 3]}}

# I expect the following to work, but it Fails:
eval range from 0 to 8m step 1m mixed_metric
	{__name__="mixed_metric"} 1 2 3 {{count:4 sum:5 buckets:[1 2 1]}} {{count:6 sum:8 buckets:[1 4 1]}} 4 5 {{schema:0 sum:18 count:10 buckets:[3 4 3]}} {{schema:0 sum:18 count:10 buckets:[3 4 3]}}


# The following does pass though.
# Where we expected Histograms, we got Floats from a lookback
eval range from 0 to 8m step 1m mixed_metric
	{__name__="mixed_metric"} 1 2 3 3 3 4 5 {{schema:0 sum:18 count:10 buckets:[3 4 3]}} {{schema:0 sum:18 count:10 buckets:[3 4 3]}}


clear

# As another note, this only occurs when a float follows a histogram.
load 1m
	mixed_metric 1 2 3 {{schema:0 sum:5 count:4 buckets:[1 2 1]}} {{schema:0 sum:8 count:6 buckets:[1 4 1]}}

# Passes
eval range from 0 to 5m step 1m mixed_metric
	{__name__="mixed_metric"} 1 2 3 {{count:4 sum:5 buckets:[1 2 1]}} {{count:6 sum:8 buckets:[1 4 1]}} {{count:6 sum:8 buckets:[1 4 1]}}

# Fails
eval range from 0 to 5m step 1m mixed_metric
	{__name__="mixed_metric"} 1 2 3 3 3 {{count:6 sum:8 buckets:[1 4 1]}}

What did you expect to see?

I expected to receive the Histogram point at 3m (in the first example).

What did you see instead? Under which circumstances?

Instead, I received a Float of 3. Because another float exists later on in the series, a lookback was used instead of the Histogram that exists at that point.

System information

No response

Prometheus version

No response

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions