File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
instrumentation/kafka-clients-node-metrics-3.7.0/src/main/java/org/apache/kafka/kafka/clients/consumer/internals Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 30
30
31
31
@ Weave (originalName = "org.apache.kafka.clients.consumer.internals.AsyncKafkaConsumer" )
32
32
public abstract class AsyncKafkaConsumer_Instrumentation <K , V > {
33
+
34
+ private final Metrics metrics = Weaver .callOriginal ();
35
+ private final String clientId = Weaver .callOriginal ();
36
+ private final ConsumerMetadata metadata = Weaver .callOriginal ();
33
37
// It's possible for constructors to be invoked multiple times (e.g. `C() { C("some default") }` ).
34
38
// When this happens we don't want to register the metrics reporter multiple times.
35
39
@ NewField
36
40
private boolean metricsReporterInstalled ;
37
41
38
- private final Metrics metrics = Weaver .callOriginal ();
39
- private final ConsumerMetadata metadata = Weaver .callOriginal ();
40
-
41
42
@ WeaveAllConstructors
42
43
public AsyncKafkaConsumer_Instrumentation () {
43
44
if (!metricsReporterInstalled ) {
45
+ NewRelic .getAgent ().getLogger ().log (Level .INFO ,
46
+ "newrelic-kafka-clients-enhancements engaged for consumer {0}" , clientId );
44
47
metrics .addReporter (new NewRelicMetricsReporter (ClientType .CONSUMER , metadata .fetch ().nodes ()));
45
48
metricsReporterInstalled = true ;
46
49
}
Original file line number Diff line number Diff line change 30
30
31
31
@ Weave (originalName = "org.apache.kafka.clients.consumer.internals.LegacyKafkaConsumer" )
32
32
public abstract class LegacyKafkaConsumer_Instrumentation <K , V > {
33
+
34
+ private final Metrics metrics = Weaver .callOriginal ();
35
+ private final String clientId = Weaver .callOriginal ();
36
+ private final ConsumerMetadata metadata = Weaver .callOriginal ();
33
37
// It's possible for constructors to be invoked multiple times (e.g. `C() { C("some default") }` ).
34
38
// When this happens we don't want to register the metrics reporter multiple times.
35
39
@ NewField
36
40
private boolean metricsReporterInstalled ;
37
41
38
- private final Metrics metrics = Weaver .callOriginal ();
39
- private final ConsumerMetadata metadata = Weaver .callOriginal ();
40
-
41
42
@ WeaveAllConstructors
42
43
public LegacyKafkaConsumer_Instrumentation () {
43
44
if (!metricsReporterInstalled ) {
45
+ NewRelic .getAgent ().getLogger ().log (Level .INFO ,
46
+ "newrelic-kafka-clients-enhancements engaged for consumer {0}" , clientId );
44
47
metrics .addReporter (new NewRelicMetricsReporter (ClientType .CONSUMER , metadata .fetch ().nodes ()));
45
48
metricsReporterInstalled = true ;
46
49
}
You can’t perform that action at this time.
0 commit comments