Skip to content
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

Metrics in Kafka Source #3112

Closed
kkondaka opened this issue Aug 4, 2023 · 1 comment · Fixed by #3118
Closed

Metrics in Kafka Source #3112

kkondaka opened this issue Aug 4, 2023 · 1 comment · Fixed by #3118
Assignees
Labels
enhancement New feature or request

Comments

@kkondaka
Copy link
Collaborator

kkondaka commented Aug 4, 2023

Is your feature request related to a problem? Please describe.
DataPrepper recently added Kafka Source support. Kafka source should expose KafkaConsumer metrics and other metrics to DataPrepper users using the PluginMetrics

Describe the solution you'd like
Types of metrics to support

  • global (KafkaSource level) metrics
  • topic level metrics
    • KafkaConsumer metrics (obtained by using metrics() API of KafkaConsumer
    • Internal metrics that track the functioning of KafkaConsumer code. Examples of these metrics are - number of positive/negative acknowledgements received, number of auth exceptions, etc

Since Kafka Source allows creation of multiple threads per topic, we need a way to efficiently collect and expose metrics.

Proposal

  • Each thread maintains local counters and exports them periodically to a common/shared data structure (shared by all threads consuming from the same topic)
  • Periodically, per-topic metrics are calculated by aggregating the metrics from each thread and PluginMetric.guage() is created. Per topic metrics will have topic. prefix followed by topicname followed by . before the metricName. Also Kafka metric names with - will be replaced by camel case equivalent. For example, the KafkaConsumer metric records-consumed per topic will be topic.topicName.recordsConsumed
  • Global metrics are aggregated across all threads (irrespective of topic)

Describe alternatives you've considered (Optional)
Alternative is to use synchronized blocks or atomic counters to increment the metrics inline. I think this method will be very inefficient when the number of topics or threads are high.

Additional context
Add any other context or screenshots about the feature request here.

@dlvenable
Copy link
Member

I agree that using . between these parts of the metric names makes sense. It could easily feed into different dimensions. I also agree with replacing the - to keep the metric names consistent with other Data Prepper names.

@dlvenable dlvenable added enhancement New feature or request and removed untriaged labels Aug 9, 2023
@github-project-automation github-project-automation bot moved this from Unplanned to Done in Data Prepper Tracking Board Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants