mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-02 02:31:14 +00:00
Merge pull request #16697 from Konstantinov-Innokentii/export-query-samples-fields
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
stats: Export QuerySamples StartTimestamp and Interval fields
This commit is contained in:
commit
ea75bc18e9
1 changed files with 6 additions and 6 deletions
|
@ -182,7 +182,7 @@ func (qs *QuerySamples) totalSamplesPerStepPoints() []stepStat {
|
|||
|
||||
ts := make([]stepStat, len(qs.TotalSamplesPerStep))
|
||||
for i, c := range qs.TotalSamplesPerStep {
|
||||
ts[i] = stepStat{T: qs.startTimestamp + int64(i)*qs.interval, V: c}
|
||||
ts[i] = stepStat{T: qs.StartTimestamp + int64(i)*qs.Interval, V: c}
|
||||
}
|
||||
return ts
|
||||
}
|
||||
|
@ -246,8 +246,8 @@ type QuerySamples struct {
|
|||
TotalSamplesPerStep []int64
|
||||
|
||||
EnablePerStepStats bool
|
||||
startTimestamp int64
|
||||
interval int64
|
||||
StartTimestamp int64
|
||||
Interval int64
|
||||
}
|
||||
|
||||
type Stats struct {
|
||||
|
@ -262,8 +262,8 @@ func (qs *QuerySamples) InitStepTracking(start, end, interval int64) {
|
|||
|
||||
numSteps := int((end-start)/interval) + 1
|
||||
qs.TotalSamplesPerStep = make([]int64, numSteps)
|
||||
qs.startTimestamp = start
|
||||
qs.interval = interval
|
||||
qs.StartTimestamp = start
|
||||
qs.Interval = interval
|
||||
}
|
||||
|
||||
// IncrementSamplesAtStep increments the total samples count. Use this if you know the step index.
|
||||
|
@ -287,7 +287,7 @@ func (qs *QuerySamples) IncrementSamplesAtTimestamp(t, samples int64) {
|
|||
qs.TotalSamples += samples
|
||||
|
||||
if qs.TotalSamplesPerStep != nil {
|
||||
i := int((t - qs.startTimestamp) / qs.interval)
|
||||
i := int((t - qs.StartTimestamp) / qs.Interval)
|
||||
qs.TotalSamplesPerStep[i] += samples
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue