mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-10 17:10:12 -04:00
chore: simplify explicit ST setting
Signed-off-by: Ridwan Sharif <ridwanmsharif@google.com>
This commit is contained in:
parent
d7d7f03e57
commit
c53aa4a207
2 changed files with 8 additions and 14 deletions
|
|
@ -111,10 +111,10 @@ Enables the use of start timestamps (ST) in PromQL functions such as `rate()`, `
|
|||
|
||||
`--enable-feature=st-synthesis`
|
||||
|
||||
Enables the synthesis of start timestamps (ST) for cumulative metrics (Counters, Classic Histograms, and Native Histograms) when they are not provided by the source. It tracks previous values to detect resets and subtracts the initial reference point to synthesize a zero-based timeline from the first sample.
|
||||
|
||||
> NOTE: This is an experimental feature. Enabling this option can cause increased allocations and memory footprint because it requires caching the previous value per series.
|
||||
|
||||
Enables the synthesis of start timestamps (ST) for cumulative metrics (Counters, Classic Histograms, and Native Histograms)
|
||||
when they are not provided by the source. Similar to [the official OpenTelemetry metricstarttimeprocessor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/metricstarttimeprocessor#strategy-subtract-initial-point),
|
||||
it tracks previous values to detect resets and subtracts the initial reference point to synthesize a zero-based timeline
|
||||
from the first sample.
|
||||
|
||||
## Concurrent evaluation of independent rules
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ loop:
|
|||
var (
|
||||
et textparse.Entry
|
||||
shouldCache, isHistogram bool
|
||||
st, explicitST int64
|
||||
st int64
|
||||
met []byte
|
||||
parsedTimestamp *int64
|
||||
val float64
|
||||
|
|
@ -256,12 +256,10 @@ loop:
|
|||
break loop
|
||||
}
|
||||
|
||||
explicitST = 0
|
||||
if sl.parseST {
|
||||
// p.StartTimestamp() tend to be expensive (e.g. OM1). Do it only if we care.
|
||||
explicitST = p.StartTimestamp()
|
||||
st = p.StartTimestamp()
|
||||
}
|
||||
st = explicitST
|
||||
|
||||
if sl.synthesizeST && st == 0 {
|
||||
st, val, h, fh, skipAppend, stCache = sl.checkAndSynthesizeStartTime(st, lset, ce, lastMFName, val, h, fh, t)
|
||||
|
|
@ -355,12 +353,8 @@ loop:
|
|||
}
|
||||
}
|
||||
|
||||
if ce != nil {
|
||||
if sl.synthesizeST && explicitST != 0 {
|
||||
ce.st = nil // Reset cache if explicit ST provided.
|
||||
} else if stCache != nil {
|
||||
ce.st = stCache
|
||||
}
|
||||
if ce != nil && sl.synthesizeST {
|
||||
ce.st = stCache
|
||||
}
|
||||
|
||||
// Track staleness uniformly, bypassing logic if there is an explicit timestamp.
|
||||
|
|
|
|||
Loading…
Reference in a new issue