arunkumarucet commented on code in PR #18823:
URL: https://github.com/apache/pinot/pull/18823#discussion_r3476164118
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java:
##########
@@ -194,6 +203,31 @@ private void updateTableConfigMetrics(String
tableNameWithType, TableConfig tabl
}
int replication = tableConfig.getReplication();
_controllerMetrics.setValueOfTableGauge(tableNameWithType,
ControllerGauge.REPLICATION_FROM_CONFIG, replication);
+
+ updateTenantInfoGauge(tableNameWithType, tableConfig);
+ }
+
+ /**
+ * Emits a {@code tableTenantInfo} gauge keyed by server tenant name so
Prometheus can extract the tenant as a
+ * label and join it onto other table-scoped metrics. Always set to {@code
1}.
+ * The gauge is registered once per unique (table, tenant) pair and only
re-registered when the tenant changes,
+ * avoiding redundant metric writes on each periodic cycle.
+ * When the tenant changes, the new gauge is registered first to avoid a gap
window, then the stale gauge is removed.
+ */
+ private void updateTenantInfoGauge(String tableNameWithType, TableConfig
tableConfig) {
+ TenantConfig tenantConfig = tableConfig.getTenantConfig();
+ String serverTenant =
+ (tenantConfig != null && tenantConfig.getServer() != null) ?
tenantConfig.getServer()
+ : TagNameUtils.DEFAULT_TENANT_NAME;
+
+ String previousTenant = _tableTenantMap.put(tableNameWithType,
serverTenant);
+ if (serverTenant.equals(previousTenant)) {
+ return;
+ }
+ _controllerMetrics.setOrUpdateTableGauge(tableNameWithType, serverTenant,
ControllerGauge.TABLE_TENANT_INFO, 1L);
Review Comment:
Good catch, thanks! I hadn't considered the broker and tier tenants. Updated
the gauge to emit one series per tenant type using a compound key
`<tenantType>.<tenantName>` embedded in the JMX metric name — so the JMX
exporter now produces three Prometheus label combinations per table:
`tenantType=server`, `tenantType=broker`, and `tenantType=tier` (the last only
when tier configs exist). Verified locally — 7 MBeans across the batch
quickstart tables, all value=1.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]