8000 TotalSamples scanned undercounted when range vector selector is used in subquery and aggregated. · Issue #16638 · prometheus/prometheus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
TotalSamples scanned undercounted when range vector selector is used in subquery and aggregated. #16638
Open
@Konstantinov-Innokentii

Description

What did you do?

Added two more test cases to TestQueryStatistics:

{
			Query:        "rate(metricWith3SampleEvery10Seconds[60s])[60s:5s]",
			Start:        time.Unix(201, 0),
			TotalSamples: 216, 
                        PeakSamples:  42,
			TotalSamplesPerStep: stats.TotalSamplesPerStep{
				201000: 216,
			},
		},
		{
			Query:        "max_over_time(rate(metricWith3SampleEvery10Seconds[60s])[60s:5s])",
			Start:        time.Unix(201, 0),
                        PeakSamples:  51,
			TotalSamples: 216, // This one fails with actual number 36.
			TotalSamplesPerStep: stats.TotalSamplesPerStep{
				201000: 216,  // This one fails too with actual number 3
6256
6.
			},
}

What did you expect to see?

Both queries report same amount of TotalSamples scanned.

What did you see instead? Under which circumstances?

The first query reports 216 TotalSamples scanned, as expected. It's calculated as 3/10 * 60 * 12.
(3/10 is three samples every ten seconds, 60 is the range selector interval, and 12 comes from the subquery: 60 / 5 = 12 queries)

The problem is that the second query reports only 36 samples processed, not 216, despite loading the same data as the first query.

Please note that I didn't dive into PeakSamples' correctness.

System information

No response

Prometheus version


Prometheus configuration file

Alertmanager version


Alertmanager configuration file

Logs


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0