Skip to content

Commit

Permalink
override instrumentation group names
Browse files Browse the repository at this point in the history
  • Loading branch information
videnkz committed Nov 3, 2023
1 parent e9388a8 commit 5f27998
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import co.elastic.apm.agent.sdk.ElasticApmInstrumentation;
import net.bytebuddy.matcher.ElementMatcher;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.classLoaderCanLoadClass;

Expand All @@ -40,7 +40,7 @@ public final boolean includeWhenInstrumentationIsDisabled() {


@Override
public final Collection<String> getInstrumentationGroupNames() {
return Arrays.asList("opentelemetry");
public Collection<String> getInstrumentationGroupNames() {
return Collections.singletonList("opentelemetry");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
import net.bytebuddy.description.NamedElement;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.implementation.bytecode.assign.Assigner;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.matcher.ElementMatchers;

import javax.annotation.Nullable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Collections;

import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.classLoaderCanLoadClass;
import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.isInAnyPackage;
Expand Down Expand Up @@ -55,6 +56,11 @@ public final ElementMatcher.Junction<ClassLoader> getClassLoaderMatcher() {
return classLoaderCanLoadClass("io.opentelemetry.instrumentation.annotations.WithSpan");
}

@Override
public Collection<String> getInstrumentationGroupNames() {
return Collections.singletonList("opentelemetry-annotations");
}

@Override
public ElementMatcher<? super TypeDescription> getTypeMatcher() {
return isInAnyPackage(stacktraceConfig.getApplicationPackages(), ElementMatchers.<NamedElement>none())
Expand Down

0 comments on commit 5f27998

Please sign in to comment.