Kafka client metrics add second path for poll #792
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The instrumentation module com.newrelic.instrumentation.kafka-clients-metrics-2.0.0 instruments KafkaConsumer#poll(Duration). This method is overloaded (KafkaConsumer#poll(long)) and both call a private method.
@meiao The private signature looks like it changed in 2.5.0 to use Timer instead of long.
https://github.com/apache/kafka/blob/ff4dff044a22ef0f3095c6f11c38a1a718ad7d13/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L1217
Instead of creating a new module it looks like I could just instrument both public poll methods.
ConsumerRecords<K, V> poll(Duration timeout)
and
ConsumerRecords<K, V> poll(long timeoutMs)
verifyInstrumentation passes open ended for this from 2.0.0.
passesOnly 'org.apache.kafka:kafka-clients:[2.0.0,)'
Related Github Issue
#711
Testing
verifyInstrumentation passes open ended
passesOnly 'org.apache.kafka:kafka-clients:[2.0.0,)'
Alternatives
Instrument the private method, But will have to split into separate modules at 2.5.0 to cover the private method signature change.