javainstrumentationopen-telemetry

Opentelemetry Java TypeInstrumentation unable to typeMatch internal class


I am trying to instrument com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse function.

To do so, I created a TypeInstrumentation with the following typeMatcher function -

public class DocumentBuilderInstrumentation implements TypeInstrumentation {

    @Override
    public ElementMatcher<TypeDescription> typeMatcher() {
        return named("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl");
    }

but I can't get it to work, it never instruments there objects... I think it's because the class is "internal", but I am not sure how to bypass it.

Also tried - return nameContains("DocumentBuilderImpl"); without any luck...

Any ideas what I am doing wrong ?


Solution

  • "com.sun.*" classes are ignored by default.

    You should be able to add an IgnoredTypesConfigurer to your instrumentation module which allows instrumentation of that specific class.