Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e374c99
Move utilities that are used by plugins to SDK (if technical) or to t…
raphw Jun 6, 2023
82812ea
Move selection of executor utils to SDK.
raphw Jun 6, 2023
1492a2c
Remove SDK/tracer combination utility class and declare tracers with …
raphw Jun 6, 2023
97bbdbd
Adjust visibility and imports.
raphw Jun 6, 2023
e7b1b73
Move Byte Buddy-related API and boot injection class to SDK.
raphw Jun 6, 2023
c805615
Refactor to service loader lookup and add test implementations for SDK.
raphw Jun 6, 2023
88ed3f0
Fix import.
raphw Jun 6, 2023
5f507a7
Add tracer.
raphw Jun 6, 2023
190ff78
Add tracer.
raphw Jun 6, 2023
f38009c
Move soft value loading cache.
raphw Jun 6, 2023
5218e68
Move long list.
raphw Jun 6, 2023
95e3414
Add minimal Version implemention to implement matchers.
raphw Jun 6, 2023
8be1da0
Add class loader matching to SDK.
raphw Jun 6, 2023
3fab5ea
Move result util to tracer module.
raphw Jun 6, 2023
15583fd
Fully move PotentiallyMultiValuedMap to tracer module without interme…
raphw Jun 6, 2023
00e89e0
Fix import.
raphw Jun 6, 2023
51e36ba
Fix imports.
raphw Jun 6, 2023
bb79679
Move test module.
raphw Jun 6, 2023
8485330
Substitute matchers with "old" approach as the new approach apparentl…
raphw Jun 6, 2023
223d9e1
Fix test for sampling profiler that is using mock.
raphw Jun 6, 2023
1b21281
Increase visibility of tracer.
raphw Jun 6, 2023
687fe53
Make class loader matching configurable.
raphw Jun 6, 2023
0a0ce09
Move DB signature parsers to SDK.
raphw Jun 6, 2023
1e0b230
Fix dependency declaration.
raphw Jun 6, 2023
a972313
Fix import.
raphw Jun 6, 2023
c45d24c
Merge branch 'main' into isolate-plugin-utils
raphw Jun 30, 2023
15c3a4d
Fixing imports.
raphw Jun 30, 2023
e60096d
ensure json files are kept up-to-date with updatecli
SylvainJuge Jul 5, 2023
ef08426
Mark "self class loader" nullable.
raphw Jul 6, 2023
d15a033
Avoid static field when only initialization is required.
raphw Jul 6, 2023
16e65bf
Reintroduce static import.
raphw Jul 6, 2023
629883b
Remove import.
raphw Jul 6, 2023
e40cc6f
Fix annotation.
raphw Jul 6, 2023
4beb26d
Moved classes not intended for public use to internal package
JonasKunz Jul 10, 2023
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
4 changes: 2 additions & 2 deletions .ci/updatecli.d/update-json-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ targets:
sourceid: sql_signature_examples.json
kind: file
spec:
file: apm-agent-core/src/test/resources/json-specs/sql_signature_examples.json
file: apm-agent-plugin-sdk/src/test/resources/json-specs/sql_signature_examples.json
sql_token_examples.json:
name: sql_token_examples.json
scmid: default
sourceid: sql_token_examples.json
kind: file
spec:
file: apm-agent-core/src/test/resources/json-specs/sql_token_examples.json
file: apm-agent-plugin-sdk/src/test/resources/json-specs/sql_token_examples.json
w3c_distributed_tracing.json:
name: w3c_distributed_tracing.json
scmid: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package co.elastic.apm.agent.benchmark.sql;

import co.elastic.apm.agent.benchmark.AbstractBenchmark;
import co.elastic.apm.agent.db.signature.SignatureParser;
import co.elastic.apm.agent.sdk.internal.db.signature.SignatureParser;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package co.elastic.apm.agent;

import co.elastic.apm.agent.bci.PluginClassLoaderRootPackageCustomizer;
import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
*/
package co.elastic.apm.agent.bbwarmup;

import co.elastic.apm.agent.bci.TracerAwareInstrumentation;
import co.elastic.apm.agent.bci.bytebuddy.CustomElementMatchers;
import co.elastic.apm.agent.bci.bytebuddy.SimpleMethodSignatureOffsetMappingFactory;
import co.elastic.apm.agent.util.PrivilegedActionUtils;
import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory;
import co.elastic.apm.agent.sdk.ElasticApmInstrumentation;
import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils;
import co.elastic.apm.agent.tracer.GlobalTracer;
import co.elastic.apm.agent.tracer.Tracer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;
Expand All @@ -31,13 +32,20 @@
import java.util.Collection;
import java.util.Collections;

import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.isSameClassLoader;
import static net.bytebuddy.matcher.ElementMatchers.isStatic;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.not;
import static net.bytebuddy.matcher.ElementMatchers.returns;
import static net.bytebuddy.matcher.ElementMatchers.takesNoArguments;

public class WarmupInstrumentation extends TracerAwareInstrumentation {
public class WarmupInstrumentation extends ElasticApmInstrumentation {

static {
// assure initialization of tracer
@SuppressWarnings("unused")
Tracer tracer = GlobalTracer.get();
}

@Override
public ElementMatcher.Junction<ClassLoader> getClassLoaderMatcher() {
Expand All @@ -46,7 +54,7 @@ public ElementMatcher.Junction<ClassLoader> getClassLoaderMatcher() {
// (caused by java.lang.ClassFormatError) on OpenJDK 7.
// By allowing instrumentation only when the test class is loaded by the same class loader that loads this
// instrumentation class, we avoid this problem and still allow it to work both on production and unit tests
return CustomElementMatchers.isSameClassLoader(PrivilegedActionUtils.getClassLoader(getClass()));
return isSameClassLoader(PrivilegedActionUtils.getClassLoader(getClass()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
*/
package co.elastic.apm.agent.bci;

import co.elastic.apm.agent.bci.bytebuddy.AnnotationValueOffsetMappingFactory;
import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer;
import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory;
import co.elastic.apm.agent.bci.bytebuddy.ErrorLoggingListener;
import co.elastic.apm.agent.bci.bytebuddy.FailSafeDeclaredMethodsCompiler;
import co.elastic.apm.agent.bci.bytebuddy.InstallationListenerImpl;
Expand All @@ -28,7 +29,7 @@
import co.elastic.apm.agent.bci.bytebuddy.NonInstrumented;
import co.elastic.apm.agent.bci.bytebuddy.PatchBytecodeVersionTo51Transformer;
import co.elastic.apm.agent.bci.bytebuddy.RootPackageCustomLocator;
import co.elastic.apm.agent.bci.bytebuddy.SimpleMethodSignatureOffsetMappingFactory;
import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory;
import co.elastic.apm.agent.bci.classloading.ExternalPluginClassLoader;
import co.elastic.apm.agent.bci.modules.ModuleOpener;
import co.elastic.apm.agent.common.ThreadUtils;
Expand All @@ -48,7 +49,7 @@
import co.elastic.apm.agent.tracemethods.TraceMethodInstrumentation;
import co.elastic.apm.agent.util.DependencyInjectingServiceLoader;
import co.elastic.apm.agent.util.ExecutorUtils;
import co.elastic.apm.agent.util.PrivilegedActionUtils;
import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy;
Expand Down Expand Up @@ -309,7 +310,7 @@ public void onChange(ConfigurationOption configurationOption, Object oldValue, O
}

public static synchronized Future<?> reInitInstrumentation() {
final Tracer tracer = TracerAwareInstrumentation.tracer.require(Tracer.class);
final Tracer tracer = GlobalTracer.get().require(Tracer.class);
if (instrumentation == null) {
throw new IllegalStateException("Can't re-init agent before it has been initialized");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import co.elastic.apm.agent.bci.classloading.IndyPluginClassLoader;
import co.elastic.apm.agent.bci.classloading.LookupExposer;
import co.elastic.apm.agent.common.JvmRuntimeInfo;
import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer;
import co.elastic.apm.agent.sdk.logging.Logger;
import co.elastic.apm.agent.sdk.logging.LoggerFactory;
import co.elastic.apm.agent.sdk.state.CallDepth;
Expand Down
Loading