0

Is it possible to write matcher for ElasticApmInstrumentation that will capture constructor of child class only?

I mean currently I use ElementMatcher.isConstructor() but some classes use in the constructor call super() and this triggers call of on the same object.

In case there are more levels I get even more duplications. Is there a way how to avoid it?

Please note as a matcher for class I need to use parent class to capture whole group of classes.

hybaken
  • 466
  • 1
  • 5
  • 16

2 Answers2

1

The matching is done based on the shape, not the implementation. This is not possible for this reason.

Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192
0

I was able to achieve it by using @Advice.Origin("#t") origin and @Advice.This instance.

Then I compared origin.equals(instance.getClass().getName()).

I was not able to avoid the instrumentation directly but I was able to filter out duplications.

hybaken
  • 466
  • 1
  • 5
  • 16