-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MQE: track number of processed samples in each query (#10232)
* MQE: track number of processed samples in each query * Updated how NH are counted to samples, update testing to check NaN's and NH's * Address PR feedback and reduce duplication * Address PR feedback: add test case for stale markers * Clarify variable name in `runMixedMetricsTests` --------- Co-authored-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
- Loading branch information
1 parent
8d784cb
commit 4ec3018
Showing
7 changed files
with
207 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// Provenance-includes-location: https://github.com/prometheus/prometheus/blob/main/util/stats/query_stats.go | ||
// Provenance-includes-license: Apache-2.0 | ||
// Provenance-includes-copyright: The Prometheus Authors | ||
|
||
package types | ||
|
||
import ( | ||
"unsafe" | ||
|
||
"github.com/prometheus/prometheus/model/histogram" | ||
) | ||
|
||
// QueryStats tracks statistics about the execution of a single query. | ||
// | ||
// It is not safe to use this type from multiple goroutines simultaneously. | ||
type QueryStats struct { | ||
// The total number of samples processed during the query. | ||
// | ||
// In the case of range vector selectors, each sample is counted once for each time step it appears in. | ||
// For example, if a query is running with a step of 30s with a range vector selector with range 45s, | ||
// then samples in the overlapping 15s are counted twice. | ||
TotalSamples int64 | ||
} | ||
|
||
const timestampFieldSize = int64(unsafe.Sizeof(int64(0))) | ||
|
||
func EquivalentFloatSampleCount(h *histogram.FloatHistogram) int64 { | ||
return (int64(h.Size()) + timestampFieldSize) / int64(FPointSize) | ||
} |