@@ -50,8 +50,8 @@ class Metrics
5050 friend class Metrics ;
5151
5252 public:
53- AtomicType () = default ;
54- virtual ~AtomicType () = default ;
53+ AtomicType () = default ;
54+ ~AtomicType () = default ;
5555
5656 int64_t
5757 load () const
@@ -296,6 +296,22 @@ class Metrics
296296 {
297297 };
298298
299+ static AtomicType *
300+ lookup (const std::string_view name)
301+ {
302+ auto &instance = Metrics::instance ();
303+
304+ return reinterpret_cast <AtomicType *>(instance.lookup (name));
305+ }
306+
307+ static AtomicType *
308+ lookup (const IdType id)
309+ {
310+ auto &instance = Metrics::instance ();
311+
312+ return reinterpret_cast <AtomicType *>(instance.lookup (id));
313+ }
314+
299315 static Metrics::IdType
300316 create (const std::string_view name)
301317 {
@@ -335,7 +351,7 @@ class Metrics
335351 }
336352
337353 static int64_t
338- load (AtomicType *metric)
354+ load (const AtomicType *metric)
339355 {
340356 ink_assert (metric);
341357 return metric->_value .load ();
@@ -360,6 +376,22 @@ class Metrics
360376 {
361377 };
362378
379+ static AtomicType *
380+ lookup (const std::string_view name)
381+ {
382+ auto &instance = Metrics::instance ();
383+
384+ return reinterpret_cast <AtomicType *>(instance.lookup (name));
385+ }
386+
387+ static AtomicType *
388+ lookup (const IdType id)
389+ {
390+ auto &instance = Metrics::instance ();
391+
392+ return reinterpret_cast <AtomicType *>(instance.lookup (id));
393+ }
394+
363395 static Metrics::IdType
364396 create (const std::string_view name)
365397 {
@@ -392,7 +424,7 @@ class Metrics
392424 }
393425
394426 static int64_t
395- load (AtomicType *metric)
427+ load (const AtomicType *metric)
396428 {
397429 ink_assert (metric);
398430 return metric->_value .load ();
0 commit comments