arunkumarucet opened a new pull request, #18747:
URL: https://github.com/apache/pinot/pull/18747
## Summary
- Adds a `tenant` label to table-scoped Prometheus metrics for brokers and
servers, enabling Grafana dashboards to group/filter metrics by tenant.
- The tenant name is sourced from each table's `TenantConfig` (broker tenant
for broker metrics, server tenant for server metrics).
- This is a purely additive change — existing Grafana queries and dashboards
that don't reference the `tenant` label continue to work without modification.
## Design
A tenant registry (`ConcurrentHashMap<String, String>`) is added to
`AbstractMetrics`. When a table's tenant is registered, the `getTableName()`
method appends `.tenant.{tenantName}` to the metric name key. The JMX
Prometheus exporter YAML configs have new, higher-priority regex rules that
capture this segment as a `tenant` label.
**Metric name format:**
- Without tenant (unchanged): `pinot.server.{table}_{type}.{metric}`
- With tenant: `pinot.server.{table}_{type}.tenant.{tenantName}.{metric}`
**What gets the tenant label (table is known when metric is updated):**
- Query path: latency / errors / throttle counts per table (broker and
server)
- Ingestion / consumption per table
- Segment / table gauges: rows, segments, freshness
**What does NOT get a tenant label (instance-only, no table context):**
- JVM: heap, GC, threads
- Process / Helix: ZK session, reconnects
- Host: CPU load, disk free
- Global counters: connection pool totals, generic errors with no table in
context
## Changes
| File | Purpose |
|---|---|
| `AbstractMetrics.java` | Add `_tableTenantMap`, `registerTableTenant()`,
`unregisterTableTenant()`, modify `getTableName()` |
| `BaseTableDataManager.java` | Register server tenant on init/refresh,
unregister on shutdown |
| `BaseBrokerRoutingManager.java` | Register broker tenant on buildRouting,
unregister on removeRouting |
| `server.yml` / `broker.yml` | Add tenant-aware JMX exporter regex rules
before existing catch-all patterns |
| `AbstractMetricsTest.java` | Unit tests for tenant registration, null
handling, gauge metrics |
## Backward Compatibility
- **Existing dashboards won't break**: `tenant` is a new additive label.
PromQL queries that don't specify `tenant` continue to match all series.
- **Tables without tenant config**: metrics are identical to before (no
`.tenant.` segment, no label).
- **Wire protocols/serialization**: no changes.
- **Metric names in Prometheus**: unchanged — only the label set is enriched.
## Test plan
- [x] Unit tests for tenant registration (with/without tenant, null/empty
handling, gauge metrics)
- [ ] Manual verification: start broker+server with multi-tenant table
configs, confirm `tenant` label appears in Prometheus scrape output
- [ ] Verify existing metrics (tables without explicit tenant) are unchanged
in Prometheus output
- [ ] Confirm existing Grafana queries return same results after upgrade
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]