Prerequisites
- A ClickHouse Observability service
- Docker with Docker Compose and
curl - For your own metrics, a Kafka broker with remote JMX enabled and reachable from the gatherer
Connection details
- Fully managed
- Self-managed
Open ClickHouse Observability and go to Team Settings → Data → Managed Telemetry. Copy your OTLP HTTP endpoint and API key. You can use Copy connection details to copy the configuration, or Reveal key to view the masked key.Set these variables in the terminal where you will run the JMX gatherer or demo collector:Replace the placeholders with the exact endpoint, including its port, and API key from your service. Use the base HTTP endpoint without a
/v1/metrics suffix; the exporter appends the signal path.http://host.docker.internal:4318. The Docker commands below include the host mapping.
Integration with an existing Kafka deployment
1
Check the broker's JMX endpoint
Use the remote JMX endpoint configured for your broker. For a broker exposing JMX on port Replace the hostname and broker ID with your own values. The RMI hostname advertised by the broker must also be reachable from the gatherer. If the broker uses separate registry and RMI ports, allow both through the network. The gatherer reads JMX; it does not need the Kafka client port
9999:9092.For containers on a shared Docker network, use the broker’s container hostname. For a broker on the Docker host, use host.docker.internal and configure the broker to advertise a hostname the container can reach. Keep JMX access restricted to your monitoring network and retain your broker’s authentication and TLS settings.2
Download the JMX Metric Gatherer
3
Configure the gatherer
Save this as If the broker is on an existing Docker network, attach
compose.yaml beside the downloaded JAR:kafka-jmx-gatherer to that network in your Compose configuration. For authenticated JMX, add otel.jmx.username and otel.jmx.password properties; for TLS, configure the appropriate trust store. See the gatherer’s authentication and TLS configuration.4
Start collection
Set the connection variables and broker variables in this terminal, then run from the directory containing Keep the terminal open and check for JMX connection or OTLP export errors. The gatherer collects every 10 seconds. Allow at least two collection intervals before checking your service. Stop it with Ctrl+C when finished testing.For multiple brokers, run one gatherer per broker with its own JMX URL and
compose.yaml:kafka.broker.id.5
Verify metrics
Open Chart Explorer, select your Metrics source, filter for
ServiceName:kafka-service, and select Last 15 minutes. Look for kafka.partition.count, kafka.partition.under_replicated, or kafka.message.count. Traffic-related metrics need broker activity to produce meaningful values.Demo dataset
The sample contains 6,282 gauge and sum points sampled every five minutes across roughly 29 hours. It preserves the original dataset’s traffic surges, request latency, consumer lag, and partition health patterns. No Kafka deployment or direct database access is needed. Set the connection variables before starting.1
Download the sample metrics
Download the sample bundle (about 53 KB) and extract
kafka-metrics-demo.json into your working directory.2
Configure the demo collector
Save this as
kafka-metrics-demo.yaml:The demo-only transform refreshes timestamps while preserving metric values and the interval between each point’s start and end timestamps. Omit it for live Kafka metrics. The batch limit keeps uploads small enough for the destination collector.
3
Run the demo collector
From the directory containing the configuration, run the collector and leave this terminal open:
4
Send the sample
In another terminal, run this command from the download directory:A response such as
{} or {"partialSuccess":{}} indicates the local collector accepted the request. Check the collector terminal for export errors and allow a few seconds for forwarding. Stop it with Ctrl+C after verifying the data. Sending the sample again can produce duplicate points.5
Verify the metrics
Import the dashboard in the next section, filter for
ServiceName:kafka-demo, and select Last 2 days. The sample includes both gauge and sum metrics; no direct database access is needed.Dashboards and visualization
1
2
Import the dashboard
- Open Dashboards and click Import in the upper-right corner.
- Upload
kafka-metrics-dashboard.json. - Map the charts to your Metrics source and click Finish Import.
3
View the dashboard
For the sample, filter for
ServiceName:kafka-demo and select Last 2 days. The dashboard shows throughput, consumer lag, request latency, queue depth, and offline partitions.The dashboard uses the demo’s metric names, including precomputed rates and consumer lag. The broker JMX gatherer exposes a different set of metrics, so adjust charts to match your live data. Broker JMX alone does not provide consumer-group lag.
Troubleshooting
JMX connection fails
Check the gatherer output withdocker compose logs kafka-jmx-gatherer. Confirm JMX is enabled, both the registry and advertised RMI endpoint are reachable, and the configured JMX credentials and trust store match the broker. Containers must share the intended network when using container hostnames.
No metrics appearing
- Check the gatherer or demo collector output for connection, authentication, or export errors.
- Verify the OTLP HTTP endpoint and authentication against your service’s connection details.
- Check the Metrics source, service-name filter, and time range. For the demo, use Last 2 days.
- For an existing collector, confirm its metrics pipeline includes the OTLP receiver and a metrics exporter.
- Verify live metric names in Chart Explorer before using the demo dashboard.
JMX port conflicts in Kafka client commands
If you run Kafka client commands inside the broker container, unset the inherited broker JMX settings for that command so the client does not try to bind the same port:Next steps
- Set up alerts for partition health or request latency.
- Create additional dashboards for your broker metrics.
- See Sending OpenTelemetry data for collector deployment guidance.