From df1b888a2bfadefadc7dbfce59d34f811ff002ec Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Thu, 11 Apr 2019 10:59:49 +0200 Subject: Add support for names vector and fill name in interface/node stats Change-Id: I3a6bcb635701c0f00e47d04fce2113e1ac23b67b Signed-off-by: Ondrej Fabry --- adapter/stats_api.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'adapter/stats_api.go') diff --git a/adapter/stats_api.go b/adapter/stats_api.go index 3538176..4087865 100644 --- a/adapter/stats_api.go +++ b/adapter/stats_api.go @@ -39,10 +39,11 @@ type StatType int const ( _ StatType = 0 - ScalarIndex = 1 - SimpleCounterVector = 2 - CombinedCounterVector = 3 - ErrorIndex = 4 + ScalarIndex StatType = 1 + SimpleCounterVector StatType = 2 + CombinedCounterVector StatType = 3 + ErrorIndex StatType = 4 + NameVector StatType = 5 ) func (d StatType) String() string { @@ -55,6 +56,8 @@ func (d StatType) String() string { return "CombinedCounterVector" case ErrorIndex: return "ErrorIndex" + case NameVector: + return "NameVector" } return fmt.Sprintf("UnknownStatType(%d)", d) } @@ -76,6 +79,9 @@ type CombinedCounter struct { Bytes Counter } +// Name represents string value stored under name vector. +type Name string + // ScalarStat represents stat for ScalarIndex. type ScalarStat float64 @@ -92,6 +98,9 @@ type SimpleCounterStat [][]Counter // Values should be aggregated per interface/node for every worker. type CombinedCounterStat [][]CombinedCounter +// NameStat represents stat for NameVector. +type NameStat []Name + // Data represents some type of stat which is usually defined by StatType. type Stat interface { // isStat is unexported to limit implementations of Data interface to this package, @@ -102,3 +111,4 @@ func (ScalarStat) isStat() {} func (ErrorStat) isStat() {} func (SimpleCounterStat) isStat() {} func (CombinedCounterStat) isStat() {} +func (NameStat) isStat() {} -- cgit 1.2.3-korg