Search in sources :

Example 1 with IgnoredTypesConfigurer

use of io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer in project opentelemetry-java-instrumentation by open-telemetry.

the class TestAgentListener method buildOtherConfiguredIgnores.

private static Trie<IgnoreAllow> buildOtherConfiguredIgnores() {
    Config config = Config.builder().build();
    IgnoredTypesBuilderImpl builder = new IgnoredTypesBuilderImpl();
    for (IgnoredTypesConfigurer configurer : SafeServiceLoader.loadOrdered(IgnoredTypesConfigurer.class)) {
        // skip built-in agent ignores
        if (configurer instanceof AdditionalLibraryIgnoredTypesConfigurer || configurer instanceof GlobalIgnoredTypesConfigurer) {
            continue;
        }
        configurer.configure(config, builder);
    }
    return builder.buildIgnoredTypesTrie();
}
Also used : IgnoredTypesConfigurer(io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer) AdditionalLibraryIgnoredTypesConfigurer(io.opentelemetry.javaagent.tooling.ignore.AdditionalLibraryIgnoredTypesConfigurer) GlobalIgnoredTypesConfigurer(io.opentelemetry.javaagent.tooling.ignore.GlobalIgnoredTypesConfigurer) Config(io.opentelemetry.instrumentation.api.config.Config) IgnoredTypesBuilderImpl(io.opentelemetry.javaagent.tooling.ignore.IgnoredTypesBuilderImpl) GlobalIgnoredTypesConfigurer(io.opentelemetry.javaagent.tooling.ignore.GlobalIgnoredTypesConfigurer) AdditionalLibraryIgnoredTypesConfigurer(io.opentelemetry.javaagent.tooling.ignore.AdditionalLibraryIgnoredTypesConfigurer)

Example 2 with IgnoredTypesConfigurer

use of io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer in project opentelemetry-java-instrumentation by open-telemetry.

the class AgentInstaller method configureIgnoredTypes.

private static AgentBuilder configureIgnoredTypes(Config config, AgentBuilder agentBuilder) {
    IgnoredTypesBuilderImpl builder = new IgnoredTypesBuilderImpl();
    for (IgnoredTypesConfigurer configurer : loadOrdered(IgnoredTypesConfigurer.class)) {
        configurer.configure(config, builder);
    }
    Trie<Boolean> ignoredTasksTrie = builder.buildIgnoredTasksTrie();
    InstrumentedTaskClasses.setIgnoredTaskClassesPredicate(ignoredTasksTrie::contains);
    return agentBuilder.ignore(any(), new IgnoredClassLoadersMatcher(builder.buildIgnoredClassLoadersTrie())).or(new IgnoredTypesMatcher(builder.buildIgnoredTypesTrie())).or((typeDescription, classLoader, module, classBeingRedefined, protectionDomain) -> {
        return HelperInjector.isInjectedClass(classLoader, typeDescription.getName());
    });
}
Also used : IgnoredClassLoadersMatcher(io.opentelemetry.javaagent.tooling.ignore.IgnoredClassLoadersMatcher) IgnoredTypesMatcher(io.opentelemetry.javaagent.tooling.ignore.IgnoredTypesMatcher) IgnoredTypesConfigurer(io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer) IgnoredTypesBuilderImpl(io.opentelemetry.javaagent.tooling.ignore.IgnoredTypesBuilderImpl)

Aggregations

IgnoredTypesConfigurer (io.opentelemetry.javaagent.extension.ignore.IgnoredTypesConfigurer)2 IgnoredTypesBuilderImpl (io.opentelemetry.javaagent.tooling.ignore.IgnoredTypesBuilderImpl)2 Config (io.opentelemetry.instrumentation.api.config.Config)1 AdditionalLibraryIgnoredTypesConfigurer (io.opentelemetry.javaagent.tooling.ignore.AdditionalLibraryIgnoredTypesConfigurer)1 GlobalIgnoredTypesConfigurer (io.opentelemetry.javaagent.tooling.ignore.GlobalIgnoredTypesConfigurer)1 IgnoredClassLoadersMatcher (io.opentelemetry.javaagent.tooling.ignore.IgnoredClassLoadersMatcher)1 IgnoredTypesMatcher (io.opentelemetry.javaagent.tooling.ignore.IgnoredTypesMatcher)1