Support counter and gauge get. Needed in some rare cases 47/4947/1 v0.5.11
authorJuha Hyttinen <juha.hyttinen@nokia.com>
Fri, 30 Oct 2020 10:31:01 +0000 (12:31 +0200)
committerJuha Hyttinen <juha.hyttinen@nokia.com>
Fri, 30 Oct 2020 10:31:25 +0000 (12:31 +0200)
Change-Id: I950b04e2c96e9ae9657ad86414d15ed3d52162ce
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
pkg/xapp/metrics.go

index 96f407c..f85c488 100644 (file)
@@ -52,6 +52,12 @@ func (met *MetricGroupsCache) CIs(metric string) bool {
        return ok
 }
 
+func (met *MetricGroupsCache) CGet(metric string) Counter {
+       met.RLock()
+       defer met.RUnlock()
+       return met.counters[metric]
+}
+
 func (met *MetricGroupsCache) CInc(metric string) {
        met.RLock()
        defer met.RUnlock()
@@ -71,6 +77,12 @@ func (met *MetricGroupsCache) GIs(metric string) bool {
        return ok
 }
 
+func (met *MetricGroupsCache) GGet(metric string) Gauge {
+       met.RLock()
+       defer met.RUnlock()
+       return met.gauges[metric]
+}
+
 func (met *MetricGroupsCache) GSet(metric string, val float64) {
        met.RLock()
        defer met.RUnlock()