-
Notifications
You must be signed in to change notification settings - Fork 57
[monitoring] Impl metrics #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…bles with AtomicLong to make atomic operations
…alculate exp. moving. avg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements metrics collection and JMX monitoring capabilities for the ClickHouse Kafka connector sink tasks. The changes enable tracking of key performance indicators such as record processing rates, batch statistics, event lag times, and insert durations.
Key changes:
- Introduces JMX MBeans for exposing sink task and topic-level statistics
- Adds tracking of successful/failed records and batches, receive lag, and insert time metrics
- Updates test infrastructure to register/unregister MBeans properly in test lifecycle
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| TopicStatisticsMBean.java | Defines MBean interface for topic-level metrics (success/failure counts, lag, insert time) |
| TopicStatistics.java | Implements topic statistics tracking using atomic counters and exponential moving averages |
| SinkTaskStatisticsMBean.java | Adds getInsertedRecords method to sink task MBean interface |
| SinkTaskStatistics.java | Enhances statistics collection with thread-safe atomics, topic-level tracking, and MBean registration |
| Processing.java | Integrates statistics recording for insert operations including event receive lag calculation |
| ClickHouseWriter.java | Records insert time metrics across all insert method variants |
| ProxySinkTask.java | Refactors to use final fields and handles MBean lifecycle management |
| ClickHouseSinkTask.java | Exposes taskId accessor for test verification |
| ProcessingTest.java | Updates tests to properly manage SinkTaskStatistics MBean lifecycle |
| ClickHouseWriterTest.java | Updates constructor calls to pass SinkTaskStatistics instances |
| ClickHouseSinkTaskTest.java | Adds comprehensive tests for metrics validation and mean lag time calculation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Sink task and topic metrics are accessible via JMX. Bean name format is
com.clickhouse:type=ClickHouseKafkaConnector,name=SinkTask<taskId>,version=<version>.For example,
com.clickhouse:type=ClickHouseKafkaConnector,name=SinkTask0,version=v1.3.5.Topic metrics bean name format is
com.clickhouse:type=ClickHouseKafkaConnector,name=SinkTask<taskId>,version=<version>,topic=<topic>.For example
com.clickhouse:type=ClickHouseKafkaConnector,name=SinkTask0,version=v1.3.5,topic=schemaless_simple_batch_test_1762822854777.Checklist
Delete items not relevant to your PR: