Skip to content

Commit bdb034e

Browse files
aneesurrehman001dougm
authored andcommitted
api: Exporting Unit field in MetricSeries struct for external use
Closes #3494
1 parent d7e2709 commit bdb034e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

performance/manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,14 @@ func (m *Manager) SampleByName(ctx context.Context, spec types.PerfQuerySpec, me
395395

396396
// MetricSeries contains the same data as types.PerfMetricIntSeries, but with the CounterId converted to Name.
397397
type MetricSeries struct {
398-
Name string `json:"name"`
399-
unit string
398+
Name string `json:"name"`
399+
Unit string `json:"unit"`
400400
Instance string `json:"instance"`
401401
Value []int64 `json:"value"`
402402
}
403403

404404
func (s *MetricSeries) Format(val int64) string {
405-
switch types.PerformanceManagerUnit(s.unit) {
405+
switch types.PerformanceManagerUnit(s.Unit) {
406406
case types.PerformanceManagerUnitPercent:
407407
return strconv.FormatFloat(float64(val)/100.0, 'f', 2, 64)
408408
default:
@@ -470,7 +470,7 @@ func (m *Manager) ToMetricSeries(ctx context.Context, series []types.BasePerfEnt
470470

471471
values = append(values, MetricSeries{
472472
Name: info.Name(),
473-
unit: info.UnitInfo.GetElementDescription().Key,
473+
Unit: info.UnitInfo.GetElementDescription().Key,
474474
Instance: v.Id.Instance,
475475
Value: v.Value,
476476
})

0 commit comments

Comments
 (0)