zwoop commented on code in PR #10694:
URL: https://github.com/apache/trafficserver/pull/10694#discussion_r1384181248


##########
include/api/Metrics.h:
##########
@@ -289,10 +280,126 @@ class Metrics
 
   mutable std::mutex _mutex;
   LookupTable _lookups;
-  MetricBlobs _blobs;
+  BlobStorage _blobs;
   uint16_t _cur_blob = 0;
   uint16_t _cur_off  = 0;
 
+public:
+  // These are sort of factory classes, using the Metrics singleton for all 
storage etc.
+  class Gauge
+  {
+  public:
+    using self_type = Gauge;
+    using SpanType  = Metrics::SpanType;
+
+    class AtomicType : public Metrics::AtomicType
+    {
+    };

Review Comment:
   Because then the compiler won't give errors or warnings about wrong types. 
Initially I did this all with "using", and then it became too easy to do the 
wrong things with the wrong types of metrics. Meaning, if you do
   
   ```
   using Foo == Bar;
   ```
   
   Foo and Bar are identical types, and can be used interchangeable. They truly 
are aliases. And I wanted to avoid people trying to do dangerous stuff such as 
sucking out a Counter out of the metrics storage, and then treat it as a Gauge.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to