This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 2701f6c954 Cleanup Redundant JMX Exporter Rules (#14348)
2701f6c954 is described below

commit 2701f6c9547ddda9558dc19b787740db92aa0d13
Author: Prashant Pandey <[email protected]>
AuthorDate: Tue Dec 17 00:57:11 2024 +0530

    Cleanup Redundant JMX Exporter Rules (#14348)
---
 .../jmx_prometheus_javaagent/configs/broker.yml    | 233 ++---------------
 .../configs/controller.yml                         | 280 +++------------------
 .../jmx_prometheus_javaagent/configs/minion.yml    |  52 +---
 .../jmx_prometheus_javaagent/configs/server.yml    | 246 +++---------------
 .../prometheus/BrokerPrometheusMetricsTest.java    |   4 +-
 .../ControllerPrometheusMetricsTest.java           |   3 +-
 .../prometheus/MinionPrometheusMetricsTest.java    |  14 +-
 .../prometheus/PinotPrometheusMetricsTest.java     |   7 +-
 .../prometheus/ServerPrometheusMetricsTest.java    |  13 +-
 9 files changed, 105 insertions(+), 747 deletions(-)

diff --git 
a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/broker.yml 
b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/broker.yml
index cabeb7048b..771f45fe52 100644
--- a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/broker.yml
+++ b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/broker.yml
@@ -1,208 +1,5 @@
 rules:
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.authorization\"><>(\\w+)"
-  name: "pinot_broker_authorization_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.documentsScanned\"><>(\\w+)"
-  name: "pinot_broker_documentsScanned_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.entriesScannedInFilter\"><>(\\w+)"
-  name: "pinot_broker_entriesScannedInFilter_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.entriesScannedPostFilter\"><>(\\w+)"
-  name: "pinot_broker_entriesScannedPostFilter_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.freshnessLagMs\"><>(\\w+)"
-  name: "pinot_broker_freshnessLagMs_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.queries\"><>(\\w+)"
-  name: "pinot_broker_queries_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.queryExecution\"><>(\\w+)"
-  name: "pinot_broker_queryExecution_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.queryRouting\"><>(\\w+)"
-  name: "pinot_broker_queryRouting_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.reduce\"><>(\\w+)"
-  name: "pinot_broker_reduce_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.requestCompilation\"><>(\\w+)"
-  name: "pinot_broker_requestCompilation_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.requestSize\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
-  name: "pinot_broker_requestSize_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.scatterGather\"><>(\\w+)"
-  name: "pinot_broker_scatterGather_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.totalServerResponseSize\"><>(\\w+)"
-  name: "pinot_broker_totalServerResponseSize_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.groupBySize\"><>(\\w+)"
-  name: "pinot_broker_groupBySize_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.noServingHostForSegment\"><>(\\w+)"
-  name: "pinot_broker_noServingHostForSegment_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.healthcheck(\\w+)\"><>(\\w+)"
-  name: "pinot_broker_healthcheck_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.helix\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_broker_helix_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.helixZookeeper(\\w+)\"><>(\\w+)"
-  name: "pinot_broker_helix_zookeeper_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.nettyConnection(\\w+)\"><>(\\w+)"
-  name: "pinot_broker_nettyConnection_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.unhealthyServers\"><>(\\w+)"
-  name: "pinot_broker_unhealthyServers_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.clusterChangeCheck\"\"><>(\\w+)"
-  name: "pinot_broker_clusterChangeCheck_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.proactiveClusterChangeCheck\"><>(\\w+)"
-  name: "pinot_broker_proactiveClusterChangeCheck_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(\\w+)Exceptions\"><>(\\w+)"
-  name: "pinot_broker_exceptions_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.routingTableUpdateTime\"><>(\\w+)"
-  name: "pinot_broker_routingTableUpdateTime_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.adaptiveServerSelectorType\"><>(\\w+)"
-  name: "pinot_broker_adaptiveServerSelectorType_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.adaptiveServerSelectorType\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_broker_adaptiveServerSelectorType_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.brokerResponsesWithPartialServersResponded\"><>(\\w+)"
-  name: "pinot_broker_brokerResponsesWithPartialServersResponded_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.brokerResponsesWithTimeouts\"><>(\\w+)"
-  name: "pinot_broker_brokerResponsesWithTimeouts_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.noServerFoundExceptions\"><>(\\w+)"
-  name: "pinot_broker_noServerFoundExceptions_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.brokerResponsesWithProcessingExceptions\"><>(\\w+)"
-  name: "pinot_broker_brokerResponsesWithProcessingExceptions_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.brokerResponsesWithNumGroupsLimitReached\"><>(\\w+)"
-  name: "pinot_broker_brokerResponsesWithNumGroupsLimitReached_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.queryQuotaExceeded\"><>(\\w+)"
-  name: "pinot_broker_queryQuotaExceeded_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.queryTotalTimeMs\"><>(\\w+)"
-  name: "pinot_broker_queryTotalTimeMs_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.serverMissingForRouting\"><>(\\w+)"
-  name: "pinot_broker_serverMissingForRouting_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.deserialization\"><>(\\w+)"
-  name: "pinot_broker_deserialization_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(([^.]+)\\.)?([^.]*)\\.requestConnectionWait\"><>(\\w+)"
-  name: "pinot_broker_requestConnectionWait_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.version\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_version"
-  cache: true
-  labels:
-    version: "$2"
-
-  ## Metrics that fit the catch-all patterns above should not be added to this 
file.
-  ## In case a metric does not fit the catch-all patterns, add them before 
this comment
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\d+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$8"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-    partition: "$7"
-  # This is a catch-all pattern for pinot table metrics with offline/realtime 
suffix without kafka topic
-  # Patterns after this line may be skipped.
+# Meters/timers that accept tableNameWithType
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$6_$7"
   cache: true
@@ -210,7 +7,7 @@ rules:
     database: "$3"
     table: "$2$4"
     tableType: "$5"
-  #when there is no partition in the metric
+# Gauges that accept tableNameWithType
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\\"?><>(\\w+)"
   name: "pinot_$1_$2_$7"
   cache: true
@@ -218,24 +15,26 @@ rules:
     database: "$4"
     table: "$3$5"
     tableType: "$6"
-  #This is a catch-all pattern for pinot table metrics with offline/realtime 
suffix that also contain kafka topic
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$9"
+# Gauges that accept raw table name. Add any new metric names to (requestSize) 
group
+# We've to hardcode metric names otherwise meters/timers start colliding with 
this regexp. This happens due to inconsistent naming convention of gauges. Ref: 
https://github.com/apache/pinot/pull/14348#pullrequestreview-2480114447
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(requestSize)\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
+  name: "pinot_broker_$1_$5"
   cache: true
   labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-    topic: "$7"
-    partition: "$8"
-  # This is a catch-all pattern for pinot table metrics. Patterns after this 
line may be skipped.
+    database: "$3"
+    table: "$2$4"
+# Meters/timers that accept rawTableName
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$5_$6"
   cache: true
   labels:
     database: "$3"
     table: "$2$4"
-  # This is a catch-all pattern for pinot controller metrics not related to 
tables. Patterns after this line may be skipped.
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$3"
+# These five meters are exported as `pinot_broker_exceptions_`. This regex has 
been added to maintain backward compat. Don't add more metrics to this list. 
They should rather be exported as `pinot_broker_myException`
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"BrokerMetrics\", 
name=\"pinot\\.broker\\.(uncaughtGet|uncaughtPost|queryRejected|requestCompilation|resourceMissing)Exceptions\"><>(\\w+)"
+  name: "pinot_broker_exceptions_$1_$2"
+  cache: true
+# All global gauge/meters/timers
+- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.broker\\.(\\w+)\"?><>(\\w+)"
+  name: "pinot_broker_$1_$2"
   cache: true
diff --git 
a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/controller.yml 
b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/controller.yml
index 2de30b46a5..908dd95f65 100644
--- a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/controller.yml
+++ b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/controller.yml
@@ -1,102 +1,29 @@
 rules:
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.controller(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.helix\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_helix_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.helixZookeeperReconnects\"><>(\\w+)"
-  name: "pinot_controller_helix_ZookeeperReconnects_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.idealstateZnodeSize\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_idealstateZnodeSize_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.idealstateZnodeByteSize\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_idealstateZnodeByteSize_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.replicationFromConfig\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_replicationFromConfig_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.numberOfReplicas\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_numberOfReplicas_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.percentOfReplicas\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_percentOfReplicas_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.percentSegmentsAvailable\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_percentSegmentsAvailable_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.segmentCount\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_segmentCount_$5"
+# Gauges that accept tableNameWithType
+- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\\"?><>(\\w+)"
+  name: "pinot_$1_$2_$7"
   cache: true
   labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.segmentsInErrorState\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_segmentsInErrorState_$5"
+    database: "$4"
+    table: "$3$5"
+    tableType: "$6"
+# Gauges that accept tableNameWithType + partition
+- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\d+)\"?><>(\\w+)"
+  name: "pinot_$1_$2_$8"
   cache: true
   labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.dataDir\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_dataDir_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.numberSegmentUploadTimeoutExceeded\"><>(\\w+)"
-  name: "pinot_controller_numberSegmentUploadTimeoutExceeded_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.numberTimesScheduleTasksCalled\"><>(\\w+)"
-  name: "pinot_controller_numberTimesScheduleTasksCalled_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.periodicTaskNumTablesProcessed\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_periodicTaskNumTablesProcessed_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.pinotControllerLeader\"><>(\\w+)"
-  name: "pinot_controller_pinotControllerLeader_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.pinotControllerPartitionLeader\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_partitionLeader_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.realtimeTableCount\"><>(\\w+)"
-  name: "pinot_controller_realtimeTableCount_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.offlineTableCount\"><>(\\w+)"
-  name: "pinot_controller_offlineTableCount_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tierBackendTableCount\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_tierBackendTableCount_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ValidationMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_validateion_$4_$5"
+    database: "$4"
+    table: "$3$5"
+    tableType: "$6"
+    partition: "$7"
+# Gauges that accept the controller taskType
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(numMinionTasksInProgress|numMinionSubtasksRunning|numMinionSubtasksWaiting|numMinionSubtasksError|percentMinionSubtasksInQueue|percentMinionSubtasksInError)\\.(\\w+)\"><>(\\w+)"
+  name: "pinot_controller_$1_$3"
   cache: true
   labels:
-    database: "$2"
-    table: "$1$3"
+    taskType: "$2"
+# We hardcode `cronScheduleJobScheduled` and `periodicTaskError`
+# cronScheduleJobScheduled exports the label `table=${tableName}_${tableType}.
 - pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.cronSchedulerJobScheduled\\.(([^.]+)\\.)?([^.]*)\\.(\\w+)\"><>(\\w+)"
   name: "pinot_controller_cronSchedulerJobScheduled_$5"
   cache: true
@@ -104,49 +31,16 @@ rules:
     database: "$2"
     table: "$1$3"
     taskType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)\\.(\\w+)\\.cronSchedulerJobTriggered\"><>(\\w+)"
-  name: "pinot_controller_cronSchedulerJobTriggered_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    taskType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)\\.(\\w+)\\.cronSchedulerJobSkipped\"><>(\\w+)"
-  name: "pinot_controller_cronSchedulerJobSkipped_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    taskType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)\\.(\\w+)\\.cronSchedulerJobExecutionTimeMs\"><>(\\w+)"
-  name: "pinot_controller_cronSchedulerJobExecutionTimeMs_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    taskType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)\\.(\\w+)\\.tableRebalanceExecutionTimeMs\"><>(\\w+)"
-  name: "pinot_controller_tableRebalanceExecutionTimeMs_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    result: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.taskStatus\\.([^.]*)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_taskStatus_$3"
-  cache: true
-  labels:
-    taskType: "$1"
-    status: "$2"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.timeMsSinceLastMinionTaskMetadataUpdate\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_timeMsSinceLastMinionTaskMetadataUpdate_$6"
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\\.periodicTaskError\"><>(\\w+)"
+  name: "pinot_controller_periodicTaskError_$6"
   cache: true
   labels:
     database: "$2"
     table: "$1$3"
     tableType: "$4"
-    taskType: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(numMinionSubtasksRunning|numMinionSubtasksWaiting|numMinionSubtasksError|percentMinionSubtasksInQueue|percentMinionSubtasksInError)\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
+    periodicTask: "$5"
+# Gauges that accept tableNameWithType + the controller taskType
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.([^.]*)\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
   name: "pinot_controller_$1_$7"
   cache: true
   labels:
@@ -154,105 +48,18 @@ rules:
     table: "$2$4"
     tableType: "$5"
     taskType: "$6"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(numMinionTasksInProgress|numMinionSubtasksRunning|numMinionSubtasksWaiting|numMinionSubtasksError|percentMinionSubtasksInQueue|percentMinionSubtasksInError)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_$1_$3"
+# Gauges that accept taskType and task status
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.([^.]*)\\.([^.]*)\\.(\\w+)\"><>(\\w+)"
+  name: "pinot_controller_$1_$4"
   cache: true
   labels:
     taskType: "$2"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.timeMsSinceLastSuccessfulMinionTaskGeneration\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_timeMsSinceLastSuccessfulMinionTaskGeneration_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    taskType: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.lastMinionTaskGenerationEncountersError\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_controller_lastMinionTaskGenerationEncountersError_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    taskType: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.pinotLeadControllerResourceEnabled\"><>(\\w+)"
-  name: "pinot_controller_pinotLeadControllerResourceEnabled_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.offlineTableEstimatedSize\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
-  name: "pinot_controller_offlineTableEstimatedSize_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tableQuota\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_tableQuota_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\\.periodicTaskError\"><>(\\w+)"
-  name: "pinot_controller_periodicTaskError_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    periodicTask: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tableStorageQuotaUtilization\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_tableStorageQuotaUtilization_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tableStorageEstMissingSegmentPercent\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_tableStorageEstMissingSegmentPercent_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tableTotalSizeOnServer\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_tableTotalSizeOnServer_$5"
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tableSizePerReplicaOnServer\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_tableSizePerReplicaOnServer_$5"
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.tableCompressedSize\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_controller_tableCompressedSize_$5"
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-# Controller periodic task metrics
+    status: "$3"
+# Meter for controller periodic tasks runs
 - pattern: 
"\"?org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"?pinot\\.controller\\.(\\w+)\\.controllerPeriodicTaskRun\"?><>(\\w+)"
   name: "pinot_controller_periodicTaskRun_$1_$2"
   cache: true
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.version\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_version"
-  cache: true
-  labels:
-    version: "$2"
-
-  ## Metrics that fit the catch-all patterns above should not be added to this 
file.
-  ## In case a metric does not fit the catch-all patterns, add them before 
this comment
-  # This is a catch-all pattern for pinot table metrics with offline/realtime 
suffix without kafka topic
-  # Patterns after this line may be skipped.
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\d+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$8"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-    partition: "$7"
+# Meters/timers that accept tableNameWithType
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$6_$7"
   cache: true
@@ -260,32 +67,19 @@ rules:
     database: "$3"
     table: "$2$4"
     tableType: "$5"
-  #This is a catch-all pattern for pinot table metrics with offline/realtime 
suffix that also contain kafka topic
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$9"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-    topic: "$7"
-    partition: "$8"
-  #when there is no partition in the metric
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\\"?><>(\\w+)"
-  name: "pinot_$1_$2_$7"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-  # This is a catch-all pattern for pinot table metrics. Patterns after this 
line may be skipped.
+# Meters/timers that accept rawTableName
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$5_$6"
   cache: true
   labels:
     database: "$3"
     table: "$2$4"
-  # This is a catch-all pattern for pinot controller metrics not related to 
tables. Patterns after this line may be skipped.
+# Global meters that have prefix `controller`
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ControllerMetrics\", 
name=\"pinot\\.controller\\.controller(\\w+)\"><>(\\w+)"
+  name: "pinot_controller_$1_$2"
+  cache: true
+# Global gauges/meters/timers
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$2_$3"
   cache: true
+
diff --git 
a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/minion.yml 
b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/minion.yml
index d22340d153..b8e5a73d3c 100644
--- a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/minion.yml
+++ b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/minion.yml
@@ -1,17 +1,6 @@
 rules:
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.version\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_minion_version"
-  cache: true
-  labels:
-    version: "$1"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.numberOfTasks\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_minion_numberOfTasks_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\\.(taskExecution|taskQueueing|numberTasks|numberTasksExecuted|numberTasksCompleted|numberTasksCancelled|numberTasksFailed|numberTasksFatalFailed|segmentBytesDownloaded|segmentDownloadCount|segmentBytesUploaded|segmentUploadCount|recordsPurgedCount|recordsProcessedCount|compactedRecordsCount)\"><>(\\w+)"
+# Meters/timers that accept tableNameWithType and minion taskType
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\\.(\\w+)\"><>(\\w+)"
   name: "pinot_minion_$6_$7"
   cache: true
   labels:
@@ -19,46 +8,13 @@ rules:
     table: "$1$3"
     tableType: "$4"
     taskType: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(segmentBytesDownloaded|segmentDownloadCount|segmentBytesUploaded|segmentUploadCount|recordsPurgedCount|recordsProcessedCount)\"><>(\\w+)"
-  name: "pinot_minion_$4_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_minion_$1_$2"
-  cache: true
+# Meters that accept either rawTableName or tableNameWithType ($1). $2 is the 
metric name
 - pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"MinionMetrics\", 
name=\"pinot\\.minion\\.(\\w+)\\.(\\w+)\"><>(\\w+)"
   name: "pinot_minion_$2_$3"
   cache: true
   labels:
     id: "$1"
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.version\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_version"
-  cache: true
-  labels:
-    version: "$2"
-
-  ## Metrics that fit the catch-all patterns above should not be added to this 
file.
-  ## In case a metric does not fit the catch-all patterns, add them before 
this comment
-
-  # This is a catch-all pattern for pinot table metrics with offline/realtime 
suffix.
-  # Patterns after this line may be skipped.
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$6_$7"
-  cache: true
-  labels:
-    database: "$3"
-    table: "$2$4"
-    tableType: "$5"
-  # This is a catch-all pattern for pinot table metrics. Patterns after this 
line may be skipped.
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$5_$6"
-  cache: true
-  labels:
-    database: "$3"
-    table: "$2$4"
-  # This is a catch-all pattern for pinot controller metrics not related to 
tables. Patterns after this line may be skipped.
+# All global gauges/meters/timers
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$2_$3"
   cache: true
diff --git 
a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/server.yml 
b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/server.yml
index 8751bfa517..341d1d3f95 100644
--- a/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/server.yml
+++ b/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/server.yml
@@ -1,44 +1,32 @@
 rules:
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.documentCount\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_server_documentCount_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.segmentCount\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_server_segmentCount_$5"
+# Gauges that accept tableNameWithType
+- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\\"?><>(\\w+)"
+  name: "pinot_$1_$2_$7"
   cache: true
   labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.helix\\.connected\"><>(\\w+)"
-  name: "pinot_server_helix_connected_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.helixZookeeperReconnects\"><>(\\w+)"
-  name: "pinot_server_helix_zookeeperReconnects_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.highestKafkaOffsetConsumed\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"><>(\\w+)"
-  name: "pinot_server_highestKafkaOffsetConsumed_$7"
+    database: "$4"
+    table: "$3$5"
+    tableType: "$6"
+# Gauges that accept raw table name. Add any new metric names to ($metricName) 
group
+# We've to hardcode metric names otherwise meters/timers start colliding with 
this regexp. This happens due to inconsistent naming convention of gauges. Ref: 
https://github.com/apache/pinot/pull/14348#pullrequestreview-2480114447
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(realtimeSegmentNumPartitions|luceneIndexingDelayMs|luceneIndexingDelayDocs)\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
+  name: "pinot_server_$1_$5"
   cache: true
   labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    topic: "$5"
-    partition: "$6"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.highestStreamOffsetConsumed\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"><>(\\w+)"
-  name: "pinot_server_highestStreamOffsetConsumed_$7"
+    database: "$3"
+    table: "$2$4"
+# Gauges that accept tableNameWithType + partitionId
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(\\w+)\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
+  name: "pinot_server_$1_$7"
   cache: true
   labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    topic: "$5"
+    database: "$3"
+    table: "$2$4"
+    tableType: "$5"
     partition: "$6"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.lastRealtimeSegment(\\w+)Seconds\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"><>(\\w+)"
-  name: "pinot_server_lastRealtimeSegment$1Seconds_$8"
+# Gauges that accept tableNameWithType + topic + partition
+- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.server\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"?><>(\\w+)"
+  name: "pinot_server_$1_$8"
   cache: true
   labels:
     database: "$3"
@@ -46,206 +34,46 @@ rules:
     tableType: "$5"
     topic: "$6"
     partition: "$7"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.llcControllerResponse(\\w+)\"><>(\\w+)"
-  name: "pinot_server_llcControllerResponse_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.llcPartitionConsuming\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"><>(\\w+)"
-  name: "pinot_server_llcPartitionConsuming_$7"
+# Special gauges that contain pinot_server_realtime as prefixes. This has to 
be hardcoded as most of the other gauges are exported as 
pinot_server_realtimeMetricName. This is an exception
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeOffheapMemoryUsed\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
+  name: "pinot_server_realtime_offheapMemoryUsed_$4"
   cache: true
   labels:
     database: "$2"
     table: "$1$3"
-    tableType: "$4"
-    topic: "$5"
-    partition: "$6"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeIngestionDelayMs\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_realtimeIngestionDelayMs_$6"
+# Meters/timers that accept tableNametWithType + topic + partition
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\\.(\\w+)\"><>(\\w+)"
+  name: "pinot_server_$7_$8"
   cache: true
   labels:
     database: "$2"
     table: "$1$3"
     tableType: "$4"
-    partition: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.endToEndRealtimeIngestionDelayMs\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_endToEndRealtimeIngestionDelayMs_$6"
+    topic: "$5"
+    partition: "$6"
+# Meters/timers that accept tableNameWithType
+- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
+  name: "pinot_server_$5_$6"
   cache: true
   labels:
     database: "$2"
     table: "$1$3"
     tableType: "$4"
-    partition: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeIngestionOffsetLag\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_realtimeIngestionOffsetLag_$6"
+# Meters/timers that accept rawTableName
+- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.server\\.((\\w+)\\.)?(\\w+)\\.(\\w+)\"?><>(\\w+)"
+  name: "pinot_server_$4_$5"
   cache: true
   labels:
     database: "$2"
     table: "$1$3"
-    tableType: "$4"
-    partition: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.llcSimultaneousSegmentBuilds\"><>(\\w+)"
-  name: "pinot_server_llcSimultaneousSegmentBuilds_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.memory\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_memory_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.queries\"><>(\\w+)"
-  name: "pinot_server_queries_$1"
-  cache: true
+# Harcoded meters
 - pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeConsumptionExceptions\"><>(\\w+)"
   name: "pinot_server_realtime_consumptionExceptions_$1"
   cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\\.(invalidRealtimeRowsDropped|incompleteRealtimeRowsConsumed|rowsWithErrors|realtimeRowsFiltered|realtimeRowsConsumed|realtimeRowsFetched|streamConsumerCreateExceptions|realtimeRowsSanitized)\"><>(\\w+)"
-  name: "pinot_server_$7_$8"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    topic: "$5"
-    partition: "$6"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeOffheapMemoryUsed\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
-  name: "pinot_server_realtime_offheapMemoryUsed_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeOffsetCommits\"><>(\\w+)"
-  name: "pinot_server_realtime_offsetCommits_$1"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeRowsConsumed\"><>(\\w+)"
-  name: "pinot_server_realtime_rowsConsumed_$1"
-  cache: true
 - pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(\\w+)Exceptions\"><>(\\w+)"
   name: "pinot_server_realtime_exceptions_$1_$2"
   cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.transport\\.netty\\.NettyTCPServer_(\\w+)_\"<type=\"\",
 name=\"(\\w+)\"><>(\\w+)"
-  name: "pinot_server_netty_tcp_$2_$3"
-  cache: true
-  labels:
-    id: "$1"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.nettyConnection(\\w+)\"><>(\\w+)"
-  name: "pinot_server_nettyConnection_$1_$2"
-  cache: true
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.realtimeSegmentNumPartitions\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
-  name: "pinot_server_realtimeSegmentNumPartitions_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.luceneIndexingDelayMs\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
-  name: "pinot_server_luceneIndexingDelayMs_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.luceneIndexingDelayDocs\\.(([^.]+)\\.)?([^.]*)\"><>(\\w+)"
-  name: "pinot_server_luceneIndexingDelayDocs_$4"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.numResizes\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_server_numResizes_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.resizeTimeMs\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\"><>(\\w+)"
-  name: "pinot_server_resizeTimeMs_$5"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.upsertPrimaryKeysCount\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_upsertPrimaryKeysCount_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    partition: "$5"
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.version\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_version"
-  cache: true
-  labels:
-    version: "$2"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.upsertValidDocIdSnapshotCount\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_upsertValidDocIdSnapshotCount_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    partition: "$5"
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.upsertPrimaryKeysInSnapshotCount\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_upsertPrimaryKeysInSnapshotCount_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-    partition: "$5"
-#grpc related metrics
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.grpc(.+)\"><>(\\w+)"
-  name: "pinot_server_grpc$1_$2"
-  cache: true
-
-- pattern: 
"\"org\\.apache\\.pinot\\.common\\.metrics\"<type=\"ServerMetrics\", 
name=\"pinot\\.server\\.(([^.]+)\\.)?([^.]*)_(OFFLINE|REALTIME)\\.(\\w+)\"><>(\\w+)"
-  name: "pinot_server_$5_$6"
-  cache: true
-  labels:
-    database: "$2"
-    table: "$1$3"
-    tableType: "$4"
-
-  ## Metrics that fit the catch-all patterns above should not be added to this 
file.
-  ## In case a metric does not fit the catch-all patterns, add them before 
this comment
-  # when there is partition but no topic in the metric
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\d+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$8"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-    partition: "$7"
-  # This is a catch-all pattern for pinot table metrics with offline/realtime 
suffix without the topic
-  # Patterns after this line may be skipped.
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$6_$7"
-  cache: true
-  labels:
-    database: "$3"
-    table: "$2$4"
-    tableType: "$5"
-#when there is partition and topic in the metric
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\-(.+)\\-(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$2_$9"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-    topic: "$7"
-    partition: "$8"
-#when there is no partition in the metric
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\\.((\\w+)\\.)?(\\w+)_(OFFLINE|REALTIME)\\\"?><>(\\w+)"
-  name: "pinot_$1_$2_$7"
-  cache: true
-  labels:
-    database: "$4"
-    table: "$3$5"
-    tableType: "$6"
-  # This is a catch-all pattern for pinot table metrics. Patterns after this 
line may be skipped.
-- pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.((\\w+)\\.)?(\\w+)\\.(\\w+)\"?><>(\\w+)"
-  name: "pinot_$1_$5_$6"
-  cache: true
-  labels:
-    database: "$3"
-    table: "$2$4"
-  # This is a catch-all pattern for pinot controller metrics not related to 
tables. Patterns after this line may be skipped.
+# All global gauges/meters/timers
 - pattern: "\"?org\\.apache\\.pinot\\.common\\.metrics\"?<type=\"?\\w+\"?, 
name=\"?pinot\\.(\\w+)\\.(\\w+)\"?><>(\\w+)"
   name: "pinot_$1_$2_$3"
   cache: true
diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/BrokerPrometheusMetricsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/BrokerPrometheusMetricsTest.java
index 399e5b400b..79add5d557 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/BrokerPrometheusMetricsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/BrokerPrometheusMetricsTest.java
@@ -50,6 +50,8 @@ public abstract class BrokerPrometheusMetricsTest extends 
PinotPrometheusMetrics
           BrokerMeter.ENTRIES_SCANNED_POST_FILTER, 
BrokerMeter.TOTAL_SERVER_RESPONSE_SIZE,
           BrokerMeter.QUERY_QUOTA_EXCEEDED);
 
+  private static final List<BrokerGauge> GAUGES_ACCEPTING_RAW_TABLE_NAME = 
List.of(BrokerGauge.REQUEST_SIZE);
+
   private BrokerMetrics _brokerMetrics;
 
   @BeforeClass
@@ -77,7 +79,7 @@ public abstract class BrokerPrometheusMetricsTest extends 
PinotPrometheusMetrics
       _brokerMetrics.setOrUpdateGlobalGauge(gauge, () -> 5L);
       assertGaugeExportedCorrectly(gauge.getGaugeName(), 
EXPORTED_METRIC_PREFIX);
     } else {
-      if (gauge == BrokerGauge.REQUEST_SIZE) {
+      if (GAUGES_ACCEPTING_RAW_TABLE_NAME.contains(gauge)) {
         
_brokerMetrics.setOrUpdateTableGauge(PinotPrometheusMetricsTest.ExportedLabelValues.TABLENAME,
 gauge, 5L);
         assertGaugeExportedCorrectly(gauge.getGaugeName(), 
PinotPrometheusMetricsTest.ExportedLabels.TABLENAME,
             EXPORTED_METRIC_PREFIX);
diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ControllerPrometheusMetricsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ControllerPrometheusMetricsTest.java
index 7fcb76eae1..21645d201c 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ControllerPrometheusMetricsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ControllerPrometheusMetricsTest.java
@@ -52,8 +52,7 @@ public abstract class ControllerPrometheusMetricsTest extends 
PinotPrometheusMet
           ControllerGauge.TIME_MS_SINCE_LAST_SUCCESSFUL_MINION_TASK_GENERATION,
           ControllerGauge.LAST_MINION_TASK_GENERATION_ENCOUNTERS_ERROR);
 
-  private static final List<ControllerGauge> GAUGES_ACCEPTING_RAW_TABLENAME =
-      List.of(ControllerGauge.OFFLINE_TABLE_ESTIMATED_SIZE);
+  private static final List<ControllerGauge> GAUGES_ACCEPTING_RAW_TABLENAME = 
List.of();
 
   private ControllerMetrics _controllerMetrics;
 
diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/MinionPrometheusMetricsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/MinionPrometheusMetricsTest.java
index 84de2f4d81..1dd982d627 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/MinionPrometheusMetricsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/MinionPrometheusMetricsTest.java
@@ -43,7 +43,6 @@ public abstract class MinionPrometheusMetricsTest extends 
PinotPrometheusMetrics
 
   @Test(dataProvider = "minionTimers")
   public void timerTest(MinionTimer timer) {
-
     if (timer.isGlobal()) {
       _minionMetrics.addTimedValue(timer, 30L, TimeUnit.MILLISECONDS);
       assertTimerExportedCorrectly(timer.getTimerName(), 
EXPORTED_METRIC_PREFIX);
@@ -51,18 +50,10 @@ public abstract class MinionPrometheusMetricsTest extends 
PinotPrometheusMetrics
       
_minionMetrics.addTimedValue(ExportedLabelValues.MINION_TASK_SEGMENT_IMPORT, 
timer, 30L, TimeUnit.MILLISECONDS);
       assertTimerExportedCorrectly(timer.getTimerName(),
           List.of(ExportedLabelKeys.ID, 
ExportedLabelValues.MINION_TASK_SEGMENT_IMPORT), EXPORTED_METRIC_PREFIX);
-
       _minionMetrics.addTimedTableValue(TABLE_NAME_WITH_TYPE, 
ExportedLabelValues.MINION_TASK_SEGMENT_IMPORT, timer,
           30L, TimeUnit.MILLISECONDS);
-
-      if (timer == MinionTimer.TASK_THREAD_CPU_TIME_NS) {
-        assertTimerExportedCorrectly(timer.getTimerName(),
-            List.of(ExportedLabelKeys.DATABASE, 
ExportedLabelValues.TABLENAME_WITH_TYPE_REALTIME,
-                ExportedLabelKeys.TABLE, 
"myTable_REALTIME.SegmentImportTask"), EXPORTED_METRIC_PREFIX);
-      } else {
-        assertTimerExportedCorrectly(timer.getTimerName(), 
ExportedLabels.TABLENAME_TABLETYPE_MINION_TASKTYPE,
-            EXPORTED_METRIC_PREFIX);
-      }
+      assertTimerExportedCorrectly(timer.getTimerName(), 
ExportedLabels.TABLENAME_TABLETYPE_MINION_TASKTYPE,
+          EXPORTED_METRIC_PREFIX);
     }
   }
 
@@ -90,7 +81,6 @@ public abstract class MinionPrometheusMetricsTest extends 
PinotPrometheusMetrics
       assertMeterExportedCorrectly(meter.getMeterName(),
           List.of(ExportedLabelKeys.ID, 
ExportedLabelValues.MINION_TASK_SEGMENT_IMPORT), EXPORTED_METRIC_PREFIX);
     } else if (meter == MinionMeter.SEGMENT_UPLOAD_FAIL_COUNT || meter == 
MinionMeter.SEGMENT_DOWNLOAD_FAIL_COUNT) {
-
       _minionMetrics.addMeteredTableValue(TABLE_NAME_WITH_TYPE, meter, 1L);
       assertMeterExportedCorrectly(meter.getMeterName(), 
List.of(ExportedLabelKeys.ID, TABLE_NAME_WITH_TYPE),
           EXPORTED_METRIC_PREFIX);
diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/PinotPrometheusMetricsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/PinotPrometheusMetricsTest.java
index a3f21ad91d..2de1ce8c8b 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/PinotPrometheusMetricsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/PinotPrometheusMetricsTest.java
@@ -181,9 +181,10 @@ public abstract class PinotPrometheusMetricsTest {
     try {
       promMetrics = 
parseExportedPromMetrics(getExportedPromMetrics().getResponse());
       for (String meterType : METER_TYPES) {
-        Assert.assertTrue(promMetrics.contains(
-                PromMetric.withNameAndLabels(exportedMetricPrefix + 
exportedTimerPrefix + "_" + meterType, labels)),
-            exportedTimerPrefix);
+        PromMetric expectedTimer =
+            PromMetric.withNameAndLabels(exportedMetricPrefix + 
exportedTimerPrefix + "_" + meterType, labels);
+        Assert.assertTrue(promMetrics.contains(expectedTimer),
+            "Cannot find timer: " + expectedTimer + " in exported metrics");
       }
     } catch (Exception e) {
       throw new RuntimeException(e);
diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ServerPrometheusMetricsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ServerPrometheusMetricsTest.java
index 366d538ec1..7ff5a99b87 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ServerPrometheusMetricsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/ServerPrometheusMetricsTest.java
@@ -118,18 +118,7 @@ public abstract class ServerPrometheusMetricsTest extends 
PinotPrometheusMetrics
       _serverMetrics.setValueOfGlobalGauge(serverGauge, 10L);
       assertGaugeExportedCorrectly(serverGauge.getGaugeName(), 
EXPORTED_METRIC_PREFIX);
     } else {
-      if (serverGauge == ServerGauge.DEDUP_PRIMARY_KEYS_COUNT) {
-        //this gauge is currently exported as: 
`pinot_server_${partitionId}_Value{database="dedupPrimaryKeysCount",
-        // table="dedupPrimaryKeysCount.myTable",tableType="REALTIME",}`. We 
add an explicit test for it to maintain
-        // backward compatibility. todo: ServerGauge.DEDUP_PRIMARY_KEYS_COUNT 
should be moved to
-        //  gaugesThatAcceptPartition. It should be exported as:
-        //  `pinot_server_dedupPrimaryKeysCount_Value{partition="3", 
table="myTable",tableType="REALTIME",}`
-        addPartitionGaugeWithLabels(serverGauge, TABLE_NAME_WITH_TYPE);
-        assertGaugeExportedCorrectly(String.valueOf(3),
-            List.of(ExportedLabelKeys.DATABASE, serverGauge.getGaugeName(), 
ExportedLabelKeys.TABLE,
-                "dedupPrimaryKeysCount.myTable", ExportedLabelKeys.TABLETYPE, 
ExportedLabelValues.TABLETYPE_REALTIME),
-            EXPORTED_METRIC_PREFIX);
-      } else if (GAUGES_ACCEPTING_CLIENT_ID.contains(serverGauge)) {
+      if (GAUGES_ACCEPTING_CLIENT_ID.contains(serverGauge)) {
         addGaugeWithLabels(serverGauge, CLIENT_ID);
         assertGaugeExportedCorrectly(serverGauge.getGaugeName(),
             ExportedLabels.PARTITION_TABLENAME_TABLETYPE_KAFKATOPIC, 
EXPORTED_METRIC_PREFIX);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to