From: Juha Hyttinen Date: Fri, 30 Oct 2020 10:31:01 +0000 (+0200) Subject: Support counter and gauge get. Needed in some rare cases X-Git-Tag: v0.5.11^0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=inline;h=f17036063ccad42582f6c48a43bb4496af3f7461;p=ric-plt%2Fxapp-frame.git Support counter and gauge get. Needed in some rare cases Change-Id: I950b04e2c96e9ae9657ad86414d15ed3d52162ce Signed-off-by: Juha Hyttinen --- diff --git a/pkg/xapp/metrics.go b/pkg/xapp/metrics.go index 96f407c..f85c488 100644 --- a/pkg/xapp/metrics.go +++ b/pkg/xapp/metrics.go @@ -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()