Prototype completed

This commit is contained in:
Christoph Kluge
2023-12-05 15:30:40 +01:00
parent b5b355c16c
commit ead5c54bcb
6 changed files with 87 additions and 19 deletions

View File

@@ -536,11 +536,13 @@ func (r *JobRepository) jobsMetricStatisticsHistogram(
// Get specific Peak or largest Peak
var metricConfig *schema.MetricConfig
var peak float64 = 0.0
var unit string = ""
for _, f := range filters {
if f.Cluster != nil {
metricConfig = archive.GetMetricConfig(*f.Cluster.Eq, metric)
peak = metricConfig.Peak
unit = metricConfig.Unit.Prefix + metricConfig.Unit.Base
log.Debugf("Cluster %s filter found with peak %f for %s", *f.Cluster.Eq, peak, metric)
}
}
@@ -552,6 +554,9 @@ func (r *JobRepository) jobsMetricStatisticsHistogram(
if m.Peak > peak {
peak = m.Peak
}
if unit == "" {
unit = m.Unit.Prefix + m.Unit.Base
}
}
}
}
@@ -602,7 +607,7 @@ func (r *JobRepository) jobsMetricStatisticsHistogram(
points = append(points, &point)
}
result := model.MetricHistoPoints{Metric: metric, Data: points}
result := model.MetricHistoPoints{Metric: metric, Unit: unit, Data: points}
log.Debugf("Timer jobsStatisticsHistogram %s", time.Since(start))
return &result, nil