Support counter and gauge get. Needed in some rare cases
[ric-plt/xapp-frame.git] / 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()