You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/05/15 10:47:00 UTC

[GitHub] [incubator-openwhisk] chetanmeh opened a new pull request #4481: Track Kafka client side metrics via Kamon

chetanmeh opened a new pull request #4481: Track Kafka client side metrics via Kamon
URL: https://github.com/apache/incubator-openwhisk/pull/4481
 
 
   Tracks Kafka client metrics via Kamon for monitoring
   
   ## Description
   
   Currently Kafka metrics are not getting tracked via Kamon. Due to this we do not gain any insight into the Kafka interactions. Out of the box Kafka [tracks quite a few metrics][1] on client side these metrics are exposed via JMX
   
   ![image](https://user-images.githubusercontent.com/664531/57769171-deb13d00-772a-11e9-86a5-15f235c253aa.png)
   
   It also support custom [MetricsReporter][2] to listen to such metrics. This PR makes use of same reporter support to publish the metrics to Kamon (based on approach taken in [kamon-metrics-reporter][3])
   
   ### Usage
   
   `KamonMetricsReporter` needs to be enabled via config and provided a set of metric names to track.
   
   ```
   whisk {
     kafka {
       common {
         metric-reporters = "org.apache.openwhisk.connector.kafka.KamonMetricsReporter"
       }
       metrics {
         // Name of metrics which should be tracked via Kamon
         names = [
           // consumer-fetch-manager-metrics
           "records-lag-max", // The maximum lag in terms of number of records for any partition in this window
           "records-consumed-total" // The total number of records consumed
         ]
   
         report-interval = 10 seconds
       }
     }
   }
   ```
   
   Once enabled those metrics would be pushed to Kamon. For above config following metrics can be seen in Prometheus
   
   ```
   # TYPE consumer_fetch_manager_metrics_records_consumed_total counter
   consumer_fetch_manager_metrics_records_consumed_total{client_id="consumer-completed0"} 2.0
   consumer_fetch_manager_metrics_records_consumed_total{client_id="consumer-cacheInvalidation"} 0.0
   consumer_fetch_manager_metrics_records_consumed_total{client_id="consumer-health"} 1007.0
   ```
   
   ### Implementation
   
   This PR takes a whitelist approach and does not publishes all metrics by default. As there are more than 300 metrics tracked by Kafka across Producer and Consumer.
   
   For counters Kafka records two types of metrics `total` and `rate`. See [KIP-187][4] for details. So we should ignore metrics ending with `rate` and prefer `total` metrics for Kamon tracking
   
   ## Related issue and scope
   <!--- Please include a link to a related issue if there is one. -->
   - [ ] I opened an issue to propose and discuss this change (#????)
   
   ## My changes affect the following components
   <!--- Select below all system components are affected by your change. -->
   <!--- Enter an `x` in all applicable boxes. -->
   - [ ] API
   - [ ] Controller
   - [x] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [ ] Documentation
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Use `x` in all the boxes that apply: -->
   - [ ] Bug fix (generally a non-breaking change which closes an issue).
   - [x] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing behavior).
   
   ## Checklist:
   <!--- Please review the points below which help you make sure you've covered all aspects of the change you're making. -->
   
   - [x] I signed an [Apache CLA](https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md).
   - [x] I reviewed the [style guides](https://github.com/apache/incubator-openwhisk/wiki/Contributing:-Git-guidelines#code-readiness) and followed the recommendations (Travis CI will check :).
   - [ ] I added tests to cover my changes.
   - [ ] My changes require further changes to the documentation.
   - [ ] I updated the documentation where necessary.
   
   [1]: https://docs.confluent.io/current/kafka/monitoring.html
   [2]: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/metrics/MetricsReporter.java
   [3]: https://github.com/andreas-schroeder/kamon-kafka-reporter
   [4]: https://cwiki.apache.org/confluence/display/KAFKA/KIP-187+-+Add+cumulative+count+metric+for+all+Kafka+rate+metrics
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services