Skip to content

Commit

Permalink
Refactor and specific agent classes bootdelegation (#376)
Browse files Browse the repository at this point in the history
* Test public API in app server integration test (fails on WildFly, Payara and WebSphere Liberty)
* Refactor so that all agent implementation classes are under a common root, separate from APIs
* Update WildFly system packages setting and OSGi bootdelegation
  • Loading branch information
eyalkoren authored Dec 10, 2018
1 parent 702d130 commit 5de1437
Show file tree
Hide file tree
Showing 357 changed files with 1,662 additions and 1,651 deletions.
4 changes: 2 additions & 2 deletions .ci/run-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function benchmark() {
sudo cset proc --exec /benchmark -- \
$JAVA_HOME/bin/java -jar apm-agent-benchmarks/target/benchmarks.jar ".*ContinuousBenchmark" \
-prof gc \
-prof co.elastic.apm.benchmark.profiler.ReporterProfiler \
-prof co.elastic.apm.agent.benchmark.profiler.ReporterProfiler \
-rf json \
-rff ${RESULT_FILE}

Expand All @@ -78,7 +78,7 @@ function benchmark() {
rm -f ${RESULT_FILE}
mv "${RESULT_FILE}.clean" ${RESULT_FILE}

$JAVA_HOME/bin/java -cp apm-agent-benchmarks/target/benchmarks.jar co.elastic.apm.benchmark.PostProcessBenchmarkResults ${RESULT_FILE} ${BULK_UPLOAD_FILE} ${COMMIT_UNIX}
$JAVA_HOME/bin/java -cp apm-agent-benchmarks/target/benchmarks.jar co.elastic.apm.agent.benchmark.PostProcessBenchmarkResults ${RESULT_FILE} ${BULK_UPLOAD_FILE} ${COMMIT_UNIX}
setCloudCredentials
curl --user ${CLOUD_USERNAME}:${CLOUD_PASSWORD} -XPOST 'https://1ec92c339f616ca43771bff669cc419c.europe-west3.gcp.cloud.es.io:9243/_bulk' -H 'Content-Type: application/json' --data-binary @${BULK_UPLOAD_FILE}
unset CLOUD_USERNAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void end() {

@Override
public void captureException(Throwable throwable) {
// co.elastic.apm.plugin.api.CaptureExceptionInstrumentation
// co.elastic.apm.agent.plugin.api.CaptureExceptionInstrumentation
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void end() {

@Override
public void captureException(Throwable throwable) {
// co.elastic.apm.plugin.api.CaptureExceptionInstrumentation
// co.elastic.apm.agent.plugin.api.CaptureExceptionInstrumentation
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public class ScopeImpl implements Scope {

@Override
public void close() {
// co.elastic.apm.plugin.api.ApiScopeInstrumentation
// co.elastic.apm.agent.plugin.api.ApiScopeInstrumentation
}
}
24 changes: 12 additions & 12 deletions apm-agent-api/src/main/java/co/elastic/apm/api/SpanImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* If the agent is active, it injects the implementation from
* co.elastic.apm.plugin.api.SpanInstrumentation
* co.elastic.apm.agent.plugin.api.SpanInstrumentation
* into this class.
* <p>
* Otherwise, this class is a noop.
Expand All @@ -32,7 +32,7 @@
class SpanImpl implements Span {

@Nonnull
// co.elastic.apm.impl.transaction.AbstractSpan
// co.elastic.apm.agent.impl.transaction.AbstractSpan
protected final Object span;

SpanImpl(@Nonnull Object span) {
Expand All @@ -41,17 +41,17 @@ class SpanImpl implements Span {

@Override
public void setName(String name) {
// co.elastic.apm.plugin.api.SpanInstrumentation$SetNameInstrumentation.setName
// co.elastic.apm.agent.plugin.api.SpanInstrumentation$SetNameInstrumentation.setName
}

@Override
public void setType(String type) {
// co.elastic.apm.plugin.api.SpanInstrumentation$SetTypeInstrumentation.setType
// co.elastic.apm.agent.plugin.api.SpanInstrumentation$SetTypeInstrumentation.setType
}

@Override
public void addTag(String key, String value) {
// co.elastic.apm.plugin.api.SpanInstrumentation$AddTagInstrumentation.addTag
// co.elastic.apm.agent.plugin.api.SpanInstrumentation$AddTagInstrumentation.addTag
}

@Override
Expand All @@ -61,43 +61,43 @@ public Span createSpan() {
}

private Object doCreateSpan() {
// co.elastic.apm.plugin.api.SpanInstrumentation$DoCreateSpanInstrumentation.doCreateSpan
// co.elastic.apm.agent.plugin.api.SpanInstrumentation$DoCreateSpanInstrumentation.doCreateSpan
return null;
}

@Override
public void end() {
// co.elastic.apm.plugin.api.SpanInstrumentation$EndInstrumentation.end
// co.elastic.apm.agent.plugin.api.SpanInstrumentation$EndInstrumentation.end
}

@Override
public void captureException(Throwable throwable) {
// co.elastic.apm.plugin.api.SpanInstrumentation.CaptureExceptionInstrumentation
// co.elastic.apm.agent.plugin.api.SpanInstrumentation.CaptureExceptionInstrumentation
}

@Nonnull
@Override
public String getId() {
// co.elastic.apm.plugin.api.SpanInstrumentation.GetIdInstrumentation
// co.elastic.apm.agent.plugin.api.SpanInstrumentation.GetIdInstrumentation
return "";
}

@Nonnull
@Override
public String getTraceId() {
// co.elastic.apm.plugin.api.SpanInstrumentation.GetTraceIdInstrumentation
// co.elastic.apm.agent.plugin.api.SpanInstrumentation.GetTraceIdInstrumentation
return "";
}

@Override
public Scope activate() {
// co.elastic.apm.plugin.api.SpanInstrumentation.ActivateInstrumentation
// co.elastic.apm.agent.plugin.api.SpanInstrumentation.ActivateInstrumentation
return new ScopeImpl(span);
}

@Override
public boolean isSampled() {
// co.elastic.apm.plugin.api.SpanInstrumentation.IsSampledInstrumentation
// co.elastic.apm.agent.plugin.api.SpanInstrumentation.IsSampledInstrumentation
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* If the agent is active, it injects the implementation from
* co.elastic.apm.plugin.api.TransactionInstrumentation
* co.elastic.apm.agent.plugin.api.TransactionInstrumentation
* into this class.
* <p>
* Otherwise, this class is a noop.
Expand All @@ -37,7 +37,7 @@ class TransactionImpl extends SpanImpl implements Transaction {

@Override
public void setUser(String id, String email, String username) {
// co.elastic.apm.plugin.api.TransactionInstrumentation$SetUserInstrumentation.setUser
// co.elastic.apm.agent.plugin.api.TransactionInstrumentation$SetUserInstrumentation.setUser
}

@Override
Expand All @@ -48,7 +48,7 @@ public void setResult(String result) {
@Nonnull
@Override
public String ensureParentId() {
// co.elastic.apm.plugin.api.TransactionInstrumentation.EnsureParentIdInstrumentation
// co.elastic.apm.agent.plugin.api.TransactionInstrumentation.EnsureParentIdInstrumentation
return "";
}

Expand Down
2 changes: 1 addition & 1 deletion apm-agent-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</dependency>
<!--
we can't add elastic-apm-agent as it causes shading problems:
java.util.ServiceConfigurationError: org.stagemonitor.configuration.ConfigurationOptionProvider: co.elastic.apm.web.WebConfiguration not a subtype
java.util.ServiceConfigurationError: org.stagemonitor.configuration.ConfigurationOptionProvider: co.elastic.apm.agent.web.WebConfiguration not a subtype
-->
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import co.elastic.apm.benchmark.profiler.CpuProfiler;
import co.elastic.apm.benchmark.profiler.ReporterProfiler;
import co.elastic.apm.agent.benchmark.profiler.CpuProfiler;
import co.elastic.apm.agent.benchmark.profiler.ReporterProfiler;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Scope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.runner.RunnerException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;

import co.elastic.apm.bci.ElasticApmAgent;
import co.elastic.apm.benchmark.sql.BlackholeConnection;
import co.elastic.apm.configuration.CoreConfiguration;
import co.elastic.apm.impl.ElasticApmTracer;
import co.elastic.apm.impl.ElasticApmTracerBuilder;
import co.elastic.apm.report.Reporter;
package co.elastic.apm.agent.benchmark;

import co.elastic.apm.agent.bci.ElasticApmAgent;
import co.elastic.apm.agent.benchmark.sql.BlackholeConnection;
import co.elastic.apm.agent.configuration.CoreConfiguration;
import co.elastic.apm.agent.impl.ElasticApmTracer;
import co.elastic.apm.agent.impl.ElasticApmTracerBuilder;
import co.elastic.apm.agent.report.Reporter;
import io.undertow.Undertow;
import io.undertow.server.handlers.BlockingHandler;
import net.bytebuddy.agent.ByteBuddyAgent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.runner.RunnerException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import javax.servlet.AsyncContext;
import javax.servlet.DispatcherType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark;
package co.elastic.apm.agent.benchmark;

import co.elastic.apm.impl.ElasticApmTracer;
import co.elastic.apm.impl.ElasticApmTracerBuilder;
import co.elastic.apm.impl.error.ErrorCapture;
import co.elastic.apm.impl.transaction.Span;
import co.elastic.apm.impl.transaction.Transaction;
import co.elastic.apm.report.ReporterConfiguration;
import co.elastic.apm.util.MathUtils;
import co.elastic.apm.agent.impl.ElasticApmTracer;
import co.elastic.apm.agent.impl.ElasticApmTracerBuilder;
import co.elastic.apm.agent.impl.error.ErrorCapture;
import co.elastic.apm.agent.impl.transaction.Span;
import co.elastic.apm.agent.impl.transaction.Transaction;
import co.elastic.apm.agent.report.ReporterConfiguration;
import co.elastic.apm.agent.util.MathUtils;
import org.ehcache.sizeof.SizeOf;

public class SizeOfSpan {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.objectpool;
package co.elastic.apm.agent.benchmark.objectpool;

import co.elastic.apm.benchmark.AbstractBenchmark;
import co.elastic.apm.impl.ElasticApmTracer;
import co.elastic.apm.impl.ElasticApmTracerBuilder;
import co.elastic.apm.impl.transaction.Transaction;
import co.elastic.apm.objectpool.impl.MixedObjectPool;
import co.elastic.apm.objectpool.impl.QueueBasedObjectPool;
import co.elastic.apm.objectpool.impl.ThreadLocalObjectPool;
import co.elastic.apm.agent.benchmark.AbstractBenchmark;
import co.elastic.apm.agent.impl.ElasticApmTracer;
import co.elastic.apm.agent.impl.ElasticApmTracerBuilder;
import co.elastic.apm.agent.impl.transaction.Transaction;
import co.elastic.apm.agent.objectpool.impl.MixedObjectPool;
import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool;
import co.elastic.apm.agent.objectpool.impl.ThreadLocalObjectPool;
import org.agrona.concurrent.ManyToManyConcurrentArrayQueue;
import org.jctools.queues.MpmcArrayQueue;
import org.jctools.queues.atomic.MpmcAtomicArrayQueue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.profiler;
package co.elastic.apm.agent.benchmark.profiler;

import com.sun.management.OperatingSystemMXBean;
import org.openjdk.jmh.infra.BenchmarkParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.profiler;
package co.elastic.apm.agent.benchmark.profiler;

import co.elastic.apm.report.Reporter;
import co.elastic.apm.agent.report.Reporter;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.profile.InternalProfiler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.sql;
package co.elastic.apm.agent.benchmark.sql;

import org.openjdk.jmh.infra.Blackhole;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.sql;
package co.elastic.apm.agent.benchmark.sql;

import org.openjdk.jmh.infra.Blackhole;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.sql;
package co.elastic.apm.agent.benchmark.sql;

import org.openjdk.jmh.infra.Blackhole;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.benchmark.sql;
package co.elastic.apm.agent.benchmark.sql;

import org.openjdk.jmh.infra.Blackhole;

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
co.elastic.apm.benchmark.profiler.ReporterProfiler
co.elastic.apm.agent.benchmark.profiler.ReporterProfiler
4 changes: 2 additions & 2 deletions apm-agent-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ It provides access to all fields available in the APM server intake api: https:/
The Reporter is responsible for sending Transactions to the APM server.

It's based on a Disruptor/ring buffer and receives finished transactions potentially from multiple threads.
The ring buffer decouples the transaction-producing threads from the co.elastic.apm.report.ReportingEventHandler,
The ring buffer decouples the transaction-producing threads from the co.elastic.apm.agent.report.ReportingEventHandler,
which is single-threaded and sends the transactions to the APM server via HTTP.

The class co.elastic.apm.report.ReporterConfiguration contains all relevant configuration options for the reporter.
The class co.elastic.apm.agent.report.ReporterConfiguration contains all relevant configuration options for the reporter.

## Lifecycle

Expand Down
2 changes: 1 addition & 1 deletion apm-agent-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<version>0.5.1</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<targetPackage>co.elastic.apm.impl.intake</targetPackage>
<targetPackage>co.elastic.apm.agent.impl.intake</targetPackage>
<usePrimitives>true</usePrimitives>
<useLongIntegers>true</useLongIntegers>
<includeAdditionalProperties>false</includeAdditionalProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package co.elastic.apm.annotation;
package co.elastic.apm.agent.annotation;

import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
* #L%
*/
@NonnullApi
package co.elastic.apm.annotation;
package co.elastic.apm.agent.annotation;
Loading

0 comments on commit 5de1437

Please sign in to comment.