Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
*/
@AutoService(InstrumenterModule.class)
public final class KafkaConsumerInfoInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
implements Instrumenter.ForTypeHierarchy,
Instrumenter.HasMethodAdvice,
Instrumenter.WithTypeStructure {

public KafkaConsumerInfoInstrumentation() {
super("kafka", "kafka-3.8");
Expand Down Expand Up @@ -60,8 +62,12 @@ public String hierarchyMarkerType() {

@Override
public ElementMatcher<TypeDescription> hierarchyMatcher() {
return implementsInterface(named(hierarchyMarkerType()))
.and(declaresField(named("offsetCommitCallbackInvoker")));
return implementsInterface(named(hierarchyMarkerType()));
}

@Override
public ElementMatcher<TypeDescription> structureMatcher() {
return declaresField(named("offsetCommitCallbackInvoker"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
*/
@AutoService(InstrumenterModule.class)
public final class LegacyKafkaConsumerInfoInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
implements Instrumenter.ForTypeHierarchy,
Instrumenter.HasMethodAdvice,
Instrumenter.WithTypeStructure {

public LegacyKafkaConsumerInfoInstrumentation() {
super("kafka", "kafka-3.8");
Expand Down Expand Up @@ -60,8 +62,12 @@ public String hierarchyMarkerType() {
// new - we are instrumenting the ConsumerDelegate class instead of the KafkaConsumer class
@Override
public ElementMatcher<TypeDescription> hierarchyMatcher() {
return implementsInterface(named(hierarchyMarkerType()))
.and(declaresField(named("coordinator")));
return implementsInterface(named(hierarchyMarkerType()));
}

@Override
public ElementMatcher<TypeDescription> structureMatcher() {
return declaresField(named("coordinator"));
}

@Override
Expand Down