bneradt commented on code in PR #12250:
URL: https://github.com/apache/trafficserver/pull/12250#discussion_r2098378729


##########
include/iocore/net/ConnectionTracker.h:
##########
@@ -322,6 +333,31 @@ ConnectionTracker::Group::hash(const Key &key)
   }
 }
 
+inline std::string
+ConnectionTracker::Group::metric_name(const Key &key, std::string_view fqdn, 
std::string metric_prefix)
+{
+  std::string metric_name = "";
+  char        buf[INET6_ADDRSTRLEN];
+
+  switch (key._match_type) {
+  case MATCH_IP:
+    metric_name += ats_ip_ntop(&key._addr.sa, buf, sizeof(buf));
+    break;
+  case MATCH_PORT:
+    metric_name += ats_ip_nptop(&key._addr.sa, buf, sizeof(buf));
+    break;
+  case MATCH_HOST:
+    metric_name += std::string(fqdn);
+    break;
+  case MATCH_BOTH:
+    metric_name += std::string(fqdn) + "." + ats_ip_nptop(&key._addr.sa, buf, 
sizeof(buf));
+    break;
+  default:
+    metric_name += "";

Review Comment:
   It might be better to actually remove the default so that the compiler will 
warn if a new value is added and the switch statement isn't updated to 
accomodate it.



-- 
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