Add rounding to archiver avg stat calculation

This commit is contained in:
Christoph Kluge 2025-02-24 11:10:45 +01:00
parent 998ef8d834
commit 633bd42036
2 changed files with 3 additions and 2 deletions

View File

@ -60,12 +60,13 @@ func ArchiveJob(job *schema.Job, ctx context.Context) (*schema.JobMeta, error) {
max = math.Max(max, series.Statistics.Max) max = math.Max(max, series.Statistics.Max)
} }
// Round AVG Result to 2 Digits
jobMeta.Statistics[metric] = schema.JobStatistics{ jobMeta.Statistics[metric] = schema.JobStatistics{
Unit: schema.Unit{ Unit: schema.Unit{
Prefix: archive.GetMetricConfig(job.Cluster, metric).Unit.Prefix, Prefix: archive.GetMetricConfig(job.Cluster, metric).Unit.Prefix,
Base: archive.GetMetricConfig(job.Cluster, metric).Unit.Base, Base: archive.GetMetricConfig(job.Cluster, metric).Unit.Base,
}, },
Avg: avg / float64(job.NumNodes), Avg: (math.Round((avg/float64(job.NumNodes))*100) / 100),
Min: min, Min: min,
Max: max, Max: max,
} }

View File

@ -94,7 +94,7 @@ func RegisterFootprintWorker() {
} }
} }
// Add values rounded to 2 digits // Add values rounded to 2 digits: repo.LoadStats may return unrounded
jobMeta.Statistics[metric] = schema.JobStatistics{ jobMeta.Statistics[metric] = schema.JobStatistics{
Unit: schema.Unit{ Unit: schema.Unit{
Prefix: archive.GetMetricConfig(job.Cluster, metric).Unit.Prefix, Prefix: archive.GetMetricConfig(job.Cluster, metric).Unit.Prefix,