From e61a8fc141c417df7f6389c0ef1f713e5004add7 Mon Sep 17 00:00:00 2001 From: apmmachine Date: Wed, 6 Mar 2024 16:49:51 +0000 Subject: [PATCH 001/132] [maven-release-plugin] prepare for next development iteration --- apm-agent-api/pom.xml | 2 +- apm-agent-attach-cli/pom.xml | 2 +- apm-agent-attach/pom.xml | 2 +- apm-agent-benchmarks/pom.xml | 2 +- apm-agent-bootstrap/pom.xml | 2 +- apm-agent-builds/apm-agent-java8/pom.xml | 2 +- apm-agent-builds/apm-agent/pom.xml | 2 +- apm-agent-builds/pom.xml | 2 +- apm-agent-cached-lookup-key/pom.xml | 2 +- apm-agent-common/pom.xml | 2 +- apm-agent-core/pom.xml | 2 +- apm-agent-lambda-layer/pom.xml | 2 +- apm-agent-plugin-sdk/pom.xml | 2 +- .../apm-apache-httpclient-common/pom.xml | 2 +- .../apm-apache-httpclient3-plugin/pom.xml | 2 +- .../apm-apache-httpclient4-plugin/pom.xml | 2 +- .../apm-apache-httpclient5-plugin/pom.xml | 2 +- apm-agent-plugins/apm-apache-httpclient/pom.xml | 2 +- apm-agent-plugins/apm-api-plugin/pom.xml | 2 +- apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/pom.xml | 2 +- apm-agent-plugins/apm-awslambda-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra-core-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/pom.xml | 2 +- apm-agent-plugins/apm-dubbo-plugin/pom.xml | 2 +- apm-agent-plugins/apm-ecs-logging-plugin/pom.xml | 2 +- .../apm-es-restclient-plugin-5_6/pom.xml | 2 +- .../apm-es-restclient-plugin-6_4/pom.xml | 2 +- .../apm-es-restclient-plugin-7_x/pom.xml | 2 +- .../apm-es-restclient-plugin-8_x/pom.xml | 2 +- .../apm-es-restclient-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-es-restclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grails-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-grpc/pom.xml | 2 +- .../apm-hibernate-search-plugin-5_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-6_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-hibernate-search-plugin/pom.xml | 2 +- apm-agent-plugins/apm-httpclient-core/pom.xml | 2 +- apm-agent-plugins/apm-httpserver-core/pom.xml | 2 +- apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-concurrent-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-ldap-plugin/pom.xml | 2 +- apm-agent-plugins/apm-javalin-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxrs-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxws-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdbc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml | 2 +- .../apm-jms-plugin/apm-jms-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jmx-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jsf-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-base-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-kafka-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-jboss-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-log4j1-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-log4j2-plugin/pom.xml | 2 +- .../apm-logback-plugin/apm-logback-plugin-impl/pom.xml | 2 +- .../apm-logback-plugin-legacy-tests/pom.xml | 2 +- .../apm-logging-plugin/apm-logback-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-logging-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-plugin/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-test/pom.xml | 2 +- .../apm-opentelemetry-embedded-metrics-sdk/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-common/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-latest/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-v1_14/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-parent/pom.xml | 2 +- .../apm-opentelemetry-metricsdk-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-test/pom.xml | 2 +- apm-agent-plugins/apm-opentelemetry/pom.xml | 2 +- apm-agent-plugins/apm-opentracing-plugin/pom.xml | 2 +- apm-agent-plugins/apm-process-plugin/pom.xml | 2 +- apm-agent-plugins/apm-profiling-plugin/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml | 2 +- apm-agent-plugins/apm-quartz/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/pom.xml | 2 +- apm-agent-plugins/apm-reactor-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-lettuce-3-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml | 2 +- .../apm-redis-plugin/apm-redisson-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/pom.xml | 2 +- apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml | 2 +- .../apm-scheduled-annotation-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml | 2 +- apm-agent-plugins/apm-servlet-jakarta-test/pom.xml | 2 +- apm-agent-plugins/apm-servlet-plugin/pom.xml | 2 +- apm-agent-plugins/apm-sparkjava-plugin/pom.xml | 2 +- .../apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- .../apm-spring-resttemplate-test/pom.xml | 2 +- apm-agent-plugins/apm-spring-resttemplate/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webclient-plugin/pom.xml | 2 +- .../apm-spring-webflux-common-spring5/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-common/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-plugin/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-spring5/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-testapp/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- apm-agent-plugins/apm-struts-plugin/pom.xml | 2 +- apm-agent-plugins/apm-urlconnection-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/pom.xml | 2 +- apm-agent-plugins/pom.xml | 2 +- apm-agent-tracer/pom.xml | 2 +- apm-opentracing/pom.xml | 2 +- elastic-apm-agent-java8/pom.xml | 2 +- elastic-apm-agent-premain/pom.xml | 2 +- elastic-apm-agent/pom.xml | 2 +- .../application-server-integration-tests/pom.xml | 2 +- integration-tests/aws-lambda-test/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-dependent/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-standalone/pom.xml | 2 +- integration-tests/cdi-app/pom.xml | 2 +- .../cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml | 2 +- .../cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml | 2 +- integration-tests/cdi-jakartaee-app/pom.xml | 2 +- .../external-plugin-otel-test-app/pom.xml | 2 +- .../external-plugin-otel-test-plugin1/pom.xml | 2 +- .../external-plugin-otel-test-plugin2/pom.xml | 2 +- integration-tests/external-plugin-otel-test/pom.xml | 2 +- .../external-plugin-test/external-plugin-app/pom.xml | 2 +- .../external-plugin-test/external-plugin-jakarta-app/pom.xml | 2 +- .../external-plugin-test/external-plugin/pom.xml | 2 +- .../plugin-instrumentation-target/pom.xml | 2 +- integration-tests/external-plugin-test/pom.xml | 2 +- .../jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml | 2 +- .../jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml | 2 +- integration-tests/jakartaee-jsf-app/pom.xml | 2 +- integration-tests/jakartaee-simple-webapp/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-dependent/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-standalone/pom.xml | 2 +- integration-tests/jsf-app/pom.xml | 2 +- integration-tests/main-app-test/pom.xml | 2 +- integration-tests/pom.xml | 2 +- integration-tests/quarkus/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-base/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml | 2 +- integration-tests/runtime-attach/pom.xml | 2 +- integration-tests/runtime-attach/runtime-attach-app/pom.xml | 2 +- integration-tests/runtime-attach/runtime-attach-test/pom.xml | 2 +- integration-tests/simple-webapp/pom.xml | 2 +- integration-tests/soap-test/pom.xml | 2 +- integration-tests/spring-boot-1-5/pom.xml | 2 +- integration-tests/spring-boot-2/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-base/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-undertow/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml | 2 +- integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-undertow/pom.xml | 2 +- pom.xml | 4 ++-- 200 files changed, 201 insertions(+), 201 deletions(-) diff --git a/apm-agent-api/pom.xml b/apm-agent-api/pom.xml index f86c39bf78..dc56879084 100644 --- a/apm-agent-api/pom.xml +++ b/apm-agent-api/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-api diff --git a/apm-agent-attach-cli/pom.xml b/apm-agent-attach-cli/pom.xml index 3b4027067c..49d3761542 100644 --- a/apm-agent-attach-cli/pom.xml +++ b/apm-agent-attach-cli/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-attach/pom.xml b/apm-agent-attach/pom.xml index 6ea031e268..44bb4d3407 100644 --- a/apm-agent-attach/pom.xml +++ b/apm-agent-attach/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-attach diff --git a/apm-agent-benchmarks/pom.xml b/apm-agent-benchmarks/pom.xml index 53d671c7f9..05a9398e17 100644 --- a/apm-agent-benchmarks/pom.xml +++ b/apm-agent-benchmarks/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-benchmarks diff --git a/apm-agent-bootstrap/pom.xml b/apm-agent-bootstrap/pom.xml index 7d213ae3b8..e2977db54c 100644 --- a/apm-agent-bootstrap/pom.xml +++ b/apm-agent-bootstrap/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-bootstrap diff --git a/apm-agent-builds/apm-agent-java8/pom.xml b/apm-agent-builds/apm-agent-java8/pom.xml index bca962e66a..f7a80a7819 100644 --- a/apm-agent-builds/apm-agent-java8/pom.xml +++ b/apm-agent-builds/apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-java8 diff --git a/apm-agent-builds/apm-agent/pom.xml b/apm-agent-builds/apm-agent/pom.xml index 2c44c9feb7..03aa5bbf66 100644 --- a/apm-agent-builds/apm-agent/pom.xml +++ b/apm-agent-builds/apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.48.1 + 1.48.2-SNAPSHOT apm-agent diff --git a/apm-agent-builds/pom.xml b/apm-agent-builds/pom.xml index f02d688dc2..2d64440819 100644 --- a/apm-agent-builds/pom.xml +++ b/apm-agent-builds/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-cached-lookup-key/pom.xml b/apm-agent-cached-lookup-key/pom.xml index d5bc35061a..8f214a8b1f 100644 --- a/apm-agent-cached-lookup-key/pom.xml +++ b/apm-agent-cached-lookup-key/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-common/pom.xml b/apm-agent-common/pom.xml index 1b7611f1aa..e57ab1abce 100644 --- a/apm-agent-common/pom.xml +++ b/apm-agent-common/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index afd5e43512..52c81eda23 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-core diff --git a/apm-agent-lambda-layer/pom.xml b/apm-agent-lambda-layer/pom.xml index 7acb09a53e..00279d5bbd 100644 --- a/apm-agent-lambda-layer/pom.xml +++ b/apm-agent-lambda-layer/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugin-sdk/pom.xml b/apm-agent-plugin-sdk/pom.xml index 2adaf7fd88..8373fd913b 100644 --- a/apm-agent-plugin-sdk/pom.xml +++ b/apm-agent-plugin-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml index 01d85b23d1..09b244f874 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-apache-httpclient-common diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml index 3c9413eefb..26badce88b 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-apache-httpclient3-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml index 1f8b78b0ca..e1e3d3d799 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-apache-httpclient4-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml index 6780638bac..912cd34205 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-apache-httpclient - 1.48.1 + 1.48.2-SNAPSHOT apm-apache-httpclient5-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/pom.xml b/apm-agent-plugins/apm-apache-httpclient/pom.xml index cc2a7466ab..13039a2137 100644 --- a/apm-agent-plugins/apm-apache-httpclient/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-apache-httpclient diff --git a/apm-agent-plugins/apm-api-plugin/pom.xml b/apm-agent-plugins/apm-api-plugin/pom.xml index 8245bf49f8..9bbf32fc0a 100644 --- a/apm-agent-plugins/apm-api-plugin/pom.xml +++ b/apm-agent-plugins/apm-api-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT diff --git a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml index 0817cb480e..d16146a415 100644 --- a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-asynchttpclient-plugin diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml index 5e65f9695d..9ce3564a88 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index 4c5bd4cadd..7b3a044eb3 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml index 62ecad9a73..3d3f0de94e 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/pom.xml b/apm-agent-plugins/apm-aws-sdk/pom.xml index 9acd6ab199..5cf7a1e724 100644 --- a/apm-agent-plugins/apm-aws-sdk/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-awslambda-plugin/pom.xml b/apm-agent-plugins/apm-awslambda-plugin/pom.xml index 6ecc7e3cf0..2fc9a49e39 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/pom.xml +++ b/apm-agent-plugins/apm-awslambda-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml index 110cc51a59..52ada94e7e 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml index 245b37dda1..1c48a45f4b 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml index 57bb53d1cc..977e380899 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/pom.xml b/apm-agent-plugins/apm-cassandra/pom.xml index 3628a07846..28412125b2 100644 --- a/apm-agent-plugins/apm-cassandra/pom.xml +++ b/apm-agent-plugins/apm-cassandra/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-dubbo-plugin/pom.xml b/apm-agent-plugins/apm-dubbo-plugin/pom.xml index 4e07dff93c..8b62725169 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/pom.xml +++ b/apm-agent-plugins/apm-dubbo-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml index d7d4191da5..f261b19bc2 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-ecs-logging-plugin diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml index 953b7df444..aaf43fd306 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-es-restclient-plugin-5_6 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml index ecebe23244..7d8b0b7284 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-es-restclient-plugin-6_4 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml index 1d7449dde8..9149b883fb 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-es-restclient-plugin-7_x diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml index ede3c16185..997ab85f8a 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml @@ -3,7 +3,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml index 1b9542947f..40dadf3324 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-es-restclient-plugin-common diff --git a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml index f6f737e86e..afd404b925 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-es-restclient-plugin diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml index 358b698acf..959f055bcf 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-finagle-httpclient-plugin diff --git a/apm-agent-plugins/apm-grails-plugin/pom.xml b/apm-agent-plugins/apm-grails-plugin/pom.xml index ce4941288f..dd04a58d3a 100644 --- a/apm-agent-plugins/apm-grails-plugin/pom.xml +++ b/apm-agent-plugins/apm-grails-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-grails-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml index 9633786176..1cd687415b 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.48.1 + 1.48.2-SNAPSHOT apm-grpc-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml index b435a854e3..49a7d51de1 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.48.1 + 1.48.2-SNAPSHOT apm-grpc-test-1.6.1 diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml index 0a15cdba35..f583d33fba 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.48.1 + 1.48.2-SNAPSHOT apm-grpc-test-latest diff --git a/apm-agent-plugins/apm-grpc/pom.xml b/apm-agent-plugins/apm-grpc/pom.xml index 297f801075..1ab7d2d4a1 100644 --- a/apm-agent-plugins/apm-grpc/pom.xml +++ b/apm-agent-plugins/apm-grpc/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.1 + 1.48.2-SNAPSHOT apm-grpc diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml index 5231eadcfa..00ad479bc5 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-hibernate-search-plugin-5_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml index f90873c3f7..af31592546 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-hibernate-search-plugin-6_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml index 0bd46f79af..c6c8482f39 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-hibernate-search-plugin-common diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml index 5f8b49d2a3..d0a531299d 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-hibernate-search-plugin diff --git a/apm-agent-plugins/apm-httpclient-core/pom.xml b/apm-agent-plugins/apm-httpclient-core/pom.xml index df0969200c..f3030694a4 100644 --- a/apm-agent-plugins/apm-httpclient-core/pom.xml +++ b/apm-agent-plugins/apm-httpclient-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-httpclient-core diff --git a/apm-agent-plugins/apm-httpserver-core/pom.xml b/apm-agent-plugins/apm-httpserver-core/pom.xml index 2fff28b293..702736ed6e 100644 --- a/apm-agent-plugins/apm-httpserver-core/pom.xml +++ b/apm-agent-plugins/apm-httpserver-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-httpserver-core diff --git a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml index 06e4e69463..6630f0da94 100644 --- a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml +++ b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jakarta-websocket-plugin diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml index b182dbd8e7..aec7d4d61e 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-java-concurrent-plugin diff --git a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml index 96bf17a825..d69b13e8d4 100644 --- a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-java-ldap-plugin diff --git a/apm-agent-plugins/apm-javalin-plugin/pom.xml b/apm-agent-plugins/apm-javalin-plugin/pom.xml index 72d3615e04..c8e4775859 100644 --- a/apm-agent-plugins/apm-javalin-plugin/pom.xml +++ b/apm-agent-plugins/apm-javalin-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-javalin-plugin diff --git a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml index f31c284347..26255efff9 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml index 9ee30678ed..15eaeb76c2 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jaxrs-plugin diff --git a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml index 8356ea4a83..1466284ce5 100644 --- a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jaxws-plugin/pom.xml b/apm-agent-plugins/apm-jaxws-plugin/pom.xml index e97b1acb0b..b16e3a2782 100644 --- a/apm-agent-plugins/apm-jaxws-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jaxws-plugin diff --git a/apm-agent-plugins/apm-jdbc-plugin/pom.xml b/apm-agent-plugins/apm-jdbc-plugin/pom.xml index 997d54e0e5..8d279585e3 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdbc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jdbc-plugin diff --git a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml index cd638d2d04..a7f6523fd7 100644 --- a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jdk-httpclient-plugin diff --git a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml index 0aefe8f0ba..85c2823725 100644 --- a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jdk-httpserver-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml index bd96256253..bbbcc1a0f0 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml index 9973007166..9c10e3f17c 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml index e5089ad80d..b85ed7a13e 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jms-plugin-base diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml index c427ab178b..81e1cfde8f 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jms-spring-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/pom.xml index 2d4e692fe1..c3c3b9d1b4 100644 --- a/apm-agent-plugins/apm-jms-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jms-plugin diff --git a/apm-agent-plugins/apm-jmx-plugin/pom.xml b/apm-agent-plugins/apm-jmx-plugin/pom.xml index 1112c40c13..64af345431 100644 --- a/apm-agent-plugins/apm-jmx-plugin/pom.xml +++ b/apm-agent-plugins/apm-jmx-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jmx-plugin diff --git a/apm-agent-plugins/apm-jsf-plugin/pom.xml b/apm-agent-plugins/apm-jsf-plugin/pom.xml index 7368aa8462..8556914066 100644 --- a/apm-agent-plugins/apm-jsf-plugin/pom.xml +++ b/apm-agent-plugins/apm-jsf-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jsf-plugin diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml index b0f150727a..f3b6911e9d 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml @@ -3,7 +3,7 @@ apm-kafka-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml index cdcd4d0462..4137353472 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml index 82284c44a6..bfbaf17272 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/pom.xml index ac7ded3a3d..85676c0666 100644 --- a/apm-agent-plugins/apm-kafka-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml index e17343791c..c1e66a3766 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jboss-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml index 2d1c5a996c..a27c6ea565 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jul-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml index ca055fbf6b..afa55c335e 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-log4j1-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml index ae81294677..a64a1a0f33 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-log4j2-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml index b00ffd019e..5d31a5212d 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-logback-plugin-impl diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml index cee32d6fe1..3fe9c12bee 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-logback-plugin-legacy-tests diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml index 07edd698d3..0c4618b9d9 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-logback-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml index 17507eb097..f3fed7db39 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-logging-plugin-common diff --git a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml index d9b6b779ef..fe9d2ea927 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-slf4j-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml index 5c6f251b4b..1f901bfd46 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-tomcat-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/pom.xml index 033cb42d4a..210a547700 100644 --- a/apm-agent-plugins/apm-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-logging-plugin diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 101e463b63..1bf14f7a15 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml index c8c68661bc..2ed07d0c3c 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml @@ -4,7 +4,7 @@ apm-mongodb co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml index f9a8903c3f..2cd12d88fa 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-mongodb co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml index 09cb31f444..f79e060b0e 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-mongodb co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-mongodb4-plugin diff --git a/apm-agent-plugins/apm-mongodb/pom.xml b/apm-agent-plugins/apm-mongodb/pom.xml index ec8ee44c4e..94f6457acb 100644 --- a/apm-agent-plugins/apm-mongodb/pom.xml +++ b/apm-agent-plugins/apm-mongodb/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-mongodb diff --git a/apm-agent-plugins/apm-okhttp-plugin/pom.xml b/apm-agent-plugins/apm-okhttp-plugin/pom.xml index 5ee95563c0..17a140044a 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/pom.xml +++ b/apm-agent-plugins/apm-okhttp-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-okhttp-plugin diff --git a/apm-agent-plugins/apm-okhttp-test/pom.xml b/apm-agent-plugins/apm-okhttp-test/pom.xml index 1784e3a205..370ce9b874 100644 --- a/apm-agent-plugins/apm-okhttp-test/pom.xml +++ b/apm-agent-plugins/apm-okhttp-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml index 2cd72d452c..65610a16a8 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.1 + 1.48.2-SNAPSHOT apm-opentelemetry-embedded-metrics-sdk diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml index bd703e7427..5f039cf1f6 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml index 70635e304b..1dd43e348e 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml index dfd9e5b293..b2464b6b7d 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml index d488231fd5..4c63b96869 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml index 1266170f5d..8427d641bf 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.1 + 1.48.2-SNAPSHOT apm-opentelemetry-metricsdk-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml index 0d34df9662..9caf40a9e7 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.1 + 1.48.2-SNAPSHOT apm-opentelemetry-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml index 0491af15dc..0e426ab323 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.1 + 1.48.2-SNAPSHOT ${project.groupId}:${project.artifactId} diff --git a/apm-agent-plugins/apm-opentelemetry/pom.xml b/apm-agent-plugins/apm-opentelemetry/pom.xml index 2f16505192..a309696fcd 100644 --- a/apm-agent-plugins/apm-opentelemetry/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.1 + 1.48.2-SNAPSHOT apm-opentelemetry diff --git a/apm-agent-plugins/apm-opentracing-plugin/pom.xml b/apm-agent-plugins/apm-opentracing-plugin/pom.xml index ae90005844..ae9e4bf4b0 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentracing-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-opentracing-plugin diff --git a/apm-agent-plugins/apm-process-plugin/pom.xml b/apm-agent-plugins/apm-process-plugin/pom.xml index 0111e938da..da684669d9 100644 --- a/apm-agent-plugins/apm-process-plugin/pom.xml +++ b/apm-agent-plugins/apm-process-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-profiling-plugin/pom.xml b/apm-agent-plugins/apm-profiling-plugin/pom.xml index 37e3cdc23d..8f5e912af0 100644 --- a/apm-agent-plugins/apm-profiling-plugin/pom.xml +++ b/apm-agent-plugins/apm-profiling-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-profiling-plugin diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml index 403bbf01dc..c4012b542e 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml index 234b339ee0..019654416e 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml index 3504cf38dc..1b2d22a3cc 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/pom.xml b/apm-agent-plugins/apm-quartz/pom.xml index 816532c5b2..5bd74fe5b8 100644 --- a/apm-agent-plugins/apm-quartz/pom.xml +++ b/apm-agent-plugins/apm-quartz/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-quartz diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml index 0b5ce43811..232a8a3c91 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-rabbitmq-plugin diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml index 9c0cbdd2b8..d5d6476ea6 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-rabbitmq-spring diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml index 4bb6c21fdc..964023983e 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-rabbitmq-test-3 diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml index 26095b556a..c0f6d5606f 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-rabbitmq-test-4 diff --git a/apm-agent-plugins/apm-rabbitmq/pom.xml b/apm-agent-plugins/apm-rabbitmq/pom.xml index a3659d7921..84c3adf675 100644 --- a/apm-agent-plugins/apm-rabbitmq/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-rabbitmq diff --git a/apm-agent-plugins/apm-reactor-plugin/pom.xml b/apm-agent-plugins/apm-reactor-plugin/pom.xml index 111a6febac..7c33618024 100644 --- a/apm-agent-plugins/apm-reactor-plugin/pom.xml +++ b/apm-agent-plugins/apm-reactor-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.1 + 1.48.2-SNAPSHOT apm-reactor-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml index c94d152b40..b851eba9bd 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jedis-2-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml index e8c2de4861..dffe6419d6 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jedis-3-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml index e9673307ed..e67e74953d 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jedis-4-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml index e4900c367e..8a36ca3d0b 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jedis-5-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml index f24e4bc799..3f1760fbec 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-jedis-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml index e45daa53c3..27859df68e 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml index 3fde25d809..ce9a3f8dcf 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml index b4812c6fda..47e44ad13e 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-redis-common diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml index 46bbb3a0d6..f55fed32df 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-redisson-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/pom.xml index 2c5f5bae5f..bcc0712a47 100644 --- a/apm-agent-plugins/apm-redis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-redis-plugin diff --git a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml index 49b1ec62a3..6cf99a7db4 100644 --- a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-scala-concurrent-plugin diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml index 6cccfbc2d9..c49411054e 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml index 9a84de38ed..6e4018e604 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-scheduled-annotation-plugin diff --git a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml index 5f74e01506..156602f6d0 100644 --- a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml +++ b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-servlet-jakarta-test diff --git a/apm-agent-plugins/apm-servlet-plugin/pom.xml b/apm-agent-plugins/apm-servlet-plugin/pom.xml index daad3d4005..53be86608e 100644 --- a/apm-agent-plugins/apm-servlet-plugin/pom.xml +++ b/apm-agent-plugins/apm-servlet-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-servlet-plugin diff --git a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml index 086eaef2b7..e5d4e3a010 100644 --- a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml +++ b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index 3bbe86c0b2..3f02160f34 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-restclient-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index 4ce5b21314..8d9a70f69f 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-resttemplate-plugin diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml index 8feed99793..deae551502 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-resttemplate-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/pom.xml index 7cbd13450d..94f3434b62 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-resttemplate diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml index c296198695..446ebd3c83 100755 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webclient-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml index 3cb1bb3649..7fd7fca12d 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webflux-common-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml index 4e09f1c9cc..b781076a72 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webflux-common diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml index 594d935872..85531d1a2f 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webflux-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml index 2bc3dc392b..30f4c298d7 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webflux-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml index 885cddc043..3e45fefa40 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webflux-testapp diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index fec6bc31c9..51265fae3c 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webflux diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index d9b0d31e49..f42d4482df 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webmvc-plugin diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml index 74b1169377..21a82e7866 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-spring-webmvc-spring5 diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index 0e0dbc1cfa..e3c4af3f60 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-struts-plugin/pom.xml b/apm-agent-plugins/apm-struts-plugin/pom.xml index f7adb7f895..f2f1116ef2 100644 --- a/apm-agent-plugins/apm-struts-plugin/pom.xml +++ b/apm-agent-plugins/apm-struts-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml index d741479e10..b6ef4740c4 100644 --- a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml +++ b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-urlconnection-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml index a55dee0f1f..2f7905c136 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-vertx-common diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml index 80699ce105..f449482dea 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-vertx3-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml index b0c07fb7d3..6e07055cf6 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-vertx3-test-latest diff --git a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml index 93240e1ed4..be4b5e74d7 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-vertx4-plugin diff --git a/apm-agent-plugins/apm-vertx/pom.xml b/apm-agent-plugins/apm-vertx/pom.xml index 52ffacae81..46fb2455c2 100644 --- a/apm-agent-plugins/apm-vertx/pom.xml +++ b/apm-agent-plugins/apm-vertx/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-vertx diff --git a/apm-agent-plugins/pom.xml b/apm-agent-plugins/pom.xml index 2643a3f595..bb2071af86 100644 --- a/apm-agent-plugins/pom.xml +++ b/apm-agent-plugins/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-plugins diff --git a/apm-agent-tracer/pom.xml b/apm-agent-tracer/pom.xml index 52ee021f60..dccd4562ed 100644 --- a/apm-agent-tracer/pom.xml +++ b/apm-agent-tracer/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.48.1 + 1.48.2-SNAPSHOT apm-agent-tracer diff --git a/apm-opentracing/pom.xml b/apm-opentracing/pom.xml index 552bd7b756..36d44a138e 100644 --- a/apm-opentracing/pom.xml +++ b/apm-opentracing/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT apm-opentracing diff --git a/elastic-apm-agent-java8/pom.xml b/elastic-apm-agent-java8/pom.xml index 8f80175967..e0d262749a 100644 --- a/elastic-apm-agent-java8/pom.xml +++ b/elastic-apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.48.1 + 1.48.2-SNAPSHOT elastic-apm-agent-java8 diff --git a/elastic-apm-agent-premain/pom.xml b/elastic-apm-agent-premain/pom.xml index c9c5476159..9d87be02e9 100644 --- a/elastic-apm-agent-premain/pom.xml +++ b/elastic-apm-agent-premain/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/elastic-apm-agent/pom.xml b/elastic-apm-agent/pom.xml index 1d6e625611..76f7c4c2f2 100644 --- a/elastic-apm-agent/pom.xml +++ b/elastic-apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.48.1 + 1.48.2-SNAPSHOT elastic-apm-agent diff --git a/integration-tests/application-server-integration-tests/pom.xml b/integration-tests/application-server-integration-tests/pom.xml index 821a2ab925..78f55c218a 100644 --- a/integration-tests/application-server-integration-tests/pom.xml +++ b/integration-tests/application-server-integration-tests/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT application-server-integration-tests diff --git a/integration-tests/aws-lambda-test/pom.xml b/integration-tests/aws-lambda-test/pom.xml index eaafe01c06..043164b62e 100644 --- a/integration-tests/aws-lambda-test/pom.xml +++ b/integration-tests/aws-lambda-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-dependent/pom.xml b/integration-tests/cdi-app/cdi-app-dependent/pom.xml index 10838ff968..645386cf40 100644 --- a/integration-tests/cdi-app/cdi-app-dependent/pom.xml +++ b/integration-tests/cdi-app/cdi-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-standalone/pom.xml b/integration-tests/cdi-app/cdi-app-standalone/pom.xml index 3bce8646f2..77baba8340 100644 --- a/integration-tests/cdi-app/cdi-app-standalone/pom.xml +++ b/integration-tests/cdi-app/cdi-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-app/pom.xml b/integration-tests/cdi-app/pom.xml index 6d90f7280f..aec2fbfdab 100644 --- a/integration-tests/cdi-app/pom.xml +++ b/integration-tests/cdi-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml index 527744cfda..de3110de16 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml index 40ac20e077..28d9f094cc 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/pom.xml b/integration-tests/cdi-jakartaee-app/pom.xml index cfa65f2e72..f0dfb87676 100644 --- a/integration-tests/cdi-jakartaee-app/pom.xml +++ b/integration-tests/cdi-jakartaee-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml index 47fde11ba3..d4148f8389 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.48.1 + 1.48.2-SNAPSHOT external-plugin-otel-test-app diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml index 15b5daa0ee..51304363e2 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.48.1 + 1.48.2-SNAPSHOT external-plugin-otel-test-plugin1 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml index 74fc5c585c..2327dd561c 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.48.1 + 1.48.2-SNAPSHOT external-plugin-otel-test-plugin2 diff --git a/integration-tests/external-plugin-otel-test/pom.xml b/integration-tests/external-plugin-otel-test/pom.xml index 06f4084f52..8c8101f4bf 100644 --- a/integration-tests/external-plugin-otel-test/pom.xml +++ b/integration-tests/external-plugin-otel-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm integration-tests - 1.48.1 + 1.48.2-SNAPSHOT external-plugin-otel-test diff --git a/integration-tests/external-plugin-test/external-plugin-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-app/pom.xml index ee288ab1f4..2eaf4b7011 100644 --- a/integration-tests/external-plugin-test/external-plugin-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT external-plugin-app diff --git a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml index 376b0fda26..32e9230a95 100644 --- a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT external-plugin-jakarta-app diff --git a/integration-tests/external-plugin-test/external-plugin/pom.xml b/integration-tests/external-plugin-test/external-plugin/pom.xml index 455233737c..842800861e 100644 --- a/integration-tests/external-plugin-test/external-plugin/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT external-plugin diff --git a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml index 9963bb9464..37a8fe6849 100644 --- a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml +++ b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT plugin-instrumentation-target diff --git a/integration-tests/external-plugin-test/pom.xml b/integration-tests/external-plugin-test/pom.xml index 9bfb8a0a39..6e897b3663 100644 --- a/integration-tests/external-plugin-test/pom.xml +++ b/integration-tests/external-plugin-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml index 091241e9a1..4a69451d2a 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml index 068e92b87d..8a390f932c 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/pom.xml b/integration-tests/jakartaee-jsf-app/pom.xml index 420d5d44ec..0b0938d089 100644 --- a/integration-tests/jakartaee-jsf-app/pom.xml +++ b/integration-tests/jakartaee-jsf-app/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 pom diff --git a/integration-tests/jakartaee-simple-webapp/pom.xml b/integration-tests/jakartaee-simple-webapp/pom.xml index 29dbd0c91c..73d8836596 100644 --- a/integration-tests/jakartaee-simple-webapp/pom.xml +++ b/integration-tests/jakartaee-simple-webapp/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT jakartaee-simple-webapp diff --git a/integration-tests/jsf-app/jsf-app-dependent/pom.xml b/integration-tests/jsf-app/jsf-app-dependent/pom.xml index 07b6525d8b..0e97912243 100644 --- a/integration-tests/jsf-app/jsf-app-dependent/pom.xml +++ b/integration-tests/jsf-app/jsf-app-dependent/pom.xml @@ -4,7 +4,7 @@ jsf-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/jsf-app/jsf-app-standalone/pom.xml b/integration-tests/jsf-app/jsf-app-standalone/pom.xml index 82358a7655..5992155203 100644 --- a/integration-tests/jsf-app/jsf-app-standalone/pom.xml +++ b/integration-tests/jsf-app/jsf-app-standalone/pom.xml @@ -6,7 +6,7 @@ jsf-app co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT jsf-app-standalone diff --git a/integration-tests/jsf-app/pom.xml b/integration-tests/jsf-app/pom.xml index 15bf87c569..e2fc080321 100644 --- a/integration-tests/jsf-app/pom.xml +++ b/integration-tests/jsf-app/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT jsf-app diff --git a/integration-tests/main-app-test/pom.xml b/integration-tests/main-app-test/pom.xml index cfd0d1cc1c..7aba42e2a1 100644 --- a/integration-tests/main-app-test/pom.xml +++ b/integration-tests/main-app-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT main-app-test diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index e1e668fb04..c6800d5577 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT integration-tests diff --git a/integration-tests/quarkus/pom.xml b/integration-tests/quarkus/pom.xml index 5155f0a7c1..5d099e3f07 100644 --- a/integration-tests/quarkus/pom.xml +++ b/integration-tests/quarkus/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT quarkus diff --git a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml index 0844fd2315..19d6d81b24 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT quarkus-jaxrs-base diff --git a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml index 9579589899..1075b45659 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT quarkus-jaxrs-undertow diff --git a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml index 63b1078af0..fdb198f7ea 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT quarkus-jaxrs-vertx diff --git a/integration-tests/runtime-attach/pom.xml b/integration-tests/runtime-attach/pom.xml index c2f384da95..c6d07b45eb 100644 --- a/integration-tests/runtime-attach/pom.xml +++ b/integration-tests/runtime-attach/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT runtime-attach diff --git a/integration-tests/runtime-attach/runtime-attach-app/pom.xml b/integration-tests/runtime-attach/runtime-attach-app/pom.xml index 3d4e1ba2c9..67442e2407 100644 --- a/integration-tests/runtime-attach/runtime-attach-app/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-app/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/runtime-attach/runtime-attach-test/pom.xml b/integration-tests/runtime-attach/runtime-attach-test/pom.xml index 7a8335522a..203e031971 100644 --- a/integration-tests/runtime-attach/runtime-attach-test/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-test/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/simple-webapp/pom.xml b/integration-tests/simple-webapp/pom.xml index c6fda1e5a5..b08f6fec40 100644 --- a/integration-tests/simple-webapp/pom.xml +++ b/integration-tests/simple-webapp/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT simple-webapp diff --git a/integration-tests/soap-test/pom.xml b/integration-tests/soap-test/pom.xml index ee7878bdf5..1ebad4536e 100644 --- a/integration-tests/soap-test/pom.xml +++ b/integration-tests/soap-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT soap-test diff --git a/integration-tests/spring-boot-1-5/pom.xml b/integration-tests/spring-boot-1-5/pom.xml index f2e60f25b2..a27b24fd16 100644 --- a/integration-tests/spring-boot-1-5/pom.xml +++ b/integration-tests/spring-boot-1-5/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-1-5 diff --git a/integration-tests/spring-boot-2/pom.xml b/integration-tests/spring-boot-2/pom.xml index f6b797ae08..6e834687b2 100644 --- a/integration-tests/spring-boot-2/pom.xml +++ b/integration-tests/spring-boot-2/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-2 diff --git a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml index 8571f30a4b..528160db9b 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-2-base diff --git a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml index e5033ba0e8..9f07748eef 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-2-jetty diff --git a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml index 3373ee2fb1..4eacadb320 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-2-tomcat diff --git a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml index 5ee5340308..3c7212ec18 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-2-undertow diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 4dea8a7b02..174007e9fe 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT spring-boot-3 diff --git a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml index 3ff81f77dd..4d63b45954 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml index e0fc0192e5..75cf0f4adc 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml index 4ba6db6657..1633a3aeb5 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.48.1 + 1.48.2-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 38d8bcf393..0e376b96b8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.48.1 + 1.48.2-SNAPSHOT pom ${project.groupId}:${project.artifactId} @@ -30,7 +30,7 @@ scm:git:git@github.com:elastic/apm-agent-java.git scm:git:git@github.com:elastic/apm-agent-java.git https://github.com/elastic/apm-agent-java - v1.48.1 + HEAD From c7f7f2c593c6b64aa57972217e238f20e3fd0f92 Mon Sep 17 00:00:00 2001 From: apmmachine Date: Wed, 6 Mar 2024 17:17:44 +0000 Subject: [PATCH 002/132] Update cloudfoundry for 1.48.1 release --- cloudfoundry/index.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/cloudfoundry/index.yml b/cloudfoundry/index.yml index 750c4919ab..24b766a778 100644 --- a/cloudfoundry/index.yml +++ b/cloudfoundry/index.yml @@ -60,3 +60,4 @@ 1.47.0: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.47.0/elastic-apm-agent-1.47.0.jar 1.47.1: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.47.1/elastic-apm-agent-1.47.1.jar 1.48.0: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.48.0/elastic-apm-agent-1.48.0.jar +1.48.1: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.48.1/elastic-apm-agent-1.48.1.jar From 72a74e5eae9815f9d96a49cee697c5b7fe43fd20 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 11 Mar 2024 09:43:43 +0100 Subject: [PATCH 003/132] ci: use .java-version and prepare to use VM with installed tools in BK (#3554) --- .buildkite/hooks/prepare-common.sh | 28 +++++---- .buildkite/release.yml | 4 +- .buildkite/snapshot.yml | 4 +- .ci/release.sh | 13 +++- .ci/snapshot.sh | 15 +++-- .github/workflows/main.yml | 2 +- .github/workflows/maven-goal-jdk/action.yml | 44 ++++++++++++++ .github/workflows/maven-goal/action.yml | 22 +------ .github/workflows/release.yml | 67 +++++++++++---------- .java-version | 1 + 10 files changed, 126 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/maven-goal-jdk/action.yml create mode 100644 .java-version diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index 68cf0d4ad4..50b3d3388e 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -1,17 +1,23 @@ #!/usr/bin/env bash set -euo pipefail -echo "--- Install JDK17 :java:" -# JDK version is defined in two different locations, here and .github/workflows/maven-goal/action.yml -JAVA_URL=https://jvm-catalog.elastic.co/jdk -JAVA_HOME=$(pwd)/.openjdk17 -JAVA_PKG="$JAVA_URL/latest_openjdk_17_linux.tar.gz" -curl -L --output /tmp/jdk.tar.gz "$JAVA_PKG" -mkdir -p "$JAVA_HOME" -tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1 - +# Configure the java version +JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]') +JAVA_HOME="${HOME}/.java/openjdk${JAVA_VERSION}" export JAVA_HOME -PATH=$JAVA_HOME/bin:$PATH +PATH="${JAVA_HOME}/bin:$PATH" export PATH -java -version || true +# Fallback to install at runtime +if [ ! -d "${JAVA_HOME}" ] ; then + # This should not be the case normally untless the .java-version file has been changed + # and the VM Image is not yet available with the latest version. + echo "--- Install JDK${JAVA_VERSION} :java:" + JAVA_URL=https://jvm-catalog.elastic.co/jdk + JAVA_PKG="${JAVA_URL}/latest_openjdk_${JAVA_VERSION}_linux.tar.gz" + curl -L --output /tmp/jdk.tar.gz "$JAVA_PKG" + mkdir -p "$JAVA_HOME" + tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1 +fi + +java -version diff --git a/.buildkite/release.yml b/.buildkite/release.yml index 1b6a41fae7..b646bf3309 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -1,5 +1,6 @@ agents: provider: "gcp" + #image: "family/apm-agent-java-ubuntu-2204" steps: - label: "Run the release" @@ -11,4 +12,5 @@ steps: notify: - slack: "#apm-agent-java" - if: 'build.state != "passed"' + # skip slack messages if no failures and dry-run mode + if: 'build.state != "passed" && build.env("dry_run") == "false"' diff --git a/.buildkite/snapshot.yml b/.buildkite/snapshot.yml index c33406f9f4..6421fad588 100644 --- a/.buildkite/snapshot.yml +++ b/.buildkite/snapshot.yml @@ -1,5 +1,6 @@ agents: provider: "gcp" + #image: "family/apm-agent-java-ubuntu-2204" steps: - label: "Run the snapshot" @@ -11,4 +12,5 @@ steps: notify: - slack: "#apm-agent-java" - if: 'build.state != "passed"' + # skip slack messages if no failures and dry-run mode + if: 'build.state != "passed" && build.env("dry_run") == "false"' diff --git a/.ci/release.sh b/.ci/release.sh index 77a418d863..b05947ce95 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -21,5 +21,14 @@ echo $PATH java -version set +x -echo "--- Deploy the release :package:" -./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee release.txt +# Default in dry-run mode +GOAL="install" +DRY_RUN_MSG="(dry-run)" +# Otherwise, a RELEASE +if [[ "$dry_run" == "false" ]] ; then + GOAL="deploy" + DRY_RUN_MSG="" +fi + +echo "--- Deploy the release :package: [./mvnw $GOAL)] $DRY_RUN_MSG" +./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt diff --git a/.ci/snapshot.sh b/.ci/snapshot.sh index 63ec170778..a11cd4eb9a 100755 --- a/.ci/snapshot.sh +++ b/.ci/snapshot.sh @@ -23,9 +23,14 @@ echo $PATH java -version set +x -echo "--- Deploy the snapshot :package:" -if [[ "$dry_run" == "true" ]] ; then - echo './mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode' -else - ./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee snapshot.txt +# Default in dry-run mode +GOAL="install" +DRY_RUN_MSG="(dry-run)" +# Otherwise, a snapshot +if [[ "$dry_run" == "false" ]] ; then + GOAL="deploy" + DRY_RUN_MSG="" fi + +echo "--- Deploy the snapshot :package: [./mvnw $GOAL)] $DRY_RUN_MSG" +./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee snapshot.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e31fd70f5..419c369cd3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -305,7 +305,7 @@ jobs: distribution: 'temurin' steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/maven-goal + - uses: ./.github/workflows/maven-goal-jdk with: test-java-version: ${{ matrix.version }} test-java-distribution: ${{ matrix.distribution }} diff --git a/.github/workflows/maven-goal-jdk/action.yml b/.github/workflows/maven-goal-jdk/action.yml new file mode 100644 index 0000000000..43379e2fcf --- /dev/null +++ b/.github/workflows/maven-goal-jdk/action.yml @@ -0,0 +1,44 @@ +--- + +name: common build tasks +description: Install specific JDK and run a command + +inputs: + test-java-version: + description: 'Testing Java version' + required: true + default: '17' + test-java-distribution: + description: 'Testing Java distribution' + required: true + default: 'temurin' + command: + description: 'Command to execute' + required: true + shell: + description: 'Default shell' + default: 'bash' + required: false + +runs: + using: "composite" + steps: + - name: Set up testing JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.test-java-version}} + distribution: ${{ inputs.test-java-distribution}} + + - name: Set up TEST_JAVA_BINARY environment variable + shell: bash + run: | + major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')" + java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }} + echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV + + - uses: ./.github/workflows/maven-goal + with: + command: ${{ inputs.command }} + shell: ${{ inputs.shell }} + env: + TEST_JAVA_BINARY: ${{ env.TEST_JAVA_BINARY }} diff --git a/.github/workflows/maven-goal/action.yml b/.github/workflows/maven-goal/action.yml index a2ddbea62b..371934f3a4 100644 --- a/.github/workflows/maven-goal/action.yml +++ b/.github/workflows/maven-goal/action.yml @@ -4,14 +4,6 @@ name: common build tasks description: Install specific JDK and run a command inputs: - test-java-version: - description: 'Testing Java version' - required: true - default: '17' - test-java-distribution: - description: 'Testing Java distribution' - required: true - default: 'temurin' command: description: 'Command to execute' required: true @@ -23,23 +15,11 @@ inputs: runs: using: "composite" steps: - - name: Set up testing JDK - if: ${{ inputs.test-java-version != '17' }} - uses: actions/setup-java@v4 - with: - java-version: ${{ inputs.test-java-version}} - distribution: ${{ inputs.test-java-distribution}} - name: Set up build JDK uses: actions/setup-java@v4 with: - java-version: 17 # NOTE: This version is also defined in .buildkite/hooks/pre-command + java-version-file: .java-version distribution: temurin cache: 'maven' - - name: Set up TEST_JAVA_BINARY environment variable - shell: bash - run: | - major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')" - java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }} - echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV - run: ${{ inputs.command }} shell: ${{ inputs.shell }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04915c1910..d15ea5f5bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,10 +34,12 @@ on: type: boolean required: true default: false + dry_run: + description: If set, run a dry-run release + default: false + type: boolean env: - JAVA_VERSION: 17 - JAVA_DIST: temurin TAG_NAME: v${{ inputs.version }} permissions: @@ -68,21 +70,21 @@ jobs: with: ref: ${{ inputs.branch }} token: ${{ env.GITHUB_TOKEN }} - - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@v4 + - name: Install JDK and mvn clean + uses: ./.github/workflows/maven-goal with: - java-version: ${{ env.JAVA_VERSION }} - distribution: ${{ env.JAVA_DIST }} - cache: 'maven' + command: ./mvnw clean - name: Prepare changelog for release - if: ${{ inputs.update_changelog }} + if: ${{ inputs.update_changelog && ! inputs.dry_run }} run: | java .ci/ReleaseChangelog.java CHANGELOG.asciidoc ${{ inputs.version }} git commit -m "Prepare changelog for release ${{ inputs.version }}" CHANGELOG.asciidoc - name: Bump version and add git tag + if: ${{ ! inputs.dry_run }} run: ./mvnw release:prepare -B -DpushChanges=false "-Darguments=-DskipTests -Dmaven.javadoc.skip=true" -DreleaseVersion=${{ inputs.version }} - - run: git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }} - + - name: Push changes + if: ${{ ! inputs.dry_run }} + run: git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }} maven_central_deploy: name: "Deploy to Maven Central (Buildkite)" @@ -103,12 +105,8 @@ jobs: pipelineCommit: ${{ env.TAG_NAME }} waitFor: true printBuildLogs: false - # The action fails with .github/actions/buildkite/run.sh: line 24: 3: parameter missing. - # Which is an unexpected bug. - # Adding a random buildEnvVar to circumvent the behaviour. buildEnvVars: | - something_something=true - + dry_run=${{ inputs.dry_run || 'false' }} await_artifact_on_maven_central: name: "Wait for artifacts to be available on maven central" @@ -116,6 +114,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Await artifacts published in maven central + if: ${{ ! inputs.dry_run }} shell: bash timeout-minutes: 120 run: | @@ -147,8 +146,11 @@ jobs: with: ref: ${{ env.TAG_NAME }} token: ${{ env.GITHUB_TOKEN }} - - run: .ci/release/update_major_branch.sh ${{ inputs.version }} - - run: git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')" + - name: Update major branch + run: .ci/release/update_major_branch.sh ${{ inputs.version }} + - name: Push changes + if: ${{ ! inputs.dry_run }} + run: git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')" update_cloudfoundry: name: "Update Cloudfoundry" @@ -175,8 +177,9 @@ jobs: - name: "Update Cloudfoundry index.yml file" shell: bash run: .ci/release/update_cloudfoundry.sh ${{ inputs.version }} - - run: git push origin ${{ inputs.branch }} - + - name: Push changes + if: ${{ ! inputs.dry_run }} + run: git push origin ${{ inputs.branch }} build_and_push_docker_images: name: "Build and push docker images" @@ -199,9 +202,11 @@ jobs: secretId: ${{ secrets.VAULT_SECRET_ID }} - name: "Build docker image" shell: bash - run: | - ./scripts/docker-release/build_docker.sh - ./scripts/docker-release/push_docker.sh + run: ./scripts/docker-release/build_docker.sh + - name: "Push docker image" + if: ${{ ! inputs.dry_run }} + shell: bash + run: ./scripts/docker-release/push_docker.sh publish_aws_lambda: name: "Publish AWS Lambda" @@ -218,14 +223,10 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.TAG_NAME }} - - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@v4 - with: - java-version: ${{ env.JAVA_VERSION }} - distribution: ${{ env.JAVA_DIST }} - cache: 'maven' - name: Build Lambda-layer zip using agent from maven-central - run: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer + uses: ./.github/workflows/maven-goal + with: + command: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer - uses: hashicorp/vault-action@v3.0.0 with: url: ${{ secrets.VAULT_ADDR }} @@ -236,6 +237,7 @@ jobs: secret/observability-team/ci/service-account/apm-aws-lambda access_key_id | AWS_ACCESS_KEY_ID ; secret/observability-team/ci/service-account/apm-aws-lambda secret_access_key | AWS_SECRET_ACCESS_KEY - name: Publish + if: ${{ ! inputs.dry_run }} run: | # Convert v1.2.3 to ver-1-2-3 VERSION=${TAG_NAME/v/ver-} @@ -243,23 +245,25 @@ jobs: ELASTIC_LAYER_NAME="elastic-apm-java-${VERSION}" .ci/publish-aws.sh - uses: actions/upload-artifact@v4 + if: ${{ ! inputs.dry_run }} with: name: arn-file path: .ci/.arn-file.md - name: Add ARN file to output + if: ${{ ! inputs.dry_run }} id: arn_output run: | echo 'arn_content<> $GITHUB_OUTPUT cat .ci/.arn-file.md >> $GITHUB_OUTPUT echo 'ARN_CONTENT_EOF' >> $GITHUB_OUTPUT - create_github_release: name: "Create GitHub Release" needs: - publish_aws_lambda - update_major_branch runs-on: ubuntu-latest + if: ${{ ! inputs.dry_run }} permissions: contents: write steps: @@ -286,10 +290,9 @@ jobs: --title="Release ${{ inputs.version }}" \ --notes="[Release Notes for ${{ inputs.version }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ inputs.version }}) ${{ needs.publish_aws_lambda.outputs.arn_content }}" - notify: - if: always() + if: ${{ always() && ! inputs.dry_run }} needs: - prepare_release - maven_central_deploy diff --git a/.java-version b/.java-version new file mode 100644 index 0000000000..8e2afd3427 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +17 \ No newline at end of file From 6d111e83cdbd10067cf0d1b87a596fa313e48f0e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 11 Mar 2024 15:29:08 +0100 Subject: [PATCH 004/132] ci(bk): use specialised VMs (#3555) --- .buildkite/README.md | 16 ++++++++++++++-- .buildkite/hooks/prepare-common.sh | 16 ++++++++++------ .buildkite/release.yml | 2 +- .buildkite/snapshot.yml | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.buildkite/README.md b/.buildkite/README.md index 0a13f51042..409c434e41 100644 --- a/.buildkite/README.md +++ b/.buildkite/README.md @@ -9,7 +9,7 @@ This is the Buildkite pipeline for releasing the APM Agent Java. ### Pipeline Configuration To view the pipeline and its configuration, click [here](https://buildkite.com/elastic/apm-agent-java-release) or -go to the definition in the `elastic/ci` repository. +go to the definition in `release.yml`. ### Credentials @@ -25,7 +25,7 @@ This is the Buildkite pipeline for the APM Agent Java in charge of the snapshots ### Pipeline Configuration To view the pipeline and its configuration, click [here](https://buildkite.com/elastic/apm-agent-java-snapshot) or -go to the definition in the `elastic/ci` repository. +go to the definition in `snapshot.yml`. ## opentelemetry-benchmark pipeline @@ -35,3 +35,15 @@ This is the Buildkite pipeline for the Opentelemetry Benchmark. To view the pipeline and its configuration, click [here](https://buildkite.com/elastic/apm-agent-java-opentelemetry-benchmark) or go to the definition in `opentelemetry-benchmark.yml`. + +## Buildkite VM runners + +A set of Buildkite VM runners has been created for this repository. The VM runners contain +the required software: +* JDK +* GPG +* Maven dependencies + +If a new version of Java is required, update the `.java-version` file with the latest major. When the changes are merged onto `main,` wait for the following day; that's when the automation will be responsible for recreating the VM with the new Java version. + +If you would like to know more about how it works, please go to https://github.com/elastic/ci-agent-images/tree/main/vm-images/apm-agent-java (**NOTE**: only available for Elastic employees) diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index 50b3d3388e..f5fc876099 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -5,19 +5,23 @@ set -euo pipefail JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]') JAVA_HOME="${HOME}/.java/openjdk${JAVA_VERSION}" export JAVA_HOME -PATH="${JAVA_HOME}/bin:$PATH" +PATH="${JAVA_HOME}/bin:${PATH}" export PATH -# Fallback to install at runtime -if [ ! -d "${JAVA_HOME}" ] ; then +if [ -d "${JAVA_HOME}" ] ; then + echo "--- Skip installing JDK${JAVA_VERSION} :java:" + echo "already available in the Buildkite runner" +else + # Fallback to install at runtime # This should not be the case normally untless the .java-version file has been changed # and the VM Image is not yet available with the latest version. echo "--- Install JDK${JAVA_VERSION} :java:" JAVA_URL=https://jvm-catalog.elastic.co/jdk JAVA_PKG="${JAVA_URL}/latest_openjdk_${JAVA_VERSION}_linux.tar.gz" - curl -L --output /tmp/jdk.tar.gz "$JAVA_PKG" - mkdir -p "$JAVA_HOME" - tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1 + curl -L --output /tmp/jdk.tar.gz "${JAVA_PKG}" + mkdir -p "${JAVA_HOME}" + tar --extract --file /tmp/jdk.tar.gz --directory "${JAVA_HOME}" --strip-components 1 fi +# Validate java is available in the runner. java -version diff --git a/.buildkite/release.yml b/.buildkite/release.yml index b646bf3309..347f35358e 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -1,6 +1,6 @@ agents: provider: "gcp" - #image: "family/apm-agent-java-ubuntu-2204" + image: "family/apm-agent-java-ubuntu-2204" steps: - label: "Run the release" diff --git a/.buildkite/snapshot.yml b/.buildkite/snapshot.yml index 6421fad588..c5cf1bcb79 100644 --- a/.buildkite/snapshot.yml +++ b/.buildkite/snapshot.yml @@ -1,6 +1,6 @@ agents: provider: "gcp" - #image: "family/apm-agent-java-ubuntu-2204" + image: "family/apm-agent-java-ubuntu-2204" steps: - label: "Run the snapshot" From 9a97f788b1e45b3d5afacaf5d5d03d5518d941f4 Mon Sep 17 00:00:00 2001 From: Som <111349830+someshwaranM@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:20:39 +0530 Subject: [PATCH 005/132] Added a note on centralized agent config support for AWS Lambda (#3498) --- docs/setup-aws-lambda.asciidoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/setup-aws-lambda.asciidoc b/docs/setup-aws-lambda.asciidoc index 632cee9119..2149c2d534 100644 --- a/docs/setup-aws-lambda.asciidoc +++ b/docs/setup-aws-lambda.asciidoc @@ -4,6 +4,10 @@ The Java APM Agent can be used with AWS Lambda to monitor the execution of your AWS Lambda functions. +``` +Note: The Centralized Agent Configuration on the Elasticsearch APM currently does NOT support AWS Lambda. +``` + [float] [[aws-lambda-java-quick-start]] === Quick Start From cb509840861471a44c9d7b7203ca6c7b53adba50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:51:46 +0100 Subject: [PATCH 006/132] Bump com.networknt:json-schema-validator from 1.1.0 to 1.3.3 (#3547) * Bump com.networknt:json-schema-validator from 1.1.0 to 1.3.3 Bumps [com.networknt:json-schema-validator](https://github.com/networknt/json-schema-validator) from 1.1.0 to 1.3.3. - [Release notes](https://github.com/networknt/json-schema-validator/releases) - [Changelog](https://github.com/networknt/json-schema-validator/blob/master/CHANGELOG.md) - [Commits](https://github.com/networknt/json-schema-validator/compare/1.1.0...1.3.3) --- updated-dependencies: - dependency-name: com.networknt:json-schema-validator dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Fix compilation * Fix schema version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Kunz --- .../src/test/java/co/elastic/apm/agent/MockReporter.java | 3 ++- pom.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java index 1d927c4dce..6fe269b495 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java @@ -40,6 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.networknt.schema.JsonSchema; import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; import com.networknt.schema.ValidationMessage; import org.awaitility.core.ThrowingRunnable; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -810,7 +811,7 @@ private enum SchemaInstance { private static JsonSchema getSchema(String resource) { InputStream input = Objects.requireNonNull(MockReporter.class.getResourceAsStream(resource), "missing resource " + resource); - return JsonSchemaFactory.getInstance().getSchema(input); + return JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V4).getSchema(input); } } diff --git a/pom.xml b/pom.xml index 0e376b96b8..55daeaac73 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ 1.5.0 5.0.15.RELEASE 9.4.11.v20180605 - 1.1.0 + 1.3.3 1.14.12 9.6 From 6d4b20e6c4f2cf71a2fe5d928ed08d57448530c3 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Mon, 11 Mar 2024 17:41:44 +0100 Subject: [PATCH 007/132] Fix inheritance for API annotations (#3551) --- CHANGELOG.asciidoc | 4 + .../AnnotationValueOffsetMappingFactory.java | 63 ++++++++--- .../apm/api/AnnotationInheritanceTest.java | 105 +++++++++++++++--- 3 files changed, 138 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a63d81080c..96e2ec1b21 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +[float] +===== Bug fixes +* Fixed problems with public API annotation inheritance - {pull}3551[#3551] + [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/AnnotationValueOffsetMappingFactory.java b/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/AnnotationValueOffsetMappingFactory.java index 98e1d433c8..de58b9602b 100644 --- a/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/AnnotationValueOffsetMappingFactory.java +++ b/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/AnnotationValueOffsetMappingFactory.java @@ -22,6 +22,7 @@ import co.elastic.apm.agent.sdk.logging.LoggerFactory; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.annotation.AnnotationDescription; +import net.bytebuddy.description.annotation.AnnotationValue; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.method.ParameterDescription; import net.bytebuddy.description.type.TypeDescription; @@ -32,6 +33,11 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.util.ArrayDeque; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Queue; +import java.util.Set; import static net.bytebuddy.matcher.ElementMatchers.named; @@ -58,20 +64,31 @@ public Target resolve(TypeDescription instrumentedType, MethodDescription instru @Nullable private Object getAnnotationValue(MethodDescription instrumentedMethod, AnnotationValueExtractor annotationValueExtractor) { - MethodDescription methodDescription = instrumentedMethod; - do { - for (TypeDescription typeDescription : methodDescription.getDeclaredAnnotations().asTypeList()) { - if (named(annotationValueExtractor.annotationClassName()).matches(typeDescription)) { - for (MethodDescription.InDefinedShape annotationMethod : typeDescription.getDeclaredMethods()) { - if (annotationMethod.getName().equals(annotationValueExtractor.method())) { - return methodDescription.getDeclaredAnnotations().ofType(typeDescription).getValue(annotationMethod).resolve(); - } + Queue typesToCheck = new ArrayDeque<>(); + typesToCheck.add(instrumentedMethod.getDeclaringType().asErasure()); + Set alreadyCheckedTypes = Collections.newSetFromMap(new IdentityHashMap()); + + while (!typesToCheck.isEmpty()) { + TypeDescription type = typesToCheck.poll(); + if (alreadyCheckedTypes.add(type)) { + MethodDescription method = findMethodWithSameSignature(type, instrumentedMethod); + if (method != null) { + AnnotationValue value = findValueOnMethod(method, annotationValueExtractor); + if (value != null) { + return value.resolve(); } } + + TypeDescription.Generic superClass = type.getSuperClass(); + if (superClass != null) { + typesToCheck.add(superClass.asErasure()); + } + for (TypeDescription.Generic interfaceType : type.getInterfaces()) { + typesToCheck.add(interfaceType.asErasure()); + } } + } - methodDescription = findInstrumentedMethodInSuperClass(methodDescription.getDeclaringType().getSuperClass(), instrumentedMethod); - } while (methodDescription != null); Class defaultValueProvider = annotationValueExtractor.defaultValueProvider(); try { return defaultValueProvider.getDeclaredConstructor().newInstance().getDefaultValue(); @@ -89,12 +106,8 @@ private Object getAnnotationValue(MethodDescription instrumentedMethod, Annotati } @Nullable - private MethodDescription findInstrumentedMethodInSuperClass(@Nullable TypeDescription.Generic superClass, MethodDescription instrumentedMethod) { - if (superClass == null) { - return null; - - } - for (MethodDescription declaredMethod : superClass.getDeclaredMethods()) { + private MethodDescription findMethodWithSameSignature(TypeDescription declaringType, MethodDescription instrumentedMethod) { + for (MethodDescription declaredMethod : declaringType.getDeclaredMethods()) { if (instrumentedMethod.getInternalName().equals(declaredMethod.getInternalName()) && instrumentedMethod.getParameters().asTypeList().asErasures().equals(declaredMethod.getParameters().asTypeList().asErasures())) { return declaredMethod; @@ -103,6 +116,21 @@ private MethodDescription findInstrumentedMethodInSuperClass(@Nullable TypeDescr return null; } + @Nullable + private static AnnotationValue findValueOnMethod(MethodDescription method, AnnotationValueExtractor valueExtractor) { + for (TypeDescription typeDescription : method.getDeclaredAnnotations().asTypeList()) { + if (named(valueExtractor.annotationClassName()).matches(typeDescription)) { + for (MethodDescription.InDefinedShape annotationMethod : typeDescription.getDeclaredMethods()) { + if (annotationMethod.getName().equals(valueExtractor.method())) { + return method.getDeclaredAnnotations().ofType(typeDescription).getValue(annotationMethod); + } + } + } + } + return null; + } + + @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) public @interface AnnotationValueExtractor { @@ -114,7 +142,8 @@ private MethodDescription findInstrumentedMethodInSuperClass(@Nullable TypeDescr } public interface DefaultValueProvider { - @Nullable Object getDefaultValue(); + @Nullable + Object getDefaultValue(); } public static class NullDefaultValueProvider implements DefaultValueProvider { diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java index 902fea1c74..3ad2468ab7 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java @@ -31,6 +31,11 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; @@ -94,6 +99,7 @@ void testClassWithoutAnnotations() { @TestInstance(TestInstance.Lifecycle.PER_CLASS) class EnabledPublicApiAnnotationInheritance { + @BeforeAll void beforeAll() { init(true); @@ -104,6 +110,13 @@ void afterAll() { reset(); } + private TestClassBase createTestClassInstance(Class testClass) + throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { + Constructor declaredConstructor = testClass.getDeclaredConstructor(); + declaredConstructor.setAccessible(true); + return declaredConstructor.newInstance(); + } + @Test void testClassWithAnnotations() { invokeApiMethods(new ClassWithAnnotations()); @@ -111,36 +124,43 @@ void testClassWithAnnotations() { assertThat(reporter.getSpans()).hasSize(1); } - @Test - void testInheritedCaptureTransaction() { - new ClassWithoutAnnotations().captureTransaction(); - checkTransaction("ClassWithoutAnnotations#captureTransaction"); + @ParameterizedTest + @ValueSource(classes = {ClassWithoutAnnotations.class, TransitiveClassWithoutAnnotations.class, InterfaceImplementor.class}) + void testInheritedCaptureTransaction(Class testClass) throws Exception { + TestClassBase instance = createTestClassInstance(testClass); + instance.captureTransaction(); + checkTransaction(testClass.getSimpleName() + "#captureTransaction"); } - @Test - void testInheritedCaptureSpan() { + + @ParameterizedTest + @ValueSource(classes = {ClassWithoutAnnotations.class, TransitiveClassWithoutAnnotations.class, InterfaceImplementor.class}) + void testInheritedCaptureSpan(Class testClass) throws Exception { + TestClassBase instance = createTestClassInstance(testClass); Transaction transaction = ElasticApm.startTransaction(); try (Scope scope = transaction.activate()) { - new ClassWithoutAnnotations().captureSpan(); + instance.captureSpan(); } transaction.end(); - checkSpan("ClassWithoutAnnotations#captureSpan"); + checkSpan(testClass.getSimpleName() + "#captureSpan"); } - @Test - void testInheritedTracedWithoutActiveTransaction() { - new ClassWithoutAnnotations().traced(); - checkTransaction("ClassWithoutAnnotations#traced"); + @ParameterizedTest + @ValueSource(classes = {ClassWithoutAnnotations.class, TransitiveClassWithoutAnnotations.class, InterfaceImplementor.class}) + void testInheritedTracedWithoutActiveTransaction(Class testClass) throws Exception { + createTestClassInstance(testClass).traced(); + checkTransaction(testClass.getSimpleName() + "#traced"); } - @Test - void testInheritedTracedWithActiveTransaction() { + @ParameterizedTest + @ValueSource(classes = {ClassWithoutAnnotations.class, TransitiveClassWithoutAnnotations.class, InterfaceImplementor.class}) + void testInheritedTracedWithActiveTransaction(Class testClass) throws Exception { Transaction transaction = ElasticApm.startTransaction(); try (Scope scope = transaction.activate()) { - new ClassWithoutAnnotations().traced(); + createTestClassInstance(testClass).traced(); } transaction.end(); - checkSpan("ClassWithoutAnnotations#traced"); + checkSpan(testClass.getSimpleName() + "#traced"); } private void checkTransaction(String name) { @@ -166,7 +186,16 @@ private void invokeApiMethods(ClassWithAnnotations classWithAnnotations) { classWithAnnotations.traced(); } - static class ClassWithAnnotations { + + abstract static class TestClassBase { + abstract void captureTransaction(); + + abstract void captureSpan(); + + abstract void traced(); + } + + static class ClassWithAnnotations extends TestClassBase { @CaptureTransaction void captureTransaction() { } @@ -193,4 +222,46 @@ void captureSpan() { void traced() { } } + + static class EmptyClass extends ClassWithAnnotations { + } + + static class TransitiveClassWithoutAnnotations extends EmptyClass { + @Override + void captureTransaction() { + } + + @Override + void captureSpan() { + } + + @Override + void traced() { + } + } + + interface InterfaceWithAnnotations { + @CaptureTransaction + void captureTransaction(); + + @CaptureSpan + void captureSpan(); + + @Traced + void traced(); + } + + static class InterfaceImplementor extends TestClassBase implements InterfaceWithAnnotations { + + public void captureTransaction() { + } + + public void captureSpan() { + } + + @Override + public void traced() { + } + } + } From c5ed2e1cb4d496c8f36afd1610ccbf48ced88f22 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:29:36 +0100 Subject: [PATCH 008/132] powershell no-logo (#3556) --- CHANGELOG.asciidoc | 1 + .../java/co/elastic/apm/agent/impl/metadata/SystemInfo.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 96e2ec1b21..c989a23500 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -44,6 +44,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [float] ===== Bug fixes * Avoid another case where we might touch application exceptions for `safe_exceptions` - {pull}3553[#3553] +* More robust hostname detection on Windows - {pull}3556[#3556] [[release-notes-1.48.0]] ==== 1.48.0 - 2024/03/05 diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java index baf8820d1b..68624213ef 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java @@ -188,7 +188,10 @@ static String fallbackHostnameDiscovery(boolean isWindows) { static String discoverHostnameThroughCommand(boolean isWindows, long timeoutMillis) { String hostname; if (isWindows) { - hostname = executeHostnameDiscoveryCommand(Arrays.asList("powershell.exe", "[System.Net.Dns]::GetHostEntry($env:computerName).HostName"), timeoutMillis); + List powershellCmd = Arrays.asList("powershell.exe", + "-NoLogo", "-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass", + "-Command", "[System.Net.Dns]::GetHostEntry($env:computerName).HostName"); + hostname = executeHostnameDiscoveryCommand(powershellCmd, timeoutMillis); if (hostname == null || hostname.isEmpty()) { hostname = executeHostnameDiscoveryCommand(Arrays.asList("cmd.exe", "/c", "hostname"), timeoutMillis); } From f45c74616f0c2d361f825f13e6beab97062b77c3 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Tue, 12 Mar 2024 10:02:33 +0100 Subject: [PATCH 009/132] security: add permissions block to workflows (#3531) --- .github/workflows/addToProject.yml | 3 +++ .github/workflows/labeler.yml | 5 +++++ .github/workflows/snapshot.yml | 3 +++ .github/workflows/test-reporter.yml | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/.github/workflows/addToProject.yml b/.github/workflows/addToProject.yml index 7f49a3a657..e7befea26f 100644 --- a/.github/workflows/addToProject.yml +++ b/.github/workflows/addToProject.yml @@ -3,6 +3,9 @@ on: issues: types: - opened, milestoned +permissions: + contents: read + jobs: add_to_project: if: github.event.issue && github.event.issue.milestone diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 36eb42ad80..809b6eda02 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -5,6 +5,11 @@ on: pull_request_target: types: [opened] +permissions: + contents: read + issues: write + pull-requests: write + jobs: triage: runs-on: ubuntu-latest diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 355e919c84..86d6353476 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -12,6 +12,9 @@ on: default: false type: boolean +permissions: + contents: read + jobs: deploy: name: Deploy diff --git a/.github/workflows/test-reporter.yml b/.github/workflows/test-reporter.yml index 57c29a50e1..dae96d5e09 100644 --- a/.github/workflows/test-reporter.yml +++ b/.github/workflows/test-reporter.yml @@ -8,6 +8,11 @@ on: types: - completed +permissions: + contents: read + actions: read + checks: write + jobs: report: runs-on: ubuntu-latest From dfa95191a210369c9c8b8eab8909cdd39079913a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 10:07:01 +0100 Subject: [PATCH 010/132] Bump io.micrometer:micrometer-core from 1.12.2 to 1.12.4 (#3559) Bumps [io.micrometer:micrometer-core](https://github.com/micrometer-metrics/micrometer) from 1.12.2 to 1.12.4. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.12.2...v1.12.4) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 1bf14f7a15..8ff7909d41 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -29,7 +29,7 @@ io.micrometer micrometer-core - 1.12.2 + 1.12.4 provided From d8ae52b96a21ece930624938882f5d447fcaf94d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 09:54:51 +0000 Subject: [PATCH 011/132] Bump version.log4j from 2.12.4 to 2.23.1 (#3557) * Bump version.log4j from 2.12.4 to 2.23.1 Bumps `version.log4j` from 2.12.4 to 2.23.1. Updates `org.apache.logging.log4j:log4j-core` from 2.12.4 to 2.23.1 Updates `org.apache.logging.log4j:log4j-slf4j-impl` from 2.12.4 to 2.23.1 --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-core dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.apache.logging.log4j:log4j-slf4j-impl dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * restore previous log4j version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- apm-agent-plugins/apm-ecs-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml index f261b19bc2..5644c1d34d 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml @@ -41,7 +41,7 @@ org.apache.logging.log4j log4j-core - 2.23.0 + 2.23.1 provided true diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml index a64a1a0f33..b5f08e2b67 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml @@ -24,7 +24,7 @@ org.apache.logging.log4j log4j-core - 2.23.0 + 2.23.1 provided From 464b9c134c9d74e2a482367e9c1e8a1a8e2ba97e Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Tue, 12 Mar 2024 14:32:41 +0100 Subject: [PATCH 012/132] Add API for instrumenting FAAS and adjust the AWS plugin (#3516) --------- Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- .../apm/agent/impl/ElasticApmTracer.java | 39 +++++++++++++- .../apm/agent/impl/context/Request.java | 8 +-- .../apm/agent/impl/context/Response.java | 7 ++- .../apm/agent/impl/context/ServiceOrigin.java | 5 +- .../impl/context/TransactionContext.java | 1 + .../apm/agent/impl/transaction/Faas.java | 7 ++- .../agent/impl/transaction/FaasTrigger.java | 4 +- .../apm-awslambda-plugin/pom.xml | 6 --- ...stractAwsLambdaHandlerInstrumentation.java | 4 +- .../RequestHandlerInstrumentation.java | 10 ++-- .../RequestStreamHandlerInstrumentation.java | 10 ++-- .../APIGatewayProxyV1TransactionHelper.java | 16 +++--- .../APIGatewayProxyV2TransactionHelper.java | 16 +++--- .../awslambda/helper/AWSEventsHelper.java | 6 +-- .../AbstractAPIGatewayTransactionHelper.java | 36 ++++++------- .../AbstractLambdaTransactionHelper.java | 54 +++++-------------- ...AbstractMessageBasedTransactionHelper.java | 20 +++---- .../helper/PlainTransactionHelper.java | 14 ++--- .../awslambda/helper/S3TransactionHelper.java | 24 ++++----- .../helper/SNSTransactionHelper.java | 10 ++-- .../helper/SQSTransactionHelper.java | 10 ++-- .../co/elastic/apm/agent/tracer/Faas.java | 36 +++++++++++++ .../elastic/apm/agent/tracer/FaasTrigger.java | 28 ++++++++++ .../apm/agent/tracer/GlobalTracer.java | 10 ++++ .../elastic/apm/agent/tracer/NoopTracer.java | 9 ++++ .../apm/agent/tracer/ServiceOrigin.java | 30 +++++++++++ .../co/elastic/apm/agent/tracer/Tracer.java | 4 ++ .../elastic/apm/agent/tracer/Transaction.java | 2 + .../apm/agent/tracer/TransactionContext.java | 2 + .../apm/agent/tracer/metadata/Request.java | 9 ++++ .../apm/agent/tracer/metadata/Response.java | 2 + 31 files changed, 288 insertions(+), 151 deletions(-) create mode 100644 apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Faas.java create mode 100644 apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/FaasTrigger.java create mode 100644 apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ServiceOrigin.java diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java index 6980d1812e..08cb977c59 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java @@ -18,7 +18,9 @@ */ package co.elastic.apm.agent.impl; +import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.bci.IndyBootstrap; +import co.elastic.apm.agent.bci.InstrumentationStats; import co.elastic.apm.agent.collections.WeakReferenceCountedMap; import co.elastic.apm.agent.common.JvmRuntimeInfo; import co.elastic.apm.agent.common.util.WildcardMatcher; @@ -27,7 +29,12 @@ import co.elastic.apm.agent.configuration.MetricsConfiguration; import co.elastic.apm.agent.configuration.ServerlessConfiguration; import co.elastic.apm.agent.impl.error.RedactedException; +import co.elastic.apm.agent.impl.metadata.FaaSMetaDataExtension; +import co.elastic.apm.agent.impl.metadata.Framework; +import co.elastic.apm.agent.impl.metadata.MetaDataFuture; +import co.elastic.apm.agent.impl.metadata.NameAndIdField; import co.elastic.apm.agent.impl.metadata.ServiceFactory; +import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.tracer.service.Service; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.configuration.SpanConfiguration; @@ -36,7 +43,6 @@ import co.elastic.apm.agent.impl.baggage.Baggage; import co.elastic.apm.agent.impl.baggage.W3CBaggagePropagation; import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.metadata.MetaDataFuture; import co.elastic.apm.agent.impl.sampling.ProbabilitySampler; import co.elastic.apm.agent.impl.sampling.Sampler; import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; @@ -83,6 +89,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; /** @@ -93,6 +100,7 @@ */ public class ElasticApmTracer implements Tracer { private static final Logger logger = LoggerFactory.getLogger(ElasticApmTracer.class); + private static final Logger enabledInstrumentationsLogger = LoggerUtils.logOnce(logger); private static final WeakMap serviceInfoByClassLoader = WeakConcurrent.buildMap(); @@ -1007,4 +1015,33 @@ public Throwable redactExceptionIfRequired(@Nullable Throwable original) { } return original; } + + @Override + public void flush() { + long flushTimeout = configurationRegistry.getConfig(ServerlessConfiguration.class).getDataFlushTimeout(); + try { + if (!reporter.flush(flushTimeout, TimeUnit.MILLISECONDS, true)) { + logger.error("APM data flush haven't completed within {} milliseconds.", flushTimeout); + } + } catch (Exception e) { + logger.error("An error occurred on flushing APM data.", e); + } + logEnabledInstrumentations(); + } + + private void logEnabledInstrumentations() { + if (enabledInstrumentationsLogger.isInfoEnabled()) { + InstrumentationStats instrumentationStats = ElasticApmAgent.getInstrumentationStats(); + enabledInstrumentationsLogger.info("Used instrumentation groups: {}", instrumentationStats.getUsedInstrumentationGroups()); + } + } + + @Override + public void completeMetaData(String name, String version, String id, String region) { + metaDataFuture.getFaaSMetaDataExtensionFuture().complete(new FaaSMetaDataExtension( + new Framework(name, version), + new NameAndIdField(null, id), + region + )); + } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java index 028882f4e6..a6d2694b4e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java @@ -175,13 +175,7 @@ public PotentiallyMultiValuedMap getFormUrlEncodedParameters() { return postParams; } - /** - * Adds a request header. - * - * @param headerName The name of the header. - * @param headerValue The value of the header. - * @return {@code this}, for fluent method chaining - */ + @Override public Request addHeader(String headerName, @Nullable String headerValue) { if (headerValue != null) { headers.add(headerName, headerValue); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java index 811f89293a..4a6ef90b99 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java @@ -60,8 +60,11 @@ public Response withFinished(boolean finished) { * @param headerValue The value of the header. * @return {@code this}, for fluent method chaining */ - public Response addHeader(String headerName, String headerValue) { - headers.add(headerName, headerValue); + @Override + public Response addHeader(String headerName, @Nullable String headerValue) { + if (headerValue != null) { + headers.add(headerName, headerValue); + } return this; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java index 9927f7b66e..5cdf69b407 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java @@ -28,7 +28,7 @@ * If a request originated from another service, * the service origin interface can be used to collect information about the origin service. */ -public class ServiceOrigin implements Recyclable { +public class ServiceOrigin implements co.elastic.apm.agent.tracer.ServiceOrigin, Recyclable { @Nullable private String id; @@ -43,6 +43,7 @@ public String getId() { return id; } + @Override public ServiceOrigin withId(@Nullable String id) { this.id = id; return this; @@ -52,6 +53,7 @@ public StringBuilder getName() { return name; } + @Override public ServiceOrigin withName(@Nullable CharSequence name) { this.name.setLength(0); if (name != null) { @@ -72,6 +74,7 @@ public String getVersion() { return version; } + @Override public ServiceOrigin withVersion(@Nullable String version) { this.version = version; return this; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java index c4c9ea756b..05df0e1015 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java @@ -118,6 +118,7 @@ public CloudOrigin getCloudOrigin() { return cloudOrigin; } + @Override public ServiceOrigin getServiceOrigin() { return serviceOrigin; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java index 9d7e73b5f8..1299184003 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java @@ -22,7 +22,7 @@ import javax.annotation.Nullable; -public class Faas implements Recyclable { +public class Faas implements co.elastic.apm.agent.tracer.Faas, Recyclable { @Nullable private String execution; @@ -68,26 +68,31 @@ public String getVersion() { return version; } + @Override public Faas withExecution(@Nullable String execution) { this.execution = execution; return this; } + @Override public Faas withColdStart(boolean coldStart) { this.coldStart = coldStart; return this; } + @Override public Faas withId(@Nullable String id) { this.id = id; return this; } + @Override public Faas withName(@Nullable String name) { this.name = name; return this; } + @Override public Faas withVersion(@Nullable String version) { this.version = version; return this; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java index 6d80601634..d3d3fb3775 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java @@ -22,7 +22,7 @@ import javax.annotation.Nullable; -public class FaasTrigger implements Recyclable { +public class FaasTrigger implements co.elastic.apm.agent.tracer.FaasTrigger, Recyclable { @Nullable private String type; @@ -40,11 +40,13 @@ public String getRequestId() { return requestId; } + @Override public FaasTrigger withType(@Nullable String type) { this.type = type; return this; } + @Override public FaasTrigger withRequestId(@Nullable String requestId) { this.requestId = requestId; return this; diff --git a/apm-agent-plugins/apm-awslambda-plugin/pom.xml b/apm-agent-plugins/apm-awslambda-plugin/pom.xml index 2fc9a49e39..f4819bbdeb 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/pom.xml +++ b/apm-agent-plugins/apm-awslambda-plugin/pom.xml @@ -17,12 +17,6 @@ - - - ${project.groupId} - apm-agent-core - ${project.version} - com.amazonaws aws-lambda-java-core diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/AbstractAwsLambdaHandlerInstrumentation.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/AbstractAwsLambdaHandlerInstrumentation.java index d447a53d40..a79ee7c37c 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/AbstractAwsLambdaHandlerInstrumentation.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/AbstractAwsLambdaHandlerInstrumentation.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.awslambda; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; @@ -41,7 +41,7 @@ public abstract class AbstractAwsLambdaHandlerInstrumentation extends ElasticApm @Nullable protected String handlerMethodName; - public AbstractAwsLambdaHandlerInstrumentation(ElasticApmTracer tracer) { + public AbstractAwsLambdaHandlerInstrumentation(Tracer tracer) { serverlessConfiguration = tracer.getConfig(ServerlessConfiguration.class); String awsLambdaHandler = serverlessConfiguration.getAwsLambdaHandler(); //noinspection ConstantConditions diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestHandlerInstrumentation.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestHandlerInstrumentation.java index 0d443b1316..a709840e7e 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestHandlerInstrumentation.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestHandlerInstrumentation.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.awslambda.helper.AWSEventsHelper; import co.elastic.apm.agent.awslambda.helper.PlainTransactionHelper; -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -35,7 +35,7 @@ public class RequestHandlerInstrumentation extends AbstractAwsLambdaHandlerInstrumentation { - public RequestHandlerInstrumentation(ElasticApmTracer tracer) { + public RequestHandlerInstrumentation(Tracer tracer) { super(tracer); } @@ -70,8 +70,8 @@ public static Object handlerEnter(@Nullable @Advice.Argument(value = 0) Object i public static void handlerExit(@Nullable @Advice.Enter Object transactionObj, @Nullable @Advice.Thrown Throwable thrown, @Nullable @Advice.Return Object output) { - if (transactionObj instanceof Transaction) { - Transaction transaction = (Transaction) transactionObj; + if (transactionObj instanceof Transaction) { + Transaction transaction = (Transaction) transactionObj; if (output != null && output.getClass().getName().startsWith("com.amazonaws.services.lambda.runtime.events")) { // handler uses aws events, it's safe to assume that the AWS events classes are available diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestStreamHandlerInstrumentation.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestStreamHandlerInstrumentation.java index a32e9a5246..e97fe84d19 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestStreamHandlerInstrumentation.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/RequestStreamHandlerInstrumentation.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.awslambda; import co.elastic.apm.agent.awslambda.helper.PlainTransactionHelper; -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -35,7 +35,7 @@ public class RequestStreamHandlerInstrumentation extends AbstractAwsLambdaHandlerInstrumentation { - public RequestStreamHandlerInstrumentation(ElasticApmTracer tracer) { + public RequestStreamHandlerInstrumentation(Tracer tracer) { super(tracer); } @@ -65,8 +65,8 @@ public static Object handlerEnter(@Advice.Argument(value = 0) InputStream inputS @Advice.OnMethodExit(suppress = Throwable.class, inline = false, onThrowable = Throwable.class) public static void handlerExit(@Nullable @Advice.Enter Object transactionObj, @Nullable @Advice.Thrown Throwable thrown) { - if (transactionObj instanceof Transaction) { - Transaction transaction = (Transaction) transactionObj; + if (transactionObj instanceof Transaction) { + Transaction transaction = (Transaction) transactionObj; PlainTransactionHelper.getInstance().finalizeTransaction(transaction, null, thrown); } } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java index d2d4589d9c..20cbe4c828 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.awslambda.helper; import co.elastic.apm.agent.awslambda.MapTextHeaderGetter; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; @@ -35,20 +35,20 @@ public class APIGatewayProxyV1TransactionHelper extends AbstractAPIGatewayTransa @Nullable private static APIGatewayProxyV1TransactionHelper INSTANCE; - private APIGatewayProxyV1TransactionHelper(ElasticApmTracer tracer) { + private APIGatewayProxyV1TransactionHelper(Tracer tracer) { super(tracer); } public static APIGatewayProxyV1TransactionHelper getInstance() { if (INSTANCE == null) { - INSTANCE = new APIGatewayProxyV1TransactionHelper(GlobalTracer.get().require(ElasticApmTracer.class)); + INSTANCE = new APIGatewayProxyV1TransactionHelper(GlobalTracer.get()); } return INSTANCE; } @Override - protected Transaction doStartTransaction(APIGatewayProxyRequestEvent apiGatewayEvent, Context lambdaContext) { - Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); + protected Transaction doStartTransaction(APIGatewayProxyRequestEvent apiGatewayEvent, Context lambdaContext) { + Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); String host = getHost(apiGatewayEvent); if (null != transaction) { @@ -92,7 +92,7 @@ private String getQueryString(APIGatewayProxyRequestEvent apiGatewayEvent) { } @Override - public void captureOutputForTransaction(Transaction transaction, APIGatewayProxyResponseEvent responseEvent) { + public void captureOutputForTransaction(Transaction transaction, APIGatewayProxyResponseEvent responseEvent) { Integer statusCode = responseEvent.getStatusCode(); if (statusCode == null) { statusCode = 0; @@ -101,7 +101,7 @@ public void captureOutputForTransaction(Transaction transaction, APIGatewayProxy } @Override - protected void setTransactionTriggerData(Transaction transaction, APIGatewayProxyRequestEvent apiGatewayRequest) { + protected void setTransactionTriggerData(Transaction transaction, APIGatewayProxyRequestEvent apiGatewayRequest) { super.setTransactionTriggerData(transaction, apiGatewayRequest); APIGatewayProxyRequestEvent.ProxyRequestContext rContext = apiGatewayRequest.getRequestContext(); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java index ec7ed0db69..db3edf620b 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.awslambda.helper; import co.elastic.apm.agent.awslambda.MapTextHeaderGetter; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse; @@ -33,20 +33,20 @@ public class APIGatewayProxyV2TransactionHelper extends AbstractAPIGatewayTransa @Nullable private static APIGatewayProxyV2TransactionHelper INSTANCE; - private APIGatewayProxyV2TransactionHelper(ElasticApmTracer tracer) { + private APIGatewayProxyV2TransactionHelper(Tracer tracer) { super(tracer); } public static APIGatewayProxyV2TransactionHelper getInstance() { if (INSTANCE == null) { - INSTANCE = new APIGatewayProxyV2TransactionHelper(GlobalTracer.get().require(ElasticApmTracer.class)); + INSTANCE = new APIGatewayProxyV2TransactionHelper(GlobalTracer.get()); } return INSTANCE; } @Override - protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, Context lambdaContext) { - Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); + protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, Context lambdaContext) { + Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); APIGatewayV2HTTPEvent.RequestContext requestContext = apiGatewayEvent.getRequestContext(); if (transaction != null) { @@ -60,12 +60,12 @@ protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, } @Override - public void captureOutputForTransaction(Transaction transaction, APIGatewayV2HTTPResponse responseEvent) { + public void captureOutputForTransaction(Transaction transaction, APIGatewayV2HTTPResponse responseEvent) { fillHttpResponseData(transaction, responseEvent.getHeaders(), responseEvent.getStatusCode()); } @Override - protected void setTransactionTriggerData(Transaction transaction, APIGatewayV2HTTPEvent apiGatewayRequest) { + protected void setTransactionTriggerData(Transaction transaction, APIGatewayV2HTTPEvent apiGatewayRequest) { super.setTransactionTriggerData(transaction, apiGatewayRequest); APIGatewayV2HTTPEvent.RequestContext rContext = apiGatewayRequest.getRequestContext(); setApiGatewayContextData(transaction, rContext.getRequestId(), rContext.getApiId(), diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java index 9ec285ad99..b72c423c79 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.awslambda.helper; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; @@ -33,7 +33,7 @@ public class AWSEventsHelper { @Nullable - public static Transaction startTransaction(Object input, Context lambdaContext) { + public static Transaction startTransaction(Object input, Context lambdaContext) { if (input instanceof APIGatewayV2HTTPEvent && ((APIGatewayV2HTTPEvent) input).getRequestContext() != null && ((APIGatewayV2HTTPEvent) input).getRequestContext().getHttp() != null) { // API Gateway V2 trigger @@ -54,7 +54,7 @@ public static Transaction startTransaction(Object input, Context lambdaContext) return PlainTransactionHelper.getInstance().startTransaction(input, lambdaContext); } - public static void finalizeTransaction(Transaction transaction, Object output, @Nullable Throwable thrown) { + public static void finalizeTransaction(Transaction transaction, Object output, @Nullable Throwable thrown) { if (output instanceof APIGatewayV2HTTPResponse) { APIGatewayProxyV2TransactionHelper.getInstance().finalizeTransaction(transaction, (APIGatewayV2HTTPResponse) output, thrown); } else if (output instanceof APIGatewayProxyResponseEvent) { diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java index 72c1d0eecb..b30ba86151 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.awslambda.helper; -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.context.CloudOrigin; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.ServiceOrigin; +import co.elastic.apm.agent.tracer.ServiceOrigin; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; +import co.elastic.apm.agent.tracer.metadata.CloudOrigin; +import co.elastic.apm.agent.tracer.metadata.Request; +import co.elastic.apm.agent.tracer.metadata.Response; import co.elastic.apm.agent.tracer.util.ResultUtil; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -47,13 +47,13 @@ public abstract class AbstractAPIGatewayTransactionHelper extends Abstract private static final Set METHODS_WITH_BODY = new HashSet<>(Arrays.asList("POST", "PUT", "PATCH", "DELETE")); private static final String CONTENT_TYPE_FROM_URLENCODED = "application/x-www-form-urlencoded"; - protected AbstractAPIGatewayTransactionHelper(ElasticApmTracer tracer) { + protected AbstractAPIGatewayTransactionHelper(Tracer tracer) { super(tracer); } protected abstract String getApiGatewayVersion(); - protected void fillHttpRequestData(Transaction transaction, @Nullable String httpMethod, @Nullable Map headers, @Nullable String serverName, @Nullable String path, @Nullable String queryString, @Nullable String body) { + protected void fillHttpRequestData(Transaction transaction, @Nullable String httpMethod, @Nullable Map headers, @Nullable String serverName, @Nullable String path, @Nullable String queryString, @Nullable String body) { Request request = transaction.getContext().getRequest(); request.withMethod(httpMethod); fillUrlRelatedFields(request, serverName, path, queryString); @@ -67,7 +67,7 @@ protected void fillHttpRequestData(Transaction transaction, @Nullable String htt } } - protected void fillHttpResponseData(Transaction transaction, @Nullable Map headers, int statusCode) { + protected void fillHttpResponseData(Transaction transaction, @Nullable Map headers, int statusCode) { Response response = transaction.getContext().getResponse(); response.withFinished(true); if (transaction.isSampled() && null != headers && isCaptureHeaders()) { @@ -82,17 +82,11 @@ protected void fillHttpResponseData(Transaction transaction, @Nullable Map transaction, @Nullable String method, @Nullable String contentTypeHeader) { Request request = transaction.getContext().getRequest(); if (hasBody(contentTypeHeader, method)) { if (coreConfiguration.getCaptureBody() != OFF @@ -127,7 +121,7 @@ private boolean hasBody(@Nullable String contentTypeHeader, @Nullable String met } @Override - protected void setTransactionTriggerData(Transaction transaction, I apiGatewayRequest) { + protected void setTransactionTriggerData(Transaction transaction, I apiGatewayRequest) { transaction.withType(TRANSACTION_TYPE); CloudOrigin cloudOrigin = transaction.getContext().getCloudOrigin(); cloudOrigin.withServiceName("api gateway"); @@ -136,7 +130,7 @@ protected void setTransactionTriggerData(Transaction transaction, I apiGatewayRe transaction.getContext().getServiceOrigin().withVersion(getApiGatewayVersion()); } - protected void setApiGatewayContextData(Transaction transaction, @Nullable String requestId, @Nullable String apiId, + protected void setApiGatewayContextData(Transaction transaction, @Nullable String requestId, @Nullable String apiId, @Nullable String domainName, @Nullable String accountId) { transaction.getFaas().getTrigger().withRequestId(requestId); ServiceOrigin serviceOrigin = transaction.getContext().getServiceOrigin(); @@ -146,7 +140,7 @@ protected void setApiGatewayContextData(Transaction transaction, @Nullable Strin transaction.getContext().getCloudOrigin().withAccountId(accountId); } - private void setRequestHeaders(Transaction transaction, Map headers) { + private void setRequestHeaders(Transaction transaction, Map headers) { final Request req = transaction.getContext().getRequest(); if (transaction.isSampled() && isCaptureHeaders()) { for (Map.Entry headerEntry : headers.entrySet()) { @@ -156,7 +150,7 @@ private void setRequestHeaders(Transaction transaction, Map head } @Override - protected void setTransactionName(Transaction transaction, I event, Context lambdaContext) { + protected void setTransactionName(Transaction transaction, I event, Context lambdaContext) { StringBuilder transactionName = transaction.getAndOverrideName(AbstractSpan.PRIORITY_HIGH_LEVEL_FRAMEWORK); if (transactionName != null) { String httpMethod = getHttpMethod(event); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractLambdaTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractLambdaTransactionHelper.java index 8c61317ce1..2763e7423b 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractLambdaTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractLambdaTransactionHelper.java @@ -18,50 +18,42 @@ */ package co.elastic.apm.agent.awslambda.helper; -import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.bci.InstrumentationStats; -import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import co.elastic.apm.agent.tracer.configuration.CoreConfiguration; import co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.metadata.FaaSMetaDataExtension; -import co.elastic.apm.agent.impl.metadata.Framework; -import co.elastic.apm.agent.impl.metadata.NameAndIdField; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.sdk.internal.util.VersionUtils; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import javax.annotation.Nullable; -import java.util.concurrent.TimeUnit; public abstract class AbstractLambdaTransactionHelper { private static final Logger logger = LoggerFactory.getLogger(AbstractLambdaTransactionHelper.class); - private static final Logger enabledInstrumentationsLogger = LoggerUtils.logOnce(logger); - protected final ElasticApmTracer tracer; + protected final Tracer tracer; protected final ServerlessConfiguration serverlessConfiguration; protected final CoreConfiguration coreConfiguration; protected final WebConfiguration webConfiguration; - protected AbstractLambdaTransactionHelper(ElasticApmTracer tracer) { + protected AbstractLambdaTransactionHelper(Tracer tracer) { this.tracer = tracer; this.coreConfiguration = tracer.getConfig(CoreConfiguration.class); this.webConfiguration = tracer.getConfig(WebConfiguration.class); this.serverlessConfiguration = tracer.getConfig(ServerlessConfiguration.class); } - protected abstract void setTransactionTriggerData(Transaction transaction, I input); + protected abstract void setTransactionTriggerData(Transaction transaction, I input); @Nullable - protected abstract Transaction doStartTransaction(I input, Context lambdaContext); + protected abstract Transaction doStartTransaction(I input, Context lambdaContext); - protected abstract void captureOutputForTransaction(Transaction transaction, O output); + protected abstract void captureOutputForTransaction(Transaction transaction, O output); private static boolean coldStart = true; @@ -69,13 +61,13 @@ protected AbstractLambdaTransactionHelper(ElasticApmTracer tracer) { private String functionArn; @Nullable - public Transaction startTransaction(I input, Context lambdaContext) { + public Transaction startTransaction(I input, Context lambdaContext) { boolean isColdStart = coldStart; if (isColdStart) { completeMetaData(lambdaContext); coldStart = false; } - Transaction transaction = doStartTransaction(input, lambdaContext); + Transaction transaction = doStartTransaction(input, lambdaContext); if (null != transaction) { transaction.getFaas() .withId(getFaasId(lambdaContext)) @@ -104,7 +96,7 @@ private String getFaasId(Context lambdaContext) { return functionArn; } - public void finalizeTransaction(Transaction transaction, @Nullable O output, @Nullable Throwable thrown) { + public void finalizeTransaction(Transaction transaction, @Nullable O output, @Nullable Throwable thrown) { try { if (null != output) { captureOutputForTransaction(transaction, output); @@ -118,23 +110,7 @@ public void finalizeTransaction(Transaction transaction, @Nullable O output, @Nu } finally { transaction.deactivate().end(); } - long flushTimeout = serverlessConfiguration.getDataFlushTimeout(); - try { - if (!tracer.getReporter().flush(flushTimeout, TimeUnit.MILLISECONDS, true)) { - logger.error("APM data flush haven't completed within {} milliseconds.", flushTimeout); - } - } catch (Exception e) { - logger.error("An error occurred on flushing APM data.", e); - } - - logEnabledInstrumentations(); - } - - private void logEnabledInstrumentations() { - if (enabledInstrumentationsLogger.isInfoEnabled()) { - InstrumentationStats instrumentationStats = ElasticApmAgent.getInstrumentationStats(); - enabledInstrumentationsLogger.info("Used instrumentation groups: {}", instrumentationStats.getUsedInstrumentationGroups()); - } + tracer.flush(); } private void completeMetaData(Context lambdaContext) { @@ -149,17 +125,13 @@ private void completeMetaData(Context lambdaContext) { lambdaLibVersion = "unknown"; } - tracer.getMetaDataFuture().getFaaSMetaDataExtensionFuture().complete(new FaaSMetaDataExtension( - new Framework("AWS Lambda", lambdaLibVersion), - new NameAndIdField(null, accountId), - region - )); + tracer.completeMetaData("AWS Lambda", lambdaLibVersion, accountId, region); } catch (Exception e) { logger.error("Failed updating metadata for first lambda execution!", e); } } - protected void setTransactionName(Transaction transaction, I event, Context lambdaContext) { + protected void setTransactionName(Transaction transaction, I event, Context lambdaContext) { StringBuilder transactionName = transaction.getAndOverrideName(AbstractSpan.PRIORITY_HIGH_LEVEL_FRAMEWORK); if (transactionName != null) { transactionName.append(lambdaContext.getFunctionName()); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractMessageBasedTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractMessageBasedTransactionHelper.java index 328d88febf..68071da7bc 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractMessageBasedTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractMessageBasedTransactionHelper.java @@ -18,12 +18,12 @@ */ package co.elastic.apm.agent.awslambda.helper; -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.context.CloudOrigin; -import co.elastic.apm.agent.impl.context.ServiceOrigin; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.ServiceOrigin; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; +import co.elastic.apm.agent.tracer.metadata.CloudOrigin; import com.amazonaws.services.lambda.runtime.Context; import javax.annotation.Nullable; @@ -31,7 +31,7 @@ public abstract class AbstractMessageBasedTransactionHelper extends AbstractLambdaTransactionHelper { protected static final String TRANSACTION_TYPE = "messaging"; - protected AbstractMessageBasedTransactionHelper(ElasticApmTracer tracer) { + protected AbstractMessageBasedTransactionHelper(Tracer tracer) { super(tracer); } @@ -50,23 +50,23 @@ protected AbstractMessageBasedTransactionHelper(ElasticApmTracer tracer) { @Nullable @Override - protected Transaction doStartTransaction(I event, Context lambdaContext) { - Transaction transaction = tracer.startRootTransaction(PrivilegedActionUtils.getClassLoader(lambdaContext.getClass())); + protected Transaction doStartTransaction(I event, Context lambdaContext) { + Transaction transaction = tracer.startRootTransaction(PrivilegedActionUtils.getClassLoader(lambdaContext.getClass())); if (null != transaction) { addSpanLinks(transaction, event); } return transaction; } - protected abstract void addSpanLinks(Transaction transaction, I event); + protected abstract void addSpanLinks(Transaction transaction, I event); @Override - public void captureOutputForTransaction(Transaction transaction, O output) { + public void captureOutputForTransaction(Transaction transaction, O output) { // Nothing to do here } @Override - protected void setTransactionTriggerData(Transaction transaction, I event) { + protected void setTransactionTriggerData(Transaction transaction, I event) { R record = getFirstRecord(event); transaction.withType(TRANSACTION_TYPE); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/PlainTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/PlainTransactionHelper.java index d86880d0f4..a0453ad866 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/PlainTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/PlainTransactionHelper.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.awslambda.helper; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; import javax.annotation.Nullable; @@ -33,29 +33,29 @@ public class PlainTransactionHelper extends AbstractLambdaTransactionHelper doStartTransaction(Object input, Context lambdaContext) { return tracer.startRootTransaction(PrivilegedActionUtils.getClassLoader(lambdaContext.getClass())); } @Override - public void captureOutputForTransaction(Transaction transaction, Object output) { + public void captureOutputForTransaction(Transaction transaction, Object output) { // Nothing to do here } @Override - protected void setTransactionTriggerData(Transaction transaction, Object input) { + protected void setTransactionTriggerData(Transaction transaction, Object input) { transaction.getFaas().getTrigger().withType("other"); transaction.withType(TRANSACTION_TYPE); } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java index e2203a665d..ac00d9ef54 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java @@ -18,14 +18,14 @@ */ package co.elastic.apm.agent.awslambda.helper; -import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.tracer.AbstractSpan; +import co.elastic.apm.agent.tracer.FaasTrigger; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.context.CloudOrigin; -import co.elastic.apm.agent.impl.context.ServiceOrigin; -import co.elastic.apm.agent.impl.transaction.FaasTrigger; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.ServiceOrigin; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; +import co.elastic.apm.agent.tracer.metadata.CloudOrigin; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.events.S3Event; import com.amazonaws.services.lambda.runtime.events.models.s3.S3EventNotification; @@ -38,13 +38,13 @@ public class S3TransactionHelper extends AbstractLambdaTransactionHelper doStartTransaction(S3Event s3Event, Context lambdaContext) { return tracer.startRootTransaction(PrivilegedActionUtils.getClassLoader(lambdaContext.getClass())); } @Override - public void captureOutputForTransaction(Transaction transaction, Void output) { + public void captureOutputForTransaction(Transaction transaction, Void output) { // Nothing to do here } @Override - protected void setTransactionTriggerData(Transaction transaction, S3Event s3Event) { + protected void setTransactionTriggerData(Transaction transaction, S3Event s3Event) { transaction.withType(TRANSACTION_TYPE); FaasTrigger faasTrigger = transaction.getFaas().getTrigger(); @@ -97,7 +97,7 @@ protected void setTransactionTriggerData(Transaction transaction, S3Event s3Even } @Override - protected void setTransactionName(Transaction transaction, S3Event s3Event, Context lambdaContext) { + protected void setTransactionName(Transaction transaction, S3Event s3Event, Context lambdaContext) { S3EventNotification.S3EventNotificationRecord s3NotificationRecord = getS3NotificationRecord(s3Event); StringBuilder transactionName = transaction.getAndOverrideName(AbstractSpan.PRIORITY_HIGH_LEVEL_FRAMEWORK); if (transactionName != null && null != s3NotificationRecord && null != s3NotificationRecord.getS3() && null != s3NotificationRecord.getS3().getBucket()) { diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SNSTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SNSTransactionHelper.java index ed635f00e4..9e3425837b 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SNSTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SNSTransactionHelper.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.awslambda.helper; import co.elastic.apm.agent.awslambda.SNSMessageAttributesGetter; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.events.SNSEvent; import javax.annotation.Nullable; @@ -33,13 +33,13 @@ public class SNSTransactionHelper extends AbstractMessageBasedTransactionHelper< private final SNSEvent.SNSRecord placeholderRecord = new SNSEvent.SNSRecord(); - private SNSTransactionHelper(ElasticApmTracer tracer) { + private SNSTransactionHelper(Tracer tracer) { super(tracer); } public static SNSTransactionHelper getInstance() { if (INSTANCE == null) { - INSTANCE = new SNSTransactionHelper(GlobalTracer.get().require(ElasticApmTracer.class)); + INSTANCE = new SNSTransactionHelper(GlobalTracer.get()); } return INSTANCE; } @@ -78,7 +78,7 @@ record = event.getRecords().get(0); } @Override - protected void addSpanLinks(Transaction transaction, SNSEvent event) { + protected void addSpanLinks(Transaction transaction, SNSEvent event) { List records = event.getRecords(); if (records != null && !records.isEmpty()) { for (SNSEvent.SNSRecord record : records) { diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SQSTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SQSTransactionHelper.java index 218506a463..6f6ba9e807 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SQSTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/SQSTransactionHelper.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.awslambda.helper; import co.elastic.apm.agent.awslambda.SQSMessageAttributesGetter; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.events.SQSEvent; import javax.annotation.Nullable; @@ -34,13 +34,13 @@ public class SQSTransactionHelper extends AbstractMessageBasedTransactionHelper< private final SQSEvent.SQSMessage placeholderMessage = new SQSEvent.SQSMessage(); - private SQSTransactionHelper(ElasticApmTracer tracer) { + private SQSTransactionHelper(Tracer tracer) { super(tracer); } public static SQSTransactionHelper getInstance() { if (INSTANCE == null) { - INSTANCE = new SQSTransactionHelper(GlobalTracer.get().require(ElasticApmTracer.class)); + INSTANCE = new SQSTransactionHelper(GlobalTracer.get()); } return INSTANCE; } @@ -76,7 +76,7 @@ record = event.getRecords().get(0); } @Override - protected void addSpanLinks(Transaction transaction, SQSEvent event) { + protected void addSpanLinks(Transaction transaction, SQSEvent event) { List records = event.getRecords(); if (records != null && !records.isEmpty()) { for (SQSEvent.SQSMessage record : records) { diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Faas.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Faas.java new file mode 100644 index 0000000000..678c02b6ea --- /dev/null +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Faas.java @@ -0,0 +1,36 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.tracer; + +import javax.annotation.Nullable; + +public interface Faas { + + FaasTrigger getTrigger(); + + Faas withId(@Nullable String id); + + Faas withName(@Nullable String name); + + Faas withVersion(@Nullable String version); + + Faas withExecution(@Nullable String execution); + + Faas withColdStart(boolean coldStart); +} diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/FaasTrigger.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/FaasTrigger.java new file mode 100644 index 0000000000..72fd88913e --- /dev/null +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/FaasTrigger.java @@ -0,0 +1,28 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.tracer; + +import javax.annotation.Nullable; + +public interface FaasTrigger { + + FaasTrigger withType(@Nullable String type); + + FaasTrigger withRequestId(@Nullable String requestId); +} diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java index 449622326e..9cae3d1b20 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java @@ -156,4 +156,14 @@ public Service createService(String ephemeralId) { public Throwable redactExceptionIfRequired(@Nullable Throwable original) { return tracer.redactExceptionIfRequired(original); } + + @Override + public void flush() { + tracer.flush(); + } + + @Override + public void completeMetaData(String name, String version, String id, String region) { + tracer.completeMetaData(name, version, id, region); + } } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java index 5ee5d8a652..ac1610f99d 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java @@ -25,6 +25,7 @@ import co.elastic.apm.agent.tracer.service.Service; import javax.annotation.Nullable; +import java.io.IOException; import java.util.Collections; import java.util.Set; @@ -131,4 +132,12 @@ public Service createService(String ephemeralId) { public Throwable redactExceptionIfRequired(@Nullable Throwable original) { return original; } + + @Override + public void flush() { + } + + @Override + public void completeMetaData(String name, String version, String id, String region) { + } } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ServiceOrigin.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ServiceOrigin.java new file mode 100644 index 0000000000..9159bb29b5 --- /dev/null +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ServiceOrigin.java @@ -0,0 +1,30 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.tracer; + +import javax.annotation.Nullable; + +public interface ServiceOrigin { + + ServiceOrigin withVersion(@Nullable String version); + + ServiceOrigin withName(@Nullable CharSequence name); + + ServiceOrigin withId(@Nullable String id); +} diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java index 1cd0529de8..666ea4fca6 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java @@ -91,4 +91,8 @@ public interface Tracer { @Nullable Throwable redactExceptionIfRequired(@Nullable Throwable original); + + void flush(); + + void completeMetaData(String name, String version, String id, String region); } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Transaction.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Transaction.java index 1f6ade713c..aec2fafaba 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Transaction.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Transaction.java @@ -57,6 +57,8 @@ public interface Transaction> extends AbstractSpan { void setFrameworkVersion(@Nullable String frameworkVersion); + Faas getFaas(); + void setPendingTransactionException(Throwable exception); @Nullable diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TransactionContext.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TransactionContext.java index baafaacb96..d1800dd91c 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TransactionContext.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TransactionContext.java @@ -43,4 +43,6 @@ public interface TransactionContext extends AbstractContext { User getUser(); CloudOrigin getCloudOrigin(); + + ServiceOrigin getServiceOrigin(); } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Request.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Request.java index fe8afd2f5f..46ac03f623 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Request.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Request.java @@ -75,6 +75,15 @@ public interface Request { Request addFormUrlEncodedParameters(String key, String[] values); + /** + * Adds a request header. + * + * @param headerName The name of the header. + * @param headerValue The value of the header. + * @return {@code this}, for fluent method chaining + */ + Request addHeader(String headerName, @Nullable String headerValue); + Request addHeader(String headerName, @Nullable Enumeration headerValues); Request addCookie(String cookieName, String cookieValue); diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Response.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Response.java index e87a517a8a..43a4457dab 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Response.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Response.java @@ -40,5 +40,7 @@ public interface Response { Response withHeadersSent(boolean headersSent); + Response addHeader(String headerName, @Nullable String headerValue); + Response addHeader(String headerName, @Nullable Collection headerValues); } From 4858631fb5ddc91569eb31101304c03e52b56c61 Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Tue, 12 Mar 2024 22:20:38 +0100 Subject: [PATCH 013/132] Introduce API for metrics collection that does not depend on agent-core (#3522) * Remove logging API. * Clean up core dependencies from POMs that do not need it. * Add API for handling lambda instrumentation and apply to the AWS plugin. * Move metrics API to tracer. * Factor out JSON DSL for metrics. * Fix import issue. * Fix imports. * Fix imports. * fix formatting --------- Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- apm-agent-core/pom.xml | 5 - ...InstrumentationStatsLifecycleListener.java | 6 +- .../apm/agent/collections/WeakMapCleaner.java | 6 +- .../ApmServerConfigurationSource.java | 9 +- .../apm/agent/configuration/StartupInfo.java | 7 +- .../ClosableLifecycleListenerAdapter.java | 9 +- .../apm/agent/impl/ElasticApmTracer.java | 35 ++++- .../agent/impl/ElasticApmTracerBuilder.java | 2 +- .../impl/circuitbreaker/CircuitBreaker.java | 9 +- .../impl/circuitbreaker/GCStressMonitor.java | 3 +- .../impl/circuitbreaker/StressMonitor.java | 4 +- .../SystemCpuStressMonitor.java | 4 +- .../agent/impl/transaction/Transaction.java | 2 +- .../agent/logging/ApmServerLogAppender.java | 9 +- .../apm/agent/metrics/MetricCollector.java | 2 + .../apm/agent/metrics/MetricRegistry.java | 2 + .../elastic/apm/agent/metrics/MetricSet.java | 2 + .../metrics/builtin/AgentOverheadMetrics.java | 9 +- .../metrics/builtin/AgentReporterMetrics.java | 2 +- .../agent/metrics/builtin/CGroupMetrics.java | 11 +- .../agent/metrics/builtin/JvmFdMetrics.java | 11 +- .../agent/metrics/builtin/JvmGcMetrics.java | 11 +- .../metrics/builtin/JvmMemoryMetrics.java | 11 +- .../agent/metrics/builtin/SystemMetrics.java | 11 +- .../agent/metrics/builtin/ThreadMetrics.java | 11 +- .../report/serialize/DslJsonSerializer.java | 148 +++++++----------- .../serialize/MetricRegistryReporter.java | 11 +- .../serialize/MetricRegistrySerializer.java | 9 +- .../serialize/SerializationConstants.java | 3 +- ...lastic.apm.agent.tracer.LifecycleListener} | 0 .../apm/agent/impl/ElasticApmTracerTest.java | 2 +- .../elastic/apm/agent/impl/LifecycleTest.java | 10 +- .../apm/agent/impl/SpanTypeBreakdownTest.java | 2 +- .../apm/agent/metrics/MetricRegistryTest.java | 2 + .../builtin/AgentOverheadMetricsTest.java | 2 +- .../builtin/AgentReporterMetricsTest.java | 2 +- .../metrics/builtin/CGroupMetricsTest.java | 2 +- .../metrics/builtin/JvmFdMetricsTest.java | 2 +- .../metrics/builtin/JvmMemoryMetricsTest.java | 2 +- .../metrics/builtin/SystemMetricsTest.java | 2 +- .../metrics/builtin/ThreadMetricsTest.java | 2 +- .../serialize/MetricSetSerializationTest.java | 2 +- ...lastic.apm.agent.tracer.LifecycleListener} | 0 apm-agent-plugins/apm-jmx-plugin/pom.xml | 9 -- .../co/elastic/apm/agent/jmx/JmxMetric.java | 3 +- .../apm/agent/jmx/JmxMetricTracker.java | 35 ++--- ...lastic.apm.agent.tracer.LifecycleListener} | 0 .../apm/agent/jmx/JmxMetricTrackerTest.java | 2 +- .../apm-micrometer-plugin/pom.xml | 6 - .../AbstractMicrometerInstrumentation.java | 3 +- .../MicrometerMeterRegistrySerializer.java | 16 +- .../micrometer/MicrometerMetricsReporter.java | 20 +-- .../embeddedotel/EmbeddedSdkManager.java | 8 +- ...lastic.apm.agent.tracer.LifecycleListener} | 0 .../otelmetricsdk/MetricSetSerializer.java | 12 +- .../apm/agent/profiler/ProfilingFactory.java | 8 +- .../apm/agent/profiler/SamplingProfiler.java | 5 +- ...lastic.apm.agent.tracer.LifecycleListener} | 0 apm-agent-tracer/pom.xml | 5 + .../tracer}/AbstractLifecycleListener.java | 8 +- .../apm/agent/tracer/GlobalTracer.java | 35 +++++ .../apm/agent/tracer}/LifecycleListener.java | 36 ++--- .../elastic/apm/agent/tracer/NoopTracer.java | 29 +++- .../co/elastic/apm/agent/tracer/Tracer.java | 16 ++ .../agent/tracer}/metrics/DoubleSupplier.java | 2 +- .../apm/agent/tracer/metrics/DslJsonUtil.java | 80 ++++++++++ .../apm/agent/tracer}/metrics/Labels.java | 6 +- .../apm/agent/tracer}/metrics/LabelsTest.java | 2 +- 68 files changed, 444 insertions(+), 298 deletions(-) rename apm-agent-core/src/main/resources/META-INF/services/{co.elastic.apm.agent.context.LifecycleListener => co.elastic.apm.agent.tracer.LifecycleListener} (100%) rename apm-agent-core/src/test/resources/META-INF/services/{co.elastic.apm.agent.context.LifecycleListener => co.elastic.apm.agent.tracer.LifecycleListener} (100%) rename apm-agent-plugins/apm-jmx-plugin/src/main/resources/META-INF/services/{co.elastic.apm.agent.context.LifecycleListener => co.elastic.apm.agent.tracer.LifecycleListener} (100%) rename apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/resources/META-INF/services/{co.elastic.apm.agent.context.LifecycleListener => co.elastic.apm.agent.tracer.LifecycleListener} (100%) rename apm-agent-plugins/apm-profiling-plugin/src/main/resources/META-INF/services/{co.elastic.apm.agent.context.LifecycleListener => co.elastic.apm.agent.tracer.LifecycleListener} (100%) rename {apm-agent-core/src/main/java/co/elastic/apm/agent/context => apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer}/AbstractLifecycleListener.java (83%) rename {apm-agent-core/src/main/java/co/elastic/apm/agent/context => apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer}/LifecycleListener.java (74%) rename {apm-agent-core/src/main/java/co/elastic/apm/agent => apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer}/metrics/DoubleSupplier.java (94%) create mode 100644 apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DslJsonUtil.java rename {apm-agent-core/src/main/java/co/elastic/apm/agent => apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer}/metrics/Labels.java (98%) rename {apm-agent-core/src/test/java/co/elastic/apm/agent => apm-agent-tracer/src/test/java/co/elastic/apm/agent/tracer}/metrics/LabelsTest.java (99%) diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index 52c81eda23..a3ed72483d 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -149,11 +149,6 @@ ${version.jetty-server} test - - com.dslplatform - dsl-json - 1.9.3 - commons-math diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/InstrumentationStatsLifecycleListener.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/InstrumentationStatsLifecycleListener.java index a7f096ad59..c16d18c80d 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/InstrumentationStatsLifecycleListener.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/InstrumentationStatsLifecycleListener.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.bci; import co.elastic.apm.agent.bci.bytebuddy.MatcherTimer; -import co.elastic.apm.agent.context.AbstractLifecycleListener; -import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Tracer; import java.util.ArrayList; import java.util.Collections; @@ -31,7 +31,7 @@ public class InstrumentationStatsLifecycleListener extends AbstractLifecycleList private static final Logger logger = LoggerFactory.getLogger(InstrumentationStatsLifecycleListener.class); @Override - public void init(ElasticApmTracer tracer) { + public void init(Tracer tracer) { InstrumentationStats instrumentationStats = ElasticApmAgent.getInstrumentationStats(); instrumentationStats.reset(); instrumentationStats.setMeasureMatching(logger.isDebugEnabled()); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/collections/WeakMapCleaner.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/collections/WeakMapCleaner.java index 3755d8b26b..be6ea5fd98 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/collections/WeakMapCleaner.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/collections/WeakMapCleaner.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.collections; -import co.elastic.apm.agent.context.AbstractLifecycleListener; -import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.util.ExecutorUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -41,7 +41,7 @@ public WeakMapCleaner() { } @Override - public void start(ElasticApmTracer tracer) { + public void start(Tracer tracer) { scheduler.scheduleWithFixedDelay(this, 1, 1, TimeUnit.SECONDS); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java index 662810e4b7..0f63ac2d0c 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java @@ -18,12 +18,13 @@ */ package co.elastic.apm.agent.configuration; -import co.elastic.apm.agent.context.LifecycleListener; +import co.elastic.apm.agent.tracer.LifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.util.ExecutorUtils; import com.dslplatform.json.DslJson; import com.dslplatform.json.JsonReader; @@ -111,17 +112,17 @@ public void reload() { } @Override - public void init(ElasticApmTracer tracer) throws Exception { + public void init(Tracer tracer) throws Exception { // noop } @Override - public void start(final ElasticApmTracer tracer) { + public void start(final Tracer tracer) { threadPool = ExecutorUtils.createSingleThreadDaemonPool("remote-config-poller", 1); threadPool.execute(new Runnable() { @Override public void run() { - pollConfig(tracer.getConfigurationRegistry()); + pollConfig(tracer.require(ElasticApmTracer.class).getConfigurationRegistry()); } }); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java index f75d4807ab..4de8761af2 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java @@ -18,8 +18,9 @@ */ package co.elastic.apm.agent.configuration; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.configuration.TimeDuration; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; import co.elastic.apm.agent.util.VersionUtils; @@ -56,8 +57,8 @@ private static String getJvmAndOsVersionString() { } @Override - public void init(ElasticApmTracer tracer) { - ConfigurationRegistry configurationRegistry = tracer.getConfigurationRegistry(); + public void init(Tracer tracer) { + ConfigurationRegistry configurationRegistry = tracer.require(ElasticApmTracer.class).getConfigurationRegistry(); logConfiguration(configurationRegistry, logger); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/context/ClosableLifecycleListenerAdapter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/context/ClosableLifecycleListenerAdapter.java index 10ba08a7ed..d784743219 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/context/ClosableLifecycleListenerAdapter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/context/ClosableLifecycleListenerAdapter.java @@ -18,17 +18,18 @@ */ package co.elastic.apm.agent.context; -import java.io.Closeable; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.LifecycleListener; public class ClosableLifecycleListenerAdapter extends AbstractLifecycleListener { - private final Closeable closeable; + private final AutoCloseable closeable; - public static LifecycleListener of(Closeable closeable) { + public static LifecycleListener of(AutoCloseable closeable) { return new ClosableLifecycleListenerAdapter(closeable); } - private ClosableLifecycleListenerAdapter(Closeable closeable) { + private ClosableLifecycleListenerAdapter(AutoCloseable closeable) { this.closeable = closeable; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java index 08cb977c59..711601c319 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java @@ -35,11 +35,13 @@ import co.elastic.apm.agent.impl.metadata.NameAndIdField; import co.elastic.apm.agent.impl.metadata.ServiceFactory; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.service.Service; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.configuration.SpanConfiguration; import co.elastic.apm.agent.context.ClosableLifecycleListenerAdapter; -import co.elastic.apm.agent.context.LifecycleListener; +import co.elastic.apm.agent.tracer.LifecycleListener; import co.elastic.apm.agent.impl.baggage.Baggage; import co.elastic.apm.agent.impl.baggage.W3CBaggagePropagation; import co.elastic.apm.agent.impl.error.ErrorCapture; @@ -71,12 +73,12 @@ import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.util.DependencyInjectingServiceLoader; import co.elastic.apm.agent.util.ExecutorUtils; +import com.dslplatform.json.JsonWriter; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationOptionProvider; import org.stagemonitor.configuration.ConfigurationRegistry; import javax.annotation.Nullable; -import java.io.Closeable; import java.io.File; import java.util.ArrayList; import java.util.Collections; @@ -954,7 +956,8 @@ public ScheduledThreadPoolExecutor getSharedSingleThreadedPool() { return sharedPool; } - public void addShutdownHook(Closeable closeable) { + @Override + public void addShutdownHook(AutoCloseable closeable) { lifecycleListeners.add(ClosableLifecycleListenerAdapter.of(closeable)); } @@ -1044,4 +1047,30 @@ public void completeMetaData(String name, String version, String id, String regi region )); } + + @Override + public void removeGauge(String name, Labels.Immutable labels) { + metricRegistry.removeGauge(name, labels); + } + + @Override + public void addGauge(String name, Labels.Immutable labels, DoubleSupplier supplier) { + metricRegistry.add(name, labels, supplier); + } + + @Override + public void submit(Runnable job) { + sharedPool.submit(job); + } + + @Override + public void schedule(Runnable job, long interval, TimeUnit timeUnit) { + sharedPool.scheduleAtFixedRate(job, 0, interval, timeUnit); + } + + @Override + public void reportMetric(JsonWriter metrics) { + reporter.reportMetrics(metrics); + } + } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java index 86c93a3353..b68faae5dd 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java @@ -26,7 +26,7 @@ import co.elastic.apm.agent.configuration.source.ConfigSources; import co.elastic.apm.agent.configuration.source.SystemPropertyConfigurationSource; import co.elastic.apm.agent.context.ClosableLifecycleListenerAdapter; -import co.elastic.apm.agent.context.LifecycleListener; +import co.elastic.apm.agent.tracer.LifecycleListener; import co.elastic.apm.agent.impl.metadata.MetaData; import co.elastic.apm.agent.impl.metadata.MetaDataFuture; import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreaker.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreaker.java index f17e20876c..b90c539011 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreaker.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreaker.java @@ -18,8 +18,9 @@ */ package co.elastic.apm.agent.impl.circuitbreaker; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.util.ExecutorUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -50,7 +51,7 @@ public CircuitBreaker(ElasticApmTracer tracer) { } @Override - public void start(ElasticApmTracer tracer) { + public void start(Tracer tracer) { // failsafe loading of stress monitors in isolation loadGCStressMonitor(tracer); loadSystemCpuStressMonitor(tracer); @@ -63,7 +64,7 @@ public void run() { }); } - private void loadGCStressMonitor(ElasticApmTracer tracer) { + private void loadGCStressMonitor(Tracer tracer) { try { stressMonitors.add(new GCStressMonitor(tracer)); } catch (Throwable throwable) { @@ -71,7 +72,7 @@ private void loadGCStressMonitor(ElasticApmTracer tracer) { } } - private void loadSystemCpuStressMonitor(ElasticApmTracer tracer) { + private void loadSystemCpuStressMonitor(Tracer tracer) { try { stressMonitors.add(new SystemCpuStressMonitor(tracer)); } catch (Throwable throwable) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/GCStressMonitor.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/GCStressMonitor.java index 62405dadd6..a325e2632b 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/GCStressMonitor.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/GCStressMonitor.java @@ -21,6 +21,7 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Tracer; import java.lang.management.ManagementFactory; import java.lang.management.MemoryPoolMXBean; @@ -35,7 +36,7 @@ class GCStressMonitor extends StressMonitor { private final List heapMBeans = new ArrayList<>(); private final StringBuilder latestStressDetectionInfo = new StringBuilder("No stress has been detected so far."); - GCStressMonitor(ElasticApmTracer tracer) { + GCStressMonitor(Tracer tracer) { super(tracer); discoverMBeans(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/StressMonitor.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/StressMonitor.java index 992bb89344..a6db804364 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/StressMonitor.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/StressMonitor.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.impl.circuitbreaker; -import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.Tracer; abstract class StressMonitor { protected final CircuitBreakerConfiguration circuitBreakerConfiguration; - public StressMonitor(ElasticApmTracer tracer) { + public StressMonitor(Tracer tracer) { circuitBreakerConfiguration = tracer.getConfig(CircuitBreakerConfiguration.class); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/SystemCpuStressMonitor.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/SystemCpuStressMonitor.java index cb0b6536aa..fd0d5e8fe6 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/SystemCpuStressMonitor.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/circuitbreaker/SystemCpuStressMonitor.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl.circuitbreaker; -import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.util.JmxUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -45,7 +45,7 @@ public class SystemCpuStressMonitor extends StressMonitor { @Nullable private final Method systemCpuUsageMethod; - SystemCpuStressMonitor(ElasticApmTracer tracer) { + SystemCpuStressMonitor(Tracer tracer) { super(tracer); operatingSystemBean = ManagementFactory.getOperatingSystemMXBean(); systemCpuUsageMethod = JmxUtils.getOperatingSystemMBeanMethod(operatingSystemBean, "getSystemCpuLoad"); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java index aab38dddd2..ff3ca395c7 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java @@ -27,7 +27,7 @@ import co.elastic.apm.agent.impl.context.Response; import co.elastic.apm.agent.impl.context.TransactionContext; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.Timer; import co.elastic.apm.agent.tracer.Outcome; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java index 59328be609..97074fe210 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.logging; -import co.elastic.apm.agent.context.AbstractLifecycleListener; -import co.elastic.apm.agent.context.LifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.LifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.report.Reporter; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.logging.log4j2.EcsLayout; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Core; @@ -103,8 +104,8 @@ public void append(LogEvent event) { public LifecycleListener getInitListener() { return new AbstractLifecycleListener() { @Override - public void init(ElasticApmTracer tracer) throws Exception { - initStreaming(tracer.getConfig(LoggingConfiguration.class), tracer.getReporter()); + public void init(Tracer tracer) throws Exception { + initStreaming(tracer.getConfig(LoggingConfiguration.class), tracer.require(ElasticApmTracer.class).getReporter()); } }; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricCollector.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricCollector.java index b8ccd561f4..199899b787 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricCollector.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricCollector.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.agent.metrics; +import co.elastic.apm.agent.tracer.metrics.Labels; + public interface MetricCollector { void addMetricValue(String metric, Labels labels, double value); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java index 2df93faa7f..9c1cdeb285 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java @@ -23,6 +23,8 @@ import co.elastic.apm.agent.report.ReporterConfiguration; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import org.HdrHistogram.WriterReaderPhaser; import javax.annotation.Nonnull; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java index 474a3827be..8bb1bc6f85 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.agent.metrics; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java index c0a06ab921..3413f95f8a 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java @@ -19,9 +19,10 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricCollector; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricsProvider; @@ -113,8 +114,8 @@ public AgentOverheadMetrics() { } @Override - public void start(ElasticApmTracer tracer) throws Exception { - MetricRegistry metricRegistry = tracer.getMetricRegistry(); + public void start(Tracer tracer) throws Exception { + MetricRegistry metricRegistry = tracer.require(ElasticApmTracer.class).getMetricRegistry(); MetricsConfiguration config = tracer.getConfig(MetricsConfiguration.class); bindTo(metricRegistry, config); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java index 6970d114ae..e946bb90e1 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricCollector; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricsProvider; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/CGroupMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/CGroupMetrics.java index 9f64ed14cc..e89ee39ef5 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/CGroupMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/CGroupMetrics.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -213,8 +214,8 @@ private File getMaxMemoryFile(File maxMemoryFile, String cgroupUnlimitedConstant } @Override - public void start(ElasticApmTracer tracer) { - bindTo(tracer.getMetricRegistry()); + public void start(Tracer tracer) { + bindTo(tracer.require(ElasticApmTracer.class).getMetricRegistry()); } void bindTo(MetricRegistry metricRegistry) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetrics.java index 4a0764fe35..08d95586bf 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetrics.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import javax.annotation.Nullable; @@ -40,8 +41,8 @@ public class JvmFdMetrics extends AbstractLifecycleListener { private static final MethodHandle getMaxFileDescriptorCount = getMethodHandle("getMaxFileDescriptorCount"); @Override - public void start(ElasticApmTracer tracer) { - bindTo(tracer.getMetricRegistry()); + public void start(Tracer tracer) { + bindTo(tracer.require(ElasticApmTracer.class).getMetricRegistry()); } void bindTo(final MetricRegistry registry) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmGcMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmGcMetrics.java index 4cd140aced..089c2df2d0 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmGcMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmGcMetrics.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import com.sun.management.ThreadMXBean; import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement; @@ -35,8 +36,8 @@ public class JvmGcMetrics extends AbstractLifecycleListener { private final List garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans(); @Override - public void start(ElasticApmTracer tracer) { - bindTo(tracer.getMetricRegistry()); + public void start(Tracer tracer) { + bindTo(tracer.require(ElasticApmTracer.class).getMetricRegistry()); } void bindTo(final MetricRegistry registry) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetrics.java index b83fbf2eff..272c1e7a31 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetrics.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -36,8 +37,8 @@ public class JvmMemoryMetrics extends AbstractLifecycleListener { private static final Logger logger = LoggerFactory.getLogger(JvmMemoryMetrics.class); @Override - public void start(ElasticApmTracer tracer) { - bindTo(tracer.getMetricRegistry()); + public void start(Tracer tracer) { + bindTo(tracer.require(ElasticApmTracer.class).getMetricRegistry()); } void bindTo(final MetricRegistry registry) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/SystemMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/SystemMetrics.java index 3659938a5f..a6e79439d8 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/SystemMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/SystemMetrics.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.util.JmxUtils; import org.stagemonitor.util.StringUtils; @@ -88,8 +89,8 @@ public SystemMetrics() { } @Override - public void start(ElasticApmTracer tracer) { - bindTo(tracer.getMetricRegistry()); + public void start(Tracer tracer) { + bindTo(tracer.require(ElasticApmTracer.class).getMetricRegistry()); } void bindTo(MetricRegistry metricRegistry) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/ThreadMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/ThreadMetrics.java index 52c5203555..cf3314c0ea 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/ThreadMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/ThreadMetrics.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import java.lang.management.ManagementFactory; @@ -30,8 +31,8 @@ public class ThreadMetrics extends AbstractLifecycleListener { @Override - public void start(ElasticApmTracer tracer) { - bindTo(tracer.getMetricRegistry()); + public void start(Tracer tracer) { + bindTo(tracer.require(ElasticApmTracer.class).getMetricRegistry()); } void bindTo(final MetricRegistry registry) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java index 6ec3676c4b..e56bb1b1e3 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java @@ -59,13 +59,14 @@ import co.elastic.apm.agent.impl.transaction.StackFrame; import co.elastic.apm.agent.impl.transaction.TraceContext; import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.sdk.internal.collections.LongList; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; import co.elastic.apm.agent.tracer.pooling.Recyclable; +import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; import com.dslplatform.json.BoolConverter; import com.dslplatform.json.DslJson; import com.dslplatform.json.JsonWriter; @@ -98,7 +99,6 @@ public class DslJsonSerializer { private static final byte NEW_LINE = (byte) '\n'; private static final Logger logger = LoggerFactory.getLogger(DslJsonSerializer.class); - private static final String[] DISALLOWED_IN_PROPERTY_NAME = new String[]{".", "*", "\""}; private static final List excludedStackFramesPrefixes = Arrays.asList("java.lang.reflect.", "com.sun.", "sun.", "jdk.internal."); @@ -165,16 +165,16 @@ static void serializeMetadata(MetaData metaData, private static void serializeGlobalLabels(ArrayList globalLabelKeys, ArrayList globalLabelValues, final StringBuilder replaceBuilder, JsonWriter jw) { if (!globalLabelKeys.isEmpty()) { - writeFieldName("labels", jw); + DslJsonUtil.writeFieldName("labels", jw); jw.writeByte(OBJECT_START); - writeStringValue(sanitizePropertyName(globalLabelKeys.get(0), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(globalLabelKeys.get(0), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); - writeStringValue(globalLabelValues.get(0), replaceBuilder, jw); + DslJsonUtil.writeStringValue(globalLabelValues.get(0), replaceBuilder, jw); for (int i = 1; i < globalLabelKeys.size(); i++) { jw.writeByte(COMMA); - writeStringValue(sanitizePropertyName(globalLabelKeys.get(i), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(globalLabelKeys.get(i), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); - writeStringValue(globalLabelValues.get(i), replaceBuilder, jw); + DslJsonUtil.writeStringValue(globalLabelValues.get(i), replaceBuilder, jw); } jw.writeByte(OBJECT_END); jw.writeByte(COMMA); @@ -182,7 +182,7 @@ private static void serializeGlobalLabels(ArrayList globalLabelKeys, Arr } private static void serializeService(final Service service, final StringBuilder replaceBuilder, final JsonWriter jw, boolean supportsAgentActivationMethod) { - writeFieldName("service", jw); + DslJsonUtil.writeFieldName("service", jw); jw.writeByte(JsonWriter.OBJECT_START); writeField("name", service.getName(), replaceBuilder, jw); @@ -224,17 +224,17 @@ private static void serializeService(@Nullable final CharSequence serviceName, @ return; } - writeFieldName("service", jw); + DslJsonUtil.writeFieldName("service", jw); jw.writeByte(OBJECT_START); if (serviceName != null) { - writeFieldName("name", jw); - writeStringValue(serviceName, replaceBuilder, jw); + DslJsonUtil.writeFieldName("name", jw); + DslJsonUtil.writeStringValue(serviceName, replaceBuilder, jw); if (serviceVersion != null) { jw.writeByte(COMMA); - writeFieldName("version", jw); - writeStringValue(serviceVersion, replaceBuilder, jw); + DslJsonUtil.writeFieldName("version", jw); + DslJsonUtil.writeStringValue(serviceVersion, replaceBuilder, jw); } } @@ -242,22 +242,22 @@ private static void serializeService(@Nullable final CharSequence serviceName, @ if (serviceName != null) { jw.writeByte(COMMA); } - writeFieldName("target", jw); + DslJsonUtil.writeFieldName("target", jw); jw.writeByte(OBJECT_START); CharSequence targetType = serviceTarget.getType(); CharSequence targetName = serviceTarget.getName(); if (targetType != null) { - writeFieldName("type", jw); - writeStringValue(targetType, replaceBuilder, jw); + DslJsonUtil.writeFieldName("type", jw); + DslJsonUtil.writeStringValue(targetType, replaceBuilder, jw); } if (targetName != null) { if (targetType != null) { jw.writeByte(COMMA); } - writeFieldName("name", jw); - writeStringValue(targetName, replaceBuilder, jw); + DslJsonUtil.writeFieldName("name", jw); + DslJsonUtil.writeStringValue(targetName, replaceBuilder, jw); } jw.writeByte(OBJECT_END); @@ -271,7 +271,7 @@ private static void serializeService(@Nullable String name, @Nullable String ver } private static void serializeAgent(final Agent agent, final StringBuilder replaceBuilder, final JsonWriter jw, boolean supportsAgentActivationMethod) { - writeFieldName("agent", jw); + DslJsonUtil.writeFieldName("agent", jw); jw.writeByte(JsonWriter.OBJECT_START); if (supportsAgentActivationMethod) { writeField("activation_method", agent.getActivationMethod(), replaceBuilder, jw); @@ -284,7 +284,7 @@ private static void serializeAgent(final Agent agent, final StringBuilder replac } private static void serializeLanguage(final Language language, final StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName("language", jw); + DslJsonUtil.writeFieldName("language", jw); jw.writeByte(JsonWriter.OBJECT_START); writeField("name", language.getName(), replaceBuilder, jw); writeLastField("version", language.getVersion(), replaceBuilder, jw); @@ -293,7 +293,7 @@ private static void serializeLanguage(final Language language, final StringBuild } private static void serializeFramework(final Framework framework, final StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName("framework", jw); + DslJsonUtil.writeFieldName("framework", jw); jw.writeByte(JsonWriter.OBJECT_START); writeField("name", framework.getName(), replaceBuilder, jw); writeLastField("version", framework.getVersion(), replaceBuilder, jw); @@ -302,7 +302,7 @@ private static void serializeFramework(final Framework framework, final StringBu } private static void serializeNode(final Node node, final StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName("node", jw); + DslJsonUtil.writeFieldName("node", jw); jw.writeByte(JsonWriter.OBJECT_START); writeLastField("configured_name", node.getName(), replaceBuilder, jw); jw.writeByte(JsonWriter.OBJECT_END); @@ -310,7 +310,7 @@ private static void serializeNode(final Node node, final StringBuilder replaceBu } private static void serializeRuntime(final RuntimeInfo runtime, final StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName("runtime", jw); + DslJsonUtil.writeFieldName("runtime", jw); jw.writeByte(JsonWriter.OBJECT_START); writeField("name", runtime.getName(), replaceBuilder, jw); writeLastField("version", runtime.getVersion(), replaceBuilder, jw); @@ -319,7 +319,7 @@ private static void serializeRuntime(final RuntimeInfo runtime, final StringBuil } private static void serializeProcess(final ProcessInfo process, final StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName("process", jw); + DslJsonUtil.writeFieldName("process", jw); jw.writeByte(JsonWriter.OBJECT_START); writeField("pid", process.getPid(), jw); if (process.getPpid() != null) { @@ -337,7 +337,7 @@ private static void serializeSystem(SystemInfo system, JsonWriter jw, boolean supportsConfiguredAndDetectedHostname) { - writeFieldName("system", jw); + DslJsonUtil.writeFieldName("system", jw); jw.writeByte(JsonWriter.OBJECT_START); serializeContainerInfo(system.getContainerInfo(), replaceBuilder, jw); serializeKubernetesInfo(system.getKubernetesInfo(), replaceBuilder, jw); @@ -360,13 +360,13 @@ private static void serializeSystem(SystemInfo system, } private static void serializeCloudProvider(final CloudProviderInfo cloudProviderInfo, final StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName("cloud", jw); + DslJsonUtil.writeFieldName("cloud", jw); jw.writeByte(OBJECT_START); serializeNameAndIdField(cloudProviderInfo.getAccount(), "account", replaceBuilder, jw); serializeNameAndIdField(cloudProviderInfo.getInstance(), "instance", replaceBuilder, jw); serializeNameAndIdField(cloudProviderInfo.getProject(), "project", replaceBuilder, jw); if (cloudProviderInfo.getMachine() != null) { - writeFieldName("machine", jw); + DslJsonUtil.writeFieldName("machine", jw); jw.writeByte(JsonWriter.OBJECT_START); writeLastField("type", cloudProviderInfo.getMachine().getType(), replaceBuilder, jw); jw.writeByte(JsonWriter.OBJECT_END); @@ -375,7 +375,7 @@ private static void serializeCloudProvider(final CloudProviderInfo cloudProvider writeField("availability_zone", cloudProviderInfo.getAvailabilityZone(), replaceBuilder, jw); writeField("region", cloudProviderInfo.getRegion(), replaceBuilder, jw); if (null != cloudProviderInfo.getService()) { - writeFieldName("service", jw); + DslJsonUtil.writeFieldName("service", jw); jw.writeByte(JsonWriter.OBJECT_START); writeLastField("name", cloudProviderInfo.getService().getName(), replaceBuilder, jw); jw.writeByte(JsonWriter.OBJECT_END); @@ -388,13 +388,13 @@ private static void serializeCloudProvider(final CloudProviderInfo cloudProvider private static void serializeNameAndIdField(@Nullable NameAndIdField nameAndIdField, String fieldName, StringBuilder replaceBuilder, JsonWriter jw) { if (nameAndIdField != null && !nameAndIdField.isEmpty()) { - writeFieldName(fieldName, jw); + DslJsonUtil.writeFieldName(fieldName, jw); jw.writeByte(JsonWriter.OBJECT_START); boolean idWritten = false; String id = nameAndIdField.getId(); if (id != null) { - writeFieldName("id", jw); - writeStringValue(id, replaceBuilder, jw); + DslJsonUtil.writeFieldName("id", jw); + DslJsonUtil.writeStringValue(id, replaceBuilder, jw); idWritten = true; } String name = nameAndIdField.getName(); @@ -402,8 +402,8 @@ private static void serializeNameAndIdField(@Nullable NameAndIdField nameAndIdFi if (idWritten) { jw.writeByte(COMMA); } - writeFieldName("name", jw); - writeStringValue(name, replaceBuilder, jw); + DslJsonUtil.writeFieldName("name", jw); + DslJsonUtil.writeStringValue(name, replaceBuilder, jw); } jw.writeByte(JsonWriter.OBJECT_END); jw.writeByte(COMMA); @@ -412,7 +412,7 @@ private static void serializeNameAndIdField(@Nullable NameAndIdField nameAndIdFi private static void serializeContainerInfo(@Nullable SystemInfo.Container container, final StringBuilder replaceBuilder, final JsonWriter jw) { if (container != null) { - writeFieldName("container", jw); + DslJsonUtil.writeFieldName("container", jw); jw.writeByte(JsonWriter.OBJECT_START); writeLastField("id", container.getId(), replaceBuilder, jw); jw.writeByte(JsonWriter.OBJECT_END); @@ -422,7 +422,7 @@ private static void serializeContainerInfo(@Nullable SystemInfo.Container contai private static void serializeKubernetesInfo(@Nullable SystemInfo.Kubernetes kubernetes, final StringBuilder replaceBuilder, final JsonWriter jw) { if (kubernetes != null && kubernetes.hasContent()) { - writeFieldName("kubernetes", jw); + DslJsonUtil.writeFieldName("kubernetes", jw); jw.writeByte(JsonWriter.OBJECT_START); serializeKubeNodeInfo(kubernetes.getNode(), replaceBuilder, jw); serializeKubePodInfo(kubernetes.getPod(), replaceBuilder, jw); @@ -434,7 +434,7 @@ private static void serializeKubernetesInfo(@Nullable SystemInfo.Kubernetes kube private static void serializeKubePodInfo(@Nullable SystemInfo.Kubernetes.Pod pod, final StringBuilder replaceBuilder, final JsonWriter jw) { if (pod != null) { - writeFieldName("pod", jw); + DslJsonUtil.writeFieldName("pod", jw); jw.writeByte(JsonWriter.OBJECT_START); String podName = pod.getName(); if (podName != null) { @@ -448,7 +448,7 @@ private static void serializeKubePodInfo(@Nullable SystemInfo.Kubernetes.Pod pod private static void serializeKubeNodeInfo(@Nullable SystemInfo.Kubernetes.Node node, final StringBuilder replaceBuilder, final JsonWriter jw) { if (node != null) { - writeFieldName("node", jw); + DslJsonUtil.writeFieldName("node", jw); jw.writeByte(JsonWriter.OBJECT_START); writeLastField("name", node.getName(), replaceBuilder, jw); jw.writeByte(JsonWriter.OBJECT_END); @@ -476,13 +476,13 @@ private static void serializeStringKeyScalarValueMap(Iterator kv = it.next(); - writeStringValue(sanitizePropertyName(kv.getKey(), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(kv.getKey(), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); serializeScalarValue(replaceBuilder, jw, kv.getValue(), extendedStringLimit, supportsNonStringValues); while (it.hasNext()) { jw.writeByte(COMMA); kv = it.next(); - writeStringValue(sanitizePropertyName(kv.getKey(), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(kv.getKey(), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); serializeScalarValue(replaceBuilder, jw, kv.getValue(), extendedStringLimit, supportsNonStringValues); } @@ -498,7 +498,7 @@ static void serializeLabels(Labels labels, final String serviceName, final Strin } if (!labels.isEmpty()) { if (labels.getTransactionName() != null || labels.getTransactionType() != null) { - writeFieldName("transaction", jw); + DslJsonUtil.writeFieldName("transaction", jw); jw.writeByte(OBJECT_START); writeField("name", labels.getTransactionName(), replaceBuilder, jw); writeLastField("type", labels.getTransactionType(), replaceBuilder, jw); @@ -507,7 +507,7 @@ static void serializeLabels(Labels labels, final String serviceName, final Strin } if (labels.getSpanType() != null || labels.getSpanSubType() != null) { - writeFieldName("span", jw); + DslJsonUtil.writeFieldName("span", jw); jw.writeByte(OBJECT_START); writeField("type", labels.getSpanType(), replaceBuilder, jw); writeLastField("subtype", labels.getSpanSubType(), replaceBuilder, jw); @@ -515,7 +515,7 @@ static void serializeLabels(Labels labels, final String serviceName, final Strin jw.writeByte(COMMA); } - writeFieldName("tags", jw); + DslJsonUtil.writeFieldName("tags", jw); jw.writeByte(OBJECT_START); serialize(labels, replaceBuilder, jw); jw.writeByte(OBJECT_END); @@ -528,7 +528,7 @@ private static void serialize(Labels labels, final StringBuilder replaceBuilder, if (i > 0) { jw.writeByte(COMMA); } - writeStringValue(sanitizePropertyName(labels.getKey(i), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(labels.getKey(i), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); serializeScalarValue(replaceBuilder, jw, labels.getValue(i), false, false); } @@ -539,7 +539,7 @@ private static void serializeScalarValue(final StringBuilder replaceBuilder, fin if (extendedStringLimit) { writeLongStringValue((String) value, replaceBuilder, jw); } else { - writeStringValue((String) value, replaceBuilder, jw); + DslJsonUtil.writeStringValue((String) value, replaceBuilder, jw); } } else if (value instanceof Number) { if (supportsNonStringValues) { @@ -559,25 +559,6 @@ private static void serializeScalarValue(final StringBuilder replaceBuilder, fin } } - public static CharSequence sanitizePropertyName(String key, StringBuilder replaceBuilder) { - for (int i = 0; i < DISALLOWED_IN_PROPERTY_NAME.length; i++) { - if (key.contains(DISALLOWED_IN_PROPERTY_NAME[i])) { - return replaceAll(key, DISALLOWED_IN_PROPERTY_NAME, "_", replaceBuilder); - } - } - return key; - } - - private static CharSequence replaceAll(String s, String[] stringsToReplace, String replacement, StringBuilder replaceBuilder) { - // uses a instance variable StringBuilder to avoid allocations - replaceBuilder.setLength(0); - replaceBuilder.append(s); - for (String toReplace : stringsToReplace) { - replace(replaceBuilder, toReplace, replacement, 0); - } - return replaceBuilder; - } - static void replace(StringBuilder replaceBuilder, String toReplace, String replacement, int fromIndex) { for (int i = replaceBuilder.indexOf(toReplace, fromIndex); i != -1; i = replaceBuilder.indexOf(toReplace, fromIndex)) { replaceBuilder.replace(i, i + toReplace.length(), replacement); @@ -601,13 +582,13 @@ static void writeField(final String fieldName, if (value == null) { if (writeNull) { - writeFieldName(fieldName, jw); + DslJsonUtil.writeFieldName(fieldName, jw); jw.writeNull(); jw.writeByte(COMMA); } } else { - writeFieldName(fieldName, jw); - writeStringValue(value, replaceBuilder, jw); + DslJsonUtil.writeFieldName(fieldName, jw); + DslJsonUtil.writeStringValue(value, replaceBuilder, jw); jw.writeByte(COMMA); } } @@ -620,16 +601,6 @@ private static void writeStringBuilderValue(StringBuilder value, JsonWriter jw) jw.writeString(value); } - public static void writeStringValue(CharSequence value, final StringBuilder replaceBuilder, final JsonWriter jw) { - if (value.length() > SerializationConstants.MAX_VALUE_LENGTH) { - replaceBuilder.setLength(0); - replaceBuilder.append(value, 0, Math.min(value.length(), SerializationConstants.MAX_VALUE_LENGTH + 1)); - writeStringBuilderValue(replaceBuilder, jw); - } else { - jw.writeString(value); - } - } - private static void writeLongStringBuilderValue(StringBuilder value, JsonWriter jw) { if (value.length() > SerializationConstants.getMaxLongStringValueLength()) { value.setLength(SerializationConstants.getMaxLongStringValueLength() - 1); @@ -649,30 +620,23 @@ private static void writeLongStringValue(CharSequence value, final StringBuilder } static void writeField(final String fieldName, final long value, final JsonWriter jw) { - writeFieldName(fieldName, jw); + DslJsonUtil.writeFieldName(fieldName, jw); NumberConverter.serialize(value, jw); jw.writeByte(COMMA); } public static void writeLastField(final String fieldName, @Nullable final CharSequence value, StringBuilder replaceBuilder, final JsonWriter jw) { - writeFieldName(fieldName, jw); + DslJsonUtil.writeFieldName(fieldName, jw); if (value != null && value.length() > 0) { - writeStringValue(value, replaceBuilder, jw); + DslJsonUtil.writeStringValue(value, replaceBuilder, jw); } else { jw.writeNull(); } } - public static void writeFieldName(final String fieldName, final JsonWriter jw) { - jw.writeByte(JsonWriter.QUOTE); - jw.writeAscii(fieldName); - jw.writeByte(JsonWriter.QUOTE); - jw.writeByte(JsonWriter.SEMI); - } - static void writeField(final String fieldName, final List values, final JsonWriter jw) { if (values.size() > 0) { - writeFieldName(fieldName, jw); + DslJsonUtil.writeFieldName(fieldName, jw); jw.writeByte(ARRAY_START); jw.writeString(values.get(0)); for (int i = 1; i < values.size(); i++) { @@ -1142,7 +1106,7 @@ private void serializeNumber(Number n, JsonWriter jw) { } private void serializeComposite(Composite composite) { - DslJsonSerializer.writeFieldName("composite", jw); + DslJsonUtil.writeFieldName("composite", jw); jw.writeByte(OBJECT_START); writeField("count", composite.getCount()); writeField("sum", composite.getSumMs()); @@ -1342,7 +1306,7 @@ private void serializeStackTraceElement(StackFrame frame, StringBuilder replaceB frame.appendFileName(replaceBuilder); writeField("filename", replaceBuilder); writeField("function", frame.getMethodName()); - writeField("library_frame", isLibraryFrame(frame.getClassName())); + writeField("library_frame", frame.getClassName() != null && isLibraryFrame(frame.getClassName())); writeLastField("lineno", -1); jw.writeByte(OBJECT_END); } @@ -1675,7 +1639,7 @@ void serializeUrl(final Url url) { } else { // serialize as a string for compatibility // doing it in low-level to avoid allocation - DslJsonSerializer.writeFieldName("port", jw); + DslJsonUtil.writeFieldName("port", jw); jw.writeByte(QUOTE); NumberConverter.serialize(port, jw); jw.writeByte(QUOTE); @@ -1787,7 +1751,7 @@ private void writeStringBuilderValue(StringBuilder value) { } private void writeStringValue(CharSequence value) { - DslJsonSerializer.writeStringValue(value, replaceBuilder, jw); + DslJsonUtil.writeStringValue(value, replaceBuilder, jw); } private void writeLongStringValue(CharSequence value) { @@ -1836,7 +1800,7 @@ void writeLastField(final String fieldName, @Nullable final CharSequence value) } private void writeFieldName(final String fieldName) { - DslJsonSerializer.writeFieldName(fieldName, jw); + DslJsonUtil.writeFieldName(fieldName, jw); } private void writeNonLastIdField(String fieldName, Id id) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java index aa1a9347a9..04327f4f0f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.report.serialize; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.service.ServiceInfo; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.report.Reporter; @@ -47,10 +48,12 @@ public MetricRegistryReporter(ElasticApmTracer tracer) { } @Override - public void start(ElasticApmTracer tracer) { + public void start(Tracer tracer) { long intervalMs = tracer.getConfig(ReporterConfiguration.class).getMetricsIntervalMs(); if (intervalMs > 0) { - tracer.getSharedSingleThreadedPool().scheduleAtFixedRate(this, intervalMs, intervalMs, TimeUnit.MILLISECONDS); + tracer.require(ElasticApmTracer.class) + .getSharedSingleThreadedPool() + .scheduleAtFixedRate(this, intervalMs, intervalMs, TimeUnit.MILLISECONDS); } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistrySerializer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistrySerializer.java index e5b3700f39..afcf9133e1 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistrySerializer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistrySerializer.java @@ -19,9 +19,10 @@ package co.elastic.apm.agent.report.serialize; import co.elastic.apm.agent.tracer.service.ServiceInfo; -import co.elastic.apm.agent.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.metrics.Timer; +import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; import com.dslplatform.json.DslJson; import com.dslplatform.json.JsonWriter; import com.dslplatform.json.NumberConverter; @@ -80,14 +81,14 @@ private static boolean serialize(MetricSet metricSet, long epochMicros, String s boolean hasSamples; jw.writeByte(JsonWriter.OBJECT_START); { - DslJsonSerializer.writeFieldName("metricset", jw); + DslJsonUtil.writeFieldName("metricset", jw); jw.writeByte(JsonWriter.OBJECT_START); { - DslJsonSerializer.writeFieldName("timestamp", jw); + DslJsonUtil.writeFieldName("timestamp", jw); NumberConverter.serialize(epochMicros, jw); jw.writeByte(JsonWriter.COMMA); DslJsonSerializer.serializeLabels(metricSet.getLabels(), serviceName, serviceVersion, replaceBuilder, jw); - DslJsonSerializer.writeFieldName("samples", jw); + DslJsonUtil.writeFieldName("samples", jw); jw.writeByte(JsonWriter.OBJECT_START); hasSamples = serializeGauges(metricSet.getGauges(), jw); hasSamples |= serializeTimers(metricSet.getTimers(), hasSamples, jw); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java index 8f5e4d2db0..bd927d1b8f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java @@ -19,6 +19,7 @@ package co.elastic.apm.agent.report.serialize; import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; import javax.annotation.Nullable; @@ -31,7 +32,7 @@ public class SerializationConstants { */ public static final int BUFFER_SIZE = 16384; - public static final int MAX_VALUE_LENGTH = 1024; + public static final int MAX_VALUE_LENGTH = DslJsonUtil.MAX_VALUE_LENGTH; @Nullable private static volatile SerializationConstants INSTANCE; diff --git a/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener b/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener similarity index 100% rename from apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener rename to apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java index b2771cfd8a..b365039737 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java @@ -34,7 +34,7 @@ import co.elastic.apm.agent.impl.transaction.Span; import co.elastic.apm.agent.impl.transaction.TraceContext; import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.tracer.Outcome; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java index 9ba0dbc469..ddf693bd5e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import net.bytebuddy.agent.ByteBuddyAgent; import org.junit.jupiter.api.AfterEach; @@ -145,12 +145,12 @@ void testStartDisabled() throws Exception { .reporter(new MockReporter()) .withLifecycleListener(new AbstractLifecycleListener() { @Override - public void init(ElasticApmTracer tracer) { + public void init(co.elastic.apm.agent.tracer.Tracer tracer) { initialized.set(true); } @Override - public void start(ElasticApmTracer tracer) throws Exception { + public void start(co.elastic.apm.agent.tracer.Tracer tracer) throws Exception { started.set(true); } }) @@ -163,7 +163,7 @@ public void start(ElasticApmTracer tracer) throws Exception { /* * Has an entry in - * src/test/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener + * src/test/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener */ public static class TestLifecycleListener extends AbstractLifecycleListener { @@ -178,7 +178,7 @@ public TestLifecycleListener() { } @Override - public void start(ElasticApmTracer tracer) { + public void start(co.elastic.apm.agent.tracer.Tracer tracer) { start.incrementAndGet(); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java index a090c71566..d8147bdf33 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java @@ -26,7 +26,7 @@ import co.elastic.apm.agent.impl.transaction.AbstractSpan; import co.elastic.apm.agent.impl.transaction.Span; import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.metrics.Timer; import org.junit.jupiter.api.AfterEach; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java index 2b445c9e54..5590fea3cc 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java @@ -21,6 +21,8 @@ import co.elastic.apm.agent.configuration.MetricsConfiguration; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java index 814bc84cfc..093782f979 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.configuration.MetricsConfiguration; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.report.ReporterConfiguration; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java index bc86fd0cda..83527ffe6b 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.configuration.MetricsConfiguration; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.report.ReporterConfiguration; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java index a8d80db1e0..5dd24ae174 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.report.ReporterConfiguration; import org.junit.jupiter.api.Test; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java index dc15f3874c..3f87b5c70c 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.report.ReporterConfiguration; import org.junit.jupiter.api.condition.DisabledOnOs; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java index 05c4fe4348..413b148d5c 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.report.ReporterConfiguration; import org.assertj.core.api.AbstractDoubleAssert; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java index dea7de26c2..3226241264 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.report.ReporterConfiguration; import org.junit.jupiter.api.Test; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java index 287047b2ea..4fec12cf1a 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.metrics.builtin; import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.report.ReporterConfiguration; import org.junit.jupiter.api.Test; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java index 7f696af5f1..1abc82a114 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.configuration.MetricsConfiguration; import co.elastic.apm.agent.tracer.service.ServiceInfo; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricCollector; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricsProvider; diff --git a/apm-agent-core/src/test/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener b/apm-agent-core/src/test/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener similarity index 100% rename from apm-agent-core/src/test/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener rename to apm-agent-core/src/test/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener diff --git a/apm-agent-plugins/apm-jmx-plugin/pom.xml b/apm-agent-plugins/apm-jmx-plugin/pom.xml index 64af345431..8dddd765b6 100644 --- a/apm-agent-plugins/apm-jmx-plugin/pom.xml +++ b/apm-agent-plugins/apm-jmx-plugin/pom.xml @@ -15,13 +15,4 @@ ${project.basedir}/../.. - - - - ${project.groupId} - apm-agent-core - ${project.version} - - - diff --git a/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetric.java b/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetric.java index 9fa1b4da6d..9409e810af 100644 --- a/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetric.java +++ b/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetric.java @@ -18,12 +18,11 @@ */ package co.elastic.apm.agent.jmx; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import org.stagemonitor.configuration.converter.AbstractValueConverter; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import java.util.ArrayList; diff --git a/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java b/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java index 5560f338a1..5c3733a639 100644 --- a/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java +++ b/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java @@ -18,16 +18,15 @@ */ package co.elastic.apm.agent.jmx; -import co.elastic.apm.agent.context.AbstractLifecycleListener; -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.DoubleSupplier; -import co.elastic.apm.agent.metrics.Labels; -import co.elastic.apm.agent.metrics.MetricRegistry; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.metrics.Labels; +import co.elastic.apm.agent.tracer.GlobalLocks; import co.elastic.apm.agent.sdk.internal.util.ExecutorUtils; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.GlobalLocks; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import org.stagemonitor.configuration.ConfigurationOption; @@ -66,8 +65,8 @@ public class JmxMetricTracker extends AbstractLifecycleListener { private volatile Thread logManagerPropertyPoller; @Nullable private volatile MBeanServer server; + private final Tracer tracer; private final JmxConfiguration jmxConfiguration; - private final MetricRegistry metricRegistry; @Nullable private volatile NotificationListener listener; @@ -76,16 +75,16 @@ public class JmxMetricTracker extends AbstractLifecycleListener { @Nullable private ScheduledExecutorService retryExecutor; - public JmxMetricTracker(ElasticApmTracer tracer) { + public JmxMetricTracker(Tracer tracer) { + this.tracer = tracer; jmxConfiguration = tracer.getConfig(JmxConfiguration.class); - metricRegistry = tracer.getMetricRegistry(); // using a synchronized list so adding to the list does not require synchronization failedMetrics = Collections.synchronizedList(new ArrayList()); } @Override - public void start(ElasticApmTracer tracer) { + public void start(Tracer tracer) { ConfigurationOption.ChangeListener> captureJmxListener = new ConfigurationOption.ChangeListener>() { @Override public void onChange(ConfigurationOption configurationOption, List oldValue, List newValue) { @@ -197,10 +196,10 @@ public void onChange(ConfigurationOption configurationOption, List for (JmxMetricRegistration addedRegistration : removeAll(oldRegistrations, newRegistrations)) { - addedRegistration.register(platformMBeanServer, metricRegistry); + addedRegistration.register(platformMBeanServer, tracer); } for (JmxMetricRegistration deletedRegistration : removeAll(newRegistrations, oldRegistrations)) { - deletedRegistration.unregister(metricRegistry); + deletedRegistration.unregister(tracer); } } }); @@ -326,7 +325,7 @@ private static List removeAll(List removeFromThis, List toRemove) { private void register(List jmxMetrics, MBeanServer server, List failedMetrics) { for (JmxMetricRegistration registration : compileJmxMetricRegistrations(jmxMetrics, server, failedMetrics)) { - registration.register(server, metricRegistry); + registration.register(server, tracer); } } @@ -474,9 +473,9 @@ private JmxMetricRegistration(String metricName, Labels labels, String jmxAttrib } - void register(final MBeanServer server, final MetricRegistry metricRegistry) { + void register(final MBeanServer server, final Tracer tracer) { logger.debug("Registering JMX metric {} {}.{} as metric_name: {} labels: {}", objectName, jmxAttribute, compositeDataKey, metricName, labels); - metricRegistry.add(metricName, labels, new DoubleSupplier() { + tracer.addGauge(metricName, labels, new DoubleSupplier() { @Override public double get() { try { @@ -489,7 +488,7 @@ public double get() { return value; } catch (InstanceNotFoundException | AttributeNotFoundException e) { if (unsubscribeOnError) { - unregister(metricRegistry); + unregister(tracer); } return Double.NaN; } catch (Exception e) { @@ -499,9 +498,9 @@ public double get() { }); } - void unregister(MetricRegistry metricRegistry) { + void unregister(Tracer tracer) { logger.debug("Unregistering JMX metric {} {}.{} metric_name: {} labels: {}", objectName, jmxAttribute, compositeDataKey, metricName, labels); - metricRegistry.removeGauge(metricName, labels); + tracer.removeGauge(metricName, labels); } @Override diff --git a/apm-agent-plugins/apm-jmx-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener b/apm-agent-plugins/apm-jmx-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener similarity index 100% rename from apm-agent-plugins/apm-jmx-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener rename to apm-agent-plugins/apm-jmx-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener diff --git a/apm-agent-plugins/apm-jmx-plugin/src/test/java/co/elastic/apm/agent/jmx/JmxMetricTrackerTest.java b/apm-agent-plugins/apm-jmx-plugin/src/test/java/co/elastic/apm/agent/jmx/JmxMetricTrackerTest.java index cc8eeca851..640a374bde 100644 --- a/apm-agent-plugins/apm-jmx-plugin/src/test/java/co/elastic/apm/agent/jmx/JmxMetricTrackerTest.java +++ b/apm-agent-plugins/apm-jmx-plugin/src/test/java/co/elastic/apm/agent/jmx/JmxMetricTrackerTest.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.metrics.Labels; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.report.serialize.MetricRegistrySerializer; import org.junit.jupiter.api.AfterEach; diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 8ff7909d41..13b891a786 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -20,12 +20,6 @@ - - - ${project.groupId} - apm-agent-core - ${project.version} - io.micrometer micrometer-core diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/AbstractMicrometerInstrumentation.java b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/AbstractMicrometerInstrumentation.java index f9ac5ef254..056daf8df2 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/AbstractMicrometerInstrumentation.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/AbstractMicrometerInstrumentation.java @@ -18,7 +18,6 @@ */ package co.elastic.apm.agent.micrometer; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Tracer; @@ -30,7 +29,7 @@ public abstract class AbstractMicrometerInstrumentation extends ElasticApmInstru private static final Tracer tracer = GlobalTracer.get(); - static final MicrometerMetricsReporter reporter = new MicrometerMetricsReporter(tracer.require(ElasticApmTracer.class)); + static final MicrometerMetricsReporter reporter = new MicrometerMetricsReporter(tracer); public Collection getInstrumentationGroupNames() { return Collections.singletonList("micrometer"); diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializer.java b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializer.java index 683df9632f..58048dde12 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializer.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializer.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.micrometer; -import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakSet; import co.elastic.apm.agent.tracer.configuration.MetricsConfiguration; +import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; import com.dslplatform.json.DslJson; import com.dslplatform.json.JsonWriter; import com.dslplatform.json.NumberConverter; @@ -100,14 +100,14 @@ boolean serializeMetricSet(List tags, List meters, long epochMicros, boolean dedotMetricName = config.isDedotCustomMetrics(); jw.writeByte(JsonWriter.OBJECT_START); { - DslJsonSerializer.writeFieldName("metricset", jw); + DslJsonUtil.writeFieldName("metricset", jw); jw.writeByte(JsonWriter.OBJECT_START); { - DslJsonSerializer.writeFieldName("timestamp", jw); + DslJsonUtil.writeFieldName("timestamp", jw); NumberConverter.serialize(epochMicros, jw); jw.writeByte(JsonWriter.COMMA); serializeTags(tags, replaceBuilder, jw); - DslJsonSerializer.writeFieldName("samples", jw); + DslJsonUtil.writeFieldName("samples", jw); jw.writeByte(JsonWriter.OBJECT_START); ClassLoader originalContextCL = PrivilegedActionUtils.getContextClassLoader(Thread.currentThread()); @@ -167,16 +167,16 @@ private static void serializeTags(List tags, StringBuilder replaceBuilder, if (tags.isEmpty()) { return; } - DslJsonSerializer.writeFieldName("tags", jw); + DslJsonUtil.writeFieldName("tags", jw); jw.writeByte(OBJECT_START); for (int i = 0, tagsSize = tags.size(); i < tagsSize; i++) { Tag tag = tags.get(i); if (i > 0) { jw.writeByte(COMMA); } - DslJsonSerializer.writeStringValue(DslJsonSerializer.sanitizePropertyName(tag.getKey(), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(tag.getKey(), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); - DslJsonSerializer.writeStringValue(tag.getValue(), replaceBuilder, jw); + DslJsonUtil.writeStringValue(tag.getValue(), replaceBuilder, jw); } jw.writeByte(OBJECT_END); jw.writeByte(COMMA); @@ -320,7 +320,7 @@ private static void serializeValueStart(String key, String suffix, JsonWriter jw private static void serializeObjectStart(String key, String objectName, String suffix, JsonWriter jw, StringBuilder replaceBuilder, boolean dedotMetricName) { replaceBuilder.setLength(0); if (dedotMetricName) { - DslJsonSerializer.sanitizePropertyName(key, replaceBuilder); + DslJsonUtil.sanitizePropertyName(key, replaceBuilder); } else { replaceBuilder.append(key); } diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java index 3379ce66cd..6ec9e2cbaa 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java @@ -18,14 +18,12 @@ */ package co.elastic.apm.agent.micrometer; -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.report.Reporter; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.configuration.MetricsConfiguration; import co.elastic.apm.agent.tracer.configuration.ReporterConfiguration; import com.dslplatform.json.JsonWriter; @@ -90,19 +88,17 @@ public class MicrometerMetricsReporter implements Runnable, Closeable { private final WeakMap meterRegistries = WeakConcurrent.buildMap(); private final WeakMap configMap = WeakConcurrent.buildMap(); private final MicrometerMeterRegistrySerializer serializer; - private final Reporter reporter; - private final ElasticApmTracer tracer; + private final Tracer tracer; private final AtomicBoolean scheduledReporting = new AtomicBoolean(); private final boolean disableScheduler; - public MicrometerMetricsReporter(ElasticApmTracer tracer) { + public MicrometerMetricsReporter(Tracer tracer) { this(tracer, false); } //constructor split up to have this available for testing - MicrometerMetricsReporter(ElasticApmTracer tracer, boolean disableSchedulerThread) { + MicrometerMetricsReporter(Tracer tracer, boolean disableSchedulerThread) { this.tracer = tracer; - this.reporter = tracer.getReporter(); tracer.addShutdownHook(this); serializer = new MicrometerMeterRegistrySerializer(tracer.getConfig(MetricsConfiguration.class)); this.disableScheduler = disableSchedulerThread; @@ -135,7 +131,7 @@ private synchronized void scheduleReporting() { // called for every class loader that loaded micrometer // that's because a new MicrometerMetricsReporter instance is created in every IndyPluginClassLoader // for example if multiple webapps use potentially different versions of Micrometer - tracer.getSharedSingleThreadedPool().scheduleAtFixedRate(this, 0, INTERVAL_BETWEEN_CHECKS_IN_MILLISECONDS, TimeUnit.MILLISECONDS); + tracer.schedule(this, INTERVAL_BETWEEN_CHECKS_IN_MILLISECONDS, TimeUnit.MILLISECONDS); } } @@ -147,7 +143,7 @@ public void run() { //run split up to have this available for testing void run(final long now) { - if (tracer.getState() != Tracer.TracerState.RUNNING) { + if (!tracer.isRunning()) { return; } long metricsIntervalMs = tracer.getConfig(ReporterConfiguration.class).getMetricsIntervalMs(); @@ -190,7 +186,7 @@ void run(final long now) { } logger.debug("Reporting {} meters", meterConsumer.meters.size()); for (JsonWriter serializedMetricSet : serializer.serialize(meterConsumer.meters, now * 1000)) { - reporter.reportMetrics(serializedMetricSet); + tracer.reportMetric(serializedMetricSet); } } @@ -220,7 +216,7 @@ private long getStep(MeterRegistry meterRegistry) { public void close() { // flushing out metrics before shutting down // this is especially important for counters as the counts that were accumulated between the last report and the shutdown would otherwise get lost - tracer.getSharedSingleThreadedPool().submit(this); + tracer.submit(this); } private static class MeterMapConsumer implements Consumer { diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/EmbeddedSdkManager.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/EmbeddedSdkManager.java index 9793bbbe76..95c57c60c3 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/EmbeddedSdkManager.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/EmbeddedSdkManager.java @@ -18,11 +18,11 @@ */ package co.elastic.apm.agent.embeddedotel; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.embeddedotel.proxy.ProxyMeterProvider; -import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Tracer; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; @@ -40,14 +40,14 @@ public class EmbeddedSdkManager extends AbstractLifecycleListener { private static final Logger logger = LoggerFactory.getLogger(EmbeddedSdkManager.class); @Nullable - private ElasticApmTracer tracer; + private Tracer tracer; @Nullable private volatile SdkMeterProvider sdkInstance; private boolean isShutdown = false; @Override - public synchronized void start(ElasticApmTracer tracer) throws Exception { + public synchronized void start(Tracer tracer) throws Exception { this.tracer = tracer; } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener similarity index 100% rename from apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener rename to apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/main/java/co/elastic/apm/agent/otelmetricsdk/MetricSetSerializer.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/main/java/co/elastic/apm/agent/otelmetricsdk/MetricSetSerializer.java index de8021c3bd..6484e08906 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/main/java/co/elastic/apm/agent/otelmetricsdk/MetricSetSerializer.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/main/java/co/elastic/apm/agent/otelmetricsdk/MetricSetSerializer.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.otelmetricsdk; import co.elastic.apm.agent.report.Reporter; -import co.elastic.apm.agent.report.serialize.DslJsonSerializer; +import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; import com.dslplatform.json.BoolConverter; import com.dslplatform.json.DslJson; import com.dslplatform.json.JsonWriter; @@ -56,14 +56,14 @@ public MetricSetSerializer(Attributes attributes, CharSequence instrumentationSc jw = DSL_JSON.newWriter(INITIAL_BUFFER_SIZE); jw.writeByte(JsonWriter.OBJECT_START); { - DslJsonSerializer.writeFieldName("metricset", jw); + DslJsonUtil.writeFieldName("metricset", jw); jw.writeByte(JsonWriter.OBJECT_START); { - DslJsonSerializer.writeFieldName("timestamp", jw); + DslJsonUtil.writeFieldName("timestamp", jw); NumberConverter.serialize(epochMicros, jw); jw.writeByte(JsonWriter.COMMA); serializeAttributes(instrumentationScopeName, attributes); - DslJsonSerializer.writeFieldName("samples", jw); + DslJsonUtil.writeFieldName("samples", jw); jw.writeByte(JsonWriter.OBJECT_START); } } @@ -188,7 +188,7 @@ private void serializeAttributes(CharSequence instrumentationScopeName, Attribut if (attributeMap.isEmpty() && instrumentationScopeName.length() == 0) { return; } - DslJsonSerializer.writeFieldName("tags", jw); + DslJsonUtil.writeFieldName("tags", jw); jw.writeByte(OBJECT_START); boolean anyWritten = false; if (instrumentationScopeName.length() > 0) { @@ -210,7 +210,7 @@ private boolean serializeAttribute(AttributeKey key, @Nullable Object value, if (prependComma) { jw.writeByte(COMMA); } - DslJsonSerializer.writeStringValue(DslJsonSerializer.sanitizePropertyName(key.getKey(), replaceBuilder), replaceBuilder, jw); + DslJsonUtil.writeStringValue(DslJsonUtil.sanitizePropertyName(key.getKey(), replaceBuilder), replaceBuilder, jw); jw.writeByte(JsonWriter.SEMI); AttributeType type = key.getType(); diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingFactory.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingFactory.java index 400e28623c..e7ddcb77a4 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingFactory.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingFactory.java @@ -18,8 +18,9 @@ */ package co.elastic.apm.agent.profiler; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.tracer.Tracer; public class ProfilingFactory extends AbstractLifecycleListener { @@ -35,9 +36,10 @@ public ProfilingFactory(ElasticApmTracer tracer) { } @Override - public void start(ElasticApmTracer tracer) { + public void start(Tracer tracer) throws Exception { profiler.start(tracer); - tracer.registerSpanListener(new ProfilingActivationListener(tracer, profiler)); + ElasticApmTracer elasticApmTracer = tracer.require(ElasticApmTracer.class); + elasticApmTracer.registerSpanListener(new ProfilingActivationListener(elasticApmTracer, profiler)); } @Override diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java index 1a33248b5a..0c8cb3f674 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.profiler; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.context.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.transaction.Span; import co.elastic.apm.agent.impl.transaction.StackFrame; @@ -30,6 +30,7 @@ import co.elastic.apm.agent.sdk.internal.util.ExecutorUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.configuration.CoreConfiguration; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.tracer.pooling.Allocator; @@ -697,7 +698,7 @@ void copyFromFiles(Path activationEvents, Path traces) throws IOException { } @Override - public void start(ElasticApmTracer tracer) { + public void start(Tracer tracer) { scheduler.submit(this); } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener b/apm-agent-plugins/apm-profiling-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener similarity index 100% rename from apm-agent-plugins/apm-profiling-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener rename to apm-agent-plugins/apm-profiling-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener diff --git a/apm-agent-tracer/pom.xml b/apm-agent-tracer/pom.xml index dccd4562ed..096102758d 100644 --- a/apm-agent-tracer/pom.xml +++ b/apm-agent-tracer/pom.xml @@ -24,6 +24,11 @@ apm-agent-common ${project.version} + + com.dslplatform + dsl-json + 1.9.3 + net.bytebuddy diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/context/AbstractLifecycleListener.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/AbstractLifecycleListener.java similarity index 83% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/context/AbstractLifecycleListener.java rename to apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/AbstractLifecycleListener.java index 02c4f0c0be..6489ae1441 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/context/AbstractLifecycleListener.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/AbstractLifecycleListener.java @@ -16,17 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package co.elastic.apm.agent.context; - -import co.elastic.apm.agent.impl.ElasticApmTracer; +package co.elastic.apm.agent.tracer; public abstract class AbstractLifecycleListener implements LifecycleListener { @Override - public void init(ElasticApmTracer tracer) throws Exception { + public void init(Tracer tracer) throws Exception { } @Override - public void start(ElasticApmTracer tracer) throws Exception { + public void start(Tracer tracer) throws Exception { } @Override diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java index 9cae3d1b20..692ffdca5e 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java @@ -19,13 +19,17 @@ package co.elastic.apm.agent.tracer; import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.pooling.ObjectPoolFactory; import co.elastic.apm.agent.tracer.reference.ReferenceCounted; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.tracer.service.Service; +import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; import java.util.Set; +import java.util.concurrent.TimeUnit; public class GlobalTracer implements Tracer { @@ -166,4 +170,35 @@ public void flush() { public void completeMetaData(String name, String version, String id, String region) { tracer.completeMetaData(name, version, id, region); } + + @Override + public void removeGauge(String name, Labels.Immutable labels) { + tracer.removeGauge(name, labels); + } + + @Override + public void addGauge(String name, Labels.Immutable labels, DoubleSupplier supplier) { + tracer.addGauge(name, labels, supplier); + } + + @Override + public void submit(Runnable job) { + tracer.submit(job); + } + + @Override + public void schedule(Runnable job, long interval, TimeUnit timeUnit) { + tracer.schedule(job, interval, timeUnit); + } + + @Override + public void addShutdownHook(AutoCloseable hook) { + tracer.addShutdownHook(hook); + } + + @Override + public void reportMetric(JsonWriter metrics) { + tracer.reportMetric(metrics); + } + } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/context/LifecycleListener.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/LifecycleListener.java similarity index 74% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/context/LifecycleListener.java rename to apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/LifecycleListener.java index 3b4716518c..a1b55634c4 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/context/LifecycleListener.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/LifecycleListener.java @@ -16,42 +16,39 @@ * specific language governing permissions and limitations * under the License. */ -package co.elastic.apm.agent.context; - -import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.Tracer; +package co.elastic.apm.agent.tracer; /** - * A {@link LifecycleListener} notifies about the start and stop event of the {@link ElasticApmTracer}. + * A {@link LifecycleListener} notifies about the start and stop event of the {@link Tracer}. *

* Implement this interface and register it as a {@linkplain java.util.ServiceLoader service} under - * {@code src/main/resources/META-INF/services/co.elastic.apm.agent.context.LifecycleListener}. + * {@code src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener}. *

*

- * Implementations may have a constructor with an {@link ElasticApmTracer} argument + * Implementations may have a constructor with an {@link Tracer} argument *

*/ public interface LifecycleListener { /** - * Callback for tracer initialization. As opposed to {@link LifecycleListener#start(ElasticApmTracer)}, which may + * Callback for tracer initialization. As opposed to {@link LifecycleListener#start(Tracer)}, which may * be called in a delay, this callback is called at the bootstrap of the JVM, before anything else start. * This may be useful for listeners that need to operate very early on, for example such that setup class loading * requirement to support OSGi systems. * @param tracer the tracer * @throws Exception */ - void init(ElasticApmTracer tracer) throws Exception; + void init(Tracer tracer) throws Exception; /** - * Callback for when the {@link ElasticApmTracer} starts. + * Callback for when the {@link Tracer} starts. * * @param tracer The tracer. */ - void start(ElasticApmTracer tracer) throws Exception; + void start(Tracer tracer) throws Exception; /** - * Callback for when {@link ElasticApmTracer#pause()} has been called. + * Callback for when the {@link Tracer} is paused. *

* Typically, this method is used to reduce overhead on the application to a minimum. This can be done by cleaning * up resources like object pools, as well as by avoiding tracing-related overhead. @@ -65,7 +62,7 @@ public interface LifecycleListener { void pause() throws Exception; /** - * Callback for when {@link ElasticApmTracer#resume()} has been called. + * Callback for when {@link Tracer} resumes. *

* Typically, used in order to revert the actions taken by the {@link LifecycleListener#pause()} method, allowing * the agent to restore all tracing capabilities @@ -79,7 +76,7 @@ public interface LifecycleListener { void resume() throws Exception; /** - * Callback for when {@link ElasticApmTracer#stop()} has been called. + * Callback for when the {@link Tracer} is stopped. *

* Typically, this method is used to clean up resources like thread pools * so that there are no class loader leaks when a webapp is redeployed in an application server. @@ -96,17 +93,14 @@ public interface LifecycleListener { * The order in which lifecycle listeners are called is non-deterministic. * *

  • - * The {@link ElasticApmTracer#getSharedSingleThreadedPool()} is shut down gracefully, + * Any {@link Tracer}-managed thread pool is shut down gracefully, * waiting a moment for the already scheduled tasks to be completed. * This means that implementations of this method can schedule a last command to this pool that is executed before shutdown. - * The {@link Tracer#getState()} will still be {@link Tracer.TracerState#RUNNING} in the tasks scheduled to - * {@link ElasticApmTracer#getSharedSingleThreadedPool()} within this method. - *
  • - *
  • - * The tracer state is set to {@link co.elastic.apm.agent.impl.Tracer.TracerState#STOPPED}. + * The {@link Tracer#isRunning()} will still be {@code true} in the tasks scheduled to + * complete within {@link Tracer}-managed threads within this method. *
  • *
  • - * The {@link co.elastic.apm.agent.report.Reporter} is closed. + * The tracer state is set to {@link Tracer#isRunning()} being {@code false}. *
  • * * diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java index ac1610f99d..85fab5a76a 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java @@ -19,15 +19,18 @@ package co.elastic.apm.agent.tracer; import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.pooling.ObjectPoolFactory; import co.elastic.apm.agent.tracer.reference.ReferenceCounted; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.tracer.service.Service; +import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; -import java.io.IOException; import java.util.Collections; import java.util.Set; +import java.util.concurrent.TimeUnit; class NoopTracer implements Tracer { @@ -140,4 +143,28 @@ public void flush() { @Override public void completeMetaData(String name, String version, String id, String region) { } + + @Override + public void addGauge(String name, Labels.Immutable labels, DoubleSupplier supplier) { + } + + @Override + public void removeGauge(String name, Labels.Immutable labels) { + } + + @Override + public void submit(Runnable job) { + } + + @Override + public void schedule(Runnable job, long interval, TimeUnit timeUnit) { + } + + @Override + public void addShutdownHook(AutoCloseable hook) { + } + + @Override + public void reportMetric(JsonWriter metrics) { + } } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java index 666ea4fca6..4f1d6efc2e 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java @@ -19,13 +19,17 @@ package co.elastic.apm.agent.tracer; import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; +import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; +import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.pooling.ObjectPoolFactory; import co.elastic.apm.agent.tracer.reference.ReferenceCounted; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.tracer.service.Service; +import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; import java.util.Set; +import java.util.concurrent.TimeUnit; public interface Tracer { @@ -92,6 +96,18 @@ public interface Tracer { @Nullable Throwable redactExceptionIfRequired(@Nullable Throwable original); + void removeGauge(String name, Labels.Immutable labels); + + void addGauge(String name, Labels.Immutable labels, DoubleSupplier supplier); + + void submit(Runnable job); + + void schedule(Runnable job, long interval, TimeUnit timeUnit); + + void addShutdownHook(AutoCloseable hook); + + void reportMetric(JsonWriter metrics); // TODO: replace with internalized DSL writer that only accepts data. + void flush(); void completeMetaData(String name, String version, String id, String region); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/DoubleSupplier.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DoubleSupplier.java similarity index 94% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/DoubleSupplier.java rename to apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DoubleSupplier.java index 120a72221d..7f5087b653 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/DoubleSupplier.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DoubleSupplier.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package co.elastic.apm.agent.metrics; +package co.elastic.apm.agent.tracer.metrics; public interface DoubleSupplier { diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DslJsonUtil.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DslJsonUtil.java new file mode 100644 index 0000000000..256c8def4d --- /dev/null +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/DslJsonUtil.java @@ -0,0 +1,80 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.tracer.metrics; + +import com.dslplatform.json.JsonWriter; + +public class DslJsonUtil { + + public static final int MAX_VALUE_LENGTH = 1024; + + private static final String[] DISALLOWED_IN_PROPERTY_NAME = new String[]{".", "*", "\""}; + + public static void writeFieldName(final String fieldName, final JsonWriter jw) { + jw.writeByte(JsonWriter.QUOTE); + jw.writeAscii(fieldName); + jw.writeByte(JsonWriter.QUOTE); + jw.writeByte(JsonWriter.SEMI); + } + + + public static CharSequence sanitizePropertyName(String key, StringBuilder replaceBuilder) { + for (int i = 0; i < DISALLOWED_IN_PROPERTY_NAME.length; i++) { + if (key.contains(DISALLOWED_IN_PROPERTY_NAME[i])) { + return replaceAll(key, DISALLOWED_IN_PROPERTY_NAME, "_", replaceBuilder); + } + } + return key; + } + + private static CharSequence replaceAll(String s, String[] stringsToReplace, String replacement, StringBuilder replaceBuilder) { + // uses a instance variable StringBuilder to avoid allocations + replaceBuilder.setLength(0); + replaceBuilder.append(s); + for (String toReplace : stringsToReplace) { + replace(replaceBuilder, toReplace, replacement, 0); + } + return replaceBuilder; + } + + static void replace(StringBuilder replaceBuilder, String toReplace, String replacement, int fromIndex) { + for (int i = replaceBuilder.indexOf(toReplace, fromIndex); i != -1; i = replaceBuilder.indexOf(toReplace, fromIndex)) { + replaceBuilder.replace(i, i + toReplace.length(), replacement); + fromIndex = i; + } + } + + public static void writeStringValue(CharSequence value, final StringBuilder replaceBuilder, final JsonWriter jw) { + if (value.length() > MAX_VALUE_LENGTH) { + replaceBuilder.setLength(0); + replaceBuilder.append(value, 0, Math.min(value.length(), MAX_VALUE_LENGTH + 1)); + writeStringBuilderValue(replaceBuilder, jw); + } else { + jw.writeString(value); + } + } + + private static void writeStringBuilderValue(StringBuilder value, JsonWriter jw) { + if (value.length() > MAX_VALUE_LENGTH) { + value.setLength(MAX_VALUE_LENGTH - 1); + value.append('…'); + } + jw.writeString(value); + } +} diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/Labels.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/Labels.java similarity index 98% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/Labels.java rename to apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/Labels.java index c6a2e0475d..a48076bbed 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/Labels.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metrics/Labels.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package co.elastic.apm.agent.metrics; +package co.elastic.apm.agent.tracer.metrics; import co.elastic.apm.agent.tracer.pooling.Recyclable; @@ -31,10 +31,6 @@ * However, there are also top-level labels which are not nested under the {@code labels} object, * for example {@link #getTransactionName()}, {@link #getTransactionType()}, {@link #getSpanType()} and {@link #getSpanSubType()}. *

    - * Metrics are structured into multiple {@link MetricSet}s. - * For each distinct combination of {@link Labels}, there is one {@link MetricSet}. - *

    - *

    * Labels allow for {@link CharSequence}s as a value, * thus avoiding allocations for {@code transaction.name.toString()} when tracking breakdown metrics for a transaction. * Iterations over the labels also don't allocate an Iterator, in contrast to {@code Map.entrySet().iterator()}. diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/LabelsTest.java b/apm-agent-tracer/src/test/java/co/elastic/apm/agent/tracer/metrics/LabelsTest.java similarity index 99% rename from apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/LabelsTest.java rename to apm-agent-tracer/src/test/java/co/elastic/apm/agent/tracer/metrics/LabelsTest.java index 21e55850c0..ef68d9a229 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/LabelsTest.java +++ b/apm-agent-tracer/src/test/java/co/elastic/apm/agent/tracer/metrics/LabelsTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package co.elastic.apm.agent.metrics; +package co.elastic.apm.agent.tracer.metrics; import org.junit.jupiter.api.Test; From 3c4a753619c4bb9ec0b2f98bd0a5da3eedeb1f8b Mon Sep 17 00:00:00 2001 From: Nugusbayev Kanagat <48118512+videnkz@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:02:36 +0500 Subject: [PATCH 014/132] differentiate Lambda url from api gateway (#3417) --------- Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- CHANGELOG.asciidoc | 4 ++++ .../APIGatewayProxyV1TransactionHelper.java | 9 +++++++++ .../APIGatewayProxyV2TransactionHelper.java | 19 +++++++++++++------ .../AbstractAPIGatewayTransactionHelper.java | 18 +++++++++++++++++- .../awslambda/ApiGatewayV1LambdaTest.java | 11 +++++++++++ .../awslambda/ApiGatewayV2LambdaTest.java | 12 ++++++++++++ 6 files changed, 66 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index c989a23500..6f863ba558 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -35,6 +35,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: ===== Bug fixes * Fixed problems with public API annotation inheritance - {pull}3551[#3551] +[float] +===== Features +* Differentiate Lambda URLs from API Gateway in AWS Lambda integration - {pull}3417[#3417] + [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java index 20cbe4c828..3d13b5f35c 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java @@ -111,6 +111,15 @@ protected void setTransactionTriggerData(Transaction transaction, APIGatewayP } } + @Override + public String getDomainName(APIGatewayProxyRequestEvent apiGatewayRequest) { + APIGatewayProxyRequestEvent.ProxyRequestContext rContext = apiGatewayRequest.getRequestContext(); + if (null == rContext) { + return null; + } + return rContext.getDomainName(); + } + @Override protected String getApiGatewayVersion() { return "1.0"; diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java index db3edf620b..f912577f92 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.awslambda.helper; import co.elastic.apm.agent.awslambda.MapTextHeaderGetter; -import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.tracer.Tracer; +import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Transaction; +import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse; @@ -45,8 +45,8 @@ public static APIGatewayProxyV2TransactionHelper getInstance() { } @Override - protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, Context lambdaContext) { - Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); + protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, Context lambdaContext) { + Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); APIGatewayV2HTTPEvent.RequestContext requestContext = apiGatewayEvent.getRequestContext(); if (transaction != null) { @@ -60,12 +60,12 @@ protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEven } @Override - public void captureOutputForTransaction(Transaction transaction, APIGatewayV2HTTPResponse responseEvent) { + public void captureOutputForTransaction(Transaction transaction, APIGatewayV2HTTPResponse responseEvent) { fillHttpResponseData(transaction, responseEvent.getHeaders(), responseEvent.getStatusCode()); } @Override - protected void setTransactionTriggerData(Transaction transaction, APIGatewayV2HTTPEvent apiGatewayRequest) { + protected void setTransactionTriggerData(Transaction transaction, APIGatewayV2HTTPEvent apiGatewayRequest) { super.setTransactionTriggerData(transaction, apiGatewayRequest); APIGatewayV2HTTPEvent.RequestContext rContext = apiGatewayRequest.getRequestContext(); setApiGatewayContextData(transaction, rContext.getRequestId(), rContext.getApiId(), @@ -112,4 +112,11 @@ protected String getResourcePath(APIGatewayV2HTTPEvent event) { } return routeKey; } + + @Nullable + @Override + String getDomainName(APIGatewayV2HTTPEvent apiGatewayRequest) { + APIGatewayV2HTTPEvent.RequestContext requestContext = apiGatewayRequest.getRequestContext(); + return requestContext != null ? requestContext.getDomainName() : null; + } } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java index b30ba86151..542eed68f6 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java @@ -30,6 +30,7 @@ import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; import com.amazonaws.services.lambda.runtime.Context; +import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import javax.annotation.Nullable; import java.nio.CharBuffer; @@ -124,12 +125,27 @@ private boolean hasBody(@Nullable String contentTypeHeader, @Nullable String met protected void setTransactionTriggerData(Transaction transaction, I apiGatewayRequest) { transaction.withType(TRANSACTION_TYPE); CloudOrigin cloudOrigin = transaction.getContext().getCloudOrigin(); - cloudOrigin.withServiceName("api gateway"); + if (isLambdaUrl(apiGatewayRequest)) { + cloudOrigin.withServiceName("lambda url"); + } else { + cloudOrigin.withServiceName("api gateway"); + } cloudOrigin.withProvider("aws"); transaction.getFaas().getTrigger().withType("http"); transaction.getContext().getServiceOrigin().withVersion(getApiGatewayVersion()); } + private boolean isLambdaUrl(I apiGatewayRequest) { + String domainName = getDomainName(apiGatewayRequest); + if (null == domainName) { + return false; + } + return domainName.contains(".lambda-url."); + } + + @Nullable + abstract String getDomainName(I apiGatewayRequest); + protected void setApiGatewayContextData(Transaction transaction, @Nullable String requestId, @Nullable String apiId, @Nullable String domainName, @Nullable String accountId) { transaction.getFaas().getTrigger().withRequestId(requestId); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java index c6e0be6e30..6aa7f622b0 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java @@ -256,6 +256,17 @@ public void testTransactionNameWithUsePathAsName() { assertThat(reporter.getFirstTransaction().getNameAsString()).isEqualTo("PUT /prod/proxy-test/12345"); } + @Test + public void testServiceNameAsLambdaUrl() { + APIGatewayProxyRequestEvent event = createInput(); + event.getRequestContext().setDomainName("myurl.lambda-url.us-west-2.on.aws"); + getFunction().handleRequest(event, context); + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + Transaction transaction = reporter.getFirstTransaction(); + assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isEqualTo("lambda url"); + } + @Override protected AbstractFunction createHandler() { return new ApiGatewayV1LambdaFunction(); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java index d2a7cd73b4..d98e652551 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java @@ -31,6 +31,7 @@ import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; +import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse; import org.junit.BeforeClass; @@ -249,6 +250,17 @@ public void testTransactionNameWithUsePathAsName() { assertThat(reporter.getFirstTransaction().getNameAsString()).isEqualTo("PUT /prod/proxy-test/12345"); } + @Test + public void testServiceNameAsLambdaUrl() { + APIGatewayV2HTTPEvent event = createInput(); + event.getRequestContext().setDomainName("myurl.lambda-url.us-west-2.on.aws"); + getFunction().handleRequest(event, context); + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + Transaction transaction = reporter.getFirstTransaction(); + assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isEqualTo("lambda url"); + } + @Override protected AbstractFunction createHandler() { return new ApiGatewayV2LambdaFunction(); From 3b22aada9ac2d7bee8beb028ce9fbdd822b5b2d6 Mon Sep 17 00:00:00 2001 From: Nugusbayev Kanagat <48118512+videnkz@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:01:25 +0500 Subject: [PATCH 015/132] added support to Elastic Load Balancer triggers (#3411) --------- Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- CHANGELOG.asciidoc | 3 +- .../APIGatewayProxyV1TransactionHelper.java | 43 +--- .../APIGatewayProxyV2TransactionHelper.java | 8 +- .../awslambda/helper/AWSEventsHelper.java | 7 + .../AbstractAPIGatewayTransactionHelper.java | 43 +++- ...nLoadBalancerRequestTransactionHelper.java | 164 +++++++++++++++ ...LoadBalancerElbTargetGroupArnMetadata.java | 70 +++++++ .../agent/awslambda/AbstractLambdaTest.java | 1 + .../awslambda/ApiGatewayV1LambdaTest.java | 43 +--- .../awslambda/ApiGatewayV2LambdaTest.java | 43 +--- ...ionLoadBalancerRequestEventLambdaTest.java | 197 ++++++++++++++++++ .../awslambda/BaseGatewayLambdaTest.java | 75 +++++++ ...tionLoadBalancerRequestLambdaFunction.java | 52 +++++ 13 files changed, 617 insertions(+), 132 deletions(-) create mode 100644 apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/ApplicationLoadBalancerRequestTransactionHelper.java create mode 100644 apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/LoadBalancerElbTargetGroupArnMetadata.java create mode 100644 apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java create mode 100644 apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java create mode 100644 apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/lambdas/ApplicationLoadBalancerRequestLambdaFunction.java diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 6f863ba558..35349f1556 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -38,6 +38,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [float] ===== Features * Differentiate Lambda URLs from API Gateway in AWS Lambda integration - {pull}3417[#3417] +* Added lambda support for ELB triggers {pull}#3411[#3411] [[release-notes-1.x]] === Java Agent version 1.x @@ -127,7 +128,7 @@ affect you, if you are using the OpenTelemetry API only and not the SDK. - {pull ===== Features * Added protection against invalid timestamps provided by manual instrumentation - {pull}3363[#3363] * Added support for AWS SDK 2.21 - {pull}3373[#3373] -* Capture bucket and object key to Lambda transaction as OTel attributes - `aws.s3.bueckt`, `aws.s3.key` - {pull}3364[#3364] +* Capture bucket and object key to Lambda transaction as OTel attributes - `aws.s3.bucket`, `aws.s3.key` - {pull}3364[#3364] * Added `context_propagation_only` configuration option - {pull}3358[#3358] * Added attribute[*] for JMX pattern metrics (all metrics can now be generated with `object_name[*:type=*,name=*] attribute[*]`) - {pull}3376[#3376] diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java index 3d13b5f35c..a923707937 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV1TransactionHelper.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.awslambda.helper; import co.elastic.apm.agent.awslambda.MapTextHeaderGetter; -import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.Transaction; import com.amazonaws.services.lambda.runtime.Context; @@ -28,7 +28,6 @@ import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; import javax.annotation.Nullable; -import java.util.Map; public class APIGatewayProxyV1TransactionHelper extends AbstractAPIGatewayTransactionHelper { @@ -49,48 +48,17 @@ public static APIGatewayProxyV1TransactionHelper getInstance() { @Override protected Transaction doStartTransaction(APIGatewayProxyRequestEvent apiGatewayEvent, Context lambdaContext) { Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); - String host = getHost(apiGatewayEvent); if (null != transaction) { + String host = getHost(apiGatewayEvent.getHeaders()); + fillHttpRequestData(transaction, getHttpMethod(apiGatewayEvent), apiGatewayEvent.getHeaders(), host, - apiGatewayEvent.getRequestContext().getPath(), getQueryString(apiGatewayEvent), apiGatewayEvent.getBody()); + apiGatewayEvent.getRequestContext().getPath(), getQueryString(apiGatewayEvent.getQueryStringParameters()), apiGatewayEvent.getBody()); } return transaction; } - @Nullable - private String getHost(APIGatewayProxyRequestEvent apiGatewayEvent) { - String host = null; - if (null != apiGatewayEvent.getHeaders()) { - host = apiGatewayEvent.getHeaders().get("host"); - if (null == host) { - host = apiGatewayEvent.getHeaders().get("Host"); - } - } - return host; - } - - @Nullable - private String getQueryString(APIGatewayProxyRequestEvent apiGatewayEvent) { - Map queryParameters = apiGatewayEvent.getQueryStringParameters(); - if (null != queryParameters && !queryParameters.isEmpty()) { - StringBuilder queryString = new StringBuilder(); - int i = 0; - for (Map.Entry entry : apiGatewayEvent.getQueryStringParameters().entrySet()) { - if (i > 0) { - queryString.append('&'); - } - queryString.append(entry.getKey()); - queryString.append('='); - queryString.append(entry.getValue()); - i++; - } - return queryString.toString(); - } - return null; - } - @Override public void captureOutputForTransaction(Transaction transaction, APIGatewayProxyResponseEvent responseEvent) { Integer statusCode = responseEvent.getStatusCode(); @@ -107,7 +75,7 @@ protected void setTransactionTriggerData(Transaction transaction, APIGatewayP if (null != rContext) { setApiGatewayContextData(transaction, rContext.getRequestId(), rContext.getApiId(), - getHost(apiGatewayRequest), rContext.getAccountId()); + getHost(apiGatewayRequest.getHeaders()), rContext.getAccountId()); } } @@ -149,4 +117,5 @@ protected String getStage(APIGatewayProxyRequestEvent event) { protected String getResourcePath(APIGatewayProxyRequestEvent event) { return event.getRequestContext().getResourcePath(); } + } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java index f912577f92..0ba8476c22 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/APIGatewayProxyV2TransactionHelper.java @@ -45,8 +45,8 @@ public static APIGatewayProxyV2TransactionHelper getInstance() { } @Override - protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, Context lambdaContext) { - Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); + protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, Context lambdaContext) { + Transaction transaction = tracer.startChildTransaction(apiGatewayEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(apiGatewayEvent.getClass())); APIGatewayV2HTTPEvent.RequestContext requestContext = apiGatewayEvent.getRequestContext(); if (transaction != null) { @@ -60,12 +60,12 @@ protected Transaction doStartTransaction(APIGatewayV2HTTPEvent apiGatewayEvent, } @Override - public void captureOutputForTransaction(Transaction transaction, APIGatewayV2HTTPResponse responseEvent) { + public void captureOutputForTransaction(Transaction transaction, APIGatewayV2HTTPResponse responseEvent) { fillHttpResponseData(transaction, responseEvent.getHeaders(), responseEvent.getStatusCode()); } @Override - protected void setTransactionTriggerData(Transaction transaction, APIGatewayV2HTTPEvent apiGatewayRequest) { + protected void setTransactionTriggerData(Transaction transaction, APIGatewayV2HTTPEvent apiGatewayRequest) { super.setTransactionTriggerData(transaction, apiGatewayRequest); APIGatewayV2HTTPEvent.RequestContext rContext = apiGatewayRequest.getRequestContext(); setApiGatewayContextData(transaction, rContext.getRequestId(), rContext.getApiId(), diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java index b72c423c79..ae4f268ac8 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AWSEventsHelper.java @@ -24,6 +24,8 @@ import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse; +import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerRequestEvent; +import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerResponseEvent; import com.amazonaws.services.lambda.runtime.events.S3Event; import com.amazonaws.services.lambda.runtime.events.SNSEvent; import com.amazonaws.services.lambda.runtime.events.SQSEvent; @@ -50,6 +52,9 @@ public static Transaction startTransaction(Object input, Context lambdaContex } else if (input instanceof S3Event) { // S3 event trigger return S3TransactionHelper.getInstance().startTransaction((S3Event) input, lambdaContext); + } else if (input instanceof ApplicationLoadBalancerRequestEvent) { + // Load Balancer Request event trigger + return ApplicationLoadBalancerRequestTransactionHelper.getInstance().startTransaction((ApplicationLoadBalancerRequestEvent) input, lambdaContext); } return PlainTransactionHelper.getInstance().startTransaction(input, lambdaContext); } @@ -59,6 +64,8 @@ public static void finalizeTransaction(Transaction transaction, Object output APIGatewayProxyV2TransactionHelper.getInstance().finalizeTransaction(transaction, (APIGatewayV2HTTPResponse) output, thrown); } else if (output instanceof APIGatewayProxyResponseEvent) { APIGatewayProxyV1TransactionHelper.getInstance().finalizeTransaction(transaction, (APIGatewayProxyResponseEvent) output, thrown); + } else if (output instanceof ApplicationLoadBalancerResponseEvent) { + ApplicationLoadBalancerRequestTransactionHelper.getInstance().finalizeTransaction(transaction, (ApplicationLoadBalancerResponseEvent) output, thrown); } else { // use PlainTransactionHelper for all triggers that do not expect an output PlainTransactionHelper.getInstance().finalizeTransaction(transaction, output, thrown); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java index 542eed68f6..b8e2f30e0c 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/AbstractAPIGatewayTransactionHelper.java @@ -18,6 +18,10 @@ */ package co.elastic.apm.agent.awslambda.helper; +import co.elastic.apm.agent.common.util.WildcardMatcher; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.ServiceOrigin; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.Transaction; @@ -25,12 +29,7 @@ import co.elastic.apm.agent.tracer.metadata.Request; import co.elastic.apm.agent.tracer.metadata.Response; import co.elastic.apm.agent.tracer.util.ResultUtil; -import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.sdk.logging.Logger; -import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.AbstractSpan; import com.amazonaws.services.lambda.runtime.Context; -import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import javax.annotation.Nullable; import java.nio.CharBuffer; @@ -68,6 +67,38 @@ protected void fillHttpRequestData(Transaction transaction, @Nullable String } } + @Nullable + protected String getHost(@Nullable Map headers) { + if (null == headers) { + return null; + } + String host = headers.get("host"); + if (null == host) { + host = headers.get("Host"); + } + return host; + } + + @Nullable + protected String getQueryString(@Nullable Map queryParameters) { + if (null == queryParameters || queryParameters.isEmpty()) { + return null; + } + StringBuilder queryString = new StringBuilder(); + int i = 0; + for (Map.Entry entry : queryParameters.entrySet()) { + if (i > 0) { + queryString.append('&'); + } + queryString.append(entry.getKey()); + queryString.append('='); + queryString.append(entry.getValue()); + i++; + } + return queryString.toString(); + } + + protected void fillHttpResponseData(Transaction transaction, @Nullable Map headers, int statusCode) { Response response = transaction.getContext().getResponse(); response.withFinished(true); @@ -82,7 +113,7 @@ protected void fillHttpResponseData(Transaction transaction, @Nullable Map { + @Nullable + private static ApplicationLoadBalancerRequestTransactionHelper INSTANCE; + + private ApplicationLoadBalancerRequestTransactionHelper(Tracer tracer) { + super(tracer); + } + + public static ApplicationLoadBalancerRequestTransactionHelper getInstance() { + if (INSTANCE == null) { + INSTANCE = new ApplicationLoadBalancerRequestTransactionHelper(GlobalTracer.get()); + } + return INSTANCE; + } + + @Override + protected Transaction doStartTransaction(ApplicationLoadBalancerRequestEvent loadBalancerRequestEvent, Context lambdaContext) { + Transaction transaction = tracer.startChildTransaction(loadBalancerRequestEvent.getHeaders(), MapTextHeaderGetter.INSTANCE, PrivilegedActionUtils.getClassLoader(loadBalancerRequestEvent.getClass())); + + if (transaction != null) { + String host = getHost(loadBalancerRequestEvent.getHeaders()); + super.fillHttpRequestData(transaction, loadBalancerRequestEvent.getHttpMethod(), loadBalancerRequestEvent.getHeaders(), host, + loadBalancerRequestEvent.getPath(), getQueryString(loadBalancerRequestEvent.getQueryStringParameters()), loadBalancerRequestEvent.getBody()); + } + + return transaction; + } + + @Override + public void captureOutputForTransaction(Transaction transaction, ApplicationLoadBalancerResponseEvent responseEvent) { + fillHttpResponseData(transaction, responseEvent.getHeaders(), responseEvent.getStatusCode()); + } + + @Override + protected void setTransactionTriggerData(Transaction transaction, ApplicationLoadBalancerRequestEvent loadBalancerRequestEvent) { + transaction.withType(TRANSACTION_TYPE); + CloudOrigin cloudOrigin = transaction.getContext().getCloudOrigin(); + cloudOrigin.withServiceName("elb"); + cloudOrigin.withProvider("aws"); + FaasTrigger faasTrigger = transaction.getFaas().getTrigger(); + faasTrigger.withType("http"); + faasTrigger.withRequestId(getHeader(loadBalancerRequestEvent, "x-amzn-trace-id")); + LoadBalancerElbTargetGroupArnMetadata metadata = parseMetadata(loadBalancerRequestEvent); + if (null != metadata) { + ServiceOrigin serviceOrigin = transaction.getContext().getServiceOrigin(); + serviceOrigin.withName(metadata.getTargetGroupName()); + serviceOrigin.withId(metadata.getTargetGroupArn()); + cloudOrigin.withAccountId(metadata.getAccountId()); + cloudOrigin.withRegion(metadata.getCloudRegion()); + } + } + + @Nullable + private String getHeader(@Nonnull ApplicationLoadBalancerRequestEvent loadBalancerRequestEvent, + @Nonnull String headerName) { + Map headers = loadBalancerRequestEvent.getHeaders(); + if (null == headers) { + return null; + } + return headers.get(headerName); + } + + @Nullable + private LoadBalancerElbTargetGroupArnMetadata parseMetadata(ApplicationLoadBalancerRequestEvent event) { + if (null == event.getRequestContext()) { + return null; + } + ApplicationLoadBalancerRequestEvent.Elb elb = event.getRequestContext().getElb(); + if (null == elb) { + return null; + } + String targetGroupArn = elb.getTargetGroupArn(); + if (null == targetGroupArn) { + return null; + } + LoadBalancerElbTargetGroupArnMetadata metadata = new LoadBalancerElbTargetGroupArnMetadata(targetGroupArn); + String[] arnParts = targetGroupArn.split(":"); + int arnPartsLength = arnParts.length; + if (arnPartsLength < 4) { + return metadata; + } + metadata.withCloudRegion(arnParts[3]); + if (arnPartsLength < 5) { + return metadata; + } + metadata.withAccountId(arnParts[4]); + if (arnPartsLength < 6) { + return metadata; + } + String targetGroup = arnParts[5]; + String[] targetGroupParts = targetGroup.split("/"); + if (targetGroupParts.length < 2) { + return metadata; + } + return metadata.withTargetGroupName(targetGroupParts[2]); + } + + @Override + protected String getApiGatewayVersion() { + throw new UnsupportedOperationException("Not supported by ELB"); + } + + @Nullable + @Override + protected String getHttpMethod(ApplicationLoadBalancerRequestEvent event) { + return event.getHttpMethod(); + } + + @Nullable + @Override + protected String getRequestContextPath(ApplicationLoadBalancerRequestEvent event) { + return event.getPath(); + } + + @Nullable + @Override + protected String getStage(ApplicationLoadBalancerRequestEvent event) { + throw new UnsupportedOperationException("Not supported by ELB"); + } + + @Nullable + @Override + protected String getResourcePath(ApplicationLoadBalancerRequestEvent event) { + return null; + } + + @Nullable + @Override + String getDomainName(ApplicationLoadBalancerRequestEvent apiGatewayRequest) { + return null; + } +} diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/LoadBalancerElbTargetGroupArnMetadata.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/LoadBalancerElbTargetGroupArnMetadata.java new file mode 100644 index 0000000000..a87af8e85c --- /dev/null +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/LoadBalancerElbTargetGroupArnMetadata.java @@ -0,0 +1,70 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.awslambda.helper; + + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class LoadBalancerElbTargetGroupArnMetadata { + + private LoadBalancerElbTargetGroupArnMetadata() {} + public LoadBalancerElbTargetGroupArnMetadata(String targetGroupArn) { + this.targetGroupArn = targetGroupArn; + } + private String targetGroupArn; + private String cloudRegion; + private String accountId; + private String targetGroupName; + + public LoadBalancerElbTargetGroupArnMetadata withCloudRegion(String cloudRegion) { + this.cloudRegion = cloudRegion; + return this; + } + + @Nullable + public String getCloudRegion() { + return cloudRegion; + } + + public LoadBalancerElbTargetGroupArnMetadata withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + public LoadBalancerElbTargetGroupArnMetadata withTargetGroupName(String targetGroupName) { + this.targetGroupName = targetGroupName; + return this; + } + + @Nonnull + public String getTargetGroupArn() { + return targetGroupArn; + } + + @Nullable + public String getAccountId() { + return accountId; + } + + @Nullable + public String getTargetGroupName() { + return targetGroupName; + } +} diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java index e196b30175..9722136ae1 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java @@ -27,6 +27,7 @@ import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.metadata.MetaDataMock; import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.transaction.Faas; import co.elastic.apm.agent.impl.transaction.TraceContext; import co.elastic.apm.agent.impl.transaction.TraceState; import co.elastic.apm.agent.impl.transaction.Transaction; diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java index 6aa7f622b0..6006e85979 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; -public class ApiGatewayV1LambdaTest extends AbstractLambdaTest { +public class ApiGatewayV1LambdaTest extends BaseGatewayLambdaTest { @BeforeAll @BeforeClass @@ -144,34 +144,6 @@ public void testBasicCall() { assertThat(faas.getTrigger().getRequestId()).isEqualTo(API_GATEWAY_REQUEST_ID); } - @Test - public void testCallWithNullInput() { - getFunction().handleRequest(null, context); - - reporter.awaitTransactionCount(1); - reporter.awaitSpanCount(1); - assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); - assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); - assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); - assertThat(transaction.getType()).isEqualTo("request"); - assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); - - assertThat(transaction.getContext().getCloudOrigin()).isNotNull(); - assertThat(transaction.getContext().getCloudOrigin().getProvider()).isEqualTo("aws"); - assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isNull(); - assertThat(transaction.getContext().getCloudOrigin().getRegion()).isNull(); - assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isNull(); - - assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - - Faas faas = transaction.getFaas(); - assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); - - assertThat(faas.getTrigger().getType()).isEqualTo("other"); - assertThat(faas.getTrigger().getRequestId()).isNull(); - } - @ParameterizedTest @ValueSource(booleans = {true, false}) public void testCallWithNullRequestContext(boolean isObjectNull) { @@ -210,19 +182,6 @@ public void testCallWithNullRequestContext(boolean isObjectNull) { assertThat(faas.getTrigger().getRequestId()).isNull(); } - @Test - public void testCallWithHErrorStatusCode() { - Objects.requireNonNull(context).setErrorStatusCode(); - getFunction().handleRequest(createInput(), context); - reporter.awaitTransactionCount(1); - reporter.awaitSpanCount(1); - assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); - assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); - assertThat(transaction.getResult()).isEqualTo("HTTP 5xx"); - assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); - } - @Test public void testTransactionNameForRestApiSpecificRoute() { getFunction().handleRequest(createInput("PUT", "/prod/test/12345", "/test", "prod"), context); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java index d98e652551..4315ca4d3f 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java @@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; -public class ApiGatewayV2LambdaTest extends AbstractLambdaTest { +public class ApiGatewayV2LambdaTest extends BaseGatewayLambdaTest { @BeforeAll @BeforeClass @@ -151,34 +151,6 @@ public void testBasicCall() { assertThat(faas.getTrigger().getRequestId()).isEqualTo(API_GATEWAY_REQUEST_ID); } - @Test - public void testCallWithNullInput() { - getFunction().handleRequest(null, context); - - reporter.awaitTransactionCount(1); - reporter.awaitSpanCount(1); - assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); - assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); - assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); - assertThat(transaction.getType()).isEqualTo("request"); - assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); - - assertThat(transaction.getContext().getCloudOrigin()).isNotNull(); - assertThat(transaction.getContext().getCloudOrigin().getProvider()).isEqualTo("aws"); - assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isNull(); - assertThat(transaction.getContext().getCloudOrigin().getRegion()).isNull(); - assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isNull(); - - assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - - Faas faas = transaction.getFaas(); - assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); - - assertThat(faas.getTrigger().getType()).isEqualTo("other"); - assertThat(faas.getTrigger().getRequestId()).isNull(); - } - @ParameterizedTest @ValueSource(booleans = {true, false}) public void testCallWithNullRequestContext(boolean isObjectNull) { @@ -212,19 +184,6 @@ public void testCallWithNullRequestContext(boolean isObjectNull) { assertThat(faas.getTrigger().getRequestId()).isNull(); } - @Test - public void testCallWithHErrorStatusCode() { - Objects.requireNonNull(context).setErrorStatusCode(); - getFunction().handleRequest(createInput(), context); - reporter.awaitTransactionCount(1); - reporter.awaitSpanCount(1); - assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); - assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); - assertThat(transaction.getResult()).isEqualTo("HTTP 5xx"); - assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); - } - @Test public void testTransactionNameForRestApiSpecificRoute() { getFunction().handleRequest(createInput("PUT", "/prod/test", "ANY /test", "prod"), context); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java new file mode 100644 index 0000000000..5583ba1834 --- /dev/null +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java @@ -0,0 +1,197 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.awslambda; + +import co.elastic.apm.agent.awslambda.lambdas.AbstractFunction; +import co.elastic.apm.agent.awslambda.lambdas.ApiGatewayV1LambdaFunction; +import co.elastic.apm.agent.awslambda.lambdas.ApplicationLoadBalancerRequestLambdaFunction; +import co.elastic.apm.agent.awslambda.lambdas.TestContext; +import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.impl.context.Request; +import co.elastic.apm.agent.impl.context.Response; +import co.elastic.apm.agent.impl.context.Url; +import co.elastic.apm.agent.impl.transaction.Faas; +import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Outcome; +import co.elastic.apm.agent.tracer.configuration.WebConfiguration; +import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; +import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; +import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerRequestEvent; +import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerResponseEvent; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import javax.annotation.Nonnull; +import java.util.Arrays; +import java.util.Map; +import java.util.Objects; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.doReturn; + +public class ApplicationLoadBalancerRequestEventLambdaTest extends BaseGatewayLambdaTest { + + @BeforeAll + // Need to overwrite the beforeAll() method from parent, + // because we need to mock serverlessConfiguration BEFORE instrumentation is initialized! + public static synchronized void beforeAll() { + AbstractLambdaTest.initAllButInstrumentation(); + doReturn(ApplicationLoadBalancerRequestLambdaFunction.class.getName()).when(Objects.requireNonNull(serverlessConfiguration)).getAwsLambdaHandler(); + AbstractLambdaTest.initInstrumentation(); + } + + @Override + protected AbstractFunction createHandler() { + return new ApplicationLoadBalancerRequestLambdaFunction(); + } + + @Override + protected ApplicationLoadBalancerRequestEvent createInput() { + var event = new ApplicationLoadBalancerRequestEvent(); + event.setBody("blablablabody"); + event.setIsBase64Encoded(false); + var requestContext = new ApplicationLoadBalancerRequestEvent.RequestContext(); + var elb = new ApplicationLoadBalancerRequestEvent.Elb(); + elb.setTargetGroupArn("arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/lambda-279XGJDqGZ5rsrHC2Fjr/49e9d65c45c6791a"); + requestContext.setElb(elb); + event.setRequestContext(requestContext); + event.setHttpMethod("POST"); + event.setPath("/toolz/api/v2.0/downloadPDF/PDF_2020-09-11_11-06-01.pdf"); + event.setQueryStringParameters(Map.of("test%40key", "test%40value", "language", "en-DE")); + event.setHeaders(Map.of("accept-encoding", "gzip,deflate", + "connection", "Keep-Alive", + "host", "blabla.com", + "user-agent", "Apache-HttpClient/4.5.13 (Java/11.0.15)", + "x-amzn-trace-id", "Root=1-xxxxxxxxxxxxxx", + "x-forwarded-for", "199.99.99.999", + "x-forwarded-port", "443", + "x-forwarded-proto", "https")); + return event; + } + + @Override + protected boolean supportsContextPropagation() { + return false; + } + + @Test + public void testBasicCall() { + doReturn(CoreConfiguration.EventType.ALL).when(config.getConfig(CoreConfiguration.class)).getCaptureBody(); + getFunction().handleRequest(createInput(), context); + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); + assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); + Transaction transaction = reporter.getFirstTransaction(); + assertThat(transaction.getNameAsString()).isEqualTo("FUNCTION_NAME"); + assertThat(transaction.getType()).isEqualTo("request"); + assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); + assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); + assertThat(reporter.getPartialTransactions()).containsExactly(transaction); + + Request request = transaction.getContext().getRequest(); + assertThat(request.getMethod()).isEqualTo(HTTP_METHOD); + assertThat(request.getBody()).isNull(); + assertThat(request.getHttpVersion()).isNull(); + + Url url = request.getUrl(); + assertThat(url.getHostname()).isEqualTo("blabla.com"); + assertThat(url.getPort()).isEqualTo(443); + assertThat(url.getPathname()).isEqualTo("/toolz/api/v2.0/downloadPDF/PDF_2020-09-11_11-06-01.pdf"); + assertThat(url.getSearch()).contains("test%40key=test%40value"); + assertThat(url.getSearch()).contains(Arrays.asList("language=en-DE", "test%40key=test%40value")); + assertThat(url.getProtocol()).isEqualTo("https"); + String baseUrl = "https://" + "blabla.com" + "/toolz/api/v2.0/downloadPDF/PDF_2020-09-11_11-06-01.pdf" + "?"; + assertThat(url.getFull().toString()).containsAnyOf(baseUrl + "test%40key=test%40value&language=en-DE", + baseUrl + "language=en-DE&test%40key=test%40value"); + + assertThat(request.getHeaders()).isNotNull(); + PotentiallyMultiValuedMap headers = request.getHeaders(); + assertThat(headers.get("connection")).isEqualTo("Keep-Alive"); + assertThat(headers.get("accept-encoding")).isEqualTo("gzip,deflate"); + + Response response = transaction.getContext().getResponse(); + assertThat(response.getStatusCode()).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_STATUS_CODE); + assertThat(response.getHeaders()).isNotNull(); + assertThat(response.getHeaders().get(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_KEY)).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_VALUE); + assertThat(response.getHeaders().get(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_2_KEY)).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_2_VALUE); + + assertThat(transaction.getContext().getCloudOrigin()).isNotNull(); + assertThat(transaction.getContext().getCloudOrigin().getProvider()).isEqualTo("aws"); + assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isEqualTo("elb"); + assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isEqualTo("123456789012"); + assertThat(transaction.getContext().getCloudOrigin().getRegion()).isEqualTo("us-east-2"); + + assertThat(transaction.getContext().getServiceOrigin().hasContent()).isTrue(); + assertThat(transaction.getContext().getServiceOrigin().getName().toString()).isEqualTo("49e9d65c45c6791a"); + assertThat(transaction.getContext().getServiceOrigin().getId()).isEqualTo("arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/lambda-279XGJDqGZ5rsrHC2Fjr/49e9d65c45c6791a"); + assertThat(transaction.getContext().getServiceOrigin().getVersion()).isNull(); + + Faas faas = transaction.getFaas(); + assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); + assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); + assertThat(faas.getTrigger().getType()).isEqualTo("http"); + assertThat(faas.getTrigger().getRequestId()).isEqualTo("Root=1-xxxxxxxxxxxxxx"); + } + + @Test + public void testCallWithNullRequestContext() { + ApplicationLoadBalancerRequestEvent requestEvent = createInput(); + requestEvent.setRequestContext(null); + + getFunction().handleRequest(requestEvent, context); + + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); + assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); + Transaction transaction = reporter.getFirstTransaction(); + assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); + assertThat(transaction.getType()).isEqualTo("request"); + assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); + + assertThat(transaction.getContext().getCloudOrigin()).isNotNull(); + assertThat(transaction.getContext().getCloudOrigin().getProvider()).isEqualTo("aws"); + + assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isEqualTo("elb"); + + assertThat(transaction.getContext().getCloudOrigin().getRegion()).isNull(); + assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isNull(); + + assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); + + Faas faas = transaction.getFaas(); + assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); + + assertThat(faas.getTrigger().getType()).isEqualTo("http"); + assertThat(faas.getTrigger().getRequestId()).isEqualTo("Root=1-xxxxxxxxxxxxxx"); + } + + @Test + public void testTransactionNameWithUsePathAsName() { + doReturn(true).when(config.getConfig(WebConfiguration.class)).isUsePathAsName(); + getFunction().handleRequest(createInput(), context); + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + assertThat(reporter.getFirstTransaction().getNameAsString()).isEqualTo("POST /toolz/api/v2.0/downloadPDF/PDF_2020-09-11_11-06-01.pdf"); + } + +} diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java new file mode 100644 index 0000000000..22394fb6d6 --- /dev/null +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java @@ -0,0 +1,75 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.awslambda; + +import co.elastic.apm.agent.awslambda.lambdas.TestContext; +import co.elastic.apm.agent.impl.transaction.Faas; +import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.tracer.Outcome; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +import static org.assertj.core.api.Assertions.assertThat; + +public abstract class BaseGatewayLambdaTest extends AbstractLambdaTest { + + @Test + public void testCallWithNullInput() { + getFunction().handleRequest(null, context); + + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); + assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); + Transaction transaction = reporter.getFirstTransaction(); + assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); + assertThat(transaction.getType()).isEqualTo("request"); + assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); + + assertThat(transaction.getContext().getCloudOrigin()).isNotNull(); + assertThat(transaction.getContext().getCloudOrigin().getProvider()).isEqualTo("aws"); + assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isNull(); + assertThat(transaction.getContext().getCloudOrigin().getRegion()).isNull(); + assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isNull(); + + assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); + + Faas faas = transaction.getFaas(); + assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); + + assertThat(faas.getTrigger().getType()).isEqualTo("other"); + assertThat(faas.getTrigger().getRequestId()).isNull(); + } + + + @Test + public void testCallWithErrorStatusCode() { + Objects.requireNonNull(context).setErrorStatusCode(); + getFunction().handleRequest(createInput(), context); + reporter.awaitTransactionCount(1); + reporter.awaitSpanCount(1); + assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); + assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); + Transaction transaction = reporter.getFirstTransaction(); + assertThat(transaction.getResult()).isEqualTo("HTTP 5xx"); + assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); + } + +} diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/lambdas/ApplicationLoadBalancerRequestLambdaFunction.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/lambdas/ApplicationLoadBalancerRequestLambdaFunction.java new file mode 100644 index 0000000000..54dd61fa14 --- /dev/null +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/lambdas/ApplicationLoadBalancerRequestLambdaFunction.java @@ -0,0 +1,52 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.awslambda.lambdas; + +import com.amazonaws.services.lambda.runtime.Context; +import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerRequestEvent; +import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerResponseEvent; + +import java.util.Map; + +public class ApplicationLoadBalancerRequestLambdaFunction extends AbstractFunction { + public static final String EXPECTED_BODY = "This is some body"; + public static final String EXPECTED_RESPONSE_HEADER_1_KEY = "EXPECTED_HEADER_1_KEY"; + public static final String EXPECTED_RESPONSE_HEADER_1_VALUE = "EXPECTED_HEADER_1_VALUE"; + public static final String EXPECTED_RESPONSE_HEADER_2_KEY = "EXPECTED_HEADER_2_KEY"; + public static final String EXPECTED_RESPONSE_HEADER_2_VALUE = "EXPECTED_HEADER_2_VALUE"; + public static final int EXPECTED_STATUS_CODE = 202; + public static final int ERROR_STATUS_CODE = 505; + + @Override + public ApplicationLoadBalancerResponseEvent handleRequest(ApplicationLoadBalancerRequestEvent applicationLoadBalancerRequestEvent, Context context) { + createChildSpan(); + + ApplicationLoadBalancerResponseEvent response = new ApplicationLoadBalancerResponseEvent(); + response.setBody(EXPECTED_BODY); + response.setHeaders(Map.of(EXPECTED_RESPONSE_HEADER_1_KEY, EXPECTED_RESPONSE_HEADER_1_VALUE, EXPECTED_RESPONSE_HEADER_2_KEY, EXPECTED_RESPONSE_HEADER_2_VALUE)); + + if (((TestContext) context).shouldSetErrorStatusCode()) { + response.setStatusCode(ERROR_STATUS_CODE); + } else { + response.setStatusCode(EXPECTED_STATUS_CODE); + } + raiseException(context); + return response; + } +} From 6c673b8f0ce062727ab5b84a45d4a7466f9957f1 Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Mon, 25 Mar 2024 19:01:44 +0100 Subject: [PATCH 016/132] feat: new release process with PRs (#3567) * feat: new release process with PRs Signed-off-by: Adrien Mannocci * chore: redirect to stderr for both message Signed-off-by: Adrien Mannocci * chore: apply suggest Signed-off-by: Adrien Mannocci * ci(chore): use env var instead of prefix v Signed-off-by: Adrien Mannocci * ci: use maven wrapper instead of direct maven Signed-off-by: Adrien Mannocci * feat: validate snapshot for snapshot workflow Signed-off-by: Adrien Mannocci * docs: add new release process Signed-off-by: Adrien Mannocci --------- Signed-off-by: Adrien Mannocci --- .ci/release/post-release.sh | 31 +++ .ci/release/pre-release.sh | 22 ++ ...major_branch.sh => update-major-branch.sh} | 7 + .ci/release/update_cloudfoundry.sh | 28 --- .ci/release/util.sh | 10 +- .ci/release/wait_maven_artifact_published.sh | 13 -- .github/workflows/README.md | 6 +- .github/workflows/pre-post-release.yml | 98 +++++++++ .github/workflows/pre-release.yml | 32 +++ .github/workflows/release.yml | 198 +++++++----------- .github/workflows/snapshot.yml | 21 +- .github/workflows/validate-tag/action.yml | 25 +++ .mvn/maven.config | 1 - pom.xml | 14 +- 14 files changed, 326 insertions(+), 180 deletions(-) create mode 100755 .ci/release/post-release.sh create mode 100755 .ci/release/pre-release.sh rename .ci/release/{update_major_branch.sh => update-major-branch.sh} (85%) delete mode 100755 .ci/release/update_cloudfoundry.sh delete mode 100755 .ci/release/wait_maven_artifact_published.sh create mode 100644 .github/workflows/pre-post-release.yml create mode 100644 .github/workflows/pre-release.yml create mode 100644 .github/workflows/validate-tag/action.yml diff --git a/.ci/release/post-release.sh b/.ci/release/post-release.sh new file mode 100755 index 0000000000..e54662cdfe --- /dev/null +++ b/.ci/release/post-release.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Bash strict mode +set -euo pipefail + +# Found current script directory +RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# Found project directory +BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))" + +# Import dependencies +source "${RELATIVE_DIR}/util.sh" + +# Constants +BASE_URL="https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent" +CF_FILE="${BASE_PROJECT}/cloudfoundry/index.yml" + +# Requirements +check_version "${RELEASE_VERSION}" + +echo "Set next snapshot version" +./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnextSnapshot=true + +# make script idempotent if release is already in CF descriptor +set +e +grep -e "^${RELEASE_VERSION}:" ${CF_FILE} +[[ $? == 0 ]] && exit 0 +set -e +echo "Update cloudfoundry version" +echo "${RELEASE_VERSION}: ${BASE_URL}/${RELEASE_VERSION}/elastic-apm-agent-${RELEASE_VERSION}.jar" >> "${CF_FILE}" diff --git a/.ci/release/pre-release.sh b/.ci/release/pre-release.sh new file mode 100755 index 0000000000..ae981a3dc9 --- /dev/null +++ b/.ci/release/pre-release.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Bash strict mode +set -euo pipefail + +# Found current script directory +RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# Found project directory +BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))" + +# Import dependencies +source "${RELATIVE_DIR}/util.sh" + +# Requirements +check_version "${RELEASE_VERSION}" + +echo "Set release version" +./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnewVersion="${RELEASE_VERSION}" + +echo "Prepare changelog for release" +java "${BASE_PROJECT}/.ci/ReleaseChangelog.java" CHANGELOG.asciidoc "${RELEASE_VERSION}" diff --git a/.ci/release/update_major_branch.sh b/.ci/release/update-major-branch.sh similarity index 85% rename from .ci/release/update_major_branch.sh rename to .ci/release/update-major-branch.sh index 8fa883878b..146364f498 100755 --- a/.ci/release/update_major_branch.sh +++ b/.ci/release/update-major-branch.sh @@ -62,3 +62,10 @@ git checkout --force ${checkout_options} echo -e "\n--- move local branch ${major_branch} to match tag ${tag}" git reset --hard ${tag} + +echo -e "\n--- create new branch with updates" +git checkout -b "update-major-${v}" +git push origin "update-major-${v}" + +echo -e "\n--- create PR to update major branch" +gh pr create --title="post release v${v}: update major branch" --base "${major_branch}" --head "update-major-${v}" -b "post release v${v}" diff --git a/.ci/release/update_cloudfoundry.sh b/.ci/release/update_cloudfoundry.sh deleted file mode 100755 index 436b5b2365..0000000000 --- a/.ci/release/update_cloudfoundry.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail -source "$(dirname "${0}")/util.sh" - -REMOTE_NAME=origin -BRANCH_NAME=main -BASE_URL=https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent -CF_FILE=cloudfoundry/index.yml - -check_version "${1:-}" -v="${1:-}" - -echo -e "\n--- fetch & ensure clean state of ${REMOTE_NAME}/${BRANCH_NAME}" -git fetch ${REMOTE_NAME} ${BRANCH_NAME} -git checkout ${BRANCH_NAME} -git reset --hard ${REMOTE_NAME}/${BRANCH_NAME} - -echo -e "\n--- update ${CF_FILE} if required" - -# make script idempotent if release is already in CF descriptor -set +e -grep -e "^${v}:" ${CF_FILE} -[[ $? == 0 ]] && exit 0 -set -e - -echo "${v}: ${BASE_URL}/${v}/elastic-apm-agent-${v}.jar" >> ${CF_FILE} -git commit ${CF_FILE} -m "Update cloudfoundry for ${v} release" diff --git a/.ci/release/util.sh b/.ci/release/util.sh index 8dd546ad93..f2cbf4a323 100644 --- a/.ci/release/util.sh +++ b/.ci/release/util.sh @@ -3,14 +3,12 @@ check_version() { v=${1:-} - if [[ "${v}" == "" ]]; then - echo "usage $0 " # here $0 will be the calling script - echo "where in format '1.2.3'" + if [ -z "${v}" ]; then + >&2 echo "The environment variable 'RELEASE_VERSION' isn't defined" exit 1 fi - - if [[ ! "$v" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "invalid version format '${v}'" + if [[ ! "${v}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then + >&2 echo "The environment variable 'RELEASE_VERSION' should respect SemVer format" exit 1 fi } diff --git a/.ci/release/wait_maven_artifact_published.sh b/.ci/release/wait_maven_artifact_published.sh deleted file mode 100755 index 7c12d96c22..0000000000 --- a/.ci/release/wait_maven_artifact_published.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail -source "$(dirname "${0}")/util.sh" - -# returns '0' (zero) status code when artifact exists -# return non-zero status when artifact does not exists or unable to execute request - -check_version "${1:-}" -v="${1:-}" - -full_url="https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/${v}/elastic-apm-agent-${v}.pom" -curl -fs "${full_url}" 2>&1 > /dev/null diff --git a/.github/workflows/README.md b/.github/workflows/README.md index d2d093d024..cbc0140d24 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -35,8 +35,12 @@ Every time there is a merge to main or any branches the whole workflow will comp ### Release process -This process has been fully automated and it gets triggered manually when running the [release](https://github.com/elastic/apm-agent-java/actions/workflows/release.yml) workflow. It runs then a Buildkite pipeline in charge of generating and publishing the artifacts, +To release a new version of apm-agent-java, you must use the two GitHub Workflows. +Trigger the `Pre Release` workflow targeting the release version. +After merging the PRs created by the first workflow, you can trigger the `Release` workflow targeting the release version. +It runs then a Buildkite pipeline in charge of generating and publishing the artifacts, for further details please go to [the buildkite folder](../../.buildkite/README.md). +Finally, merge the PRs created to bump version for the next iteration. The tag release follows the naming convention: `v...`, where ``, `` and ``. diff --git a/.github/workflows/pre-post-release.yml b/.github/workflows/pre-post-release.yml new file mode 100644 index 0000000000..e34026ebd4 --- /dev/null +++ b/.github/workflows/pre-post-release.yml @@ -0,0 +1,98 @@ +--- + +name: Pre/Post Release + +on: + workflow_call: + inputs: + ref: + description: 'Branch or tag ref to run the workflow on' + type: string + required: true + default: "main" + version: + description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' + type: string + required: true + phase: + description: 'Pre or post release phase' + type: string # valid values are 'pre' or 'post' + required: true + +env: + RELEASE_VERSION: ${{ inputs.version }} + RELEASE_VERSION_TAG: v${{ inputs.version }} + BRANCH_NAME: ${{ inputs.phase }}-release-v${{ inputs.version }} + +permissions: + contents: read + +jobs: + validate-tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Validate release tag does not exist in repo + uses: ./.github/workflows/validate-tag + with: + tag: ${{ env.RELEASE_VERSION_TAG }} + + create-pr: + name: "Bump versions and create PR" + runs-on: ubuntu-latest + needs: + - validate-tag + permissions: + contents: write + steps: + - uses: elastic/apm-pipeline-library/.github/actions/github-token@current + with: + url: ${{ secrets.VAULT_ADDR }} + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + + - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current + with: + username: ${{ env.GIT_USER }} + email: ${{ env.GIT_EMAIL }} + token: ${{ env.GITHUB_TOKEN }} + + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + token: ${{ env.GITHUB_TOKEN }} + + - name: Create the release tag (post phase) + if: inputs.phase == 'post' + run: | + git tag "${{ env.RELEASE_VERSION_TAG }}" + git push origin "${{ env.RELEASE_VERSION_TAG }}" + + - name: Create a ${{ inputs.phase }} release branch + run: git checkout -b ${{ env.BRANCH_NAME }} + + - name: Perform pre release changes + if: inputs.phase == 'pre' + uses: ./.github/workflows/maven-goal-jdk + with: + command: ./.ci/release/pre-release.sh + + - name: Perform post release changes + if: inputs.phase == 'post' + uses: ./.github/workflows/maven-goal + with: + command: ./.ci/release/post-release.sh + + - name: Push the ${{ inputs.phase }} release branch + run: | + git add --all + git commit -m "${{ inputs.phase }} release: elastic-apm-agent ${{ env.RELEASE_VERSION_TAG }}" + git push origin ${{ env.BRANCH_NAME }} + + - name: Create the ${{ inputs.phase }} release PR + run: gh pr create --title="${{ inputs.phase }} release ${{ env.RELEASE_VERSION_TAG }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.phase }} release ${{ env.RELEASE_VERSION_TAG }}" + env: + GH_TOKEN: ${{ env.GITHUB_TOKEN }} diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 0000000000..3fb0b6f71f --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,32 @@ +--- + +name: Pre release + +on: + workflow_dispatch: + inputs: + ref: + description: 'Branch or tag ref to run the workflow on' + required: true + default: "main" + version: + description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' + required: true + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }} + +jobs: + pre-release: + name: "Bump versions and create PR" + uses: ./.github/workflows/pre-post-release.yml + permissions: + contents: write + with: + ref: ${{ inputs.ref }} + version: ${{ inputs.version }} + phase: 'pre' + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d15ea5f5bc..dc9a754f3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,20 +5,13 @@ name: release on: workflow_dispatch: inputs: - branch: - description: 'The branch to release' + ref: + description: 'Branch or tag ref to run the workflow on' required: true - default: 'main' + default: "main" version: description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' required: true - update_changelog: - description: | - If enabled, everything in the changelog from the "Unreleased" section will be automatically moved to a new section for the new release. - If disabled, the changelog needs to be prepared for the release manually before triggering this workflow. - type: boolean - required: true - default: true skip_preparation: description: | If enabled, the version bump, release notes update and tag creation will be skipped. @@ -39,59 +32,48 @@ on: default: false type: boolean -env: - TAG_NAME: v${{ inputs.version }} - permissions: contents: read concurrency: group: ${{ github.workflow }} +env: + RELEASE_VERSION: ${{ inputs.version }} + RELEASE_VERSION_TAG: v${{ inputs.version }} + jobs: - prepare_release: - permissions: - contents: write - name: "Changelog and Version Bump" - if: ${{ ! inputs.skip_preparation }} + validate-tag: runs-on: ubuntu-latest steps: - - uses: elastic/apm-pipeline-library/.github/actions/github-token@current - with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current + - name: Checkout + uses: actions/checkout@v4 with: - username: ${{ env.GIT_USER }} - email: ${{ env.GIT_EMAIL }} - token: ${{ env.GITHUB_TOKEN }} - - uses: actions/checkout@v4 + ref: ${{ inputs.ref }} + fetch-depth: 0 + - name: Validate tag does not exist on current commit + uses: ./.github/workflows/validate-tag with: - ref: ${{ inputs.branch }} - token: ${{ env.GITHUB_TOKEN }} - - name: Install JDK and mvn clean - uses: ./.github/workflows/maven-goal - with: - command: ./mvnw clean - - name: Prepare changelog for release - if: ${{ inputs.update_changelog && ! inputs.dry_run }} + tag: ${{ env.RELEASE_VERSION_TAG }} + - name: Validate tag match current version run: | - java .ci/ReleaseChangelog.java CHANGELOG.asciidoc ${{ inputs.version }} - git commit -m "Prepare changelog for release ${{ inputs.version }}" CHANGELOG.asciidoc - - name: Bump version and add git tag - if: ${{ ! inputs.dry_run }} - run: ./mvnw release:prepare -B -DpushChanges=false "-Darguments=-DskipTests -Dmaven.javadoc.skip=true" -DreleaseVersion=${{ inputs.version }} - - name: Push changes - if: ${{ ! inputs.dry_run }} - run: git push --atomic origin ${{ inputs.branch }} ${{ env.TAG_NAME }} + if [ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" != "${{ env.RELEASE_VERSION }}" ]; then + echo "Tag should match pom.xml project.version" + exit 1 + fi + - name: Validate version is a release version + run: | + if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then + echo "This is a snapshot version" + exit 1 + fi - maven_central_deploy: + maven-central-deploy: name: "Deploy to Maven Central (Buildkite)" if: ${{ ! inputs.skip_maven_deploy && ( inputs.skip_preparation || success() ) }} runs-on: ubuntu-latest needs: - - prepare_release + - validate-tag steps: - id: buildkite continue-on-error: true @@ -102,61 +84,29 @@ jobs: vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} pipeline: apm-agent-java-release - pipelineCommit: ${{ env.TAG_NAME }} + pipelineCommit: ${{ env.RELEASE_VERSION }} waitFor: true printBuildLogs: false buildEnvVars: | dry_run=${{ inputs.dry_run || 'false' }} - await_artifact_on_maven_central: + await-maven-central-artifact: name: "Wait for artifacts to be available on maven central" runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Await artifacts published in maven central - if: ${{ ! inputs.dry_run }} - shell: bash - timeout-minutes: 120 - run: | - until .ci/release/wait_maven_artifact_published.sh ${{ inputs.version }} - do - echo "Artifacts not found on maven central. Sleeping 30 seconds, retrying afterwards" - sleep 30s - done - - update_major_branch: - name: "Update Major Branch" - runs-on: ubuntu-latest needs: - - await_artifact_on_maven_central - permissions: - contents: write + - validate-tag steps: - - uses: elastic/apm-pipeline-library/.github/actions/github-token@current - with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current + - uses: elastic/apm-pipeline-library/.github/actions/await-maven-artifact@current with: - username: ${{ env.GIT_USER }} - email: ${{ env.GIT_EMAIL }} - token: ${{ env.GITHUB_TOKEN }} - - uses: actions/checkout@v4 - with: - ref: ${{ env.TAG_NAME }} - token: ${{ env.GITHUB_TOKEN }} - - name: Update major branch - run: .ci/release/update_major_branch.sh ${{ inputs.version }} - - name: Push changes - if: ${{ ! inputs.dry_run }} - run: git push -f origin "$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')" + groupid: 'co.elastic.apm' + artifactid: 'elastic-apm-agent' + version: ${{ env.RELEASE_VERSION }} - update_cloudfoundry: - name: "Update Cloudfoundry" + update-major-branch: + name: "Update Major Branch" runs-on: ubuntu-latest needs: - - await_artifact_on_maven_central + - await-maven-central-artifact permissions: contents: write steps: @@ -172,26 +122,23 @@ jobs: token: ${{ env.GITHUB_TOKEN }} - uses: actions/checkout@v4 with: - ref: ${{ inputs.branch }} + ref: ${{ inputs.ref }} token: ${{ env.GITHUB_TOKEN }} - - name: "Update Cloudfoundry index.yml file" - shell: bash - run: .ci/release/update_cloudfoundry.sh ${{ inputs.version }} - - name: Push changes + - name: Update major branch if: ${{ ! inputs.dry_run }} - run: git push origin ${{ inputs.branch }} + run: .ci/release/update-major-branch.sh ${{ env.RELEASE_VERSION }} - build_and_push_docker_images: + build-and-push-docker-images: name: "Build and push docker images" runs-on: ubuntu-latest needs: - - await_artifact_on_maven_central + - await-maven-central-artifact env: SONATYPE_FALLBACK: 1 steps: - uses: actions/checkout@v4 with: - ref: ${{ env.TAG_NAME }} + ref: ${{ inputs.ref }} fetch-depth: 0 # Load entire history as it is required for the push-script - uses: elastic/apm-pipeline-library/.github/actions/docker-login@current with: @@ -208,11 +155,11 @@ jobs: shell: bash run: ./scripts/docker-release/push_docker.sh - publish_aws_lambda: + publish-aws-lambda: name: "Publish AWS Lambda" runs-on: ubuntu-latest needs: - - await_artifact_on_maven_central + - await-maven-central-artifact outputs: arn_content: ${{ steps.arn_output.outputs.arn_content }} env: @@ -222,7 +169,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ env.TAG_NAME }} + ref: ${{ inputs.ref }} - name: Build Lambda-layer zip using agent from maven-central uses: ./.github/workflows/maven-goal with: @@ -240,7 +187,7 @@ jobs: if: ${{ ! inputs.dry_run }} run: | # Convert v1.2.3 to ver-1-2-3 - VERSION=${TAG_NAME/v/ver-} + VERSION=${RELEASE_VERSION/v/ver-} VERSION=${VERSION//./-} ELASTIC_LAYER_NAME="elastic-apm-java-${VERSION}" .ci/publish-aws.sh @@ -257,11 +204,11 @@ jobs: cat .ci/.arn-file.md >> $GITHUB_OUTPUT echo 'ARN_CONTENT_EOF' >> $GITHUB_OUTPUT - create_github_release: + create-github-release: name: "Create GitHub Release" needs: - - publish_aws_lambda - - update_major_branch + - publish-aws-lambda + - update-major-branch runs-on: ubuntu-latest if: ${{ ! inputs.dry_run }} permissions: @@ -269,39 +216,52 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ env.TAG_NAME }} + ref: ${{ inputs.ref }} - name: Await release-notes published shell: bash timeout-minutes: 120 run: | - until .ci/release/wait_release_notes_published.sh ${{ inputs.version }} + until .ci/release/wait_release_notes_published.sh ${{ env.RELEASE_VERSION }} do echo "Release notes not published yet. Sleeping 30 seconds, retrying afterwards" sleep 30s done - name: Compute major.x branch id: get_dotx_branch - run: echo "dotx_branch=$(echo '${{ inputs.version }}' | sed -E 's/\..+/.x/')" >> $GITHUB_OUTPUT + run: echo "dotx_branch=$(echo '${{ env.RELEASE_VERSION }}' | sed -E 's/\..+/.x/')" >> $GITHUB_OUTPUT - name: Create GitHub Release env: GH_TOKEN: ${{ github.token }} run: | - gh release create ${{ env.TAG_NAME }} \ - --title="Release ${{ inputs.version }}" \ - --notes="[Release Notes for ${{ inputs.version }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ inputs.version }}) - ${{ needs.publish_aws_lambda.outputs.arn_content }}" + gh release create ${{ env.RELEASE_VERSION }} \ + --title="Release ${{ env.RELEASE_VERSION }}" \ + --notes="[Release Notes for ${{ env.RELEASE_VERSION }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ env.RELEASE_VERSION }}) + ${{ needs.publish-aws-lambda.outputs.arn_content }}" + + post-release: + name: "Bump versions and create PR" + needs: + - await-maven-central-artifact + uses: ./.github/workflows/pre-post-release.yml + permissions: + contents: write + if: inputs.dry_run == false + with: + ref: ${{ inputs.ref }} + version: ${{ env.RELEASE_VERSION }} + phase: 'post' + secrets: inherit notify: if: ${{ always() && ! inputs.dry_run }} needs: - - prepare_release - - maven_central_deploy - - await_artifact_on_maven_central - - update_major_branch - - update_cloudfoundry - - build_and_push_docker_images - - publish_aws_lambda - - create_github_release + - maven-central-deploy + - await-maven-central-artifact + - update-major-branch + - build-and-push-docker-images + - publish-aws-lambda + - post-release + - create-github-release runs-on: ubuntu-latest steps: - id: check diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 86d6353476..9a50021824 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -16,10 +16,29 @@ permissions: contents: read jobs: + validate: + runs-on: ubuntu-latest + outputs: + is-snapshot: ${{ steps.validate-step.outputs.is-snapshot }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Validate version is a snapshot version + id: validate-step + run: | + output=false + if [[ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" =~ "-SNAPSHOT" ]]; then + echo "This is a snapshot version" + output=true + fi + echo "is-snapshot=${output}" >> "$GITHUB_OUTPUT" + deploy: name: Deploy runs-on: ubuntu-latest - + needs: + - validate + if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }} steps: - id: buildkite name: Run Deploy diff --git a/.github/workflows/validate-tag/action.yml b/.github/workflows/validate-tag/action.yml new file mode 100644 index 0000000000..1cdb8ef5c3 --- /dev/null +++ b/.github/workflows/validate-tag/action.yml @@ -0,0 +1,25 @@ +--- + +name: validate-tag +description: Validate tag format + +inputs: + tag: + description: 'Tag to validate' + required: true + +runs: + using: "composite" + steps: + - name: Validate tag does not exist on current commit + id: validate-tag + shell: 'bash' + run: | + if ! [ $(echo "${{ inputs.tag }}" | grep -P "(\d{1,2})\.(\d{1,2})\.(\d{1,2})") ]; then + echo "Tag should be a SemVer format" + exit 1 + fi + if [ $(git tag -l "${{ inputs.tag }}") ]; then + echo "The tag ${{ inputs.tag }} already exists" + exit 1 + fi diff --git a/.mvn/maven.config b/.mvn/maven.config index f50bb0f948..7c3456d7e4 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1,4 +1,3 @@ --V -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dhttps.protocols=TLSv1.2 diff --git a/pom.xml b/pom.xml index 55daeaac73..2ec5eced20 100644 --- a/pom.xml +++ b/pom.xml @@ -380,17 +380,9 @@ - maven-release-plugin - - false - gpg - true - v@{project.version} - - **/apm-agent-benchmarks/src/main/resources/** - **/apm-agent-plugins/apm-profiling-plugin/src/main/resources/** - - + org.codehaus.mojo + versions-maven-plugin + 2.16.2 org.sonatype.plugins From 5b6792421f59be9adc95504c586ee661918259b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 09:22:13 +0200 Subject: [PATCH 017/132] Bump version.aws.sdk from 2.25.0 to 2.25.21 in /apm-agent-plugins (#3574) Bumps `version.aws.sdk` from 2.25.0 to 2.25.21. Updates `software.amazon.awssdk:s3` from 2.25.0 to 2.25.21 Updates `software.amazon.awssdk:sqs` from 2.25.0 to 2.25.21 Updates `software.amazon.awssdk:dynamodb` from 2.25.0 to 2.25.21 --- updated-dependencies: - dependency-name: software.amazon.awssdk:s3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: software.amazon.awssdk:sqs dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: software.amazon.awssdk:dynamodb dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index 7b3a044eb3..62aefeded8 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -13,7 +13,7 @@ ${project.basedir}/../../.. - 2.25.0 + 2.25.21 2.0.0 8 From a10ecd4698374bbba39cf72703e6c7290f9f17cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 10:12:11 +0200 Subject: [PATCH 018/132] Bump org.awaitility:awaitility from 4.2.0 to 4.2.1 (#3573) Bumps [org.awaitility:awaitility](https://github.com/awaitility/awaitility) from 4.2.0 to 4.2.1. - [Changelog](https://github.com/awaitility/awaitility/blob/master/changelog.txt) - [Commits](https://github.com/awaitility/awaitility/compare/awaitility-4.2.0...awaitility-4.2.1) --- updated-dependencies: - dependency-name: org.awaitility:awaitility dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- integration-tests/runtime-attach/runtime-attach-test/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/runtime-attach/runtime-attach-test/pom.xml b/integration-tests/runtime-attach/runtime-attach-test/pom.xml index 203e031971..4ab75d5835 100644 --- a/integration-tests/runtime-attach/runtime-attach-test/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-test/pom.xml @@ -31,7 +31,7 @@ org.awaitility awaitility - 4.2.0 + 4.2.1 test diff --git a/pom.xml b/pom.xml index 2ec5eced20..dccc732203 100644 --- a/pom.xml +++ b/pom.xml @@ -809,7 +809,7 @@ org.awaitility awaitility - 4.2.0 + 4.2.1 test From 2e1bce7fe994efac07a72dc6162b6824f11ee5bf Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Tue, 2 Apr 2024 11:25:53 +0100 Subject: [PATCH 019/132] Add exclusion list option for calling DatabaseMetaData.getUserName (#3568) * use a dummy user for testing * exclusion list option for calling getUserName * changelog and test break fixed --- CHANGELOG.asciidoc | 1 + .../agent/jdbc/helper/JdbcConfiguration.java | 52 +++++++++++++ .../apm/agent/jdbc/helper/JdbcHelper.java | 21 ++++- ....configuration.ConfigurationOptionProvider | 1 + .../helper/JdbcGetUserNameExclusionTest.java | 77 +++++++++++++++++++ 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcConfiguration.java create mode 100644 apm-agent-plugins/apm-jdbc-plugin/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider create mode 100644 apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/JdbcGetUserNameExclusionTest.java diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 35349f1556..6b92fe1bdb 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -39,6 +39,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: ===== Features * Differentiate Lambda URLs from API Gateway in AWS Lambda integration - {pull}3417[#3417] * Added lambda support for ELB triggers {pull}#3411[#3411] +* Add exclusion list option for calling DatabaseMetaData.getUserName - {pull}#3568[#3568] [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcConfiguration.java b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcConfiguration.java new file mode 100644 index 0000000000..87dcfb976d --- /dev/null +++ b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcConfiguration.java @@ -0,0 +1,52 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.jdbc.helper; + +import co.elastic.apm.agent.common.util.WildcardMatcher; +import co.elastic.apm.agent.tracer.configuration.WildcardMatcherValueConverter; +import org.stagemonitor.configuration.ConfigurationOption; +import org.stagemonitor.configuration.ConfigurationOptionProvider; +import org.stagemonitor.configuration.converter.DoubleValueConverter; +import org.stagemonitor.configuration.converter.ListValueConverter; +import org.stagemonitor.configuration.converter.StringValueConverter; + +import java.util.Arrays; +import java.util.List; + +public class JdbcConfiguration extends ConfigurationOptionProvider { + + private final ConfigurationOption> databaseMetaDataExclusionList = ConfigurationOption + .builder(new ListValueConverter(StringValueConverter.INSTANCE), List.class) + .key("exclude_from_getting_username") + .configurationCategory("Datastore") + .description("If any of these strings match part of the package or class name of the DatabaseMetaData instance, getUserName() won't be called" + + "\n" + + WildcardMatcher.DOCUMENTATION + ) + .tags("internal","added[1.49.0]") + .dynamic(true) + .buildWithDefault(Arrays.asList( + "hikari" + )); + + public List getDatabaseMetaDataExclusionList() { + return databaseMetaDataExclusionList.get(); + } + +} diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java index 6853a14088..ca8f379e40 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java +++ b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java @@ -21,18 +21,21 @@ import co.elastic.apm.agent.sdk.internal.db.signature.Scanner; import co.elastic.apm.agent.sdk.internal.db.signature.SignatureParser; import co.elastic.apm.agent.tracer.AbstractSpan; +import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.ElasticContext; import co.elastic.apm.agent.jdbc.JdbcFilter; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; +import co.elastic.apm.agent.tracer.Tracer; import javax.annotation.Nullable; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; import java.sql.Statement; +import java.util.List; import java.util.concurrent.Callable; import static co.elastic.apm.agent.jdbc.helper.JdbcGlobalState.metaDataMap; @@ -45,6 +48,11 @@ public class JdbcHelper { public static final String DB_SPAN_ACTION = "query"; private static final JdbcHelper INSTANCE = new JdbcHelper(); + private final JdbcConfiguration config; + + public JdbcHelper() { + this.config = GlobalTracer.get().getConfig(JdbcConfiguration.class); + } public static JdbcHelper get() { return INSTANCE; @@ -181,7 +189,7 @@ private ConnectionMetaData getConnectionMetaData(@Nullable Connection connection DatabaseMetaData metaData = connection.getMetaData(); connectionMetaData = ConnectionMetaData.parse(metaData.getURL()) .withConnectionInstance(safeGetCatalog(connection)) - .withConnectionUser(metaData.getUserName()) + .withConnectionUser(maybeGetUserName(metaData, config)) .build(); if (logger.isDebugEnabled()) { @@ -201,6 +209,17 @@ private ConnectionMetaData getConnectionMetaData(@Nullable Connection connection return connectionMetaData; } + static String maybeGetUserName(DatabaseMetaData metaData, JdbcConfiguration config) throws SQLException { + List exclusionList = config.getDatabaseMetaDataExclusionList(); + String classname = metaData.getClass().getName(); + for (String exclude : exclusionList) { + if (classname.contains(exclude)) { + return null; + } + } + return metaData.getUserName(); + } + @Nullable private String safeGetCatalog(Connection connection) { String catalog = null; diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider b/apm-agent-plugins/apm-jdbc-plugin/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider new file mode 100644 index 0000000000..38d62b1c55 --- /dev/null +++ b/apm-agent-plugins/apm-jdbc-plugin/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider @@ -0,0 +1 @@ +co.elastic.apm.agent.jdbc.helper.JdbcConfiguration diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/JdbcGetUserNameExclusionTest.java b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/JdbcGetUserNameExclusionTest.java new file mode 100644 index 0000000000..5ff0962629 --- /dev/null +++ b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/JdbcGetUserNameExclusionTest.java @@ -0,0 +1,77 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.jdbc.helper; + +import co.elastic.apm.agent.AbstractInstrumentationTest; +import co.elastic.apm.agent.MockTracer; +import co.elastic.apm.agent.bci.ElasticApmAgent; +import co.elastic.apm.agent.configuration.SpyConfiguration; +import co.elastic.apm.agent.impl.ElasticApmTracer; +import net.bytebuddy.agent.ByteBuddyAgent; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.stagemonitor.configuration.ConfigurationRegistry; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.sql.DatabaseMetaData; +import java.sql.SQLException; +import java.util.List; + +import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; +import static org.mockito.Mockito.doReturn; + +public class JdbcGetUserNameExclusionTest extends AbstractInstrumentationTest { + + protected static JdbcConfiguration jdbcconfig; + + @Test + public void hasUsernameCorrectlyExcludes() throws SQLException { + DatabaseMetaData meta = (DatabaseMetaData) Proxy.newProxyInstance( + this.getClass().getClassLoader(), + new Class[] { DatabaseMetaData.class }, + new MetadataInvocationHandler()); + + assertThat(JdbcHelper.maybeGetUserName(meta, config.getConfig(JdbcConfiguration.class))).isEqualTo("testuser"); + + String classname = meta.getClass().getName(); + String excludeName = classname.substring(classname.indexOf('$')+1); + doReturn(List.of(excludeName)) + .when(config.getConfig(JdbcConfiguration.class)) + .getDatabaseMetaDataExclusionList(); + + assertThat(JdbcHelper.maybeGetUserName(meta, config.getConfig(JdbcConfiguration.class))).isEqualTo(null); + } + + public class MetadataInvocationHandler implements InvocationHandler { + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (method.getName().equals("getUserName")) { + return "testuser"; + } + return null; + } + } + +} From a3709b73dcefbd20d189ee23d9789a6c3f82e6c6 Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Tue, 2 Apr 2024 08:07:03 -0400 Subject: [PATCH 020/132] pre release: elastic-apm-agent v1.49.0 (#3576) Co-authored-by: apmmachine --- CHANGELOG.asciidoc | 9 ++++++--- apm-agent-api/pom.xml | 2 +- apm-agent-attach-cli/pom.xml | 2 +- apm-agent-attach/pom.xml | 2 +- apm-agent-benchmarks/pom.xml | 2 +- apm-agent-bootstrap/pom.xml | 2 +- apm-agent-builds/apm-agent-java8/pom.xml | 2 +- apm-agent-builds/apm-agent/pom.xml | 2 +- apm-agent-builds/pom.xml | 2 +- apm-agent-cached-lookup-key/pom.xml | 2 +- apm-agent-common/pom.xml | 2 +- apm-agent-core/pom.xml | 2 +- apm-agent-lambda-layer/pom.xml | 2 +- apm-agent-plugin-sdk/pom.xml | 2 +- .../apm-apache-httpclient-common/pom.xml | 2 +- .../apm-apache-httpclient3-plugin/pom.xml | 2 +- .../apm-apache-httpclient4-plugin/pom.xml | 2 +- .../apm-apache-httpclient5-plugin/pom.xml | 2 +- apm-agent-plugins/apm-apache-httpclient/pom.xml | 2 +- apm-agent-plugins/apm-api-plugin/pom.xml | 2 +- apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml | 2 +- .../apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml | 2 +- .../apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/pom.xml | 2 +- apm-agent-plugins/apm-awslambda-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra-core-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra3-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/pom.xml | 2 +- apm-agent-plugins/apm-dubbo-plugin/pom.xml | 2 +- apm-agent-plugins/apm-ecs-logging-plugin/pom.xml | 2 +- .../apm-es-restclient-plugin-5_6/pom.xml | 2 +- .../apm-es-restclient-plugin-6_4/pom.xml | 2 +- .../apm-es-restclient-plugin-7_x/pom.xml | 2 +- .../apm-es-restclient-plugin-8_x/pom.xml | 2 +- .../apm-es-restclient-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-es-restclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grails-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-grpc/pom.xml | 2 +- .../apm-hibernate-search-plugin-5_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-6_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-hibernate-search-plugin/pom.xml | 2 +- apm-agent-plugins/apm-httpclient-core/pom.xml | 2 +- apm-agent-plugins/apm-httpserver-core/pom.xml | 2 +- apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-concurrent-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-ldap-plugin/pom.xml | 2 +- apm-agent-plugins/apm-javalin-plugin/pom.xml | 2 +- .../apm-jaxrs-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxrs-plugin/pom.xml | 2 +- .../apm-jaxws-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxws-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdbc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml | 2 +- .../apm-jms-plugin/apm-jms-plugin-base/pom.xml | 2 +- .../apm-jms-plugin/apm-jms-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jmx-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jsf-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-base-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-kafka-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-jboss-logging-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-jul-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-log4j1-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-log4j2-plugin/pom.xml | 2 +- .../apm-logback-plugin/apm-logback-plugin-impl/pom.xml | 2 +- .../apm-logback-plugin-legacy-tests/pom.xml | 2 +- .../apm-logging-plugin/apm-logback-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-logging-plugin-common/pom.xml | 2 +- .../apm-logging-plugin/apm-slf4j-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml | 2 +- .../apm-mongodb/apm-mongodb3-plugin/pom.xml | 2 +- .../apm-mongodb/apm-mongodb4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-plugin/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-test/pom.xml | 2 +- .../apm-opentelemetry-embedded-metrics-sdk/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-common/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-latest/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-v1_14/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-parent/pom.xml | 2 +- .../apm-opentelemetry-metricsdk-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-test/pom.xml | 2 +- apm-agent-plugins/apm-opentelemetry/pom.xml | 2 +- apm-agent-plugins/apm-opentracing-plugin/pom.xml | 2 +- apm-agent-plugins/apm-process-plugin/pom.xml | 2 +- apm-agent-plugins/apm-profiling-plugin/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml | 2 +- apm-agent-plugins/apm-quartz/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-plugin/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-spring/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-test-3/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-test-4/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/pom.xml | 2 +- apm-agent-plugins/apm-reactor-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-2-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-3-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-4-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-5-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-lettuce-3-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-lettuce-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-redis-common/pom.xml | 2 +- .../apm-redis-plugin/apm-redisson-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/pom.xml | 2 +- apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../apm-scheduled-annotation-plugin/pom.xml | 2 +- apm-agent-plugins/apm-servlet-jakarta-test/pom.xml | 2 +- apm-agent-plugins/apm-servlet-plugin/pom.xml | 2 +- apm-agent-plugins/apm-sparkjava-plugin/pom.xml | 2 +- .../apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- .../apm-spring-resttemplate-test/pom.xml | 2 +- apm-agent-plugins/apm-spring-resttemplate/pom.xml | 2 +- .../apm-spring-webclient-plugin/pom.xml | 2 +- .../apm-spring-webflux-common-spring5/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-common/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-plugin/pom.xml | 2 +- .../apm-spring-webflux-spring5/pom.xml | 2 +- .../apm-spring-webflux-testapp/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- apm-agent-plugins/apm-struts-plugin/pom.xml | 2 +- apm-agent-plugins/apm-urlconnection-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml | 2 +- .../apm-vertx/apm-vertx3-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/pom.xml | 2 +- apm-agent-plugins/pom.xml | 2 +- apm-agent-tracer/pom.xml | 2 +- apm-opentracing/pom.xml | 2 +- elastic-apm-agent-java8/pom.xml | 2 +- elastic-apm-agent-premain/pom.xml | 2 +- elastic-apm-agent/pom.xml | 2 +- .../application-server-integration-tests/pom.xml | 2 +- integration-tests/aws-lambda-test/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-dependent/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-standalone/pom.xml | 2 +- integration-tests/cdi-app/pom.xml | 2 +- .../cdi-jakartaee-app-dependent/pom.xml | 2 +- .../cdi-jakartaee-app-standalone/pom.xml | 2 +- integration-tests/cdi-jakartaee-app/pom.xml | 2 +- .../external-plugin-otel-test-app/pom.xml | 2 +- .../external-plugin-otel-test-plugin1/pom.xml | 2 +- .../external-plugin-otel-test-plugin2/pom.xml | 2 +- integration-tests/external-plugin-otel-test/pom.xml | 2 +- .../external-plugin-test/external-plugin-app/pom.xml | 2 +- .../external-plugin-jakarta-app/pom.xml | 2 +- .../external-plugin-test/external-plugin/pom.xml | 2 +- .../plugin-instrumentation-target/pom.xml | 2 +- integration-tests/external-plugin-test/pom.xml | 2 +- .../jakartaee-jsf-app-dependent/pom.xml | 2 +- .../jakartaee-jsf-app-standalone/pom.xml | 2 +- integration-tests/jakartaee-jsf-app/pom.xml | 2 +- integration-tests/jakartaee-simple-webapp/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-dependent/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-standalone/pom.xml | 2 +- integration-tests/jsf-app/pom.xml | 2 +- integration-tests/main-app-test/pom.xml | 2 +- integration-tests/pom.xml | 2 +- integration-tests/quarkus/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-base/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml | 2 +- integration-tests/runtime-attach/pom.xml | 2 +- .../runtime-attach/runtime-attach-app/pom.xml | 2 +- .../runtime-attach/runtime-attach-test/pom.xml | 2 +- integration-tests/simple-webapp/pom.xml | 2 +- integration-tests/soap-test/pom.xml | 2 +- integration-tests/spring-boot-1-5/pom.xml | 2 +- integration-tests/spring-boot-2/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-base/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-jetty/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-tomcat/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-undertow/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-jetty/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-tomcat/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-undertow/pom.xml | 2 +- pom.xml | 2 +- 201 files changed, 206 insertions(+), 203 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 6b92fe1bdb..44b9c2f8e5 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,12 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +[[release-notes-1.x]] +=== Java Agent version 1.x + +[[release-notes-1.49.0]] +==== 1.49.0 - 2024/04/02 + [float] ===== Bug fixes * Fixed problems with public API annotation inheritance - {pull}3551[#3551] @@ -41,9 +47,6 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: * Added lambda support for ELB triggers {pull}#3411[#3411] * Add exclusion list option for calling DatabaseMetaData.getUserName - {pull}#3568[#3568] -[[release-notes-1.x]] -=== Java Agent version 1.x - [[release-notes-1.48.1]] ==== 1.48.1 - 2024/03/06 diff --git a/apm-agent-api/pom.xml b/apm-agent-api/pom.xml index dc56879084..7c967db31a 100644 --- a/apm-agent-api/pom.xml +++ b/apm-agent-api/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-api diff --git a/apm-agent-attach-cli/pom.xml b/apm-agent-attach-cli/pom.xml index 49d3761542..461dbf4dc2 100644 --- a/apm-agent-attach-cli/pom.xml +++ b/apm-agent-attach-cli/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-attach/pom.xml b/apm-agent-attach/pom.xml index 44bb4d3407..32da5d5c25 100644 --- a/apm-agent-attach/pom.xml +++ b/apm-agent-attach/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-attach diff --git a/apm-agent-benchmarks/pom.xml b/apm-agent-benchmarks/pom.xml index 05a9398e17..142bf7c9fb 100644 --- a/apm-agent-benchmarks/pom.xml +++ b/apm-agent-benchmarks/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-benchmarks diff --git a/apm-agent-bootstrap/pom.xml b/apm-agent-bootstrap/pom.xml index e2977db54c..bc2d76aa63 100644 --- a/apm-agent-bootstrap/pom.xml +++ b/apm-agent-bootstrap/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-bootstrap diff --git a/apm-agent-builds/apm-agent-java8/pom.xml b/apm-agent-builds/apm-agent-java8/pom.xml index f7a80a7819..47dccec352 100644 --- a/apm-agent-builds/apm-agent-java8/pom.xml +++ b/apm-agent-builds/apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-java8 diff --git a/apm-agent-builds/apm-agent/pom.xml b/apm-agent-builds/apm-agent/pom.xml index 03aa5bbf66..f04515c0a2 100644 --- a/apm-agent-builds/apm-agent/pom.xml +++ b/apm-agent-builds/apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.48.2-SNAPSHOT + 1.49.0 apm-agent diff --git a/apm-agent-builds/pom.xml b/apm-agent-builds/pom.xml index 2d64440819..bda0b824cd 100644 --- a/apm-agent-builds/pom.xml +++ b/apm-agent-builds/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-cached-lookup-key/pom.xml b/apm-agent-cached-lookup-key/pom.xml index 8f214a8b1f..3f910cf4f6 100644 --- a/apm-agent-cached-lookup-key/pom.xml +++ b/apm-agent-cached-lookup-key/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-common/pom.xml b/apm-agent-common/pom.xml index e57ab1abce..6842b66afc 100644 --- a/apm-agent-common/pom.xml +++ b/apm-agent-common/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index a3ed72483d..61dec83244 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-core diff --git a/apm-agent-lambda-layer/pom.xml b/apm-agent-lambda-layer/pom.xml index 00279d5bbd..2632f74b45 100644 --- a/apm-agent-lambda-layer/pom.xml +++ b/apm-agent-lambda-layer/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugin-sdk/pom.xml b/apm-agent-plugin-sdk/pom.xml index 8373fd913b..88840de213 100644 --- a/apm-agent-plugin-sdk/pom.xml +++ b/apm-agent-plugin-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml index 09b244f874..70a1c86efa 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-apache-httpclient-common diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml index 26badce88b..e200ba4293 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-apache-httpclient3-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml index e1e3d3d799..ad7f1b9375 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-apache-httpclient4-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml index 912cd34205..53c1f0445d 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-apache-httpclient - 1.48.2-SNAPSHOT + 1.49.0 apm-apache-httpclient5-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/pom.xml b/apm-agent-plugins/apm-apache-httpclient/pom.xml index 13039a2137..db5fea7c42 100644 --- a/apm-agent-plugins/apm-apache-httpclient/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-apache-httpclient diff --git a/apm-agent-plugins/apm-api-plugin/pom.xml b/apm-agent-plugins/apm-api-plugin/pom.xml index 9bbf32fc0a..2fa06b2262 100644 --- a/apm-agent-plugins/apm-api-plugin/pom.xml +++ b/apm-agent-plugins/apm-api-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 diff --git a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml index d16146a415..963d44ac35 100644 --- a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-asynchttpclient-plugin diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml index 9ce3564a88..2befe6bdad 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index 62aefeded8..6297842308 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml index 3d3f0de94e..a48a31ae96 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/pom.xml b/apm-agent-plugins/apm-aws-sdk/pom.xml index 5cf7a1e724..6196ff5d40 100644 --- a/apm-agent-plugins/apm-aws-sdk/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-awslambda-plugin/pom.xml b/apm-agent-plugins/apm-awslambda-plugin/pom.xml index f4819bbdeb..405bb4a42b 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/pom.xml +++ b/apm-agent-plugins/apm-awslambda-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml index 52ada94e7e..be3fbb0565 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml index 1c48a45f4b..f8ad869438 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml index 977e380899..1130b7ff35 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/pom.xml b/apm-agent-plugins/apm-cassandra/pom.xml index 28412125b2..a6fcd2e7a1 100644 --- a/apm-agent-plugins/apm-cassandra/pom.xml +++ b/apm-agent-plugins/apm-cassandra/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-dubbo-plugin/pom.xml b/apm-agent-plugins/apm-dubbo-plugin/pom.xml index 8b62725169..bef2e71d9e 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/pom.xml +++ b/apm-agent-plugins/apm-dubbo-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml index 5644c1d34d..794c55ad97 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-ecs-logging-plugin diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml index aaf43fd306..e3145e447e 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-es-restclient-plugin-5_6 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml index 7d8b0b7284..d3ce291f35 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-es-restclient-plugin-6_4 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml index 9149b883fb..972d0f081f 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-es-restclient-plugin-7_x diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml index 997ab85f8a..cba4d9d614 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml @@ -3,7 +3,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml index 40dadf3324..11191c15d0 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-es-restclient-plugin-common diff --git a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml index afd404b925..284c69814d 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-es-restclient-plugin diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml index 959f055bcf..c5282b5a39 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-finagle-httpclient-plugin diff --git a/apm-agent-plugins/apm-grails-plugin/pom.xml b/apm-agent-plugins/apm-grails-plugin/pom.xml index dd04a58d3a..395750bc79 100644 --- a/apm-agent-plugins/apm-grails-plugin/pom.xml +++ b/apm-agent-plugins/apm-grails-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-grails-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml index 1cd687415b..cce2de5dc1 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.48.2-SNAPSHOT + 1.49.0 apm-grpc-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml index 49a7d51de1..fc32f566a9 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.48.2-SNAPSHOT + 1.49.0 apm-grpc-test-1.6.1 diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml index f583d33fba..216087d7a8 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.48.2-SNAPSHOT + 1.49.0 apm-grpc-test-latest diff --git a/apm-agent-plugins/apm-grpc/pom.xml b/apm-agent-plugins/apm-grpc/pom.xml index 1ab7d2d4a1..759c1f1320 100644 --- a/apm-agent-plugins/apm-grpc/pom.xml +++ b/apm-agent-plugins/apm-grpc/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.2-SNAPSHOT + 1.49.0 apm-grpc diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml index 00ad479bc5..8f48e364f7 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-hibernate-search-plugin-5_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml index af31592546..ab99217b36 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-hibernate-search-plugin-6_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml index c6c8482f39..e5ad36c01d 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-hibernate-search-plugin-common diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml index d0a531299d..e87bec250b 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-hibernate-search-plugin diff --git a/apm-agent-plugins/apm-httpclient-core/pom.xml b/apm-agent-plugins/apm-httpclient-core/pom.xml index f3030694a4..6f0e154bc2 100644 --- a/apm-agent-plugins/apm-httpclient-core/pom.xml +++ b/apm-agent-plugins/apm-httpclient-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-httpclient-core diff --git a/apm-agent-plugins/apm-httpserver-core/pom.xml b/apm-agent-plugins/apm-httpserver-core/pom.xml index 702736ed6e..d82a19e192 100644 --- a/apm-agent-plugins/apm-httpserver-core/pom.xml +++ b/apm-agent-plugins/apm-httpserver-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-httpserver-core diff --git a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml index 6630f0da94..c60a31e44d 100644 --- a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml +++ b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jakarta-websocket-plugin diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml index aec7d4d61e..c87a92c14d 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-java-concurrent-plugin diff --git a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml index d69b13e8d4..2263c5dd1d 100644 --- a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-java-ldap-plugin diff --git a/apm-agent-plugins/apm-javalin-plugin/pom.xml b/apm-agent-plugins/apm-javalin-plugin/pom.xml index c8e4775859..a36e51557d 100644 --- a/apm-agent-plugins/apm-javalin-plugin/pom.xml +++ b/apm-agent-plugins/apm-javalin-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-javalin-plugin diff --git a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml index 26255efff9..2b1abf4e04 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml index 15eaeb76c2..45a0e56639 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jaxrs-plugin diff --git a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml index 1466284ce5..40d4a93f9a 100644 --- a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-jaxws-plugin/pom.xml b/apm-agent-plugins/apm-jaxws-plugin/pom.xml index b16e3a2782..90a111b56c 100644 --- a/apm-agent-plugins/apm-jaxws-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jaxws-plugin diff --git a/apm-agent-plugins/apm-jdbc-plugin/pom.xml b/apm-agent-plugins/apm-jdbc-plugin/pom.xml index 8d279585e3..74f20b02a8 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdbc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jdbc-plugin diff --git a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml index a7f6523fd7..6eb3481ba2 100644 --- a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jdk-httpclient-plugin diff --git a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml index 85c2823725..9ec611014a 100644 --- a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jdk-httpserver-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml index bbbcc1a0f0..6d365048b9 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml index 9c10e3f17c..27471119bc 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml index b85ed7a13e..33afe2abb0 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jms-plugin-base diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml index 81e1cfde8f..39c4afcaf3 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jms-spring-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/pom.xml index c3c3b9d1b4..dc184d7c8f 100644 --- a/apm-agent-plugins/apm-jms-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jms-plugin diff --git a/apm-agent-plugins/apm-jmx-plugin/pom.xml b/apm-agent-plugins/apm-jmx-plugin/pom.xml index 8dddd765b6..b086bf9ba4 100644 --- a/apm-agent-plugins/apm-jmx-plugin/pom.xml +++ b/apm-agent-plugins/apm-jmx-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jmx-plugin diff --git a/apm-agent-plugins/apm-jsf-plugin/pom.xml b/apm-agent-plugins/apm-jsf-plugin/pom.xml index 8556914066..d2940944e1 100644 --- a/apm-agent-plugins/apm-jsf-plugin/pom.xml +++ b/apm-agent-plugins/apm-jsf-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jsf-plugin diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml index f3b6911e9d..b250536ff2 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml @@ -3,7 +3,7 @@ apm-kafka-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml index 4137353472..ad0b8527b0 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml index bfbaf17272..5dc62cbc7d 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/pom.xml index 85676c0666..dc6c403130 100644 --- a/apm-agent-plugins/apm-kafka-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml index c1e66a3766..c634b39c11 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jboss-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml index a27c6ea565..ee67d929c8 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jul-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml index afa55c335e..ab55c53b33 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-log4j1-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml index b5f08e2b67..b53fc81013 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-log4j2-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml index 5d31a5212d..2bc3528efe 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-logback-plugin-impl diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml index 3fe9c12bee..71f1701839 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-logback-plugin-legacy-tests diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml index 0c4618b9d9..e25365e8e8 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-logback-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml index f3fed7db39..5eaeaa5d2f 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-logging-plugin-common diff --git a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml index fe9d2ea927..1da12350ba 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-slf4j-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml index 1f901bfd46..624b9e9829 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-tomcat-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/pom.xml index 210a547700..a64baaddbc 100644 --- a/apm-agent-plugins/apm-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-logging-plugin diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 13b891a786..1a5fbb68c0 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml index 2ed07d0c3c..bc303c0d7b 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml @@ -4,7 +4,7 @@ apm-mongodb co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml index 2cd12d88fa..6e257d53a4 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-mongodb co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml index f79e060b0e..7dfdd18eda 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-mongodb co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-mongodb4-plugin diff --git a/apm-agent-plugins/apm-mongodb/pom.xml b/apm-agent-plugins/apm-mongodb/pom.xml index 94f6457acb..6db3400406 100644 --- a/apm-agent-plugins/apm-mongodb/pom.xml +++ b/apm-agent-plugins/apm-mongodb/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-mongodb diff --git a/apm-agent-plugins/apm-okhttp-plugin/pom.xml b/apm-agent-plugins/apm-okhttp-plugin/pom.xml index 17a140044a..30822c0400 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/pom.xml +++ b/apm-agent-plugins/apm-okhttp-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-okhttp-plugin diff --git a/apm-agent-plugins/apm-okhttp-test/pom.xml b/apm-agent-plugins/apm-okhttp-test/pom.xml index 370ce9b874..2a541552a3 100644 --- a/apm-agent-plugins/apm-okhttp-test/pom.xml +++ b/apm-agent-plugins/apm-okhttp-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml index 65610a16a8..7800ac6b1c 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.2-SNAPSHOT + 1.49.0 apm-opentelemetry-embedded-metrics-sdk diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml index 5f039cf1f6..d28deb47dd 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml index 1dd43e348e..3e536371c6 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml index b2464b6b7d..4c8eb9ee99 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml index 4c63b96869..33500a984c 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml index 8427d641bf..4aa623a588 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.2-SNAPSHOT + 1.49.0 apm-opentelemetry-metricsdk-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml index 9caf40a9e7..8a26722207 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.2-SNAPSHOT + 1.49.0 apm-opentelemetry-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml index 0e426ab323..03b4573f92 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.48.2-SNAPSHOT + 1.49.0 ${project.groupId}:${project.artifactId} diff --git a/apm-agent-plugins/apm-opentelemetry/pom.xml b/apm-agent-plugins/apm-opentelemetry/pom.xml index a309696fcd..9171c625c5 100644 --- a/apm-agent-plugins/apm-opentelemetry/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.2-SNAPSHOT + 1.49.0 apm-opentelemetry diff --git a/apm-agent-plugins/apm-opentracing-plugin/pom.xml b/apm-agent-plugins/apm-opentracing-plugin/pom.xml index ae9e4bf4b0..be27c04d20 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentracing-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-opentracing-plugin diff --git a/apm-agent-plugins/apm-process-plugin/pom.xml b/apm-agent-plugins/apm-process-plugin/pom.xml index da684669d9..533ed6b78c 100644 --- a/apm-agent-plugins/apm-process-plugin/pom.xml +++ b/apm-agent-plugins/apm-process-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-profiling-plugin/pom.xml b/apm-agent-plugins/apm-profiling-plugin/pom.xml index 8f5e912af0..7c54ea6958 100644 --- a/apm-agent-plugins/apm-profiling-plugin/pom.xml +++ b/apm-agent-plugins/apm-profiling-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-profiling-plugin diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml index c4012b542e..5edcec6136 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml index 019654416e..2d5a1baf8b 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml index 1b2d22a3cc..f971adf098 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/pom.xml b/apm-agent-plugins/apm-quartz/pom.xml index 5bd74fe5b8..9c26ec94ad 100644 --- a/apm-agent-plugins/apm-quartz/pom.xml +++ b/apm-agent-plugins/apm-quartz/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-quartz diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml index 232a8a3c91..ea32ca0f82 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-rabbitmq-plugin diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml index d5d6476ea6..be3e19e6a1 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-rabbitmq-spring diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml index 964023983e..83a7c279cc 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-rabbitmq-test-3 diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml index c0f6d5606f..a87c19884d 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-rabbitmq-test-4 diff --git a/apm-agent-plugins/apm-rabbitmq/pom.xml b/apm-agent-plugins/apm-rabbitmq/pom.xml index 84c3adf675..e0a2323da9 100644 --- a/apm-agent-plugins/apm-rabbitmq/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-rabbitmq diff --git a/apm-agent-plugins/apm-reactor-plugin/pom.xml b/apm-agent-plugins/apm-reactor-plugin/pom.xml index 7c33618024..9e538c6043 100644 --- a/apm-agent-plugins/apm-reactor-plugin/pom.xml +++ b/apm-agent-plugins/apm-reactor-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.2-SNAPSHOT + 1.49.0 apm-reactor-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml index b851eba9bd..1d7bec2069 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jedis-2-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml index dffe6419d6..a0fe35c569 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jedis-3-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml index e67e74953d..9c6fcc4a4d 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jedis-4-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml index 8a36ca3d0b..d944984596 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jedis-5-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml index 3f1760fbec..f584237c3e 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-jedis-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml index 27859df68e..d95aae9259 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml index ce9a3f8dcf..514ffe48f8 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml index 47e44ad13e..1007e8613c 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-redis-common diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml index f55fed32df..c87bcfcfa0 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-redisson-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/pom.xml index bcc0712a47..560691c71c 100644 --- a/apm-agent-plugins/apm-redis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-redis-plugin diff --git a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml index 6cf99a7db4..943daf423d 100644 --- a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-scala-concurrent-plugin diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml index c49411054e..ecea4dfa34 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml index 6e4018e604..cf39551c41 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-scheduled-annotation-plugin diff --git a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml index 156602f6d0..be040cba19 100644 --- a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml +++ b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-servlet-jakarta-test diff --git a/apm-agent-plugins/apm-servlet-plugin/pom.xml b/apm-agent-plugins/apm-servlet-plugin/pom.xml index 53be86608e..c8dd43f4de 100644 --- a/apm-agent-plugins/apm-servlet-plugin/pom.xml +++ b/apm-agent-plugins/apm-servlet-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-servlet-plugin diff --git a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml index e5d4e3a010..e435044523 100644 --- a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml +++ b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index 3f02160f34..b529ca9fea 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-restclient-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index 8d9a70f69f..2f6c4456ea 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-resttemplate-plugin diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml index deae551502..82d497b2eb 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-resttemplate-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/pom.xml index 94f3434b62..f1d1463f07 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-resttemplate diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml index 446ebd3c83..19d61ff288 100755 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webclient-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml index 7fd7fca12d..79e5c0b0b3 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webflux-common-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml index b781076a72..a0bf5cbbf9 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webflux-common diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml index 85531d1a2f..0e43d1d7ea 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webflux-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml index 30f4c298d7..ee213cf370 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webflux-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml index 3e45fefa40..a4f28af941 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webflux-testapp diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index 51265fae3c..ca0f7359cf 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webflux diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index f42d4482df..3dfa508043 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webmvc-plugin diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml index 21a82e7866..de6ea95ec3 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-spring-webmvc-spring5 diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index e3c4af3f60..af3b7fa514 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-struts-plugin/pom.xml b/apm-agent-plugins/apm-struts-plugin/pom.xml index f2f1116ef2..1e47f97dd8 100644 --- a/apm-agent-plugins/apm-struts-plugin/pom.xml +++ b/apm-agent-plugins/apm-struts-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml index b6ef4740c4..fdacc1e9b5 100644 --- a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml +++ b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-urlconnection-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml index 2f7905c136..4db2506f70 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-vertx-common diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml index f449482dea..1c4e03391d 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-vertx3-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml index 6e07055cf6..60a2ebca8b 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-vertx3-test-latest diff --git a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml index be4b5e74d7..c47ffc1e4e 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-vertx4-plugin diff --git a/apm-agent-plugins/apm-vertx/pom.xml b/apm-agent-plugins/apm-vertx/pom.xml index 46fb2455c2..1e935c6347 100644 --- a/apm-agent-plugins/apm-vertx/pom.xml +++ b/apm-agent-plugins/apm-vertx/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-vertx diff --git a/apm-agent-plugins/pom.xml b/apm-agent-plugins/pom.xml index bb2071af86..6acbfe7d40 100644 --- a/apm-agent-plugins/pom.xml +++ b/apm-agent-plugins/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-plugins diff --git a/apm-agent-tracer/pom.xml b/apm-agent-tracer/pom.xml index 096102758d..cf71cc4e53 100644 --- a/apm-agent-tracer/pom.xml +++ b/apm-agent-tracer/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.48.2-SNAPSHOT + 1.49.0 apm-agent-tracer diff --git a/apm-opentracing/pom.xml b/apm-opentracing/pom.xml index 36d44a138e..1e34b37172 100644 --- a/apm-opentracing/pom.xml +++ b/apm-opentracing/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 apm-opentracing diff --git a/elastic-apm-agent-java8/pom.xml b/elastic-apm-agent-java8/pom.xml index e0d262749a..ce3d63b288 100644 --- a/elastic-apm-agent-java8/pom.xml +++ b/elastic-apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.48.2-SNAPSHOT + 1.49.0 elastic-apm-agent-java8 diff --git a/elastic-apm-agent-premain/pom.xml b/elastic-apm-agent-premain/pom.xml index 9d87be02e9..94ad89199b 100644 --- a/elastic-apm-agent-premain/pom.xml +++ b/elastic-apm-agent-premain/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/elastic-apm-agent/pom.xml b/elastic-apm-agent/pom.xml index 76f7c4c2f2..a7fb3005e7 100644 --- a/elastic-apm-agent/pom.xml +++ b/elastic-apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.48.2-SNAPSHOT + 1.49.0 elastic-apm-agent diff --git a/integration-tests/application-server-integration-tests/pom.xml b/integration-tests/application-server-integration-tests/pom.xml index 78f55c218a..ff82f3c7f7 100644 --- a/integration-tests/application-server-integration-tests/pom.xml +++ b/integration-tests/application-server-integration-tests/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 application-server-integration-tests diff --git a/integration-tests/aws-lambda-test/pom.xml b/integration-tests/aws-lambda-test/pom.xml index 043164b62e..8d4ccb5cb1 100644 --- a/integration-tests/aws-lambda-test/pom.xml +++ b/integration-tests/aws-lambda-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-dependent/pom.xml b/integration-tests/cdi-app/cdi-app-dependent/pom.xml index 645386cf40..7fa8622b49 100644 --- a/integration-tests/cdi-app/cdi-app-dependent/pom.xml +++ b/integration-tests/cdi-app/cdi-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-standalone/pom.xml b/integration-tests/cdi-app/cdi-app-standalone/pom.xml index 77baba8340..6976c519c7 100644 --- a/integration-tests/cdi-app/cdi-app-standalone/pom.xml +++ b/integration-tests/cdi-app/cdi-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/cdi-app/pom.xml b/integration-tests/cdi-app/pom.xml index aec2fbfdab..751dcc6c8f 100644 --- a/integration-tests/cdi-app/pom.xml +++ b/integration-tests/cdi-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml index de3110de16..90de8b028e 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml index 28d9f094cc..ce3b1d89b4 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/pom.xml b/integration-tests/cdi-jakartaee-app/pom.xml index f0dfb87676..e2a1eb57c2 100644 --- a/integration-tests/cdi-jakartaee-app/pom.xml +++ b/integration-tests/cdi-jakartaee-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml index d4148f8389..fbc6852359 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.48.2-SNAPSHOT + 1.49.0 external-plugin-otel-test-app diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml index 51304363e2..b544aef5c2 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.48.2-SNAPSHOT + 1.49.0 external-plugin-otel-test-plugin1 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml index 2327dd561c..9d08c966f9 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.48.2-SNAPSHOT + 1.49.0 external-plugin-otel-test-plugin2 diff --git a/integration-tests/external-plugin-otel-test/pom.xml b/integration-tests/external-plugin-otel-test/pom.xml index 8c8101f4bf..4bd83805c8 100644 --- a/integration-tests/external-plugin-otel-test/pom.xml +++ b/integration-tests/external-plugin-otel-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm integration-tests - 1.48.2-SNAPSHOT + 1.49.0 external-plugin-otel-test diff --git a/integration-tests/external-plugin-test/external-plugin-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-app/pom.xml index 2eaf4b7011..5cc0210bf5 100644 --- a/integration-tests/external-plugin-test/external-plugin-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 external-plugin-app diff --git a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml index 32e9230a95..3a3c626b5b 100644 --- a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 external-plugin-jakarta-app diff --git a/integration-tests/external-plugin-test/external-plugin/pom.xml b/integration-tests/external-plugin-test/external-plugin/pom.xml index 842800861e..635ec073d8 100644 --- a/integration-tests/external-plugin-test/external-plugin/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 external-plugin diff --git a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml index 37a8fe6849..1e008f01e2 100644 --- a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml +++ b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 plugin-instrumentation-target diff --git a/integration-tests/external-plugin-test/pom.xml b/integration-tests/external-plugin-test/pom.xml index 6e897b3663..1ab2a4717e 100644 --- a/integration-tests/external-plugin-test/pom.xml +++ b/integration-tests/external-plugin-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml index 4a69451d2a..5e450c96fe 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml index 8a390f932c..4ad7029e6d 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/pom.xml b/integration-tests/jakartaee-jsf-app/pom.xml index 0b0938d089..32fa2c1fa8 100644 --- a/integration-tests/jakartaee-jsf-app/pom.xml +++ b/integration-tests/jakartaee-jsf-app/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 pom diff --git a/integration-tests/jakartaee-simple-webapp/pom.xml b/integration-tests/jakartaee-simple-webapp/pom.xml index 73d8836596..3a265054c1 100644 --- a/integration-tests/jakartaee-simple-webapp/pom.xml +++ b/integration-tests/jakartaee-simple-webapp/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 jakartaee-simple-webapp diff --git a/integration-tests/jsf-app/jsf-app-dependent/pom.xml b/integration-tests/jsf-app/jsf-app-dependent/pom.xml index 0e97912243..4632305024 100644 --- a/integration-tests/jsf-app/jsf-app-dependent/pom.xml +++ b/integration-tests/jsf-app/jsf-app-dependent/pom.xml @@ -4,7 +4,7 @@ jsf-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/jsf-app/jsf-app-standalone/pom.xml b/integration-tests/jsf-app/jsf-app-standalone/pom.xml index 5992155203..cb554b6882 100644 --- a/integration-tests/jsf-app/jsf-app-standalone/pom.xml +++ b/integration-tests/jsf-app/jsf-app-standalone/pom.xml @@ -6,7 +6,7 @@ jsf-app co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 jsf-app-standalone diff --git a/integration-tests/jsf-app/pom.xml b/integration-tests/jsf-app/pom.xml index e2fc080321..4a77fc6fc8 100644 --- a/integration-tests/jsf-app/pom.xml +++ b/integration-tests/jsf-app/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 jsf-app diff --git a/integration-tests/main-app-test/pom.xml b/integration-tests/main-app-test/pom.xml index 7aba42e2a1..2394a2d859 100644 --- a/integration-tests/main-app-test/pom.xml +++ b/integration-tests/main-app-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 main-app-test diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index c6800d5577..9e925c082c 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 integration-tests diff --git a/integration-tests/quarkus/pom.xml b/integration-tests/quarkus/pom.xml index 5d099e3f07..71b503b0f3 100644 --- a/integration-tests/quarkus/pom.xml +++ b/integration-tests/quarkus/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 quarkus diff --git a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml index 19d6d81b24..fb55d2f3a0 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 quarkus-jaxrs-base diff --git a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml index 1075b45659..ba4c3c4e5a 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 quarkus-jaxrs-undertow diff --git a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml index fdb198f7ea..ef2d751b8b 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 quarkus-jaxrs-vertx diff --git a/integration-tests/runtime-attach/pom.xml b/integration-tests/runtime-attach/pom.xml index c6d07b45eb..3cd9da7adf 100644 --- a/integration-tests/runtime-attach/pom.xml +++ b/integration-tests/runtime-attach/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 runtime-attach diff --git a/integration-tests/runtime-attach/runtime-attach-app/pom.xml b/integration-tests/runtime-attach/runtime-attach-app/pom.xml index 67442e2407..69de69af65 100644 --- a/integration-tests/runtime-attach/runtime-attach-app/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-app/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/runtime-attach/runtime-attach-test/pom.xml b/integration-tests/runtime-attach/runtime-attach-test/pom.xml index 4ab75d5835..604a113b35 100644 --- a/integration-tests/runtime-attach/runtime-attach-test/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-test/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/simple-webapp/pom.xml b/integration-tests/simple-webapp/pom.xml index b08f6fec40..35b1604594 100644 --- a/integration-tests/simple-webapp/pom.xml +++ b/integration-tests/simple-webapp/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 simple-webapp diff --git a/integration-tests/soap-test/pom.xml b/integration-tests/soap-test/pom.xml index 1ebad4536e..0d03952129 100644 --- a/integration-tests/soap-test/pom.xml +++ b/integration-tests/soap-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 soap-test diff --git a/integration-tests/spring-boot-1-5/pom.xml b/integration-tests/spring-boot-1-5/pom.xml index a27b24fd16..82ffa2180c 100644 --- a/integration-tests/spring-boot-1-5/pom.xml +++ b/integration-tests/spring-boot-1-5/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-1-5 diff --git a/integration-tests/spring-boot-2/pom.xml b/integration-tests/spring-boot-2/pom.xml index 6e834687b2..8f1aaa1d15 100644 --- a/integration-tests/spring-boot-2/pom.xml +++ b/integration-tests/spring-boot-2/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-2 diff --git a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml index 528160db9b..ff01bc47fb 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-2-base diff --git a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml index 9f07748eef..879735c5a5 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-2-jetty diff --git a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml index 4eacadb320..229fc95d95 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-2-tomcat diff --git a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml index 3c7212ec18..85ceea0865 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-2-undertow diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 174007e9fe..744200d853 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 spring-boot-3 diff --git a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml index 4d63b45954..b7ba4b02bf 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml index 75cf0f4adc..bc0b652eb9 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml index 1633a3aeb5..d1818a48c5 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.48.2-SNAPSHOT + 1.49.0 4.0.0 diff --git a/pom.xml b/pom.xml index dccc732203..262422be2c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.48.2-SNAPSHOT + 1.49.0 pom ${project.groupId}:${project.artifactId} From 3059907525593a5470738503131cf0d72aaa14ae Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Tue, 2 Apr 2024 14:58:03 +0200 Subject: [PATCH 021/132] ci(fix): use input value instead of env value for post release trigger (#3577) Signed-off-by: Adrien Mannocci --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc9a754f3e..53c3ed5f58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -248,7 +248,7 @@ jobs: if: inputs.dry_run == false with: ref: ${{ inputs.ref }} - version: ${{ env.RELEASE_VERSION }} + version: ${{ inputs.version }} phase: 'post' secrets: inherit From 1a17acb2e123d67da36594ef5da8bcde7a3116a7 Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Tue, 2 Apr 2024 15:56:11 +0200 Subject: [PATCH 022/132] ci(fix): correct buildkite pipeline trigger (#3578) Signed-off-by: Adrien Mannocci --- .github/workflows/release.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53c3ed5f58..d7b05b048f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,7 +84,6 @@ jobs: vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} pipeline: apm-agent-java-release - pipelineCommit: ${{ env.RELEASE_VERSION }} waitFor: true printBuildLogs: false buildEnvVars: | @@ -204,9 +203,24 @@ jobs: cat .ci/.arn-file.md >> $GITHUB_OUTPUT echo 'ARN_CONTENT_EOF' >> $GITHUB_OUTPUT + post-release: + name: "Bump versions and create PR" + needs: + - await-maven-central-artifact + uses: ./.github/workflows/pre-post-release.yml + permissions: + contents: write + if: inputs.dry_run == false + with: + ref: ${{ inputs.ref }} + version: ${{ inputs.version }} + phase: 'post' + secrets: inherit + create-github-release: name: "Create GitHub Release" needs: + - post-release - publish-aws-lambda - update-major-branch runs-on: ubuntu-latest @@ -238,20 +252,6 @@ jobs: --notes="[Release Notes for ${{ env.RELEASE_VERSION }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ env.RELEASE_VERSION }}) ${{ needs.publish-aws-lambda.outputs.arn_content }}" - post-release: - name: "Bump versions and create PR" - needs: - - await-maven-central-artifact - uses: ./.github/workflows/pre-post-release.yml - permissions: - contents: write - if: inputs.dry_run == false - with: - ref: ${{ inputs.ref }} - version: ${{ inputs.version }} - phase: 'post' - secrets: inherit - notify: if: ${{ always() && ! inputs.dry_run }} needs: From 42f00955d23b6d7a940343a845cb4a9344c59c8e Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Thu, 4 Apr 2024 03:45:35 -0400 Subject: [PATCH 023/132] post release: elastic-apm-agent v1.49.0 (#3579) Co-authored-by: apmmachine --- apm-agent-api/pom.xml | 2 +- apm-agent-attach-cli/pom.xml | 2 +- apm-agent-attach/pom.xml | 2 +- apm-agent-benchmarks/pom.xml | 2 +- apm-agent-bootstrap/pom.xml | 2 +- apm-agent-builds/apm-agent-java8/pom.xml | 2 +- apm-agent-builds/apm-agent/pom.xml | 2 +- apm-agent-builds/pom.xml | 2 +- apm-agent-cached-lookup-key/pom.xml | 2 +- apm-agent-common/pom.xml | 2 +- apm-agent-core/pom.xml | 2 +- apm-agent-lambda-layer/pom.xml | 2 +- apm-agent-plugin-sdk/pom.xml | 2 +- .../apm-apache-httpclient/apm-apache-httpclient-common/pom.xml | 2 +- .../apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml | 2 +- .../apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml | 2 +- .../apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml | 2 +- apm-agent-plugins/apm-apache-httpclient/pom.xml | 2 +- apm-agent-plugins/apm-api-plugin/pom.xml | 2 +- apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/pom.xml | 2 +- apm-agent-plugins/apm-awslambda-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra-core-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/pom.xml | 2 +- apm-agent-plugins/apm-dubbo-plugin/pom.xml | 2 +- apm-agent-plugins/apm-ecs-logging-plugin/pom.xml | 2 +- .../apm-es-restclient-plugin-5_6/pom.xml | 2 +- .../apm-es-restclient-plugin-6_4/pom.xml | 2 +- .../apm-es-restclient-plugin-7_x/pom.xml | 2 +- .../apm-es-restclient-plugin-8_x/pom.xml | 2 +- .../apm-es-restclient-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-es-restclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grails-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-grpc/pom.xml | 2 +- .../apm-hibernate-search-plugin-5_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-6_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-hibernate-search-plugin/pom.xml | 2 +- apm-agent-plugins/apm-httpclient-core/pom.xml | 2 +- apm-agent-plugins/apm-httpserver-core/pom.xml | 2 +- apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-concurrent-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-ldap-plugin/pom.xml | 2 +- apm-agent-plugins/apm-javalin-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxrs-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxws-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdbc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jmx-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jsf-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-base-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-kafka-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-jboss-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml | 2 +- .../apm-logback-plugin/apm-logback-plugin-impl/pom.xml | 2 +- .../apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-logging-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-plugin/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-test/pom.xml | 2 +- .../apm-opentelemetry-embedded-metrics-sdk/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-common/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-latest/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-v1_14/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-parent/pom.xml | 2 +- .../apm-opentelemetry-metricsdk-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-test/pom.xml | 2 +- apm-agent-plugins/apm-opentelemetry/pom.xml | 2 +- apm-agent-plugins/apm-opentracing-plugin/pom.xml | 2 +- apm-agent-plugins/apm-process-plugin/pom.xml | 2 +- apm-agent-plugins/apm-profiling-plugin/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml | 2 +- apm-agent-plugins/apm-quartz/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/pom.xml | 2 +- apm-agent-plugins/apm-reactor-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/pom.xml | 2 +- apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml | 2 +- .../apm-scheduled-annotation-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml | 2 +- apm-agent-plugins/apm-servlet-jakarta-test/pom.xml | 2 +- apm-agent-plugins/apm-servlet-plugin/pom.xml | 2 +- apm-agent-plugins/apm-sparkjava-plugin/pom.xml | 2 +- .../apm-spring-resttemplate/apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- .../apm-spring-resttemplate-test/pom.xml | 2 +- apm-agent-plugins/apm-spring-resttemplate/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webclient-plugin/pom.xml | 2 +- .../apm-spring-webflux-common-spring5/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-common/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-plugin/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-spring5/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-testapp/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- apm-agent-plugins/apm-struts-plugin/pom.xml | 2 +- apm-agent-plugins/apm-urlconnection-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/pom.xml | 2 +- apm-agent-plugins/pom.xml | 2 +- apm-agent-tracer/pom.xml | 2 +- apm-opentracing/pom.xml | 2 +- cloudfoundry/index.yml | 1 + elastic-apm-agent-java8/pom.xml | 2 +- elastic-apm-agent-premain/pom.xml | 2 +- elastic-apm-agent/pom.xml | 2 +- integration-tests/application-server-integration-tests/pom.xml | 2 +- integration-tests/aws-lambda-test/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-dependent/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-standalone/pom.xml | 2 +- integration-tests/cdi-app/pom.xml | 2 +- .../cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml | 2 +- .../cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml | 2 +- integration-tests/cdi-jakartaee-app/pom.xml | 2 +- .../external-plugin-otel-test-app/pom.xml | 2 +- .../external-plugin-otel-test-plugin1/pom.xml | 2 +- .../external-plugin-otel-test-plugin2/pom.xml | 2 +- integration-tests/external-plugin-otel-test/pom.xml | 2 +- .../external-plugin-test/external-plugin-app/pom.xml | 2 +- .../external-plugin-test/external-plugin-jakarta-app/pom.xml | 2 +- integration-tests/external-plugin-test/external-plugin/pom.xml | 2 +- .../external-plugin-test/plugin-instrumentation-target/pom.xml | 2 +- integration-tests/external-plugin-test/pom.xml | 2 +- .../jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml | 2 +- .../jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml | 2 +- integration-tests/jakartaee-jsf-app/pom.xml | 2 +- integration-tests/jakartaee-simple-webapp/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-dependent/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-standalone/pom.xml | 2 +- integration-tests/jsf-app/pom.xml | 2 +- integration-tests/main-app-test/pom.xml | 2 +- integration-tests/pom.xml | 2 +- integration-tests/quarkus/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-base/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml | 2 +- integration-tests/runtime-attach/pom.xml | 2 +- integration-tests/runtime-attach/runtime-attach-app/pom.xml | 2 +- integration-tests/runtime-attach/runtime-attach-test/pom.xml | 2 +- integration-tests/simple-webapp/pom.xml | 2 +- integration-tests/soap-test/pom.xml | 2 +- integration-tests/spring-boot-1-5/pom.xml | 2 +- integration-tests/spring-boot-2/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-base/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml | 2 +- integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml | 2 +- integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml | 2 +- integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml | 2 +- pom.xml | 2 +- 201 files changed, 201 insertions(+), 200 deletions(-) diff --git a/apm-agent-api/pom.xml b/apm-agent-api/pom.xml index 7c967db31a..f5f4b9e638 100644 --- a/apm-agent-api/pom.xml +++ b/apm-agent-api/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-api diff --git a/apm-agent-attach-cli/pom.xml b/apm-agent-attach-cli/pom.xml index 461dbf4dc2..babd6a2e0c 100644 --- a/apm-agent-attach-cli/pom.xml +++ b/apm-agent-attach-cli/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-attach/pom.xml b/apm-agent-attach/pom.xml index 32da5d5c25..e8ebfe1006 100644 --- a/apm-agent-attach/pom.xml +++ b/apm-agent-attach/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-attach diff --git a/apm-agent-benchmarks/pom.xml b/apm-agent-benchmarks/pom.xml index 142bf7c9fb..e77f4143f4 100644 --- a/apm-agent-benchmarks/pom.xml +++ b/apm-agent-benchmarks/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-benchmarks diff --git a/apm-agent-bootstrap/pom.xml b/apm-agent-bootstrap/pom.xml index bc2d76aa63..d3be167b51 100644 --- a/apm-agent-bootstrap/pom.xml +++ b/apm-agent-bootstrap/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-bootstrap diff --git a/apm-agent-builds/apm-agent-java8/pom.xml b/apm-agent-builds/apm-agent-java8/pom.xml index 47dccec352..48f8f81e31 100644 --- a/apm-agent-builds/apm-agent-java8/pom.xml +++ b/apm-agent-builds/apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-java8 diff --git a/apm-agent-builds/apm-agent/pom.xml b/apm-agent-builds/apm-agent/pom.xml index f04515c0a2..9635ce5fe4 100644 --- a/apm-agent-builds/apm-agent/pom.xml +++ b/apm-agent-builds/apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.49.0 + 1.49.1-SNAPSHOT apm-agent diff --git a/apm-agent-builds/pom.xml b/apm-agent-builds/pom.xml index bda0b824cd..89c316891b 100644 --- a/apm-agent-builds/pom.xml +++ b/apm-agent-builds/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-cached-lookup-key/pom.xml b/apm-agent-cached-lookup-key/pom.xml index 3f910cf4f6..43dfff7a6f 100644 --- a/apm-agent-cached-lookup-key/pom.xml +++ b/apm-agent-cached-lookup-key/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-common/pom.xml b/apm-agent-common/pom.xml index 6842b66afc..c565de54aa 100644 --- a/apm-agent-common/pom.xml +++ b/apm-agent-common/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index 61dec83244..cb04140691 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-core diff --git a/apm-agent-lambda-layer/pom.xml b/apm-agent-lambda-layer/pom.xml index 2632f74b45..ef64fb7bab 100644 --- a/apm-agent-lambda-layer/pom.xml +++ b/apm-agent-lambda-layer/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugin-sdk/pom.xml b/apm-agent-plugin-sdk/pom.xml index 88840de213..bc936ad029 100644 --- a/apm-agent-plugin-sdk/pom.xml +++ b/apm-agent-plugin-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml index 70a1c86efa..803a5e56bc 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-apache-httpclient-common diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml index e200ba4293..3707e78310 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-apache-httpclient3-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml index ad7f1b9375..e0481d54d5 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-apache-httpclient4-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml index 53c1f0445d..1c877c20f2 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-apache-httpclient - 1.49.0 + 1.49.1-SNAPSHOT apm-apache-httpclient5-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/pom.xml b/apm-agent-plugins/apm-apache-httpclient/pom.xml index db5fea7c42..826d04e836 100644 --- a/apm-agent-plugins/apm-apache-httpclient/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-apache-httpclient diff --git a/apm-agent-plugins/apm-api-plugin/pom.xml b/apm-agent-plugins/apm-api-plugin/pom.xml index 2fa06b2262..4de7fd2ada 100644 --- a/apm-agent-plugins/apm-api-plugin/pom.xml +++ b/apm-agent-plugins/apm-api-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT diff --git a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml index 963d44ac35..b370270ce5 100644 --- a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-asynchttpclient-plugin diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml index 2befe6bdad..6a45943f29 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index 6297842308..e99b777283 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml index a48a31ae96..3ae762d78c 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/pom.xml b/apm-agent-plugins/apm-aws-sdk/pom.xml index 6196ff5d40..58c23fe14c 100644 --- a/apm-agent-plugins/apm-aws-sdk/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-awslambda-plugin/pom.xml b/apm-agent-plugins/apm-awslambda-plugin/pom.xml index 405bb4a42b..d41c1a4165 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/pom.xml +++ b/apm-agent-plugins/apm-awslambda-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml index be3fbb0565..f528f9982d 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml index f8ad869438..2e6876a0df 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml index 1130b7ff35..ac263b097c 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/pom.xml b/apm-agent-plugins/apm-cassandra/pom.xml index a6fcd2e7a1..8925ab40bc 100644 --- a/apm-agent-plugins/apm-cassandra/pom.xml +++ b/apm-agent-plugins/apm-cassandra/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-dubbo-plugin/pom.xml b/apm-agent-plugins/apm-dubbo-plugin/pom.xml index bef2e71d9e..3e927e43c3 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/pom.xml +++ b/apm-agent-plugins/apm-dubbo-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml index 794c55ad97..30848b2551 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-ecs-logging-plugin diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml index e3145e447e..1caf24d158 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-es-restclient-plugin-5_6 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml index d3ce291f35..1e35094b36 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-es-restclient-plugin-6_4 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml index 972d0f081f..96fca94447 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-es-restclient-plugin-7_x diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml index cba4d9d614..9a4d751980 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml @@ -3,7 +3,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml index 11191c15d0..57e1db6446 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-es-restclient-plugin-common diff --git a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml index 284c69814d..c7b9448211 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-es-restclient-plugin diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml index c5282b5a39..93c15c6973 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-finagle-httpclient-plugin diff --git a/apm-agent-plugins/apm-grails-plugin/pom.xml b/apm-agent-plugins/apm-grails-plugin/pom.xml index 395750bc79..8cf9d81d42 100644 --- a/apm-agent-plugins/apm-grails-plugin/pom.xml +++ b/apm-agent-plugins/apm-grails-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-grails-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml index cce2de5dc1..1c06a303ce 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.49.0 + 1.49.1-SNAPSHOT apm-grpc-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml index fc32f566a9..1a7d1adee7 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.49.0 + 1.49.1-SNAPSHOT apm-grpc-test-1.6.1 diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml index 216087d7a8..7ec9704929 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.49.0 + 1.49.1-SNAPSHOT apm-grpc-test-latest diff --git a/apm-agent-plugins/apm-grpc/pom.xml b/apm-agent-plugins/apm-grpc/pom.xml index 759c1f1320..650b9adbfb 100644 --- a/apm-agent-plugins/apm-grpc/pom.xml +++ b/apm-agent-plugins/apm-grpc/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.49.0 + 1.49.1-SNAPSHOT apm-grpc diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml index 8f48e364f7..a71b950a0f 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-hibernate-search-plugin-5_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml index ab99217b36..bcc06a18f1 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-hibernate-search-plugin-6_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml index e5ad36c01d..fedfd401ed 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-hibernate-search-plugin-common diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml index e87bec250b..8a8fc9ea33 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-hibernate-search-plugin diff --git a/apm-agent-plugins/apm-httpclient-core/pom.xml b/apm-agent-plugins/apm-httpclient-core/pom.xml index 6f0e154bc2..6ef9562f07 100644 --- a/apm-agent-plugins/apm-httpclient-core/pom.xml +++ b/apm-agent-plugins/apm-httpclient-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-httpclient-core diff --git a/apm-agent-plugins/apm-httpserver-core/pom.xml b/apm-agent-plugins/apm-httpserver-core/pom.xml index d82a19e192..4df8288597 100644 --- a/apm-agent-plugins/apm-httpserver-core/pom.xml +++ b/apm-agent-plugins/apm-httpserver-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-httpserver-core diff --git a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml index c60a31e44d..f3904e3db8 100644 --- a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml +++ b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jakarta-websocket-plugin diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml index c87a92c14d..8544918061 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-java-concurrent-plugin diff --git a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml index 2263c5dd1d..523cc368a1 100644 --- a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-java-ldap-plugin diff --git a/apm-agent-plugins/apm-javalin-plugin/pom.xml b/apm-agent-plugins/apm-javalin-plugin/pom.xml index a36e51557d..3c4227f266 100644 --- a/apm-agent-plugins/apm-javalin-plugin/pom.xml +++ b/apm-agent-plugins/apm-javalin-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-javalin-plugin diff --git a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml index 2b1abf4e04..d1092b01fa 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml index 45a0e56639..d6a8fa215d 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jaxrs-plugin diff --git a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml index 40d4a93f9a..cf6b2a5fc9 100644 --- a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jaxws-plugin/pom.xml b/apm-agent-plugins/apm-jaxws-plugin/pom.xml index 90a111b56c..c613e21e7f 100644 --- a/apm-agent-plugins/apm-jaxws-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jaxws-plugin diff --git a/apm-agent-plugins/apm-jdbc-plugin/pom.xml b/apm-agent-plugins/apm-jdbc-plugin/pom.xml index 74f20b02a8..f270f5eb77 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdbc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jdbc-plugin diff --git a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml index 6eb3481ba2..f93c3339df 100644 --- a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jdk-httpclient-plugin diff --git a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml index 9ec611014a..8687088de4 100644 --- a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jdk-httpserver-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml index 6d365048b9..a27a3d859a 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml index 27471119bc..77c7d5424d 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml index 33afe2abb0..072746a039 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jms-plugin-base diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml index 39c4afcaf3..c677d039fc 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jms-spring-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/pom.xml index dc184d7c8f..a4775009d0 100644 --- a/apm-agent-plugins/apm-jms-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jms-plugin diff --git a/apm-agent-plugins/apm-jmx-plugin/pom.xml b/apm-agent-plugins/apm-jmx-plugin/pom.xml index b086bf9ba4..3bcb3ae3f9 100644 --- a/apm-agent-plugins/apm-jmx-plugin/pom.xml +++ b/apm-agent-plugins/apm-jmx-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jmx-plugin diff --git a/apm-agent-plugins/apm-jsf-plugin/pom.xml b/apm-agent-plugins/apm-jsf-plugin/pom.xml index d2940944e1..014df23ca5 100644 --- a/apm-agent-plugins/apm-jsf-plugin/pom.xml +++ b/apm-agent-plugins/apm-jsf-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jsf-plugin diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml index b250536ff2..8b46074132 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml @@ -3,7 +3,7 @@ apm-kafka-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml index ad0b8527b0..6d61b032c3 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml index 5dc62cbc7d..99d0fd2f72 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/pom.xml index dc6c403130..71dd9965cb 100644 --- a/apm-agent-plugins/apm-kafka-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml index c634b39c11..3ac708c5fe 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jboss-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml index ee67d929c8..c79444831c 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jul-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml index ab55c53b33..7ae617c195 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-log4j1-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml index b53fc81013..8d4335de89 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-log4j2-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml index 2bc3528efe..a89c9d786b 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-logback-plugin-impl diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml index 71f1701839..b49b073a27 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-logback-plugin-legacy-tests diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml index e25365e8e8..93c43deaf0 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-logback-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml index 5eaeaa5d2f..a23979a734 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-logging-plugin-common diff --git a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml index 1da12350ba..cf98c40c19 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-slf4j-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml index 624b9e9829..a42a08de86 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-tomcat-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/pom.xml index a64baaddbc..b8df808228 100644 --- a/apm-agent-plugins/apm-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-logging-plugin diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 1a5fbb68c0..f5d9a2ee44 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml index bc303c0d7b..755c6c6f1d 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml @@ -4,7 +4,7 @@ apm-mongodb co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml index 6e257d53a4..37e1bae97f 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-mongodb co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml index 7dfdd18eda..b8ce4328ba 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-mongodb co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-mongodb4-plugin diff --git a/apm-agent-plugins/apm-mongodb/pom.xml b/apm-agent-plugins/apm-mongodb/pom.xml index 6db3400406..142126101a 100644 --- a/apm-agent-plugins/apm-mongodb/pom.xml +++ b/apm-agent-plugins/apm-mongodb/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-mongodb diff --git a/apm-agent-plugins/apm-okhttp-plugin/pom.xml b/apm-agent-plugins/apm-okhttp-plugin/pom.xml index 30822c0400..fcb72fcf64 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/pom.xml +++ b/apm-agent-plugins/apm-okhttp-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-okhttp-plugin diff --git a/apm-agent-plugins/apm-okhttp-test/pom.xml b/apm-agent-plugins/apm-okhttp-test/pom.xml index 2a541552a3..1d286d53a4 100644 --- a/apm-agent-plugins/apm-okhttp-test/pom.xml +++ b/apm-agent-plugins/apm-okhttp-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml index 7800ac6b1c..b7ebc9df39 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.49.0 + 1.49.1-SNAPSHOT apm-opentelemetry-embedded-metrics-sdk diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml index d28deb47dd..e9fc243d55 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml index 3e536371c6..5532fee250 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml index 4c8eb9ee99..216797ede8 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml index 33500a984c..3558645018 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml index 4aa623a588..5ba5d5788a 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.49.0 + 1.49.1-SNAPSHOT apm-opentelemetry-metricsdk-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml index 8a26722207..b6a91fa966 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.49.0 + 1.49.1-SNAPSHOT apm-opentelemetry-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml index 03b4573f92..36fcf12be9 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.49.0 + 1.49.1-SNAPSHOT ${project.groupId}:${project.artifactId} diff --git a/apm-agent-plugins/apm-opentelemetry/pom.xml b/apm-agent-plugins/apm-opentelemetry/pom.xml index 9171c625c5..05acd0120c 100644 --- a/apm-agent-plugins/apm-opentelemetry/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.49.0 + 1.49.1-SNAPSHOT apm-opentelemetry diff --git a/apm-agent-plugins/apm-opentracing-plugin/pom.xml b/apm-agent-plugins/apm-opentracing-plugin/pom.xml index be27c04d20..6f2661406d 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentracing-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-opentracing-plugin diff --git a/apm-agent-plugins/apm-process-plugin/pom.xml b/apm-agent-plugins/apm-process-plugin/pom.xml index 533ed6b78c..8e80e63881 100644 --- a/apm-agent-plugins/apm-process-plugin/pom.xml +++ b/apm-agent-plugins/apm-process-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-profiling-plugin/pom.xml b/apm-agent-plugins/apm-profiling-plugin/pom.xml index 7c54ea6958..2a8f274337 100644 --- a/apm-agent-plugins/apm-profiling-plugin/pom.xml +++ b/apm-agent-plugins/apm-profiling-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-profiling-plugin diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml index 5edcec6136..e51fe14922 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml index 2d5a1baf8b..d51e86dc01 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml index f971adf098..443ff0093f 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/pom.xml b/apm-agent-plugins/apm-quartz/pom.xml index 9c26ec94ad..5a19d2b979 100644 --- a/apm-agent-plugins/apm-quartz/pom.xml +++ b/apm-agent-plugins/apm-quartz/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-quartz diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml index ea32ca0f82..50832c6820 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-rabbitmq-plugin diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml index be3e19e6a1..2d0095ebd1 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-rabbitmq-spring diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml index 83a7c279cc..5a04bf125b 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-rabbitmq-test-3 diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml index a87c19884d..eb414ef030 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-rabbitmq-test-4 diff --git a/apm-agent-plugins/apm-rabbitmq/pom.xml b/apm-agent-plugins/apm-rabbitmq/pom.xml index e0a2323da9..a505050fff 100644 --- a/apm-agent-plugins/apm-rabbitmq/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-rabbitmq diff --git a/apm-agent-plugins/apm-reactor-plugin/pom.xml b/apm-agent-plugins/apm-reactor-plugin/pom.xml index 9e538c6043..a353270b5e 100644 --- a/apm-agent-plugins/apm-reactor-plugin/pom.xml +++ b/apm-agent-plugins/apm-reactor-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.49.0 + 1.49.1-SNAPSHOT apm-reactor-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml index 1d7bec2069..a331399344 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jedis-2-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml index a0fe35c569..5db12398d8 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jedis-3-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml index 9c6fcc4a4d..0e78468bca 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jedis-4-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml index d944984596..1632f4329f 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jedis-5-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml index f584237c3e..aae0052a15 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-jedis-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml index d95aae9259..f771afa423 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml index 514ffe48f8..80f219d91f 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml index 1007e8613c..75bd9ac1e0 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-redis-common diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml index c87bcfcfa0..18e1ca9f6b 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-redisson-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/pom.xml index 560691c71c..2f2412367c 100644 --- a/apm-agent-plugins/apm-redis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-redis-plugin diff --git a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml index 943daf423d..621876606a 100644 --- a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-scala-concurrent-plugin diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml index ecea4dfa34..cf273a1fea 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml index cf39551c41..347a1c028e 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-scheduled-annotation-plugin diff --git a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml index be040cba19..44a00b41dd 100644 --- a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml +++ b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-servlet-jakarta-test diff --git a/apm-agent-plugins/apm-servlet-plugin/pom.xml b/apm-agent-plugins/apm-servlet-plugin/pom.xml index c8dd43f4de..75250d7353 100644 --- a/apm-agent-plugins/apm-servlet-plugin/pom.xml +++ b/apm-agent-plugins/apm-servlet-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-servlet-plugin diff --git a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml index e435044523..c64cbde4d2 100644 --- a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml +++ b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index b529ca9fea..83f82ea463 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-restclient-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index 2f6c4456ea..d9095045b8 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-resttemplate-plugin diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml index 82d497b2eb..cd3b7d712e 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-resttemplate-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/pom.xml index f1d1463f07..34e7759cf2 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-resttemplate diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml index 19d61ff288..000f152ace 100755 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webclient-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml index 79e5c0b0b3..404c8dfa7c 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webflux-common-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml index a0bf5cbbf9..ef1bdf97f2 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webflux-common diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml index 0e43d1d7ea..d4e646522d 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webflux-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml index ee213cf370..762b5a3394 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webflux-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml index a4f28af941..1e266ace0c 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webflux-testapp diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index ca0f7359cf..3e3a2bfbe9 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webflux diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index 3dfa508043..943d6aaac5 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webmvc-plugin diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml index de6ea95ec3..73fc6ac253 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-spring-webmvc-spring5 diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index af3b7fa514..e105e7f028 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-struts-plugin/pom.xml b/apm-agent-plugins/apm-struts-plugin/pom.xml index 1e47f97dd8..643ed49884 100644 --- a/apm-agent-plugins/apm-struts-plugin/pom.xml +++ b/apm-agent-plugins/apm-struts-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml index fdacc1e9b5..685da314f1 100644 --- a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml +++ b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-urlconnection-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml index 4db2506f70..38c5ab97f9 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-vertx-common diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml index 1c4e03391d..f1f5bc09a4 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-vertx3-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml index 60a2ebca8b..a254019207 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-vertx3-test-latest diff --git a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml index c47ffc1e4e..cecd3a7ad3 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-vertx4-plugin diff --git a/apm-agent-plugins/apm-vertx/pom.xml b/apm-agent-plugins/apm-vertx/pom.xml index 1e935c6347..cf1306b6d9 100644 --- a/apm-agent-plugins/apm-vertx/pom.xml +++ b/apm-agent-plugins/apm-vertx/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-vertx diff --git a/apm-agent-plugins/pom.xml b/apm-agent-plugins/pom.xml index 6acbfe7d40..1185fc4596 100644 --- a/apm-agent-plugins/pom.xml +++ b/apm-agent-plugins/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-plugins diff --git a/apm-agent-tracer/pom.xml b/apm-agent-tracer/pom.xml index cf71cc4e53..92991e5858 100644 --- a/apm-agent-tracer/pom.xml +++ b/apm-agent-tracer/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.49.0 + 1.49.1-SNAPSHOT apm-agent-tracer diff --git a/apm-opentracing/pom.xml b/apm-opentracing/pom.xml index 1e34b37172..e44a285d82 100644 --- a/apm-opentracing/pom.xml +++ b/apm-opentracing/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT apm-opentracing diff --git a/cloudfoundry/index.yml b/cloudfoundry/index.yml index 24b766a778..65ca4672fa 100644 --- a/cloudfoundry/index.yml +++ b/cloudfoundry/index.yml @@ -61,3 +61,4 @@ 1.47.1: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.47.1/elastic-apm-agent-1.47.1.jar 1.48.0: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.48.0/elastic-apm-agent-1.48.0.jar 1.48.1: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.48.1/elastic-apm-agent-1.48.1.jar +1.49.0: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.49.0/elastic-apm-agent-1.49.0.jar diff --git a/elastic-apm-agent-java8/pom.xml b/elastic-apm-agent-java8/pom.xml index ce3d63b288..8aa6a6a06d 100644 --- a/elastic-apm-agent-java8/pom.xml +++ b/elastic-apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.49.0 + 1.49.1-SNAPSHOT elastic-apm-agent-java8 diff --git a/elastic-apm-agent-premain/pom.xml b/elastic-apm-agent-premain/pom.xml index 94ad89199b..2bd0687a1a 100644 --- a/elastic-apm-agent-premain/pom.xml +++ b/elastic-apm-agent-premain/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/elastic-apm-agent/pom.xml b/elastic-apm-agent/pom.xml index a7fb3005e7..9a1dbb7d32 100644 --- a/elastic-apm-agent/pom.xml +++ b/elastic-apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.49.0 + 1.49.1-SNAPSHOT elastic-apm-agent diff --git a/integration-tests/application-server-integration-tests/pom.xml b/integration-tests/application-server-integration-tests/pom.xml index ff82f3c7f7..adc872e027 100644 --- a/integration-tests/application-server-integration-tests/pom.xml +++ b/integration-tests/application-server-integration-tests/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT application-server-integration-tests diff --git a/integration-tests/aws-lambda-test/pom.xml b/integration-tests/aws-lambda-test/pom.xml index 8d4ccb5cb1..b146282afb 100644 --- a/integration-tests/aws-lambda-test/pom.xml +++ b/integration-tests/aws-lambda-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-dependent/pom.xml b/integration-tests/cdi-app/cdi-app-dependent/pom.xml index 7fa8622b49..6f592ea349 100644 --- a/integration-tests/cdi-app/cdi-app-dependent/pom.xml +++ b/integration-tests/cdi-app/cdi-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-standalone/pom.xml b/integration-tests/cdi-app/cdi-app-standalone/pom.xml index 6976c519c7..0379cbea6c 100644 --- a/integration-tests/cdi-app/cdi-app-standalone/pom.xml +++ b/integration-tests/cdi-app/cdi-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-app/pom.xml b/integration-tests/cdi-app/pom.xml index 751dcc6c8f..1c1cc53cdf 100644 --- a/integration-tests/cdi-app/pom.xml +++ b/integration-tests/cdi-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml index 90de8b028e..96c8dde9d1 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml index ce3b1d89b4..d0ae6556bd 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/pom.xml b/integration-tests/cdi-jakartaee-app/pom.xml index e2a1eb57c2..8c004fd292 100644 --- a/integration-tests/cdi-jakartaee-app/pom.xml +++ b/integration-tests/cdi-jakartaee-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml index fbc6852359..efd5fa5cf7 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.49.0 + 1.49.1-SNAPSHOT external-plugin-otel-test-app diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml index b544aef5c2..7668aa0298 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.49.0 + 1.49.1-SNAPSHOT external-plugin-otel-test-plugin1 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml index 9d08c966f9..3463e6ed7e 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.49.0 + 1.49.1-SNAPSHOT external-plugin-otel-test-plugin2 diff --git a/integration-tests/external-plugin-otel-test/pom.xml b/integration-tests/external-plugin-otel-test/pom.xml index 4bd83805c8..51a54f93d4 100644 --- a/integration-tests/external-plugin-otel-test/pom.xml +++ b/integration-tests/external-plugin-otel-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm integration-tests - 1.49.0 + 1.49.1-SNAPSHOT external-plugin-otel-test diff --git a/integration-tests/external-plugin-test/external-plugin-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-app/pom.xml index 5cc0210bf5..44d97f5878 100644 --- a/integration-tests/external-plugin-test/external-plugin-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT external-plugin-app diff --git a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml index 3a3c626b5b..581f196ee3 100644 --- a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT external-plugin-jakarta-app diff --git a/integration-tests/external-plugin-test/external-plugin/pom.xml b/integration-tests/external-plugin-test/external-plugin/pom.xml index 635ec073d8..967d7d6d2f 100644 --- a/integration-tests/external-plugin-test/external-plugin/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT external-plugin diff --git a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml index 1e008f01e2..0a6e456add 100644 --- a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml +++ b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT plugin-instrumentation-target diff --git a/integration-tests/external-plugin-test/pom.xml b/integration-tests/external-plugin-test/pom.xml index 1ab2a4717e..7f96cb6556 100644 --- a/integration-tests/external-plugin-test/pom.xml +++ b/integration-tests/external-plugin-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml index 5e450c96fe..efa6889387 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml index 4ad7029e6d..2eaa88e63b 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/pom.xml b/integration-tests/jakartaee-jsf-app/pom.xml index 32fa2c1fa8..7411855676 100644 --- a/integration-tests/jakartaee-jsf-app/pom.xml +++ b/integration-tests/jakartaee-jsf-app/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 pom diff --git a/integration-tests/jakartaee-simple-webapp/pom.xml b/integration-tests/jakartaee-simple-webapp/pom.xml index 3a265054c1..0ab2d433e9 100644 --- a/integration-tests/jakartaee-simple-webapp/pom.xml +++ b/integration-tests/jakartaee-simple-webapp/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT jakartaee-simple-webapp diff --git a/integration-tests/jsf-app/jsf-app-dependent/pom.xml b/integration-tests/jsf-app/jsf-app-dependent/pom.xml index 4632305024..50f8ed9d87 100644 --- a/integration-tests/jsf-app/jsf-app-dependent/pom.xml +++ b/integration-tests/jsf-app/jsf-app-dependent/pom.xml @@ -4,7 +4,7 @@ jsf-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/jsf-app/jsf-app-standalone/pom.xml b/integration-tests/jsf-app/jsf-app-standalone/pom.xml index cb554b6882..104f8d90f1 100644 --- a/integration-tests/jsf-app/jsf-app-standalone/pom.xml +++ b/integration-tests/jsf-app/jsf-app-standalone/pom.xml @@ -6,7 +6,7 @@ jsf-app co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT jsf-app-standalone diff --git a/integration-tests/jsf-app/pom.xml b/integration-tests/jsf-app/pom.xml index 4a77fc6fc8..2ab9293e4a 100644 --- a/integration-tests/jsf-app/pom.xml +++ b/integration-tests/jsf-app/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT jsf-app diff --git a/integration-tests/main-app-test/pom.xml b/integration-tests/main-app-test/pom.xml index 2394a2d859..625c246b46 100644 --- a/integration-tests/main-app-test/pom.xml +++ b/integration-tests/main-app-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT main-app-test diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 9e925c082c..fde3f82b66 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT integration-tests diff --git a/integration-tests/quarkus/pom.xml b/integration-tests/quarkus/pom.xml index 71b503b0f3..8dc727bdf2 100644 --- a/integration-tests/quarkus/pom.xml +++ b/integration-tests/quarkus/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT quarkus diff --git a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml index fb55d2f3a0..a144a2f254 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT quarkus-jaxrs-base diff --git a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml index ba4c3c4e5a..dd860ee5e3 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT quarkus-jaxrs-undertow diff --git a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml index ef2d751b8b..a64839752e 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT quarkus-jaxrs-vertx diff --git a/integration-tests/runtime-attach/pom.xml b/integration-tests/runtime-attach/pom.xml index 3cd9da7adf..19d7a14584 100644 --- a/integration-tests/runtime-attach/pom.xml +++ b/integration-tests/runtime-attach/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT runtime-attach diff --git a/integration-tests/runtime-attach/runtime-attach-app/pom.xml b/integration-tests/runtime-attach/runtime-attach-app/pom.xml index 69de69af65..56404d91e5 100644 --- a/integration-tests/runtime-attach/runtime-attach-app/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-app/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/runtime-attach/runtime-attach-test/pom.xml b/integration-tests/runtime-attach/runtime-attach-test/pom.xml index 604a113b35..1182bbca07 100644 --- a/integration-tests/runtime-attach/runtime-attach-test/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-test/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/simple-webapp/pom.xml b/integration-tests/simple-webapp/pom.xml index 35b1604594..68693deec3 100644 --- a/integration-tests/simple-webapp/pom.xml +++ b/integration-tests/simple-webapp/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT simple-webapp diff --git a/integration-tests/soap-test/pom.xml b/integration-tests/soap-test/pom.xml index 0d03952129..55dec73cc1 100644 --- a/integration-tests/soap-test/pom.xml +++ b/integration-tests/soap-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT soap-test diff --git a/integration-tests/spring-boot-1-5/pom.xml b/integration-tests/spring-boot-1-5/pom.xml index 82ffa2180c..92df8a5457 100644 --- a/integration-tests/spring-boot-1-5/pom.xml +++ b/integration-tests/spring-boot-1-5/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-1-5 diff --git a/integration-tests/spring-boot-2/pom.xml b/integration-tests/spring-boot-2/pom.xml index 8f1aaa1d15..48fae7c785 100644 --- a/integration-tests/spring-boot-2/pom.xml +++ b/integration-tests/spring-boot-2/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-2 diff --git a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml index ff01bc47fb..d81e7e16cb 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-2-base diff --git a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml index 879735c5a5..507c04fdca 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-2-jetty diff --git a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml index 229fc95d95..f3654ee496 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-2-tomcat diff --git a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml index 85ceea0865..06bb0f650c 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-2-undertow diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 744200d853..0ef88d8a29 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT spring-boot-3 diff --git a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml index b7ba4b02bf..cc1fb3c562 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml index bc0b652eb9..bc60dddfa1 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml index d1818a48c5..efa75d999b 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.49.0 + 1.49.1-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 262422be2c..13899352cb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.49.0 + 1.49.1-SNAPSHOT pom ${project.groupId}:${project.artifactId} From 1cdc171b409f5bc84981fa9a261a07c1bcfbbb32 Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Thu, 4 Apr 2024 07:48:14 +0000 Subject: [PATCH 024/132] ci(fix): correct release order (#3581) Signed-off-by: Adrien Mannocci --- .github/workflows/release.yml | 53 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7b05b048f..bc9b9d16e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -101,32 +101,6 @@ jobs: artifactid: 'elastic-apm-agent' version: ${{ env.RELEASE_VERSION }} - update-major-branch: - name: "Update Major Branch" - runs-on: ubuntu-latest - needs: - - await-maven-central-artifact - permissions: - contents: write - steps: - - uses: elastic/apm-pipeline-library/.github/actions/github-token@current - with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current - with: - username: ${{ env.GIT_USER }} - email: ${{ env.GIT_EMAIL }} - token: ${{ env.GITHUB_TOKEN }} - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref }} - token: ${{ env.GITHUB_TOKEN }} - - name: Update major branch - if: ${{ ! inputs.dry_run }} - run: .ci/release/update-major-branch.sh ${{ env.RELEASE_VERSION }} - build-and-push-docker-images: name: "Build and push docker images" runs-on: ubuntu-latest @@ -217,10 +191,35 @@ jobs: phase: 'post' secrets: inherit + update-major-branch: + name: "Update Major Branch" + runs-on: ubuntu-latest + needs: + - post-release + permissions: + contents: write + steps: + - uses: elastic/apm-pipeline-library/.github/actions/github-token@current + with: + url: ${{ secrets.VAULT_ADDR }} + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current + with: + username: ${{ env.GIT_USER }} + email: ${{ env.GIT_EMAIL }} + token: ${{ env.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + token: ${{ env.GITHUB_TOKEN }} + - name: Update major branch + if: ${{ ! inputs.dry_run }} + run: .ci/release/update-major-branch.sh ${{ env.RELEASE_VERSION }} + create-github-release: name: "Create GitHub Release" needs: - - post-release - publish-aws-lambda - update-major-branch runs-on: ubuntu-latest From e010c351a84f3784ac77d779e741fd1dcdbcc7af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 08:02:30 +0200 Subject: [PATCH 025/132] Bump org.springframework.boot:spring-boot-dependencies from 2.7.16 to 3.2.4 (#3572) * Bump org.springframework.boot:spring-boot-dependencies Bumps [org.springframework.boot:spring-boot-dependencies](https://github.com/spring-projects/spring-boot) from 2.7.16 to 3.2.4. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.7.16...v3.2.4) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update pom.xml * Update pom.xml * Update pom.xml --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Kunz --- .../apm-spring-resttemplate/apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index 83f82ea463..398802f986 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.2 + 3.2.4 pom import diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index d9095045b8..37b4bb29dd 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -23,7 +23,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.2 + 3.2.4 pom import diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index 3e3a2bfbe9..2f10a4cba4 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -18,7 +18,7 @@ 2.7.16 - 3.2.2 + 3.2.4 diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index 943d6aaac5..78a4d0c7c6 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.2 + 3.2.4 pom import diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index e105e7f028..9e9c73d10b 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -29,7 +29,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.2 + 3.2.4 pom import diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 0ef88d8a29..b744abc7c6 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -30,7 +30,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.2 + 3.2.4 pom import From 750ba4bb09f0fda2885a01e2c7ddaf2678b2d73a Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 22 Apr 2024 18:12:06 +0200 Subject: [PATCH 026/132] buildkite: fallback if home is not available (#3591) --- .buildkite/hooks/prepare-common.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index f5fc876099..7c04356ecf 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -1,9 +1,17 @@ #!/usr/bin/env bash -set -euo pipefail +set -eo pipefail # Configure the java version JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]') +set +u +# In case the HOME is not available in the context of the runner. +if [ -z "${HOME}" ] ; then + HOME="${BUILDKITE_BUILD_CHECKOUT_PATH}" + export HOME +fi JAVA_HOME="${HOME}/.java/openjdk${JAVA_VERSION}" +set -u + export JAVA_HOME PATH="${JAVA_HOME}/bin:${PATH}" export PATH From d63b1cca83141ec61f00d0dfbe07d6aaf9629bba Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 23 Apr 2024 13:41:34 +0200 Subject: [PATCH 027/132] Prevent cycles in inferred spans (#3588) --- CHANGELOG.asciidoc | 4 ++ .../agent/impl/transaction/TraceContext.java | 17 ++++- .../elastic/apm/agent/profiler/CallTree.java | 56 ++++++++++------ .../elastic/apm/agent/profiler/ChildList.java | 64 +++++++++++++++++++ .../apm/agent/profiler/SamplingProfiler.java | 2 +- .../agent/profiler/CallTreeSpanifyTest.java | 59 ++++++++++++++++- .../apm/agent/profiler/CallTreeTest.java | 2 +- 7 files changed, 180 insertions(+), 24 deletions(-) create mode 100644 apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ChildList.java diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 44b9c2f8e5..c04a3f9a2c 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +[float] +===== Bug fixes +* Fixed edge case where inferred spans could cause cycles in the trace parent-child relationships, subsequently resulting in the UI crashing - {pull}3588[#3588] + [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java index f8854468f0..cc3df527cb 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java @@ -64,7 +64,7 @@ public class TraceContext implements Recyclable, co.elastic.apm.agent.tracer.Tra public static final String ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME = "elastic-apm-traceparent"; public static final String W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME = "traceparent"; public static final String TRACESTATE_HEADER_NAME = "tracestate"; - public static final int SERIALIZED_LENGTH = 42; + public static final int SERIALIZED_LENGTH = 51; private static final int TEXT_HEADER_EXPECTED_LENGTH = 55; private static final int TEXT_HEADER_TRACE_ID_OFFSET = 3; private static final int TEXT_HEADER_PARENT_ID_OFFSET = 36; @@ -227,6 +227,7 @@ private TraceContext(ElasticApmTracer tracer, Id id) { *

    * Note: the {@link #traceId} will still be 128 bit *

    + * * @param tracer a valid tracer */ public static TraceContext with64BitId(ElasticApmTracer tracer) { @@ -621,7 +622,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; TraceContext that = (TraceContext) o; return id.equals(that.id) && - traceId.equals(that.traceId); + traceId.equals(that.traceId); } public boolean idEquals(@Nullable TraceContext o) { @@ -650,6 +651,8 @@ public void serialize(byte[] buffer) { offset = traceId.toBytes(buffer, offset); offset = id.toBytes(buffer, offset); offset = transactionId.toBytes(buffer, offset); + buffer[offset++] = parentId.isEmpty() ? (byte) 0 : (byte) 1; + offset = parentId.toBytes(buffer, offset); buffer[offset++] = flags; buffer[offset++] = (byte) (discardable ? 1 : 0); ByteUtils.putLong(buffer, offset, clock.getOffset()); @@ -660,6 +663,12 @@ public void deserialize(byte[] buffer, @Nullable String serviceName, @Nullable S offset += traceId.fromBytes(buffer, offset); offset += id.fromBytes(buffer, offset); offset += transactionId.fromBytes(buffer, offset); + if (buffer[offset++] != 0) { + offset += parentId.fromBytes(buffer, offset); + } else { + parentId.resetState(); + offset += 8; + } flags = buffer[offset++]; discardable = buffer[offset++] == (byte) 1; clock.init(ByteUtils.getLong(buffer, offset)); @@ -672,6 +681,10 @@ public static long getSpanId(byte[] serializedTraceContext) { return ByteUtils.getLong(serializedTraceContext, 16); } + public static long getParentId(byte[] serializedTraceContext) { + return ByteUtils.getLong(serializedTraceContext, 33); + } + public boolean traceIdAndIdEquals(byte[] serialized) { return id.dataEquals(serialized, traceId.getLength()) && traceId.dataEquals(serialized, 0); } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java index 551a74b8be..3042fee406 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java @@ -79,9 +79,9 @@ public class CallTree implements Recyclable { * @see co.elastic.apm.agent.impl.transaction.AbstractSpan#childIds */ @Nullable - private LongList childIds; + private ChildList childIds; @Nullable - private LongList maybeChildIds; + private ChildList maybeChildIds; public CallTree() { } @@ -375,20 +375,21 @@ private void toString(Appendable out, int level) throws IOException { } } - int spanify(CallTree.Root root, TraceContext parentContext) { + int spanify(CallTree.Root root, TraceContext parentContext, TraceContext nonInferredParentContext) { int createdSpans = 0; if (activeContextOfDirectParent != null) { parentContext = activeContextOfDirectParent; + nonInferredParentContext = activeContextOfDirectParent; } Span span = null; if (!isPillar() || isLeaf()) { createdSpans++; - span = asSpan(root, parentContext); + span = asSpan(root, parentContext, nonInferredParentContext); this.isSpan = true; } List children = getChildren(); for (int i = 0, size = children.size(); i < size; i++) { - createdSpans += children.get(i).spanify(root, span != null ? span.getTraceContext() : parentContext); + createdSpans += children.get(i).spanify(root, span != null ? span.getTraceContext() : parentContext, nonInferredParentContext); } if (span != null) { span.end(span.getTimestamp() + getDurationUs()); @@ -396,7 +397,7 @@ int spanify(CallTree.Root root, TraceContext parentContext) { return createdSpans; } - protected Span asSpan(Root root, TraceContext parentContext) { + protected Span asSpan(Root root, TraceContext parentContext, TraceContext nonInferredParentContext) { transferMaybeChildIdsToChildIds(); Span span = parentContext.createSpan(root.getEpochMicros(this.start)) .withType("app") @@ -410,7 +411,21 @@ protected Span asSpan(Root root, TraceContext parentContext) { } span.appendToName("#"); span.appendToName(frame.getMethodName()); - span.withChildIds(childIds); + + LongList childSpanIds = null; + if (childIds != null) { + long expectedParent = nonInferredParentContext.getId().readLong(0); + childSpanIds = new LongList(childIds.getSize()); + for (int i = 0; i < childIds.getSize(); i++) { + // to avoid cycles, we only insert child-ids if the parent of the child is also + // the parent of the stack of inferred spans inserted + if (childIds.getParentId(i) == expectedParent) { + childSpanIds.add(childIds.getId(i)); + } + } + } + + span.withChildIds(childSpanIds); // we're not interested in the very bottom of the stack which contains things like accepting and handling connections if (!root.rootContext.idEquals(parentContext)) { @@ -498,19 +513,20 @@ public void resetState() { *

    * * @param id the child span id to add to this call tree element + * @param parentId the parent id of the span represented by the id parameter */ - public void addMaybeChildId(long id) { + public void addMaybeChildId(long id, long parentId) { if (maybeChildIds == null) { - maybeChildIds = new LongList(); + maybeChildIds = new ChildList(); } - maybeChildIds.add(id); + maybeChildIds.add(id, parentId); } - public void addChildId(long id) { + public void addChildId(long id, long parentId) { if (childIds == null) { - childIds = new LongList(); + childIds = new ChildList(); } - childIds.add(id); + childIds.add(id, parentId); } public boolean hasChildIds() { @@ -541,7 +557,11 @@ void giveChildIdsTo(CallTree giveTo) { void giveLastChildIdTo(CallTree giveTo) { if (childIds != null && !childIds.isEmpty()) { - giveTo.addChildId(childIds.remove(childIds.getSize() - 1)); + int size = childIds.getSize(); + long id = childIds.getId(size - 1); + long parentId = childIds.getParentId(size - 1); + giveTo.addChildId(id, parentId); + childIds.removeLast(); } } @@ -619,7 +639,7 @@ public void onActivation(byte[] active, long timestamp) { long spanId = TraceContext.getSpanId(active); activeSet.add(spanId); if (!isNestedActivation(topOfStack)) { - topOfStack.addMaybeChildId(spanId); + topOfStack.addMaybeChildId(spanId, TraceContext.getParentId(active)); } } } @@ -628,12 +648,12 @@ private boolean isNestedActivation(CallTree topOfStack) { return isAnyActive(topOfStack.childIds) || isAnyActive(topOfStack.maybeChildIds); } - private boolean isAnyActive(@Nullable LongList spanIds) { + private boolean isAnyActive(@Nullable ChildList spanIds) { if (spanIds == null) { return false; } for (int i = 0, size = spanIds.getSize(); i < size; i++) { - if (activeSet.contains(spanIds.get(i))) { + if (activeSet.contains(spanIds.getId(i))) { return true; } } @@ -719,7 +739,7 @@ public int spanify() { int createdSpans = 0; List callTrees = getChildren(); for (int i = 0, size = callTrees.size(); i < size; i++) { - createdSpans += callTrees.get(i).spanify(this, rootContext); + createdSpans += callTrees.get(i).spanify(this, rootContext, rootContext); } return createdSpans; } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ChildList.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ChildList.java new file mode 100644 index 0000000000..c4b079f9f8 --- /dev/null +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ChildList.java @@ -0,0 +1,64 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.profiler; + + +import co.elastic.apm.agent.sdk.internal.collections.LongList; + +/** List for maintaining pairs of (spanId,parentIds) both represented as longs. */ +public class ChildList { + + // this list contains the (spanId,parentIds) flattened + private final LongList idsWithParentIds = new LongList(); + + public void add(long id, long parentId) { + idsWithParentIds.add(id); + idsWithParentIds.add(parentId); + } + + public long getId(int index) { + return idsWithParentIds.get(index * 2); + } + + public long getParentId(int index) { + return idsWithParentIds.get(index * 2 + 1); + } + + public int getSize() { + return idsWithParentIds.getSize() / 2; + } + + public void addAll(ChildList other) { + idsWithParentIds.addAll(other.idsWithParentIds); + } + + public void clear() { + idsWithParentIds.clear(); + } + + public boolean isEmpty() { + return getSize() == 0; + } + + public void removeLast() { + int size = idsWithParentIds.getSize(); + idsWithParentIds.remove(size - 1); + idsWithParentIds.remove(size - 2); + } +} diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java index 0c8cb3f674..860a0896de 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java @@ -106,7 +106,7 @@ * and at least one stack trace. * Once {@linkplain ActivationEvent#handleDeactivationEvent(SamplingProfiler) handling the deactivation event} of the root span in a thread * (after which {@link ElasticApmTracer#getActive()} would return {@code null}), - * the {@link CallTree} is {@linkplain CallTree#spanify(CallTree.Root, TraceContext) converted into regular spans}. + * the {@link CallTree} is {@linkplain CallTree#spanify(CallTree.Root, TraceContext, TraceContext) converted into regular spans}. *

    *

    * Overall, the allocation rate does not depend on the number of {@link ActivationEvent}s but only on diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java index aea204c257..738712e825 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java @@ -35,6 +35,7 @@ import org.stagemonitor.configuration.ConfigurationRegistry; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -141,8 +142,62 @@ void testCallTreeWithActiveSpan() { root.spanify(); assertThat(reporter.getSpans()).hasSize(2); - assertThat(reporter.getSpans().get(1).getTraceContext().isChildOf(spanContext)); - assertThat(reporter.getSpans().get(0).getTraceContext().isChildOf(rootContext)); + assertThat(reporter.getSpans().get(0).getTraceContext().isChildOf(spanContext)).isTrue(); + assertThat(reporter.getSpans().get(1).getTraceContext().isChildOf(rootContext)).isTrue(); + } + + + @Test + void testSpanWithInvertedActivation() { + TraceContext rootContext = CallTreeTest.rootTraceContext(tracer); + + TraceContext childSpanContext = TraceContext.with64BitId(tracer); + TraceContext.fromParentContext().asChildOf(childSpanContext, rootContext); + + NoopObjectPool rootPool = NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)); + NoopObjectPool childPool = NoopObjectPool.ofRecyclable(CallTree::new); + + CallTree.Root root = CallTree.createRoot(rootPool, childSpanContext.serialize(), rootContext.getServiceName(), rootContext.getServiceVersion(), 0); + root.addStackTrace(tracer, Collections.singletonList(StackFrame.of("A", "a")), 10_000, childPool, 0); + + root.onActivation(rootContext.serialize(), 20_000); + root.onDeactivation(rootContext.serialize(), childSpanContext.serialize(), 30_000); + + root.addStackTrace(tracer, Collections.singletonList(StackFrame.of("A", "a")), 40_000, childPool, 0); + root.end(childPool, 0); + + root.spanify(); + + assertThat(reporter.getSpans()).hasSize(1); + assertThat(reporter.getSpans().get(0).getTraceContext().isChildOf(childSpanContext)).isTrue(); + // the inferred span should not have any span links because this + // span link would cause a cycle in the trace + assertThat(reporter.getSpans().get(0).getChildIds().getSize()).isEqualTo(0L); + } + + @Test + void testSpanWithNestedActivation() { + TraceContext rootContext = CallTreeTest.rootTraceContext(tracer); + + NoopObjectPool rootPool = NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)); + NoopObjectPool childPool = NoopObjectPool.ofRecyclable(CallTree::new); + + CallTree.Root root = CallTree.createRoot(rootPool, rootContext.serialize(), rootContext.getServiceName(), rootContext.getServiceVersion(), 0); + root.addStackTrace(tracer, Collections.singletonList(StackFrame.of("A", "a")), 10_000, childPool, 0); + + root.onActivation(rootContext.serialize(), 20_000); + root.onDeactivation(rootContext.serialize(), rootContext.serialize(), 30_000); + + root.addStackTrace(tracer, Collections.singletonList(StackFrame.of("A", "a")), 40_000, childPool, 0); + root.end(childPool, 0); + + root.spanify(); + + assertThat(reporter.getSpans()).hasSize(1); + assertThat(reporter.getSpans().get(0).getTraceContext().isChildOf(rootContext)).isTrue(); + // the inferred span should not have any span links because this + // span link would cause a cycle in the trace + assertThat(reporter.getSpans().get(0).getChildIds().getSize()).isEqualTo(0L); } } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java index b18d86ecdd..ae64d3387a 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java @@ -120,7 +120,7 @@ void testCallTree() { @Test void testGiveEmptyChildIdsTo() { CallTree rich = new CallTree(); - rich.addChildId(42); + rich.addChildId(42, 0L); CallTree robinHood = new CallTree(); CallTree poor = new CallTree(); From c98702088fdce28a02a4a39c42f6f9795cb25cc3 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:45:32 +0200 Subject: [PATCH 028/132] [ci] add list of published artifacts (#3595) --- .ci/scripts/published-artifacts-list.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .ci/scripts/published-artifacts-list.sh diff --git a/.ci/scripts/published-artifacts-list.sh b/.ci/scripts/published-artifacts-list.sh new file mode 100755 index 0000000000..32edfc6d5a --- /dev/null +++ b/.ci/scripts/published-artifacts-list.sh @@ -0,0 +1,21 @@ +#!/bin/env bash + +targets="$(find . -type d -name 'target'|grep -v apm-agent-plugins|grep -v integration-tests|sort)" + +for t in ${targets}; do + find "${t}" \ + -name '*.jar' \ + | grep -v '\-sources.jar' \ + | grep -v '\-tests.jar' \ + | grep -v '\-javadoc.jar' \ + | grep -v 'original-' \ + | grep -v 'classes/' \ + | grep -v 'benchmarks' \ + | grep -v 'apm-agent-bootstrap' \ + | grep -v 'apm-agent-builds' \ + | grep -v 'apm-agent-cached-lookup-key' \ + | grep -v 'apm-agent-core' \ + | grep -v 'apm-agent-common' \ + | grep -v 'apm-agent-lambda-layer' \ + | grep -v 'apm-agent-premain' +done From 08188e6f4a3740ed8912a39eb8e0409efe839890 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 15:43:06 +0200 Subject: [PATCH 029/132] Bump version.mockito from 5.1.1 to 5.11.0 (#3587) Bumps `version.mockito` from 5.1.1 to 5.11.0. Updates `org.mockito:mockito-core` from 5.1.1 to 5.11.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.1.1...v5.11.0) Updates `org.mockito:mockito-subclass` from 5.1.1 to 5.11.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.1.1...v5.11.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: org.mockito:mockito-subclass dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 13899352cb..bbf4aeac9e 100644 --- a/pom.xml +++ b/pom.xml @@ -135,7 +135,7 @@ 9.6 5.4.0 - 5.1.1 + 5.11.0 1.17 From 9b0c70a0a54ceb9cafb753f979c90fae47dfe1bc Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 25 Apr 2024 11:08:19 +0200 Subject: [PATCH 030/132] github-actions: enable provenance for the jar files (#3594) --- .buildkite/release.yml | 4 ++++ .buildkite/snapshot.yml | 4 ++++ .ci/release.sh | 6 ++++++ .ci/scripts/published-artifacts-list.sh | 2 +- .ci/snapshot.sh | 6 ++++++ .github/workflows/release.yml | 20 ++++++++++++++++++++ .github/workflows/snapshot.yml | 23 ++++++++++++++++++++++- 7 files changed, 63 insertions(+), 2 deletions(-) diff --git a/.buildkite/release.yml b/.buildkite/release.yml index 347f35358e..f63a7e06dd 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -2,6 +2,9 @@ agents: provider: "gcp" image: "family/apm-agent-java-ubuntu-2204" +env: + TARBALL_FILE: ${TARBALL_FILE:-artifacts.tar} + steps: - label: "Run the release" key: "release" @@ -9,6 +12,7 @@ steps: artifact_paths: - "release.txt" - "**/target/*" + - "${TARBALL_FILE}" notify: - slack: "#apm-agent-java" diff --git a/.buildkite/snapshot.yml b/.buildkite/snapshot.yml index c5cf1bcb79..899d962e7e 100644 --- a/.buildkite/snapshot.yml +++ b/.buildkite/snapshot.yml @@ -2,6 +2,9 @@ agents: provider: "gcp" image: "family/apm-agent-java-ubuntu-2204" +env: + TARBALL_FILE: ${TARBALL_FILE:-artifacts.tar} + steps: - label: "Run the snapshot" key: "release" @@ -9,6 +12,7 @@ steps: artifact_paths: - "snapshot.txt" - "**/target/*" + - "${TARBALL_FILE}" notify: - slack: "#apm-agent-java" diff --git a/.ci/release.sh b/.ci/release.sh index b05947ce95..2f7c4bd832 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -32,3 +32,9 @@ fi echo "--- Deploy the release :package: [./mvnw $GOAL)] $DRY_RUN_MSG" ./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt + +echo "--- Archive the target folder with jar files" +echo 'gather artifacts' +.ci/published-artifacts-list.sh | tee artifacts.list +echo 'create tarbal' +tar -cvf "${TARBALL_FILE:-artifacts.tar}" -T artifacts.list diff --git a/.ci/scripts/published-artifacts-list.sh b/.ci/scripts/published-artifacts-list.sh index 32edfc6d5a..773a1671fe 100755 --- a/.ci/scripts/published-artifacts-list.sh +++ b/.ci/scripts/published-artifacts-list.sh @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/usr/bin/env bash targets="$(find . -type d -name 'target'|grep -v apm-agent-plugins|grep -v integration-tests|sort)" diff --git a/.ci/snapshot.sh b/.ci/snapshot.sh index a11cd4eb9a..5fa49b94a6 100755 --- a/.ci/snapshot.sh +++ b/.ci/snapshot.sh @@ -34,3 +34,9 @@ fi echo "--- Deploy the snapshot :package: [./mvnw $GOAL)] $DRY_RUN_MSG" ./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee snapshot.txt + +echo "--- Archive the target folder with jar files" +echo 'gather artifacts' +.ci/published-artifacts-list.sh | tee artifacts.list +echo 'create tarbal' +tar -cvf "${TARBALL_FILE:-artifacts.tar}" -T artifacts.list diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc9b9d16e6..76d9bcd125 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,6 +74,11 @@ jobs: runs-on: ubuntu-latest needs: - validate-tag + permissions: + contents: write + id-token: write + env: + TARBALL_FILE: artifacts.tar steps: - id: buildkite continue-on-error: true @@ -86,8 +91,23 @@ jobs: pipeline: apm-agent-java-release waitFor: true printBuildLogs: false + artifactName: releases + artifactPath: ${{ env.TARBALL_FILE }} buildEnvVars: | dry_run=${{ inputs.dry_run || 'false' }} + TARBALL_FILE=${{ env.TARBALL_FILE }} + + - uses: actions/download-artifact@v3 + with: + name: releases + + - name: untar the buildkite tarball + run: tar xvf ${{ env.TARBALL_FILE }} + + - name: generate build provenance + uses: github-early-access/generate-build-provenance@main + with: + subject-path: "${{ github.workspace }}/**/target/*.jar" await-maven-central-artifact: name: "Wait for artifacts to be available on maven central" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 9a50021824..30388ce869 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -38,6 +38,11 @@ jobs: runs-on: ubuntu-latest needs: - validate + permissions: + contents: write + id-token: write + env: + TARBALL_FILE: artifacts.tar if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }} steps: - id: buildkite @@ -48,10 +53,26 @@ jobs: vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} pipeline: apm-agent-java-snapshot - waitFor: false + pipelineBranch: ${{ github.ref_name }} + artifactName: snapshots + artifactPath: ${{ env.TARBALL_FILE }} + waitFor: true printBuildLogs: false buildEnvVars: | dry_run=${{ inputs.dry_run || 'false' }} + TARBALL_FILE=${{ env.TARBALL_FILE }} + + - uses: actions/download-artifact@v3 + with: + name: snapshots + + - name: untar the buildkite tarball + run: tar xvf ${{ env.TARBALL_FILE }} + + - name: generate build provenance + uses: github-early-access/generate-build-provenance@main + with: + subject-path: "${{ github.workspace }}/**/target/*.jar" - if: ${{ failure() }} uses: elastic/apm-pipeline-library/.github/actions/slack-message@current From 623eaae869f16de8b6a9c5a7c87e5a75f15d2f6b Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Thu, 25 Apr 2024 05:11:40 -0400 Subject: [PATCH 031/132] chore: APM agent json server schema a76e999543efb3ba803c9a57dd13a4f6b... (#3584) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... 3ffa7e1 Made with ❤️️ by updatecli Co-authored-by: apmmachine --- .../resources/apm-server-schema/current/metadata.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apm-agent-core/src/test/resources/apm-server-schema/current/metadata.json b/apm-agent-core/src/test/resources/apm-server-schema/current/metadata.json index 7103bbeb5a..1122ed68c2 100644 --- a/apm-agent-core/src/test/resources/apm-server-schema/current/metadata.json +++ b/apm-agent-core/src/test/resources/apm-server-schema/current/metadata.json @@ -441,6 +441,14 @@ ], "maxLength": 1024 }, + "host_id": { + "description": "The OpenTelemetry semantic conventions compliant \"host.id\" attribute, if available.", + "type": [ + "null", + "string" + ], + "maxLength": 1024 + }, "hostname": { "description": "Deprecated: Use ConfiguredHostname and DetectedHostname instead. DeprecatedHostname is the host name of the system the service is running on. It does not distinguish between configured and detected hostname and therefore is deprecated and only used if no other hostname information is available.", "type": [ From 2105bf4a107372492ce119839f733f680f3d289f Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:34:51 +0200 Subject: [PATCH 032/132] [ci] fix GH release version tag (#3596) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76d9bcd125..1e133e6da8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -266,7 +266,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh release create ${{ env.RELEASE_VERSION }} \ + gh release create ${{ env.RELEASE_VERSION_TAG }} \ --title="Release ${{ env.RELEASE_VERSION }}" \ --notes="[Release Notes for ${{ env.RELEASE_VERSION }}](https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${{ steps.get_dotx_branch.outputs.dotx_branch }}.html#release-notes-${{ env.RELEASE_VERSION }}) ${{ needs.publish-aws-lambda.outputs.arn_content }}" From ad564ae387daef48540c6446cdafa200c1b4152a Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:17:05 +0200 Subject: [PATCH 033/132] [ci] fix artifact list path (#3597) --- .ci/{scripts => }/published-artifacts-list.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .ci/{scripts => }/published-artifacts-list.sh (100%) diff --git a/.ci/scripts/published-artifacts-list.sh b/.ci/published-artifacts-list.sh similarity index 100% rename from .ci/scripts/published-artifacts-list.sh rename to .ci/published-artifacts-list.sh From 7ee2898a20e879d03dacdc0b05fe480f86a13676 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 25 Apr 2024 14:58:00 +0200 Subject: [PATCH 034/132] Upgrade JDK compatibility tests (#3599) * Upgrade JDK compatibility tests * Added JDK 23 ea * Attempt to set net.bytebuddy.experimental for EA versions * Remove java 23-ea tests --- .github/workflows/main.yml | 2 +- .../src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 419c369cd3..0d5944b6e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -301,7 +301,7 @@ jobs: distribution: 'temurin' - version: 21 distribution: 'temurin' - - version: 22-ea + - version: 22 distribution: 'temurin' steps: - uses: actions/checkout@v4 diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java index 324ddf7014..c4d8b958d9 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java @@ -33,7 +33,6 @@ public class JdkVersionTest { private static List releaseSchedule() { // from https://www.oracle.com/java/technologies/java-se-support-roadmap.html return List.of( - Arguments.of(22, LocalDate.parse("2024-04-01")), Arguments.of(23, LocalDate.parse("2024-10-01")), Arguments.of(24, LocalDate.parse("2025-04-01")), Arguments.of(25, LocalDate.parse("2025-10-01")) From 1d512397b47640ebbcc8478b34b2761cdb332ce0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:17:45 +0000 Subject: [PATCH 035/132] Bump version.ecs.logging from 1.5.0 to 1.6.0 (#3585) Bumps `version.ecs.logging` from 1.5.0 to 1.6.0. Updates `co.elastic.logging:log4j2-ecs-layout` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/elastic/ecs-logging-java/releases) - [Commits](https://github.com/elastic/ecs-logging-java/compare/v1.5.0...v1.6.0) Updates `co.elastic.logging:logback-ecs-encoder` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/elastic/ecs-logging-java/releases) - [Commits](https://github.com/elastic/ecs-logging-java/compare/v1.5.0...v1.6.0) Updates `co.elastic.logging:log4j-ecs-layout` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/elastic/ecs-logging-java/releases) - [Commits](https://github.com/elastic/ecs-logging-java/compare/v1.5.0...v1.6.0) Updates `co.elastic.logging:jul-ecs-formatter` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/elastic/ecs-logging-java/releases) - [Commits](https://github.com/elastic/ecs-logging-java/compare/v1.5.0...v1.6.0) Updates `co.elastic.logging:jboss-logmanager-ecs-formatter` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/elastic/ecs-logging-java/releases) - [Commits](https://github.com/elastic/ecs-logging-java/compare/v1.5.0...v1.6.0) --- updated-dependencies: - dependency-name: co.elastic.logging:log4j2-ecs-layout dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: co.elastic.logging:logback-ecs-encoder dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: co.elastic.logging:log4j-ecs-layout dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: co.elastic.logging:jul-ecs-formatter dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: co.elastic.logging:jboss-logmanager-ecs-formatter dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bbf4aeac9e..59fbc6d73e 100644 --- a/pom.xml +++ b/pom.xml @@ -126,7 +126,7 @@ (https://nvd.nist.gov/vuln/detail/CVE-2020-9488#vulnCurrentDescriptionTitle), the SMTP appender is excluded from the build and not packaged into the agent artifacts --> 2.12.4 - 1.5.0 + 1.6.0 5.0.15.RELEASE 9.4.11.v20180605 1.3.3 From c916209966a80d3a0633c46bb39ebd9e8867355f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:38:55 +0000 Subject: [PATCH 036/132] Bump org.apache.logging.log4j:log4j-bom from 2.22.1 to 2.23.1 (#3565) Bumps [org.apache.logging.log4j:log4j-bom](https://github.com/apache/logging-log4j2) from 2.22.1 to 2.23.1. - [Release notes](https://github.com/apache/logging-log4j2/releases) - [Changelog](https://github.com/apache/logging-log4j2/blob/2.x/RELEASE-NOTES.adoc) - [Commits](https://github.com/apache/logging-log4j2/compare/rel/2.22.1...rel/2.23.1) --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-builds/apm-agent-java8/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-builds/apm-agent-java8/pom.xml b/apm-agent-builds/apm-agent-java8/pom.xml index 48f8f81e31..87cca26d6b 100644 --- a/apm-agent-builds/apm-agent-java8/pom.xml +++ b/apm-agent-builds/apm-agent-java8/pom.xml @@ -21,7 +21,7 @@ org.apache.logging.log4j log4j-bom - 2.22.1 + 2.23.1 import pom From 35e0d6d0de0b6d1753f2e6bdd5678a10c2267cd4 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 26 Apr 2024 13:25:12 +0200 Subject: [PATCH 037/132] github-action: add attestations scope (#3601) --- .github/workflows/release.yml | 1 + .github/workflows/snapshot.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e133e6da8..9a36437ca7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,6 +75,7 @@ jobs: needs: - validate-tag permissions: + attestations: write contents: write id-token: write env: diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 30388ce869..f985425da2 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -39,6 +39,7 @@ jobs: needs: - validate permissions: + attestations: write contents: write id-token: write env: From cc4d8a16a7aa85099bcb8b14da0cffb3e37b9d63 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Fri, 26 Apr 2024 16:41:55 +0200 Subject: [PATCH 038/132] Universal profiling integration: write shared memory (#3598) --------- Co-authored-by: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> --- .../apm/agent/common/util/AgentInfo.java | 3 +- apm-agent-core/pom.xml | 5 + .../UniversalProfilingConfiguration.java | 72 ++++++ .../apm/agent/impl/ElasticApmTracer.java | 10 +- .../apm/agent/impl/metadata/SystemInfo.java | 2 +- .../apm/agent/impl/transaction/Id.java | 4 + .../ProfilerSharedMemoryWriter.java | 114 +++++++++ .../UniversalProfilingIntegration.java | 117 +++++++++ ....configuration.ConfigurationOptionProvider | 1 + .../UniversalProfilingIntegrationTest.java | 230 ++++++++++++++++++ 10 files changed, 555 insertions(+), 3 deletions(-) create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/UniversalProfilingConfiguration.java create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/ProfilerSharedMemoryWriter.java create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java create mode 100644 apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java diff --git a/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/AgentInfo.java b/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/AgentInfo.java index b677ceb7c4..dbd2b1a9de 100644 --- a/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/AgentInfo.java +++ b/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/AgentInfo.java @@ -36,7 +36,8 @@ public class AgentInfo { "com.blogspot.mydailyjava.weaklockfree", "com.lmax.disruptor", "com.dslplatform.json", - "com.googlecode.concurrentlinkedhashmap" + "com.googlecode.concurrentlinkedhashmap", + "co.elastic.otel" )); private static final Set agentRootPackages = new HashSet<>(Arrays.asList( diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index cb04140691..5f35f7912d 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -100,6 +100,11 @@ HdrHistogram 2.1.11 + + co.elastic.otel + jvmti-access + 0.3.0 + - 1.14.12 + 1.14.14 9.6 5.4.0 From c339b002ddc60cdd4aee2f7ba823cf814d8658a7 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 2 May 2024 10:21:05 +0200 Subject: [PATCH 042/132] Universal Profiling integration: open socket for communication (#3602) --- .../UniversalProfilingIntegration.java | 117 +++++++++++++++++- .../UniversalProfilingIntegrationTest.java | 78 +++++++++++- 2 files changed, 190 insertions(+), 5 deletions(-) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java index 251aeaf6df..33897cbfa6 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java @@ -28,14 +28,34 @@ import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.util.ExecutorUtils; import co.elastic.otel.JvmtiAccess; import co.elastic.otel.UniversalProfilingCorrelation; +import co.elastic.otel.profiler.DecodeException; +import co.elastic.otel.profiler.ProfilerMessage; +import co.elastic.otel.profiler.ProfilerRegistrationMessage; +import co.elastic.otel.profiler.TraceCorrelationMessage; import javax.annotation.Nullable; import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Duration; +import java.util.Base64; +import java.util.Random; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; public class UniversalProfilingIntegration { + /** + * The frequency at which the processor polls the unix domain socket for new messages from the + * profiler. + */ + static final long POLL_FREQUENCY_MS = 20; + private static final Logger log = LoggerFactory.getLogger(UniversalProfilingIntegration.class); private volatile ElasticApmTracer tracer; @@ -43,6 +63,11 @@ public class UniversalProfilingIntegration { // Visible for testing volatile boolean isActive = false; + // Visible for testing + String socketPath = null; + + private ScheduledExecutorService executor; + private ActivationListener activationListener = new ActivationListener() { @Override @@ -70,22 +95,51 @@ public void start(ElasticApmTracer tracer) { try { log.debug("Starting universal profiling correlation"); + socketPath = openProfilerSocket(config.getSocketDir()); + CoreConfiguration coreConfig = tracer.getConfig(CoreConfiguration.class); ByteBuffer processCorrelationStorage = ProfilerSharedMemoryWriter.generateProcessCorrelationStorage( - coreConfig.getServiceName(), coreConfig.getEnvironment(), ""); + coreConfig.getServiceName(), coreConfig.getEnvironment(), socketPath); UniversalProfilingCorrelation.setProcessStorage(processCorrelationStorage); + executor = ExecutorUtils.createSingleThreadSchedulingDaemonPool("profiling-integration"); + executor.scheduleWithFixedDelay(new Runnable() { + @Override + public void run() { + periodicTimer(); + } + }, POLL_FREQUENCY_MS, POLL_FREQUENCY_MS, TimeUnit.MILLISECONDS); + isActive = true; tracer.registerSpanListener(activationListener); } catch (Exception e) { log.error("Failed to start universal profiling integration", e); + if (socketPath != null) { + try { + UniversalProfilingCorrelation.stopProfilerReturnChannel(); + socketPath = null; + } catch (Exception e2) { + log.error("Failed to clean up universal profiling integration socket", e2); + } + } } } + private void periodicTimer() { + consumeProfilerMessages(); + } + public void stop() { try { + if (executor != null) { + executor.shutdown(); + executor.awaitTermination(10, TimeUnit.SECONDS); + executor = null; + } if (isActive) { + UniversalProfilingCorrelation.stopProfilerReturnChannel(); JvmtiAccess.destroy(); + isActive = false; } } catch (Exception e) { log.error("Failed to stop universal profiling integration", e); @@ -114,4 +168,65 @@ public void correlateAndReport(Transaction endedTransaction) { public void drop(Transaction endedTransaction) { //TODO: remove dropped transactions from correlation storage without reporting } + + + private String openProfilerSocket(String socketDir) { + Path dir = Paths.get(socketDir); + if (!Files.exists(dir) && !dir.toFile().mkdirs()) { + throw new IllegalArgumentException("Could not create directory '" + socketDir + "'"); + } + Path socketFile; + do { + socketFile = dir.resolve(randomSocketFileName()); + } while (Files.exists(socketFile)); + + String absolutePath = socketFile.toAbsolutePath().toString(); + log.debug("Opening profiler correlation socket {}", absolutePath); + UniversalProfilingCorrelation.startProfilerReturnChannel(absolutePath); + return absolutePath; + } + + private String randomSocketFileName() { + StringBuilder name = new StringBuilder("essock"); + String allowedChars = "abcdefghijklmonpqrstuvwxzyABCDEFGHIJKLMONPQRSTUVWXYZ0123456789"; + Random rnd = new Random(); + for (int i = 0; i < 8; i++) { + int idx = rnd.nextInt(allowedChars.length()); + name.append(allowedChars.charAt(idx)); + } + return name.toString(); + } + + private void consumeProfilerMessages() { + try { + while (true) { + try { + ProfilerMessage message = + UniversalProfilingCorrelation.readProfilerReturnChannelMessage(); + if (message == null) { + break; + } else if (message instanceof TraceCorrelationMessage) { + handleMessage((TraceCorrelationMessage) message); + } else if (message instanceof ProfilerRegistrationMessage) { + handleMessage((ProfilerRegistrationMessage) message); + } else { + log.debug("Received unknown message type from profiler: {}", message); + } + } catch (DecodeException e) { + log.warn("Failed to read profiler message", e); + // intentionally no break here, subsequent messages might be decodeable + } + } + } catch (Exception e) { + log.error("Cannot read from profiler socket", e); + } + } + + private void handleMessage(ProfilerRegistrationMessage message) { + //TODO: handle message + } + + private void handleMessage(TraceCorrelationMessage message) { + //TODO: handle message + } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java index 867efae359..81b64c67cb 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java @@ -38,6 +38,7 @@ import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -46,6 +47,9 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.function.Consumer; import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; @@ -62,6 +66,16 @@ public class UniversalProfilingIntegrationTest { private TestObjectPoolFactory poolFactory; + @TempDir + Path tempDir; + + void setupTracer() { + setupTracer(config -> { + UniversalProfilingConfiguration conf = config.getConfig(UniversalProfilingConfiguration.class); + doReturn(true).when(conf).isEnabled(); + doReturn(tempDir.toAbsolutePath().toString()).when(conf).getSocketDir(); + }); + } void setupTracer(Consumer configCustomizer) { ConfigurationRegistry config = SpyConfiguration.createSpyConfig(); configCustomizer.accept(config); @@ -96,6 +110,7 @@ public void ensureDisabledOnWindows() { verify(mockTracer, never()).registerSpanListener(any()); assertThat(universalProfilingIntegration.isActive).isFalse(); + assertThat(universalProfilingIntegration.socketPath).isNull(); } @Test @@ -107,6 +122,7 @@ public void ensureDisabledByDefault() { verify(mockTracer, never()).registerSpanListener(any()); assertThat(universalProfilingIntegration.isActive).isFalse(); + assertThat(universalProfilingIntegration.socketPath).isNull(); } @Nested @@ -115,8 +131,7 @@ class SharedMemory { @Test public void testNestedActivations() { - setupTracer(conf -> doReturn(true) - .when(conf.getConfig(UniversalProfilingConfiguration.class)).isEnabled()); + setupTracer(); Transaction first = tracer.startRootTransaction(null); Transaction second = tracer.startRootTransaction(null); @@ -168,7 +183,9 @@ public void testNestedActivations() { @ValueSource(strings = {"my nameßspace", ""}) public void testProcessStoragePopulated(String environment) { setupTracer(conf -> { - doReturn(true).when(conf.getConfig(UniversalProfilingConfiguration.class)).isEnabled(); + UniversalProfilingConfiguration profConfig = conf.getConfig(UniversalProfilingConfiguration.class); + doReturn(true).when(profConfig).isEnabled(); + doReturn(tempDir.toAbsolutePath().toString()).when(profConfig).getSocketDir(); CoreConfiguration core = conf.getConfig(CoreConfiguration.class); doReturn("service Ä 1").when(core).getServiceName(); doReturn(environment).when(core).getEnvironment(); @@ -179,7 +196,8 @@ public void testProcessStoragePopulated(String environment) { assertThat(buffer.getChar()).describedAs("layout-minor-version").isEqualTo((char) 1); assertThat(readUtf8Str(buffer)).isEqualTo("service Ä 1"); assertThat(readUtf8Str(buffer)).isEqualTo(environment); - assertThat(readUtf8Str(buffer)).describedAs("socket-path").isEqualTo(""); + assertThat(readUtf8Str(buffer)).describedAs("socket-path") + .startsWith(tempDir.toAbsolutePath().toString() + "/essock"); } private String readUtf8Str(ByteBuffer buffer) { @@ -220,6 +238,58 @@ static void checkTlsIs(@Nullable AbstractSpan span) { } } + @DisabledOnOs(OS.WINDOWS) + @Nested + class SpanCorrelation { + + @Test + void badSocketPath() throws Exception { + Path notADir = tempDir.resolve("not_a_dir"); + Files.createFile(notADir); + String absPath = notADir.toAbsolutePath().toString(); + + ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(); + UniversalProfilingConfiguration config = configRegistry.getConfig(UniversalProfilingConfiguration.class); + + doReturn(true).when(config).isEnabled(); + doReturn(absPath).when(config).getSocketDir(); + + UniversalProfilingIntegration universalProfilingIntegration = new UniversalProfilingIntegration(); + ElasticApmTracer mockTracer = MockTracer.create(configRegistry); + + universalProfilingIntegration.start(mockTracer); + + verify(mockTracer, never()).registerSpanListener(any()); + assertThat(universalProfilingIntegration.isActive).isFalse(); + assertThat(universalProfilingIntegration.socketPath).isNull(); + } + + @Test + void socketParentDirCreated() throws Exception { + Path subDirs = tempDir.resolve("create/me"); + String absolute = subDirs.toAbsolutePath().toString(); + + ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(); + UniversalProfilingConfiguration config = configRegistry.getConfig(UniversalProfilingConfiguration.class); + + doReturn(true).when(config).isEnabled(); + doReturn(absolute).when(config).getSocketDir(); + + UniversalProfilingIntegration universalProfilingIntegration = new UniversalProfilingIntegration(); + ElasticApmTracer mockTracer = MockTracer.create(configRegistry); + + universalProfilingIntegration.start(mockTracer); + try { + assertThat(Paths.get(universalProfilingIntegration.socketPath)).exists(); + assertThat(universalProfilingIntegration.socketPath).startsWith(absolute + "/"); + } finally { + universalProfilingIntegration.stop(); + } + } + + } + + private static byte[] idToBytes(Id id) { byte[] buff = new byte[32]; int len = id.toBytes(buff, 0); From b14f6588f6c639de29cc19c9df8731ac494a185d Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Thu, 2 May 2024 14:57:16 +0200 Subject: [PATCH 043/132] Fix NPE in dropped spans stats (#3590) * fix npe * update changelog --- CHANGELOG.asciidoc | 1 + .../elastic/apm/agent/impl/transaction/DroppedSpanStats.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index c04a3f9a2c..0cdeb84dbe 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -34,6 +34,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [float] ===== Bug fixes * Fixed edge case where inferred spans could cause cycles in the trace parent-child relationships, subsequently resulting in the UI crashing - {pull}3588[#3588] +* Fix NPE in dropped spans statistics - {pull}3590[#3590] [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java index ff25b9596b..74bcf45c95 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java @@ -190,10 +190,13 @@ public void captureDroppedSpan(Span span) { private Stats getOrCreateStats(ServiceTarget serviceTarget, Outcome outcome) { StatsKey statsKey = statsKeyObjectPool.createInstance().init(serviceTarget, outcome); Stats stats = statsMap.get(statsKey); - if (stats != null || statsMap.size() > 127) { + if (stats != null) { statsKeyObjectPool.recycle(statsKey); return stats; } + if (statsMap.size() > 127) { + statsKeyObjectPool.recycle(statsKey); + } stats = statsObjectPool.createInstance(); From 1f1857b02849bedb248c813848ed59bcdca40d3c Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 2 May 2024 15:36:42 +0200 Subject: [PATCH 044/132] Universal profiling integration: Added serialization of stacktrace IDs as profiler_stack_trace_ids otel attributes (#3607) --- .../apm/agent/impl/ElasticApmTracer.java | 18 ++++++++ .../apm/agent/impl/transaction/Id.java | 5 +++ .../agent/impl/transaction/Transaction.java | 32 ++++++++++++++ .../serialize/Base64SerializationUtils.java | 43 +++++++++++++++++++ .../report/serialize/DslJsonSerializer.java | 39 +++++++++++++++-- .../Base64SerializationUtilTest.java | 41 ++++++++++++++++++ .../serialize/DslJsonSerializerTest.java | 25 +++++++++++ 7 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtils.java create mode 100644 apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtilTest.java diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java index abc6ec489f..025de06219 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java @@ -34,9 +34,11 @@ import co.elastic.apm.agent.impl.metadata.MetaDataFuture; import co.elastic.apm.agent.impl.metadata.NameAndIdField; import co.elastic.apm.agent.impl.metadata.ServiceFactory; +import co.elastic.apm.agent.impl.transaction.Id; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; import co.elastic.apm.agent.tracer.metrics.Labels; +import co.elastic.apm.agent.tracer.pooling.Allocator; import co.elastic.apm.agent.tracer.service.Service; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.configuration.SpanConfiguration; @@ -127,6 +129,7 @@ public class ElasticApmTracer implements Tracer { private final ObjectPool spanPool; private final ObjectPool errorPool; private final ObjectPool spanLinkPool; + private final ObjectPool profilingCorrelationStackTraceIdPool; private final Reporter reporter; private final ObjectPoolFactory objectPoolFactory; @@ -245,6 +248,13 @@ public void onChange(ConfigurationOption configurationOption, Boolean oldValu // span links pool allows for 10X the maximum allowed span links per span spanLinkPool = poolFactory.createSpanLinkPool(AbstractSpan.MAX_ALLOWED_SPAN_LINKS * 10, this); + profilingCorrelationStackTraceIdPool = poolFactory.createRecyclableObjectPool(maxPooledElements, new Allocator() { + @Override + public Id createInstance() { + return Id.new128BitId(); + } + }); + sampler = ProbabilitySampler.of(coreConfiguration.getSampleRate().get()); coreConfiguration.getSampleRate().addChangeListener(new ConfigurationOption.ChangeListener() { @Override @@ -604,6 +614,10 @@ public TraceContext createSpanLink() { return spanLinkPool.createInstance(); } + public Id createProfilingCorrelationStackTraceId() { + return profilingCorrelationStackTraceIdPool.createInstance(); + } + public void recycle(Transaction transaction) { transactionPool.recycle(transaction); } @@ -620,6 +634,10 @@ public void recycle(TraceContext traceContext) { spanLinkPool.recycle(traceContext); } + public void recycleProfilingCorrelationStackTraceId(Id id) { + profilingCorrelationStackTraceIdPool.recycle(id); + } + public synchronized void stop() { if (tracerState == TracerState.STOPPED) { // may happen if explicitly stopped in a unit test and executed again within a shutdown hook diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java index 5736124dce..899bf68d28 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.impl.transaction; +import co.elastic.apm.agent.report.serialize.Base64SerializationUtils; import co.elastic.apm.agent.report.serialize.HexSerializationUtils; import co.elastic.apm.agent.tracer.pooling.Recyclable; import co.elastic.apm.agent.tracer.util.HexUtils; @@ -175,6 +176,10 @@ public void writeAsHex(JsonWriter jw) { HexSerializationUtils.writeBytesAsHex(data, jw); } + public void writeAsBase64UrlSafe(JsonWriter jw) { + Base64SerializationUtils.writeBytesAsBase64UrlSafe(data, jw); + } + public void writeAsHex(StringBuilder sb) { HexUtils.writeBytesAsHex(data, sb); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java index ff3ca395c7..83213a352c 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java @@ -37,6 +37,7 @@ import org.HdrHistogram.WriterReaderPhaser; import javax.annotation.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -107,6 +108,8 @@ public class Transaction extends AbstractSpan implements co.elastic @Nullable private Throwable pendingException; + private final ArrayList profilingCorrelationStackTraceIds = new ArrayList<>(); + /** * Faas *

    @@ -341,9 +344,23 @@ public void resetState() { faas.resetState(); wasActivated.set(false); pendingException = null; + recycleProfilingCorrelationStackTraceIds(); // don't clear timerBySpanTypeAndSubtype map (see field-level javadoc) } + private void recycleProfilingCorrelationStackTraceIds() { + for (Id toRecycle : profilingCorrelationStackTraceIds) { + tracer.recycleProfilingCorrelationStackTraceId(toRecycle); + } + if (profilingCorrelationStackTraceIds.size() > 100) { + profilingCorrelationStackTraceIds.clear(); + //trim overly big lists + profilingCorrelationStackTraceIds.trimToSize(); + } else { + profilingCorrelationStackTraceIds.clear(); + } + } + @Override public boolean isNoop() { return noop; @@ -552,4 +569,19 @@ public Throwable getPendingTransactionException() { return this.pendingException; } + public void addProfilerCorrelationStackTrace(Id idToCopy) { + Id id = tracer.createProfilingCorrelationStackTraceId(); + id.copyFrom(idToCopy); + synchronized (profilingCorrelationStackTraceIds) { + this.profilingCorrelationStackTraceIds.add(id); + } + } + + /** + * Returns the list of stacktrace-IDs from the profiler associated with this transaction + * To protect agains concurrent modifications, consumers must synchronize on the returned list. + */ + public List getProfilingCorrelationStackTraceIds() { + return profilingCorrelationStackTraceIds; + } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtils.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtils.java new file mode 100644 index 0000000000..aea9fde5bc --- /dev/null +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtils.java @@ -0,0 +1,43 @@ +package co.elastic.apm.agent.report.serialize; + +import com.dslplatform.json.JsonWriter; + +public class Base64SerializationUtils { + + private static final byte[] BASE64_URL_CHARS = new byte[]{ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '-', '_', + }; + + + public static void writeBytesAsBase64UrlSafe(byte[] data, JsonWriter jw) { + int i = 0; + for (; i + 2 < data.length; i += 3) { + int b0 = ((int) data[i]) & 0xFF; + int b1 = ((int) data[i + 1]) & 0xFF; + int b2 = ((int) data[i + 2]) & 0xFF; + jw.writeByte(BASE64_URL_CHARS[b0 >> 2]); + jw.writeByte(BASE64_URL_CHARS[((b0 << 4) & 63) | (b1 >> 4)]); + jw.writeByte(BASE64_URL_CHARS[((b1 << 2) & 63) | (b2 >> 6)]); + jw.writeByte(BASE64_URL_CHARS[b2 & 63]); + } + int leftOver = data.length - i; + if (leftOver == 1) { + int b0 = ((int) data[i]) & 0xFF; + jw.writeByte(BASE64_URL_CHARS[b0 >> 2]); + jw.writeByte(BASE64_URL_CHARS[(b0 << 4) & 63]); + } else if (leftOver == 2) { + int b0 = ((int) data[i]) & 0xFF; + int b1 = ((int) data[i + 1]) & 0xFF; + jw.writeByte(BASE64_URL_CHARS[b0 >> 2]); + jw.writeByte(BASE64_URL_CHARS[((b0 << 4) & 63) | (b1 >> 4)]); + jw.writeByte(BASE64_URL_CHARS[(b1 << 2) & 63]); + } + } +} diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java index e56bb1b1e3..a14b296bb3 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java @@ -82,6 +82,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -1050,10 +1051,22 @@ private void serializeSpanLinks(List spanLinks) { } } - private void serializeOTel(AbstractSpan span) { + private void serializeOTel(Span span) { + serializeOtel(span, Collections.emptyList()); + } + + private void serializeOTel(Transaction transaction) { + List profilingCorrelationStackTraceIds = transaction.getProfilingCorrelationStackTraceIds(); + synchronized (profilingCorrelationStackTraceIds) { + serializeOtel(transaction, profilingCorrelationStackTraceIds); + } + } + + private void serializeOtel(AbstractSpan span, List profilingStackTraceIds) { OTelSpanKind kind = span.getOtelKind(); Map attributes = span.getOtelAttributes(); - boolean hasAttributes = !attributes.isEmpty(); + + boolean hasAttributes = !attributes.isEmpty() || !profilingStackTraceIds.isEmpty(); boolean hasKind = kind != null; if (hasKind || hasAttributes) { writeFieldName("otel"); @@ -1070,11 +1083,13 @@ private void serializeOTel(AbstractSpan span) { } writeFieldName("attributes"); jw.writeByte(OBJECT_START); - int index = 0; + boolean isFirstAttrib = true; for (Map.Entry entry : attributes.entrySet()) { - if (index++ > 0) { + if (!isFirstAttrib) { jw.writeByte(COMMA); } + isFirstAttrib = false; + writeFieldName(entry.getKey()); Object o = entry.getValue(); if (o instanceof Number) { @@ -1085,6 +1100,22 @@ private void serializeOTel(AbstractSpan span) { BoolConverter.serialize((Boolean) o, jw); } } + if (!profilingStackTraceIds.isEmpty()) { + if (!isFirstAttrib) { + jw.writeByte(COMMA); + } + writeFieldName("elastic.profiler_stack_trace_ids"); + jw.writeByte(ARRAY_START); + for (int i = 0; i < profilingStackTraceIds.size(); i++) { + if (i != 0) { + jw.writeByte(COMMA); + } + jw.writeByte(QUOTE); + profilingStackTraceIds.get(i).writeAsBase64UrlSafe(jw); + jw.writeByte(QUOTE); + } + jw.writeByte(ARRAY_END); + } jw.writeByte(OBJECT_END); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtilTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtilTest.java new file mode 100644 index 0000000000..257d6fba96 --- /dev/null +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/Base64SerializationUtilTest.java @@ -0,0 +1,41 @@ +package co.elastic.apm.agent.report.serialize; + +import com.dslplatform.json.DslJson; +import com.dslplatform.json.JsonWriter; +import org.junit.jupiter.api.Test; + +import java.util.Base64; +import java.util.Random; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +public class Base64SerializationUtilTest { + + @Test + public void empty() { + JsonWriter jw = new DslJson<>(new DslJson.Settings<>()).newWriter(); + Base64SerializationUtils.writeBytesAsBase64UrlSafe(new byte[0], jw); + assertThat(jw.size()).isEqualTo(0); + } + + @Test + public void randomInputs() { + DslJson dslJson = new DslJson<>(new DslJson.Settings<>()); + + Base64.Encoder reference = Base64.getUrlEncoder().withoutPadding(); + + Random rnd = new Random(42); + for (int i = 0; i < 100_000; i++) { + int len = rnd.nextInt(31) + 1; + byte[] data = new byte[len]; + rnd.nextBytes(data); + + String expectedResult = reference.encodeToString(data); + + JsonWriter jw = dslJson.newWriter(); + Base64SerializationUtils.writeBytesAsBase64UrlSafe(data, jw); + + assertThat(jw.toString()).isEqualTo(expectedResult); + } + } +} diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java index 86def7f803..8f341fd835 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java @@ -1584,6 +1584,31 @@ void testSpanLinksSerialization() { assertThat(parent2link.get("span_id").textValue()).isEqualTo(parent2.getTraceContext().getId().toString()); } + private static Id create128BitId(String id) { + Id idObj = Id.new128BitId(); + idObj.fromHexString(id, 0); + return idObj; + } + + @Test + void testProfilingStackTraceIdSerialization() { + Transaction transaction = tracer.startRootTransaction(null); + + transaction.addProfilerCorrelationStackTrace(create128BitId("a1a2a3a4a5a6a7a8b1b2b3b4b5b6b7b8")); + transaction.addProfilerCorrelationStackTrace(create128BitId("c1c2c3c4c5c6c7c8d1d2d3d4d5d6d7d8")); + + JsonNode transactionJson = readJsonString(writer.toJsonString(transaction)); + JsonNode otel = transactionJson.get("otel"); + assertThat(otel).isNotNull(); + JsonNode attributes = otel.get("attributes"); + assertThat(attributes).isNotNull(); + JsonNode ids = attributes.get("elastic.profiler_stack_trace_ids"); + assertThat(ids.isArray()).isTrue(); + assertThat(ids.size()).isEqualTo(2); + assertThat(ids.get(0).asText()).isEqualTo("oaKjpKWmp6ixsrO0tba3uA"); + assertThat(ids.get(1).asText()).isEqualTo("wcLDxMXGx8jR0tPU1dbX2A"); + } + @ParameterizedTest @ValueSource(booleans = {true, false}) void testSerializeLog(boolean asString) { From ef28020102ccceaed8313995b8d4ff81044e62d5 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 3 May 2024 14:53:50 +0200 Subject: [PATCH 045/132] release: use explicit container arch (#3611) --- scripts/docker-release/build_docker.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/docker-release/build_docker.sh b/scripts/docker-release/build_docker.sh index 26268f279d..6b6b3554da 100755 --- a/scripts/docker-release/build_docker.sh +++ b/scripts/docker-release/build_docker.sh @@ -40,6 +40,7 @@ fi echo "INFO: Starting Docker build for version $RELEASE_VERSION" docker build -t docker.elastic.co/$NAMESPACE/apm-agent-java:$RELEASE_VERSION \ + --platform linux/amd64 \ --build-arg JAR_FILE=apm-agent-java.jar \ --build-arg HANDLER_FILE=apm-agent-lambda-layer/src/main/assembly/elastic-apm-handler . From bdd56989ac685e4e936d4917cdcbfa0d56102f62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 16:42:09 +0100 Subject: [PATCH 046/132] Bump version.aws.sdk from 2.25.21 to 2.25.43 in /apm-agent-plugins (#3614) Bumps `version.aws.sdk` from 2.25.21 to 2.25.43. Updates `software.amazon.awssdk:s3` from 2.25.21 to 2.25.43 Updates `software.amazon.awssdk:sqs` from 2.25.21 to 2.25.43 Updates `software.amazon.awssdk:dynamodb` from 2.25.21 to 2.25.43 --- updated-dependencies: - dependency-name: software.amazon.awssdk:s3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: software.amazon.awssdk:sqs dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: software.amazon.awssdk:dynamodb dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index e99b777283..bc3726ff18 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -13,7 +13,7 @@ ${project.basedir}/../../.. - 2.25.21 + 2.25.43 2.0.0 8 From bf4b4deff3f73e6631e3dd147b59d056a5550525 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Fri, 3 May 2024 18:18:38 +0200 Subject: [PATCH 047/132] Add thread dump debug option (#3589) * add thread dump option --- .../configuration/CoreConfiguration.java | 11 +++ .../co/elastic/apm/agent/util/ThreadDump.java | 85 +++++++++++++++++++ ...elastic.apm.agent.tracer.LifecycleListener | 1 + 3 files changed, 97 insertions(+) create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java index 36d8c42b85..b84f4bd172 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java @@ -488,6 +488,13 @@ public String toString(Collection value) { "exist and use it to dump bytecode of instrumented classes.") .buildWithDefault(""); + private final ConfigurationOption threadDumpInterval = TimeDurationValueConverter.durationOption("ms") + .key("thread_dump_interval") + .configurationCategory(CORE_CATEGORY) + .tags("internal") + .description("Triggers a thread dump at regular frequency, should be used to help configure trace_methods without knowledge of application code") + .buildWithDefault(TimeDuration.of("0ms")); + private final ConfigurationOption typeMatchingWithNamePreFilter = ConfigurationOption.booleanOption() .key("enable_type_matching_name_pre_filtering") .configurationCategory(CORE_CATEGORY) @@ -1017,6 +1024,10 @@ public String getBytecodeDumpPath() { return bytecodeDumpPath.get(); } + public long getThreadDumpInterval() { + return threadDumpInterval.get().getMillis(); + } + public boolean isTypeMatchingWithNamePreFilter() { return typeMatchingWithNamePreFilter.get(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java new file mode 100644 index 0000000000..3bd7d11784 --- /dev/null +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java @@ -0,0 +1,85 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.util; + +import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.AbstractLifecycleListener; +import co.elastic.apm.agent.tracer.Tracer; + +import javax.annotation.Nullable; +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.lang.management.ThreadMXBean; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class ThreadDump extends AbstractLifecycleListener { + + private Logger log = LoggerFactory.getLogger(ThreadDump.class); + + @Nullable + private ScheduledThreadPoolExecutor executor; + + @Override + public void start(Tracer tracer) throws Exception { + + long threadDumpInterval = tracer.getConfig(CoreConfiguration.class).getThreadDumpInterval(); + if (threadDumpInterval <= 0) { + return; + } + + if (!log.isDebugEnabled()) { + log.error("thread dump option requires debug log level"); + return; + } + + if (threadDumpInterval < 100) { + log.error("thread dump frequency too high, adjusted to every 100ms"); + threadDumpInterval = 100; + } + + log.warn("thread dump will be generated every %s ms", threadDumpInterval); + + executor = ExecutorUtils.createSingleThreadSchedulingDaemonPool("thread-dump"); + + executor.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); + StringBuilder sb = new StringBuilder(); + for (ThreadInfo threadInfo : threadMXBean.dumpAllThreads(true, true)) { + sb.append(threadInfo.toString()); + } + + log.debug("thread dump: \n\n {}", sb); + + } + }, threadDumpInterval, threadDumpInterval, TimeUnit.MILLISECONDS); + } + + @Override + public void stop() throws Exception { + if (executor == null) { + return; + } + ExecutorUtils.shutdownAndWaitTermination(executor); + } +} diff --git a/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener b/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener index fb1f5e9680..4425ab21a6 100644 --- a/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener +++ b/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.tracer.LifecycleListener @@ -10,3 +10,4 @@ co.elastic.apm.agent.metrics.builtin.AgentOverheadMetrics co.elastic.apm.agent.impl.circuitbreaker.CircuitBreaker co.elastic.apm.agent.collections.WeakMapCleaner co.elastic.apm.agent.report.serialize.MetricRegistryReporter +co.elastic.apm.agent.util.ThreadDump From 90277e23cd597c10c283b5e5d3f17da98475806b Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Mon, 6 May 2024 09:29:04 +0200 Subject: [PATCH 048/132] Universal profiling integration: Add stacktrace-IDs to transactions (#3615) --- CHANGELOG.asciidoc | 4 + apm-agent-core/pom.xml | 2 +- .../UniversalProfilingConfiguration.java | 14 +- .../apm/agent/impl/ElasticApmTracer.java | 4 + .../serialize/Base64SerializationUtils.java | 18 ++ .../apm/agent/universalprofiling/Clock.java | 31 +++ .../universalprofiling/MoveableEvent.java | 30 +++ .../universalprofiling/PeekingPoller.java | 90 ++++++++ .../SpanProfilingSamplesCorrelator.java | 218 ++++++++++++++++++ .../UniversalProfilingIntegration.java | 51 +++- .../Base64SerializationUtilTest.java | 18 ++ .../universalprofiling/PeekingPollerTest.java | 130 +++++++++++ .../UniversalProfilingIntegrationTest.java | 186 ++++++++++++++- docs/configuration.asciidoc | 100 ++++++++ 14 files changed, 871 insertions(+), 25 deletions(-) create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/Clock.java create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/MoveableEvent.java create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/PeekingPoller.java create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/SpanProfilingSamplesCorrelator.java create mode 100644 apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/PeekingPollerTest.java diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 0cdeb84dbe..4523676a8c 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +[float] +===== Features +* Added support for correlating APM data with elastic universal profiling data - {pull}3615[#3615], {pull}3602[#3602], {pull}3607[#3607], {pull}3598[#3598] + [float] ===== Bug fixes * Fixed edge case where inferred spans could cause cycles in the trace parent-child relationships, subsequently resulting in the UI crashing - {pull}3588[#3588] diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index 5f35f7912d..b542555929 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -103,7 +103,7 @@ co.elastic.otel jvmti-access - 0.3.0 + 0.3.1 org.springframework.boot spring-boot-dependencies - 3.2.4 + 3.2.5 pom import diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index 2f10a4cba4..7b6889d8c0 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -18,7 +18,7 @@ 2.7.16 - 3.2.4 + 3.2.5 diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index 78a4d0c7c6..0d77989efa 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.4 + 3.2.5 pom import diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index 9e9c73d10b..ac610a3e59 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -29,7 +29,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.4 + 3.2.5 pom import diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index b744abc7c6..b1d70a0c6f 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -30,7 +30,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.4 + 3.2.5 pom import From e342714cd36c319e329e2942c127ed667d185bd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 13:55:01 +0100 Subject: [PATCH 052/132] Bump org.jctools:jctools-core from 4.0.1 to 4.0.3 (#3618) * Bump org.jctools:jctools-core from 4.0.1 to 4.0.3 Bumps [org.jctools:jctools-core](https://github.com/JCTools/JCTools) from 4.0.1 to 4.0.3. - [Release notes](https://github.com/JCTools/JCTools/releases) - [Changelog](https://github.com/JCTools/JCTools/blob/master/RELEASE-NOTES.md) - [Commits](https://github.com/JCTools/JCTools/compare/v4.0.1...v4.0.3) --- updated-dependencies: - dependency-name: org.jctools:jctools-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * remove comment --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- apm-agent-core/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index b542555929..984a63cc68 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -56,8 +56,7 @@ org.jctools jctools-core - - 4.0.1 + 4.0.3 com.googlecode.concurrentlinkedhashmap From 1524ba64e1ef9a409bc17001710607b2c711e935 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 19:51:12 +0100 Subject: [PATCH 053/132] Bump version.mockito from 5.11.0 to 5.12.0 (#3629) Bumps `version.mockito` from 5.11.0 to 5.12.0. Updates `org.mockito:mockito-core` from 5.11.0 to 5.12.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.11.0...v5.12.0) Updates `org.mockito:mockito-subclass` from 5.11.0 to 5.12.0 - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.11.0...v5.12.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: org.mockito:mockito-subclass dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 05f3193f6d..84013df348 100644 --- a/pom.xml +++ b/pom.xml @@ -135,7 +135,7 @@ 9.6 5.4.0 - 5.11.0 + 5.12.0 1.17 From 172846e0492c3eb2e204e08dafa295ff752f6f95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 09:22:27 +0200 Subject: [PATCH 054/132] Bump com.networknt:json-schema-validator from 1.3.3 to 1.4.0 (#3628) Bumps [com.networknt:json-schema-validator](https://github.com/networknt/json-schema-validator) from 1.3.3 to 1.4.0. - [Release notes](https://github.com/networknt/json-schema-validator/releases) - [Changelog](https://github.com/networknt/json-schema-validator/blob/master/CHANGELOG.md) - [Commits](https://github.com/networknt/json-schema-validator/compare/1.3.3...1.4.0) --- updated-dependencies: - dependency-name: com.networknt:json-schema-validator dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 84013df348..60cb38e650 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ 1.6.0 5.0.15.RELEASE 9.4.11.v20180605 - 1.3.3 + 1.4.0 1.14.14 9.6 From 23397f9a2bd6f680adfe274ec3a4f2f06cff2590 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 14 May 2024 17:47:31 +0200 Subject: [PATCH 055/132] github-action: delete opentelemetry workflow (#3630) --- .github/workflows/opentelemetry.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/workflows/opentelemetry.yml diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml deleted file mode 100644 index 16d0101ed5..0000000000 --- a/.github/workflows/opentelemetry.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -# Look up results at https://ela.st/oblt-ci-cd-stats -# There will be one service per GitHub repository, including the org name, and one Transaction per Workflow. -name: OpenTelemetry Export Trace - -on: - workflow_run: - workflows: [ "*" ] - types: [completed] - -permissions: - contents: read - -jobs: - otel-export-trace: - runs-on: ubuntu-latest - steps: - - uses: elastic/apm-pipeline-library/.github/actions/opentelemetry@current - with: - vaultUrl: ${{ secrets.VAULT_ADDR }} - vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} - vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} From 28665501007b24c35169becb45cb2a348c0b66fa Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 14 May 2024 21:33:36 +0200 Subject: [PATCH 056/132] buildkite: avoid failing in tear-down failed (#3622) --- .ci/release.sh | 2 +- .ci/snapshot.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/release.sh b/.ci/release.sh index 2f7c4bd832..fdba0d05be 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -10,7 +10,7 @@ set -eo pipefail clean_up () { ARG=$? echo "--- Deleting tmp workspace" - rm -rf $TMP_WORKSPACE + rm -rf $TMP_WORKSPACE || true exit $ARG } trap clean_up EXIT diff --git a/.ci/snapshot.sh b/.ci/snapshot.sh index 5fa49b94a6..135c723753 100755 --- a/.ci/snapshot.sh +++ b/.ci/snapshot.sh @@ -12,7 +12,7 @@ set -eo pipefail clean_up () { ARG=$? echo "--- Deleting tmp workspace" - rm -rf $TMP_WORKSPACE + rm -rf $TMP_WORKSPACE || true exit $ARG } trap clean_up EXIT From ad3c21c5f022bb2448aa9c0f8e3afd09a7c141ad Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 15 May 2024 09:51:22 +0200 Subject: [PATCH 057/132] github-action: use actions/attest-build-provenance (#3631) --- .github/workflows/release.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c2c2a64b31..332c24b8f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -106,7 +106,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: github-early-access/generate-build-provenance@main + uses: actions/attest-build-provenance@951c0c5f8e375ad4efad33405ab77f7ded2358e4 # v1.1.1 with: subject-path: "${{ github.workspace }}/**/target/*.jar" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index f985425da2..ca4d21a52f 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -71,7 +71,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: github-early-access/generate-build-provenance@main + uses: actions/attest-build-provenance@951c0c5f8e375ad4efad33405ab77f7ded2358e4 # v1.1.1 with: subject-path: "${{ github.workspace }}/**/target/*.jar" From a2840eb99a4113fa09115960499cf1d6027bc506 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Wed, 15 May 2024 16:10:17 +0200 Subject: [PATCH 058/132] Clarify rabbitmq naming mode support (#3633) --- .../agent/tracer/configuration/MessagingConfiguration.java | 4 +++- docs/configuration.asciidoc | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java index 08eb2fb623..85420bc1b2 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java @@ -111,7 +111,9 @@ public class MessagingConfiguration extends ConfigurationOptionProvider { private final ConfigurationOption rabbitMQNamingMode = ConfigurationOption.enumOption(RabbitMQNamingMode.class) .key("rabbitmq_naming_mode") .configurationCategory(MESSAGING_CATEGORY) - .description("Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`") + .description("Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`.\n" + + "Note that `QUEUE` only works when using RabbitMQ via spring-amqp." + ) .dynamic(true) .tags("added[1.46.0]") .buildWithDefault(RabbitMQNamingMode.EXCHANGE); diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 1b3bd263bd..1a31360d3f 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -2513,7 +2513,8 @@ Starting from version 1.43.0, the classes that are part of the 'application_pack [[config-rabbitmq-naming-mode]] ==== `rabbitmq_naming_mode` (added[1.46.0]) -Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE` +Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`. +Note that `QUEUE` only works when using RabbitMQ via spring-amqp. <> @@ -4702,7 +4703,8 @@ Example: `5ms`. # # jms_listener_packages= -# Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE` +# Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`. +# Note that `QUEUE` only works when using RabbitMQ via spring-amqp. # # Valid options: EXCHANGE, QUEUE # This setting can be changed at runtime From 22f21665414eab9cb2aad8da178f472261ec1b38 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 16 May 2024 12:44:26 +0200 Subject: [PATCH 059/132] ci: build and push Docker image based on Chainguard base image (#3623) --- .github/workflows/snapshot.yml | 33 ++++++++++++++++++++++- CONTRIBUTING.md | 8 +++++- Dockerfile.wolfi | 7 +++++ scripts/docker-release/build_docker.sh | 36 ++++++++++++++++---------- scripts/docker-release/push_docker.sh | 3 +++ 5 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 Dockerfile.wolfi diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index ca4d21a52f..ed7def7f9e 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -75,7 +75,38 @@ jobs: with: subject-path: "${{ github.workspace }}/**/target/*.jar" - - if: ${{ failure() }} + build-docker-images: + name: "Build docker images" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: elastic/apm-pipeline-library/.github/actions/docker-login@current + with: + registry: docker.elastic.co + secret: secret/apm-team/ci/docker-registry/prod + url: ${{ secrets.VAULT_ADDR }} + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + - name: prepare context for testing docker build + run: | + mkdir -p elastic-apm-agent/target + curl -L -s -o elastic-apm-agent/target/elastic-apm-agent-1.49.0.jar \ + "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=co.elastic.apm&a=elastic-apm-agent&v=1.49.0" + - name: "Build docker image" + run: ./scripts/docker-release/build_docker.sh "test" + + notify: + needs: + - build-docker-images + - deploy + - validate + runs-on: ubuntu-latest + steps: + - id: check + uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current + with: + needs: ${{ toJSON(needs) }} + - if: ${{ failure() && ! inputs.dry_run }} uses: elastic/apm-pipeline-library/.github/actions/slack-message@current with: url: ${{ secrets.VAULT_ADDR }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a5689fa04..0757c17d93 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -330,8 +330,14 @@ docker.elastic.co and are located in the `observability` namespace. For example, to download the v1.12.0 of the agent, use the following: +```bash +docker pull docker.elastic.co/observability/apm-agent-java:1.12.0 ``` -docker pull docker.elastic.co/observability/apm-agent-java:1.12.0 + +In addition, you can use the `wolfi` version by adding the suffix `-wolfi` + +```bash +docker pull docker.elastic.co/observability/apm-agent-java:1.12.0-wolfi ``` #### Creating images for a Release diff --git a/Dockerfile.wolfi b/Dockerfile.wolfi new file mode 100644 index 0000000000..9770c50ea1 --- /dev/null +++ b/Dockerfile.wolfi @@ -0,0 +1,7 @@ +FROM docker.elastic.co/wolfi/chainguard-base@sha256:9f940409f96296ef56140bcc4665c204dd499af4c32c96cc00e792558097c3f1 +RUN mkdir /usr/agent +ARG JAR_FILE +ARG HANDLER_FILE +COPY ${JAR_FILE} /usr/agent/elastic-apm-agent.jar +COPY ${HANDLER_FILE} /usr/agent/elastic-apm-handler +RUN chmod +x /usr/agent/elastic-apm-handler diff --git a/scripts/docker-release/build_docker.sh b/scripts/docker-release/build_docker.sh index 6b6b3554da..39dcab2391 100755 --- a/scripts/docker-release/build_docker.sh +++ b/scripts/docker-release/build_docker.sh @@ -18,11 +18,13 @@ readonly SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" readonly PROJECT_ROOT=$SCRIPT_PATH/../../ readonly NAMESPACE="observability" -if [ "$(ls -A ${PROJECT_ROOT}elastic-apm-agent/target/*.jar)" ] +FILE=$(ls -A ${PROJECT_ROOT}elastic-apm-agent/target/*.jar | grep -E "elastic-apm-agent-[0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)?.jar" ) + +if [ -n "${FILE}" ] then # We have build files to use echo "INFO: Found local build artifact. Using locally built for Docker build" - find -E ${PROJECT_ROOT}elastic-apm-agent/target -regex '.*/elastic-apm-agent-[0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)?.jar' -exec cp {} ${PROJECT_ROOT}apm-agent-java.jar \; || echo "INFO: No locally built image found" + cp "${FILE}" "${PROJECT_ROOT}apm-agent-java.jar" || echo "INFO: No locally built image found" elif [ ! -z ${SONATYPE_FALLBACK+x} ] then echo "INFO: No local build artifact and SONATYPE_FALLBACK. Falling back to downloading artifact from Sonatype Nexus repository for version $RELEASE_VERSION" @@ -37,19 +39,27 @@ then exit 1 fi -echo "INFO: Starting Docker build for version $RELEASE_VERSION" +ls -l apm-agent-java.jar -docker build -t docker.elastic.co/$NAMESPACE/apm-agent-java:$RELEASE_VERSION \ - --platform linux/amd64 \ - --build-arg JAR_FILE=apm-agent-java.jar \ - --build-arg HANDLER_FILE=apm-agent-lambda-layer/src/main/assembly/elastic-apm-handler . +echo "INFO: Starting Docker build for version $RELEASE_VERSION" +for DOCKERFILE in "Dockerfile" "Dockerfile.wolfi" ; do + DOCKER_TAG=$RELEASE_VERSION + if [[ $DOCKERFILE =~ "wolfi" ]]; then + DOCKER_TAG="${RELEASE_VERSION}-wolfi" + fi + docker build -t docker.elastic.co/$NAMESPACE/apm-agent-java:$DOCKER_TAG \ + --platform linux/amd64 \ + --build-arg JAR_FILE=apm-agent-java.jar \ + --build-arg HANDLER_FILE=apm-agent-lambda-layer/src/main/assembly/elastic-apm-handler \ + --file $DOCKERFILE . -if [ $? -eq 0 ] -then - echo "INFO: Docker image built successfully" -else - echo "ERROR: Problem building Docker image!" -fi + if [ $? -eq 0 ] + then + echo "INFO: Docker image built successfully" + else + echo "ERROR: Problem building Docker image!" + fi +done function finish { diff --git a/scripts/docker-release/push_docker.sh b/scripts/docker-release/push_docker.sh index b30fd7e5ad..b6fc1ae1bf 100755 --- a/scripts/docker-release/push_docker.sh +++ b/scripts/docker-release/push_docker.sh @@ -32,6 +32,7 @@ readonly DOCKER_PUSH_IMAGE_LATEST="$DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:lates echo "INFO: Pushing image $DOCKER_PUSH_IMAGE to $DOCKER_REGISTRY_URL" docker push $DOCKER_PUSH_IMAGE || { echo "You may need to run 'docker login' first and then re-run this script"; exit 1; } +docker push "${DOCKER_PUSH_IMAGE}-wolfi" || { echo "You may need to run 'docker login' first and then re-run this script"; exit 1; } readonly LATEST_TAG=$(git tag --list --sort=version:refname "v*" | grep -v RC | sed s/^v// | tail -n 1) @@ -40,4 +41,6 @@ then echo "INFO: Current version ($RELEASE_VERSION) is the latest version. Tagging and pushing $DOCKER_PUSH_IMAGE_LATEST ..." docker tag $DOCKER_PUSH_IMAGE $DOCKER_PUSH_IMAGE_LATEST docker push $DOCKER_PUSH_IMAGE_LATEST || { echo "You may need to run 'docker login' first and then re-run this script"; exit 1; } + docker tag "${DOCKER_PUSH_IMAGE}-wolfi" "${DOCKER_PUSH_IMAGE_LATEST}-wolfi" + docker push "${DOCKER_PUSH_IMAGE_LATEST}-wolfi" || { echo "You may need to run 'docker login' first and then re-run this script"; exit 1; } fi From ea685113257279c820dc4b97d288486fb7cbe76d Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Thu, 16 May 2024 13:40:52 +0100 Subject: [PATCH 060/132] bouncy castle upgrade (#3634) --- apm-agent-attach-cli/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apm-agent-attach-cli/pom.xml b/apm-agent-attach-cli/pom.xml index babd6a2e0c..c5dea23c4f 100644 --- a/apm-agent-attach-cli/pom.xml +++ b/apm-agent-attach-cli/pom.xml @@ -19,8 +19,8 @@ ${project.basedir}/.. - 1.0.5.1 - 1.0.2.1 + 1.0.7.1 + 1.0.2.5 From b7b62297eadc3fae8ef4e3e243e4b043f2476d98 Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Fri, 17 May 2024 15:36:42 +0100 Subject: [PATCH 061/132] add symlink in dockerfile for /javaagent.jar for otel operator to find (#3635) * add symlink in dockerfile for /javaagent.jar for otel operator to find * and wolfi too --- Dockerfile | 1 + Dockerfile.wolfi | 1 + 2 files changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 847b473b35..0fa5d3f094 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,3 +8,4 @@ ARG HANDLER_FILE COPY ${JAR_FILE} /usr/agent/elastic-apm-agent.jar COPY ${HANDLER_FILE} /usr/agent/elastic-apm-handler RUN chmod +x /usr/agent/elastic-apm-handler +RUN ln -s /usr/agent/elastic-apm-agent.jar /javaagent.jar diff --git a/Dockerfile.wolfi b/Dockerfile.wolfi index 9770c50ea1..df2ecfc4eb 100644 --- a/Dockerfile.wolfi +++ b/Dockerfile.wolfi @@ -5,3 +5,4 @@ ARG HANDLER_FILE COPY ${JAR_FILE} /usr/agent/elastic-apm-agent.jar COPY ${HANDLER_FILE} /usr/agent/elastic-apm-handler RUN chmod +x /usr/agent/elastic-apm-handler +RUN ln -s /usr/agent/elastic-apm-agent.jar /javaagent.jar From 026cc5ea176025ab687bfa1d3c369d52e105b5b3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 20 May 2024 15:36:06 +0200 Subject: [PATCH 062/132] buildkite: support version 21 for opentelemetry (#3621) --- .buildkite/hooks/pre-command | 10 +++++++--- .buildkite/hooks/prepare-common.sh | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 5b42228ea6..b8d23cd6fa 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -14,8 +14,15 @@ if [[ "$BUILDKITE_COMMAND" =~ .*"upload".* ]]; then exit 0 fi +# Run always +source .buildkite/hooks/prepare-common.sh + if [ "$BUILDKITE_PIPELINE_SLUG" == "apm-agent-java-opentelemetry-benchmark" ]; then source .buildkite/hooks/prepare-benchmark.sh + # NOTE: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11323 might + # support .java-version, if so then it might be worthy to read the file. + JAVA_VERSION=21 + source .buildkite/hooks/prepare-common.sh fi if [ "$BUILDKITE_PIPELINE_SLUG" == "apm-agent-java-snapshot" ]; then @@ -25,6 +32,3 @@ fi if [ "$BUILDKITE_PIPELINE_SLUG" == "apm-agent-java-release" ]; then source .buildkite/hooks/prepare-release.sh fi - -# Run always -source .buildkite/hooks/prepare-common.sh diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index 7c04356ecf..7697908c6f 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -2,7 +2,9 @@ set -eo pipefail # Configure the java version -JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]') +if [ -z "$JAVA_VERSION" ] ; then + JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]') +fi set +u # In case the HOME is not available in the context of the runner. if [ -z "${HOME}" ] ; then From b7cac10364f306b6131d0074c3f8666ea236125c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 12:19:59 +0200 Subject: [PATCH 063/132] Bump version.testcontainers from 1.19.1 to 1.19.8 (#3641) Bumps `version.testcontainers` from 1.19.1 to 1.19.8. Updates `org.testcontainers:testcontainers-bom` from 1.19.1 to 1.19.8 - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.19.1...1.19.8) Updates `org.testcontainers:testcontainers` from 1.19.1 to 1.19.8 - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.19.1...1.19.8) --- updated-dependencies: - dependency-name: org.testcontainers:testcontainers-bom dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.testcontainers:testcontainers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 60cb38e650..0066e0d189 100644 --- a/pom.xml +++ b/pom.xml @@ -140,7 +140,7 @@ 1.17 - 1.19.1 + 1.19.8 2.38.0 From a65bf2e297b372e45b0a6f898464f8a52485c0df Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 21 May 2024 14:06:26 +0200 Subject: [PATCH 064/132] ci: add some job timeouts (#3638) --- .github/workflows/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d5944b6e3..d69d0d610e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,6 +63,7 @@ jobs: build: name: Build runs-on: ubuntu-latest + timeout-minutes: 20 steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/maven-goal @@ -128,6 +129,7 @@ jobs: name: License runs-on: ubuntu-latest needs: build + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/unstash @@ -148,6 +150,7 @@ jobs: # When undefined, we need to emulate the default value if: inputs.test_ci == true || inputs.test_ci == null runs-on: ubuntu-latest + timeout-minutes: 30 needs: build steps: - uses: actions/checkout@v4 @@ -169,6 +172,7 @@ jobs: non-app-server-integration-tests: name: Non-Application Server integration tests + timeout-minutes: 60 if: | contains(github.event.pull_request.labels.*.name, 'ci:agent-integration') || github.event.pull_request.draft == false @@ -207,6 +211,7 @@ jobs: app-server-integration-tests: name: Application Server integration tests + timeout-minutes: 60 if: | contains(github.event.pull_request.labels.*.name, 'ci:agent-integration') || github.event.pull_request.draft == false @@ -248,6 +253,7 @@ jobs: name: Javadoc runs-on: ubuntu-latest needs: build + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/unstash @@ -260,6 +266,7 @@ jobs: unit-tests-windows: name: Build & Test Windows + timeout-minutes: 60 # Inputs aren't defined on some events # When undefined, we need to emulate the default value if: | @@ -287,6 +294,7 @@ jobs: jdk-compatibility-tests: name: JDK Compatibility Tests + timeout-minutes: 60 if: | contains(github.event.pull_request.labels.*.name, 'ci:jdk-compatibility') || inputs.jdk_compatibility_ci == true @@ -324,6 +332,7 @@ jobs: jboss: name: JBoss integration tests runs-on: ubuntu-latest + timeout-minutes: 30 needs: build # If no PR event or if a PR event that's caused by a non-fork and non dependabot actor if: github.event_name != 'pull_request' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' ) From a28d9786f93e1e446ffe3d5d155d5b127eb81881 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Wed, 22 May 2024 09:50:54 +0200 Subject: [PATCH 065/132] Fix too small activation stack for low transaction_max_spans values (#3643) --- CHANGELOG.asciidoc | 1 + .../apm/agent/impl/ElasticApmTracer.java | 8 +- .../apm/agent/impl/ElasticApmTracerTest.java | 91 ++++++++++++------- 3 files changed, 67 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4523676a8c..feeb63febf 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -39,6 +39,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: ===== Bug fixes * Fixed edge case where inferred spans could cause cycles in the trace parent-child relationships, subsequently resulting in the UI crashing - {pull}3588[#3588] * Fix NPE in dropped spans statistics - {pull}3590[#3590] +* Fix too small activation stack size for small `transaction_max_spans` values - {pull}3643[#3643] [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java index d50ba17470..893dfb6c69 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java @@ -112,6 +112,7 @@ public class ElasticApmTracer implements Tracer { private static final Map, Class> configs = new HashMap<>(); public static final Set TRACE_HEADER_NAMES; + public static final int ACTIVATION_STACK_BASE_SIZE = 16; static { Set headerNames = new HashSet<>(); @@ -138,7 +139,10 @@ public class ElasticApmTracer implements Tracer { private final ThreadLocal activeStack = new ThreadLocal() { @Override protected ActiveStack initialValue() { - return new ActiveStack(transactionMaxSpans, emptyContext); + //We allow transactionMaxSpan activation plus a constant minimum of 16 to account for + // * the activation of the transaction itself + // * account for baggage updates, which also count towards the depth + return new ActiveStack(ACTIVATION_STACK_BASE_SIZE + transactionMaxSpans, emptyContext); } }; @@ -673,7 +677,7 @@ public synchronized void stop() { public Reporter getReporter() { return reporter; } - + public UniversalProfilingIntegration getProfilingIntegration() { return profilingIntegration; } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java index b365039737..6ef0970c47 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java @@ -22,6 +22,7 @@ import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.configuration.AutoDetectedServiceInfo; import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.impl.baggage.BaggageContext; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.configuration.source.ConfigSources; @@ -52,6 +53,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -73,9 +75,15 @@ class ElasticApmTracerTest { @BeforeEach void setUp() { + doSetup(conf -> { + }); + } + + void doSetup(Consumer configCustomizer) { objectPoolFactory = new TestObjectPoolFactory(); reporter = new MockReporter(); config = SpyConfiguration.createSpyConfig(); + configCustomizer.accept(config); apmServerClient = new ApmServerClient(config); apmServerClient = mock(ApmServerClient.class, delegatesTo(apmServerClient)); @@ -88,6 +96,11 @@ void setUp() { .buildAndStart(); } + void setupWithCustomConfig(Consumer configCustomizer) { + cleanupAndCheck(); //cleanup @BeforeEach + doSetup(configCustomizer); + } + @AfterEach void cleanupAndCheck() { reporter.assertRecycledAfterDecrementingReferences(); @@ -326,11 +339,14 @@ private ErrorCapture validateError(ErrorCapture error, AbstractSpan span, boo @Test void testEnableDropSpans() { - doReturn(1).when(tracerImpl.getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); + setupWithCustomConfig(conf -> { + doReturn(1).when(conf.getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); + }); Transaction transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { Span span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { + assertThat(tracerImpl.getActive()).isSameAs(span); //ensure ActiveStack limit is not reached assertThat(span.isSampled()).isTrue(); span.end(); } @@ -359,48 +375,61 @@ void testActivationStackOverflow() { .withObjectPoolFactory(objectPoolFactory) .buildAndStart(); - Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); - assertThat(tracer.getActive()).isNull(); - try (Scope scope = transaction.activateInScope()) { - assertThat(tracer.getActive()).isEqualTo(transaction); - Span child1 = transaction.createSpan(); - try (Scope childScope = child1.activateInScope()) { - assertThat(tracer.getActive()).isEqualTo(child1); - Span grandchild1 = child1.createSpan(); - try (Scope grandchildScope = grandchild1.activateInScope()) { - // latter activation should not be applied due to activation stack overflow + doWithNestedBaggageActivations(() -> { + Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); + assertThat(tracer.getActive()).isNull(); + try (Scope scope = transaction.activateInScope()) { + assertThat(tracer.getActive()).isEqualTo(transaction); + Span child1 = transaction.createSpan(); + try (Scope childScope = child1.activateInScope()) { assertThat(tracer.getActive()).isEqualTo(child1); - Span ggc = grandchild1.createSpan(); - try (Scope ggcScope = ggc.activateInScope()) { + Span grandchild1 = child1.createSpan(); + try (Scope grandchildScope = grandchild1.activateInScope()) { + // latter activation should not be applied due to activation stack overflow assertThat(tracer.getActive()).isEqualTo(child1); - ggc.end(); + Span ggc = grandchild1.createSpan(); + try (Scope ggcScope = ggc.activateInScope()) { + assertThat(tracer.getActive()).isEqualTo(child1); + ggc.end(); + } + grandchild1.end(); } - grandchild1.end(); + assertThat(tracer.getActive()).isEqualTo(child1); + child1.end(); } - assertThat(tracer.getActive()).isEqualTo(child1); - child1.end(); - } - assertThat(tracer.getActive()).isEqualTo(transaction); - Span child2 = transaction.createSpan(); - try (Scope childScope = child2.activateInScope()) { - assertThat(tracer.getActive()).isEqualTo(child2); - Span grandchild2 = child2.createSpan(); - try (Scope grandchildScope = grandchild2.activateInScope()) { - // latter activation should not be applied due to activation stack overflow + assertThat(tracer.getActive()).isEqualTo(transaction); + Span child2 = transaction.createSpan(); + try (Scope childScope = child2.activateInScope()) { + assertThat(tracer.getActive()).isEqualTo(child2); + Span grandchild2 = child2.createSpan(); + try (Scope grandchildScope = grandchild2.activateInScope()) { + // latter activation should not be applied due to activation stack overflow + assertThat(tracer.getActive()).isEqualTo(child2); + grandchild2.end(); + } assertThat(tracer.getActive()).isEqualTo(child2); - grandchild2.end(); + child2.end(); } - assertThat(tracer.getActive()).isEqualTo(child2); - child2.end(); + assertThat(tracer.getActive()).isEqualTo(transaction); + transaction.end(); } - assertThat(tracer.getActive()).isEqualTo(transaction); - transaction.end(); - } + }, tracer, ElasticApmTracer.ACTIVATION_STACK_BASE_SIZE); assertThat(tracer.getActive()).isNull(); assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getSpans()).hasSize(2); } + private void doWithNestedBaggageActivations(Runnable r, Tracer tracer, int nestedCount) { + if (nestedCount == 0) { + r.run(); + return; + } + BaggageContext baggageContext = tracer.currentContext().withUpdatedBaggage().buildContext(); + try (Scope scope = baggageContext.activateInScope()) { + doWithNestedBaggageActivations(r, tracer, nestedCount - 1); + } + } + @Test void testPause() { tracerImpl.pause(); From b1a41729f43377b8cfbed387753ebe4bcc0b405a Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Wed, 22 May 2024 10:21:28 +0200 Subject: [PATCH 066/132] Exclude new Cisco AppD packages (#3632) --- CHANGELOG.asciidoc | 1 + .../src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index feeb63febf..1b2dd1cafb 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -34,6 +34,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [float] ===== Features * Added support for correlating APM data with elastic universal profiling data - {pull}3615[#3615], {pull}3602[#3602], {pull}3607[#3607], {pull}3598[#3598] +* Excluded latest AppDynamics packages from instrumentation (`com.cisco.mtagent.*`) - {pull}3632[#3632] [float] ===== Bug fixes diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java index 05e092c94e..d0c7a468c4 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java @@ -737,6 +737,8 @@ public Iterable>> onError(int index, List> batc .or(nameStartsWith("com.singularity.")) .or(any(), classLoaderWithNamePrefix("com.appdynamics.")) .or(nameStartsWith("com.appdynamics.")) + .or(any(), classLoaderWithNamePrefix("com.cisco.mtagent.")) + .or(nameStartsWith("com.cisco.mtagent.")) .or(any(), classLoaderWithNamePrefix("com.instana.")) .or(nameStartsWith("com.instana.")) .or(any(), classLoaderWithNamePrefix("datadog.")) From 098ee3c51a1cb0194207c5b86922c7ed454772e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 14:57:44 +0200 Subject: [PATCH 067/132] Bump version.okhttp from 3.14.7 to 4.12.0 (#3640) Bumps `version.okhttp` from 3.14.7 to 4.12.0. Updates `com.squareup.okhttp3:okhttp` from 3.14.7 to 4.12.0 - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-3.14.7...parent-4.12.0) Updates `com.squareup.okhttp3:logging-interceptor` from 4.9.1 to 4.12.0 - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-4.9.1...parent-4.12.0) --- updated-dependencies: - dependency-name: com.squareup.okhttp3:okhttp dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.squareup.okhttp3:logging-interceptor dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-dubbo-plugin/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apm-agent-plugins/apm-dubbo-plugin/pom.xml b/apm-agent-plugins/apm-dubbo-plugin/pom.xml index 3e927e43c3..30cf725dfe 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/pom.xml +++ b/apm-agent-plugins/apm-dubbo-plugin/pom.xml @@ -39,7 +39,7 @@ com.squareup.okhttp3 okhttp - 3.14.7 + 4.12.0 test diff --git a/pom.xml b/pom.xml index 0066e0d189..7a9a8fb862 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ 2.14.2 5.9.1 4.13.2 - 4.9.1 + 4.12.0 1.7.36 - 3.2.0 + 3.3.0 co.elastic.apm.agent.springwebflux.testapp.WebFluxApplication From 33184bcc5e5ed7cd5536cdb07d68a2d6b3dd3393 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 May 2024 11:46:05 +0200 Subject: [PATCH 077/132] buildkite: use shared secret for obltmachine (#3656) --- .buildkite/hooks/prepare-benchmark.sh | 6 ------ .buildkite/hooks/prepare-common.sh | 8 ++++++++ .buildkite/hooks/prepare-release.sh | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.buildkite/hooks/prepare-benchmark.sh b/.buildkite/hooks/prepare-benchmark.sh index fb9f17b731..056042566a 100644 --- a/.buildkite/hooks/prepare-benchmark.sh +++ b/.buildkite/hooks/prepare-benchmark.sh @@ -7,12 +7,6 @@ ES_USER_SECRET=$(vault read -field=es_user secret/ci/elastic-apm-agent-java/open ES_PASS_SECRET=$(vault read -field=es_pass secret/ci/elastic-apm-agent-java/opentelemetry-benchmark) export ES_URL_SECRET ES_USER_SECRET ES_PASS_SECRET -echo "--- Prepare github secrets :vault:" -GITHUB_SECRET=$(vault kv get -field token "kv/ci-shared/observability-ci/github-bot-user") -GITHUB_USERNAME=$(vault kv get -field username "kv/ci-shared/observability-ci/github-bot-user") -GH_TOKEN=$GITHUB_SECRET -export GITHUB_SECRET GH_TOKEN GITHUB_USERNAME - echo "--- Install gh :github:" GH_URL=https://github.com/cli/cli/releases/download/v2.37.0/gh_2.37.0_linux_amd64.tar.gz GH_HOME=$(pwd)/.gh diff --git a/.buildkite/hooks/prepare-common.sh b/.buildkite/hooks/prepare-common.sh index 7697908c6f..b3d16a1aae 100644 --- a/.buildkite/hooks/prepare-common.sh +++ b/.buildkite/hooks/prepare-common.sh @@ -35,3 +35,11 @@ fi # Validate java is available in the runner. java -version + +echo "--- Prepare github secrets :vault:" +VAULT_SECRET_PATH=kv/ci-shared/observability-ci/github-bot-user +GITHUB_SECRET=$(vault kv get -field token "${VAULT_SECRET_PATH}") +GIT_USER=$(vault kv get -field username "${VAULT_SECRET_PATH}") +GIT_EMAIL=$(vault kv get -field email "${VAULT_SECRET_PATH}") +GH_TOKEN=$GITHUB_SECRET +export GITHUB_SECRET GH_TOKEN GIT_USER GIT_EMAIL diff --git a/.buildkite/hooks/prepare-release.sh b/.buildkite/hooks/prepare-release.sh index def869b9d2..70175af39c 100644 --- a/.buildkite/hooks/prepare-release.sh +++ b/.buildkite/hooks/prepare-release.sh @@ -35,5 +35,5 @@ echo "$KEYPASS_SECRET" | gpg --batch --import "$KEY_FILE" echo "--- Configure git context :git:" # Configure the committer since the maven release requires to push changes to GitHub # This will help with the SLSA requirements. -git config --global user.email "infra-root+apmmachine@elastic.co" -git config --global user.name "apmmachine" +git config --global user.email "${GIT_EMAIL}" +git config --global user.name "${GIT_USER}" From 2596bdf6e65966bf9423147a15225df7195da796 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 May 2024 11:59:44 +0200 Subject: [PATCH 078/132] build: bump org.springframework.boot:spring-boot-dependencies from 2.7.16 to 3.3.0 (#3645) * build: bump org.springframework.boot:spring-boot-dependencies Bumps [org.springframework.boot:spring-boot-dependencies](https://github.com/spring-projects/spring-boot) from 2.7.16 to 3.3.0. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.7.16...v3.3.0) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * keep older versions --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- .../apm-spring-resttemplate/apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index 81b26c332b..f4b1d073da 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.5 + 3.3.0 pom import diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index a50d6633f0..7ded397ec8 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -23,7 +23,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.5 + 3.3.0 pom import diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index 506262ae2e..c7b86d8426 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -18,7 +18,7 @@ 2.7.16 - 3.2.5 + 3.3.0 diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index b875a4177e..474977cee6 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.5 + 3.3.0 pom import diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index afb1961a69..823566ad06 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -29,7 +29,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.5 + 3.3.0 pom import diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 00f3e59537..7e1ddecbb7 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -30,7 +30,7 @@ org.springframework.boot spring-boot-dependencies - 3.2.5 + 3.3.0 pom import From 45095ff9e3b633175667dd338a99dc6e7eaed8c5 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Thu, 30 May 2024 14:57:42 +0200 Subject: [PATCH 079/132] revert jctools to 4.0.1 (#3657) * revert jctools to 4.0.1 * update changelog --- CHANGELOG.asciidoc | 4 ++++ apm-agent-core/pom.xml | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index c98b6f6a22..f87aaa5350 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -34,6 +34,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [[release-notes-1.x]] === Java Agent version 1.x +[float] +===== Bug fixes +* Restore compatibility with Java 7 - {pull}3657[#3657] + [[release-notes-1.50.0]] ==== 1.50.0 - 2024/05/28 diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index 54b981fcf2..282b846b0e 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -56,7 +56,9 @@ org.jctools jctools-core - 4.0.3 + + 4.0.1 com.googlecode.concurrentlinkedhashmap From e00a088f3ddb59bcd51dca04c0aa33255c86c6a4 Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Thu, 30 May 2024 15:57:53 +0100 Subject: [PATCH 080/132] add a jdk7 check so that we break before releasing! (#3659) --- .../src/test/java/co/elastic/apm/test/AgentSetupIT.java | 1 + 1 file changed, 1 insertion(+) diff --git a/integration-tests/main-app-test/src/test/java/co/elastic/apm/test/AgentSetupIT.java b/integration-tests/main-app-test/src/test/java/co/elastic/apm/test/AgentSetupIT.java index 28924ada91..fac320dffe 100644 --- a/integration-tests/main-app-test/src/test/java/co/elastic/apm/test/AgentSetupIT.java +++ b/integration-tests/main-app-test/src/test/java/co/elastic/apm/test/AgentSetupIT.java @@ -41,6 +41,7 @@ class AgentSetupIT { @ParameterizedTest @CsvSource({ + "openjdk:7,STANDARD", "openjdk:8,STANDARD", "openjdk:8,JAVA8_BUILD", "openjdk:11,STANDARD", From 0e1fb43f64076fe77f739609513a1f8e7e1cff18 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 May 2024 17:41:21 +0200 Subject: [PATCH 081/132] github-actions: docker login with GitHub secrets (#3658) --- .github/workflows/main.yml | 13 +++++++------ .github/workflows/release.yml | 13 +++++++------ .github/workflows/snapshot.yml | 13 +++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d69d0d610e..4ffaa2cceb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -338,13 +338,14 @@ jobs: if: github.event_name != 'pull_request' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' ) steps: - uses: actions/checkout@v4 - - uses: elastic/apm-pipeline-library/.github/actions/docker-login@current + + - name: Log in to the Elastic Container registry + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 with: - registry: docker.elastic.co - secret: secret/observability-team/ci/docker-registry/prod - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} + registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} + username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} + password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }} + - uses: ./.github/workflows/unstash with: name: build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6641ac0fca..d44347dd73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -135,13 +135,14 @@ jobs: with: ref: ${{ inputs.ref }} fetch-depth: 0 # Load entire history as it is required for the push-script - - uses: elastic/apm-pipeline-library/.github/actions/docker-login@current + + - name: Log in to the Elastic Container registry + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 with: - registry: docker.elastic.co - secret: secret/apm-team/ci/docker-registry/prod - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} + registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} + username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} + password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }} + - name: "Build docker image" shell: bash run: ./scripts/docker-release/build_docker.sh "${{ env.RELEASE_VERSION }}" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index a0e5139be1..9bede59356 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -80,13 +80,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: elastic/apm-pipeline-library/.github/actions/docker-login@current + + - name: Log in to the Elastic Container registry + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 with: - registry: docker.elastic.co - secret: secret/apm-team/ci/docker-registry/prod - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} + registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} + username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} + password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }} + - name: prepare context for testing docker build run: | mkdir -p elastic-apm-agent/target From 0c45a570790456cc20518799870f4ed1ce36518c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:07:18 +0200 Subject: [PATCH 082/132] build: bump version.aws.sdk in /apm-agent-plugins (#3661) Bumps `version.aws.sdk` from 2.25.43 to 2.25.64. Updates `software.amazon.awssdk:s3` from 2.25.43 to 2.25.64 Updates `software.amazon.awssdk:sqs` from 2.25.43 to 2.25.64 Updates `software.amazon.awssdk:dynamodb` from 2.25.43 to 2.25.64 --- updated-dependencies: - dependency-name: software.amazon.awssdk:s3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: software.amazon.awssdk:sqs dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: software.amazon.awssdk:dynamodb dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index e344f8be0b..90073a5292 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -13,7 +13,7 @@ ${project.basedir}/../../.. - 2.25.43 + 2.25.64 2.0.0 8 From 4a4d049615afe5779fb9b924fb6cd00e3d3381d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:51:13 +0200 Subject: [PATCH 083/132] build: bump version.byte-buddy from 1.14.14 to 1.14.17 (#3664) * build: bump version.byte-buddy from 1.14.14 to 1.14.17 Bumps `version.byte-buddy` from 1.14.14 to 1.14.17. Updates `net.bytebuddy:byte-buddy` from 1.14.14 to 1.14.17 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.14...byte-buddy-1.14.17) Updates `net.bytebuddy:byte-buddy-agent` from 1.9.16 to 1.14.17 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.9.16...byte-buddy-1.14.17) Updates `net.bytebuddy:byte-buddy-dep` from 1.14.14 to 1.14.17 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.14...byte-buddy-1.14.17) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: net.bytebuddy:byte-buddy-agent dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: net.bytebuddy:byte-buddy-dep dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * revert old known version * bump asm version to keep it consistent with bytebuddy --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7821579eca..decfa218b1 100644 --- a/pom.xml +++ b/pom.xml @@ -131,8 +131,8 @@ 9.4.11.v20180605 1.4.0 - 1.14.14 - 9.6 + 1.14.17 + 9.7 5.4.0 5.12.0 From a1812e782c235313d08bb62e534ea9fd9cbd1352 Mon Sep 17 00:00:00 2001 From: Deniza Topalova <129867589+deni-topalova@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:53:56 +0300 Subject: [PATCH 084/132] adding an option to make routing-key part of RabbitMQ transaction names (#3636) Co-authored-by: Deniza Topalova --- CHANGELOG.asciidoc | 4 ++ .../rabbitmq/ChannelInstrumentation.java | 15 ++++- .../rabbitmq/ConsumerInstrumentation.java | 16 ++++- .../apm/agent/rabbitmq/RabbitMQIT.java | 67 ++++++++++++++----- .../configuration/MessagingConfiguration.java | 8 ++- docs/configuration.asciidoc | 12 ++-- 6 files changed, 93 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index f87aaa5350..3b82880c61 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -38,6 +38,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: ===== Bug fixes * Restore compatibility with Java 7 - {pull}3657[#3657] +[float] +===== Features +* Added option to make routing-key part of RabbitMQ transaction/span names - {pull}3636[#3636] + [[release-notes-1.50.0]] ==== 1.50.0 - 2024/05/28 diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java index 5fa4812ac1..35ec95f310 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java @@ -24,6 +24,7 @@ import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.tracer.ElasticContext; import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; @@ -137,10 +138,9 @@ public static Object[] onBasicPublish(@Advice.This Channel channel, if (exitSpan != null) { exchange = normalizeExchangeName(exchange); - + String transactionNameSuffix = normalizeExchangeName(resolveTransactionNameSuffix(exchange, routingKey)); exitSpan.withAction("send") - .withName("RabbitMQ SEND to ").appendToName(exchange); - + .withName("RabbitMQ SEND to ").appendToName(transactionNameSuffix); } properties = propagateTraceContext(tracer.currentContext(), properties); @@ -174,6 +174,15 @@ private static AMQP.BasicProperties propagateTraceContext(ElasticContext toPr return properties.builder().headers(headersWithContext).build(); } + private static String resolveTransactionNameSuffix(String exchange, String routingKey) { + + if (MessagingConfiguration.RabbitMQNamingMode.ROUTING_KEY == AbstractBaseInstrumentation.getRabbitMQNamingMode()) { + return routingKey; + } else { + return exchange; + } + } + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false) public static void afterBasicPublish(@Advice.Enter @Nullable Object[] enterArray, @Advice.Thrown @Nullable Throwable throwable) { diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ConsumerInstrumentation.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ConsumerInstrumentation.java index 2ac2847c0c..5659022575 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ConsumerInstrumentation.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ConsumerInstrumentation.java @@ -20,6 +20,7 @@ import co.elastic.apm.agent.tracer.Transaction; import co.elastic.apm.agent.rabbitmq.header.RabbitMQTextHeaderGetter; +import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration.RabbitMQNamingMode; import co.elastic.apm.agent.tracer.metadata.Message; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import com.rabbitmq.client.AMQP; @@ -106,8 +107,9 @@ public static Object onHandleDelivery(@Advice.Origin Class originClazz, return null; } + String transactionNameSuffix = getExchangeOrRoutingKey(envelope); transaction.withType("messaging") - .withName("RabbitMQ RECEIVE from ").appendToName(normalizeExchangeName(exchange)); + .withName("RabbitMQ RECEIVE from ").appendToName(normalizeExchangeName(transactionNameSuffix)); transaction.setFrameworkName("RabbitMQ"); @@ -129,5 +131,17 @@ public static void afterHandleDelivery(@Advice.Enter @Nullable final Object tran .end(); } } + + private static String getExchangeOrRoutingKey(Envelope envelope) { + if (null == envelope) { + return null; + } + + if (RabbitMQNamingMode.ROUTING_KEY == AbstractBaseInstrumentation.getRabbitMQNamingMode()) { + return envelope.getRoutingKey(); + } else { + return envelope.getExchange(); + } + } } } diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java index b43f719046..1899aa6f42 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java @@ -56,6 +56,7 @@ import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.testutils.TestContainersUtils; +import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration.RabbitMQNamingMode; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; @@ -98,7 +99,7 @@ public class RabbitMQIT extends AbstractInstrumentationTest { private static final String IMAGE = "rabbitmq:3.7-management-alpine"; private static final RabbitMQContainer container = new RabbitMQContainer(IMAGE); - private static final String ROUTING_KEY = "test.key"; + private static final String TEST_ROUTING_KEY = "test.key"; private static final byte[] MSG = "Testing APM!".getBytes(); @@ -203,7 +204,8 @@ void headersCaptureSanitize() throws IOException, InterruptedException { ), true); } - private void testHeadersCapture(Map headersMap, Map expectedHeaders, boolean expectTracingHeaders) throws IOException, InterruptedException { + private void testHeadersCapture(Map headersMap, Map expectedHeaders, + boolean expectTracingHeaders) throws IOException, InterruptedException { performTest( propertiesMap(headersMap), false, @@ -228,6 +230,15 @@ void ignoreExchangeName() throws IOException, InterruptedException { }); } + @Test + void routingKeyInTransactionName() throws IOException, InterruptedException { + MessagingConfiguration messagingConfiguration = config.getConfig(MessagingConfiguration.class); + doReturn(RabbitMQNamingMode.ROUTING_KEY).when(messagingConfiguration).getRabbitMQNamingMode(); + + performTest(emptyProperties(), false, randString("exchange"), "different-routing-key", + (mt, ms) -> {}); + } + private void performTest(@Nullable AMQP.BasicProperties properties) throws IOException, InterruptedException { performTest(properties, false, randString("exchange"), (mt, ms) -> { }); @@ -238,9 +249,18 @@ private void performTest(@Nullable AMQP.BasicProperties properties, String channelName, BiConsumer messageCheck) throws IOException, InterruptedException { + performTest(properties, shouldIgnore, channelName, TEST_ROUTING_KEY, messageCheck); + } + + private void performTest(@Nullable AMQP.BasicProperties properties, + boolean shouldIgnore, + String channelName, + String routingKey, + BiConsumer messageCheck) throws IOException, InterruptedException { + Channel channel = connection.createChannel(); String exchange = createExchange(channel, channelName); - String queue = createQueue(channel, exchange); + String queue = createQueue(channel, exchange, routingKey); CountDownLatch messageReceived = new CountDownLatch(1); @@ -248,7 +268,8 @@ private void performTest(@Nullable AMQP.BasicProperties properties, // using an anonymous class to ensure class matching is properly applied @Override - public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, + byte[] body) throws IOException { assertThat(properties).isNotNull(); Map headers = properties.getHeaders(); @@ -264,7 +285,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp Transaction rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); - channel.basicPublish(exchange, ROUTING_KEY, properties, MSG); + channel.basicPublish(exchange, routingKey, properties, MSG); endRootTransaction(rootTransaction); @@ -285,17 +306,17 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp return; } - // 2 transactions, 1 span expected getReporter().awaitTransactionCount(2); getReporter().awaitSpanCount(1); Transaction childTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); - checkTransaction(childTransaction, exchange); + String transactionNameSuffix = !routingKey.equals(TEST_ROUTING_KEY) ? routingKey: exchange; + checkTransaction(childTransaction, exchange, transactionNameSuffix, "RabbitMQ"); Span span = getReporter().getSpans().get(0); - checkSendSpan(span, exchange); + checkSendSpan(span, exchange, transactionNameSuffix); // span should be child of the first transaction checkParentChild(rootTransaction, span); @@ -306,12 +327,11 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp Message spanMessage = span.getContext().getMessage(); Message transactionMessage = childTransaction.getContext().getMessage(); - // test-specific assertions on captured message messageCheck.accept(transactionMessage, spanMessage); - } + @Test void testPollingWithinTransactionNoMessage() throws IOException { Channel channel = connection.createChannel(); @@ -395,7 +415,7 @@ void testPollingIgnoreExchangeName() throws IOException { private String declareAndBindQueue(String queue, String exchange, Channel channel) { try { channel.queueDeclare(queue, false, false, false, null); - channel.queueBind(queue, exchange, ROUTING_KEY); + channel.queueBind(queue, exchange, TEST_ROUTING_KEY); return queue; } catch (IOException e) { throw new IllegalStateException(e); @@ -413,7 +433,7 @@ private void pollingTest(boolean withinTransaction, boolean withResult, Supplier } if (withResult) { - channel.basicPublish(exchange, ROUTING_KEY, emptyProperties(), MSG); + channel.basicPublish(exchange, TEST_ROUTING_KEY, emptyProperties(), MSG); } channel.basicGet(queue, true); @@ -573,9 +593,9 @@ static Transaction getNonRootTransaction(Transaction rootTransaction, List" : exchange); + .isEqualTo("RabbitMQ RECEIVE from %s", transactionNameSuffix.isEmpty() ? "" : transactionNameSuffix); assertThat(transaction.getFrameworkName()).isEqualTo(frameworkName); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); @@ -682,14 +706,23 @@ private static HashMap getHeadersMap(Message message) { } private static void checkSendSpan(Span span, String exchange) { - checkSendSpan(span, exchange, connection.getAddress().getHostAddress(), connection.getPort()); + checkSendSpan(span, exchange, exchange, connection.getAddress().getHostAddress(), connection.getPort()); + } + + private static void checkSendSpan(Span span, String exchange, String spanNameSuffix) { + checkSendSpan(span, exchange, spanNameSuffix, connection.getAddress().getHostAddress(), connection.getPort()); } static void checkSendSpan(Span span, String exchange, String host, int port) { + checkSendSpan(span, exchange, exchange, host, port); + } + + static void checkSendSpan(Span span, String exchange, String spanNameSuffix, String host, int port) { String exchangeName = exchange.isEmpty() ? "" : exchange; + String spanName = spanNameSuffix.isEmpty() ? "" : spanNameSuffix; checkSpanCommon(span, "send", - String.format("RabbitMQ SEND to %s", exchangeName), + String.format("RabbitMQ SEND to %s", spanName), exchangeName, true ); diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java index 85420bc1b2..ab8c28322a 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/MessagingConfiguration.java @@ -111,8 +111,8 @@ public class MessagingConfiguration extends ConfigurationOptionProvider { private final ConfigurationOption rabbitMQNamingMode = ConfigurationOption.enumOption(RabbitMQNamingMode.class) .key("rabbitmq_naming_mode") .configurationCategory(MESSAGING_CATEGORY) - .description("Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`.\n" + - "Note that `QUEUE` only works when using RabbitMQ via spring-amqp." + .description("Defines whether the agent should use the exchanges, the routing key or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE`, `ROUTING_KEY` and `EXCHANGE`.\n" + + "Note that `QUEUE` only works when using RabbitMQ via spring-amqp and `ROUTING_KEY` only works for the non spring-client." ) .dynamic(true) .tags("added[1.46.0]") @@ -187,5 +187,9 @@ public enum RabbitMQNamingMode { * Use queue in transaction names */ QUEUE, + /** + * Use routing key in transaction names + */ + ROUTING_KEY } } diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 1a31360d3f..3d124b4b2d 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -2513,12 +2513,12 @@ Starting from version 1.43.0, the classes that are part of the 'application_pack [[config-rabbitmq-naming-mode]] ==== `rabbitmq_naming_mode` (added[1.46.0]) -Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`. -Note that `QUEUE` only works when using RabbitMQ via spring-amqp. +Defines whether the agent should use the exchanges, the routing key or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE`, `ROUTING_KEY` and `EXCHANGE`. +Note that `QUEUE` only works when using RabbitMQ via spring-amqp and `ROUTING_KEY` only works for the non spring-client. <> -Valid options: `EXCHANGE`, `QUEUE` +Valid options: `EXCHANGE`, `QUEUE`, `ROUTING_KEY` [options="header"] |============ @@ -4703,10 +4703,10 @@ Example: `5ms`. # # jms_listener_packages= -# Defines whether the agent should use the exchanges or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE` and `EXCHANGE`. -# Note that `QUEUE` only works when using RabbitMQ via spring-amqp. +# Defines whether the agent should use the exchanges, the routing key or the queue for the naming of RabbitMQ Transactions. Valid options are `QUEUE`, `ROUTING_KEY` and `EXCHANGE`. +# Note that `QUEUE` only works when using RabbitMQ via spring-amqp and `ROUTING_KEY` only works for the non spring-client. # -# Valid options: EXCHANGE, QUEUE +# Valid options: EXCHANGE, QUEUE, ROUTING_KEY # This setting can be changed at runtime # Type: RabbitMQNamingMode # Default value: EXCHANGE From 290c87a7796b54bf22ae8290a1a7946bcd7e07dc Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:14:09 +0200 Subject: [PATCH 085/132] [release] improve release steps naming (#3667) * enhance main branch PR message for merge with commit * minor wording clarifications * [release] rename release steps * add PR created in first step in readme --- .ci/release/update-major-branch.sh | 6 +++++- .github/workflows/README.md | 17 ++++++++++++----- .github/workflows/pre-post-release.yml | 12 ++++++++++-- .../{pre-release.yml => release-step-1.yml} | 4 +++- .../{release.yml => release-step-3.yml} | 8 +++++--- 5 files changed, 35 insertions(+), 12 deletions(-) rename .github/workflows/{pre-release.yml => release-step-1.yml} (75%) rename .github/workflows/{release.yml => release-step-3.yml} (96%) diff --git a/.ci/release/update-major-branch.sh b/.ci/release/update-major-branch.sh index 146364f498..31f6ebe80e 100755 --- a/.ci/release/update-major-branch.sh +++ b/.ci/release/update-major-branch.sh @@ -68,4 +68,8 @@ git checkout -b "update-major-${v}" git push origin "update-major-${v}" echo -e "\n--- create PR to update major branch" -gh pr create --title="post release v${v}: update major branch" --base "${major_branch}" --head "update-major-${v}" -b "post release v${v}" +gh pr create \ + --title="[release] release-step-4 ${v}" \ + --base "${major_branch}" \ + --head "update-major-${v}" \ + -b "Step 4 of the release process for version ${v}: review & merge with merge commit WITHOUT SQUASH to prevent conflicts" diff --git a/.github/workflows/README.md b/.github/workflows/README.md index cbc0140d24..8d8bd55ad9 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -36,11 +36,18 @@ Every time there is a merge to main or any branches the whole workflow will comp ### Release process To release a new version of apm-agent-java, you must use the two GitHub Workflows. -Trigger the `Pre Release` workflow targeting the release version. -After merging the PRs created by the first workflow, you can trigger the `Release` workflow targeting the release version. -It runs then a Buildkite pipeline in charge of generating and publishing the artifacts, -for further details please go to [the buildkite folder](../../.buildkite/README.md). -Finally, merge the PRs created to bump version for the next iteration. + +- Trigger the `release-step-1` GH workflow + - parameters: version to release + - will open `release-step-2` PR +- Review and merge the `release-step-2` PR to `main` (version bump to release + changelog update) +- Trigger the `release-step-3` GH workflow + - parameters: version to release and the `main` branch (or merge commit/ref of `release-step-2` PR merge). + - will generate and publish release artifact through [buildkite](../../.buildkite/README.md). + - will open two PRs: `release-step-4` and `release-step-5` + - will wait on the `release-step-4` PR to be merged and published (documentation update) +- Review and merge the `release-step-4` PR to the "major branch", which is currently `1.x`, the documentation effective build and publication can take a while. +- Review and merge the `release-step-5` PR to `main` (version bump from release to next snapshot version) The tag release follows the naming convention: `v...`, where ``, `` and ``. diff --git a/.github/workflows/pre-post-release.yml b/.github/workflows/pre-post-release.yml index e34026ebd4..a6d1123e34 100644 --- a/.github/workflows/pre-post-release.yml +++ b/.github/workflows/pre-post-release.yml @@ -18,6 +18,14 @@ on: description: 'Pre or post release phase' type: string # valid values are 'pre' or 'post' required: true + pr_title: + description: 'pull-request title' + type: string + required: true + pr_body: + description: : 'pull-request body' + type: string + required: true env: RELEASE_VERSION: ${{ inputs.version }} @@ -91,8 +99,8 @@ jobs: git add --all git commit -m "${{ inputs.phase }} release: elastic-apm-agent ${{ env.RELEASE_VERSION_TAG }}" git push origin ${{ env.BRANCH_NAME }} - + - name: Create the ${{ inputs.phase }} release PR - run: gh pr create --title="${{ inputs.phase }} release ${{ env.RELEASE_VERSION_TAG }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.phase }} release ${{ env.RELEASE_VERSION_TAG }}" + run: gh pr create --title="${{ inputs.pr_title }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.pr_body }}" env: GH_TOKEN: ${{ env.GITHUB_TOKEN }} diff --git a/.github/workflows/pre-release.yml b/.github/workflows/release-step-1.yml similarity index 75% rename from .github/workflows/pre-release.yml rename to .github/workflows/release-step-1.yml index 3fb0b6f71f..c0b5a1a365 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/release-step-1.yml @@ -1,6 +1,6 @@ --- -name: Pre release +name: 'release-step-1' on: workflow_dispatch: @@ -29,4 +29,6 @@ jobs: ref: ${{ inputs.ref }} version: ${{ inputs.version }} phase: 'pre' + pr_title: "[release] release-step-2 ${{ inputs.version }}" + pr_body: "Step 2 of the release process for version ${{ inputs.version }}: review & merge, then execute 'release-step-3' GH workflow" secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release-step-3.yml similarity index 96% rename from .github/workflows/release.yml rename to .github/workflows/release-step-3.yml index d44347dd73..d2884219e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-step-3.yml @@ -1,6 +1,6 @@ --- # Releases the agent -name: release +name: 'release-step-3' on: workflow_dispatch: @@ -10,7 +10,7 @@ on: required: true default: "main" version: - description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps' + description: 'The version to release (e.g. 1.2.3). This workflow will automatically perform the required post-release version bumps' required: true skip_preparation: description: | @@ -55,7 +55,7 @@ jobs: uses: ./.github/workflows/validate-tag with: tag: ${{ env.RELEASE_VERSION_TAG }} - - name: Validate tag match current version + - name: Validate tag match current maven project version run: | if [ "$(./mvnw -q help:evaluate -Dexpression=project.version -DforceStdout)" != "${{ env.RELEASE_VERSION }}" ]; then echo "Tag should match pom.xml project.version" @@ -212,6 +212,8 @@ jobs: ref: ${{ inputs.ref }} version: ${{ inputs.version }} phase: 'post' + pr_title: "[release] release-step-5 ${{ inputs.version }}" + pr_body: "Step 5 of the release process for version ${{ inputs.version }}: review & merge" secrets: inherit update-major-branch: From 2b7bdb57e3e1f0504a774abd0a57aba1f98a717c Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 4 Jun 2024 13:35:31 +0200 Subject: [PATCH 086/132] Fix unreleased changelog (#3669) --- CHANGELOG.asciidoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 3b82880c61..6dee85db93 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,9 +31,6 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased -[[release-notes-1.x]] -=== Java Agent version 1.x - [float] ===== Bug fixes * Restore compatibility with Java 7 - {pull}3657[#3657] @@ -42,6 +39,9 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: ===== Features * Added option to make routing-key part of RabbitMQ transaction/span names - {pull}3636[#3636] +[[release-notes-1.x]] +=== Java Agent version 1.x + [[release-notes-1.50.0]] ==== 1.50.0 - 2024/05/28 From 46aaa7431c30b9406e48437c65065e506d2d3b12 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 4 Jun 2024 14:07:52 +0200 Subject: [PATCH 087/132] github-action: run buildkite action with GH secrets (#3668) --- .github/workflows/microbenchmark.yml | 31 +++++++--------------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/.github/workflows/microbenchmark.yml b/.github/workflows/microbenchmark.yml index c576f067dc..f1814b2e4b 100644 --- a/.github/workflows/microbenchmark.yml +++ b/.github/workflows/microbenchmark.yml @@ -21,36 +21,19 @@ permissions: jobs: microbenchmark: runs-on: ubuntu-latest - # wait up to 1 hour - timeout-minutes: 60 + timeout-minutes: 5 steps: - - id: buildkite - name: Run buildkite pipeline - uses: elastic/apm-pipeline-library/.github/actions/buildkite@current + - name: Run microbenchmark + uses: elastic/oblt-actions/buildkite/run@v1.5.0 env: JAVA_VERSION: ${{ inputs.java_version || 'openjdk-17+35-linux' }} with: - vaultUrl: ${{ secrets.VAULT_ADDR }} - vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} - vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - pipeline: apm-agent-microbenchmark - triggerMessage: "${{ github.repository }}@${{ github.ref_name }}" - waitFor: true - printBuildLogs: true - buildEnvVars: | + pipeline: "apm-agent-microbenchmark" + token: ${{ secrets.BUILDKITE_TOKEN }} + wait-for: false + env-vars: | script=.ci/scripts/bench.sh repo=apm-agent-java sha=${{ github.sha }} JAVA_VERSION=${{ env.JAVA_VERSION }} BRANCH_NAME=${{ github.ref_name }} - - - if: ${{ failure() }} - uses: elastic/apm-pipeline-library/.github/actions/slack-message@current - with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - channel: "#apm-agent-java" - message: | - :ghost: [${{ github.repository }}] microbenchmark *${{ github.ref_name }}* failed to run in Buildkite. - Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>) From 65bbdbd05f7e6ad5a3e3211deb934ec59d57fc2a Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 4 Jun 2024 22:36:49 +0200 Subject: [PATCH 088/132] github-actions: remove snapshoty (#3670) --- .ci/snapshoty.yml | 55 --------------------------------- .github/workflows/README.md | 3 +- .github/workflows/snapshoty.yml | 31 ------------------- 3 files changed, 1 insertion(+), 88 deletions(-) delete mode 100644 .ci/snapshoty.yml delete mode 100644 .github/workflows/snapshoty.yml diff --git a/.ci/snapshoty.yml b/.ci/snapshoty.yml deleted file mode 100644 index e83c94de7b..0000000000 --- a/.ci/snapshoty.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- - -# Version of configuration to use -version: '1.0' - -# You can define a Google Cloud Account to use -account: - # Project id of the service account - project: '${GCS_PROJECT}' - # Private key id of the service account - private_key_id: '${GCS_PRIVATE_KEY_ID}' - # Private key of the service account - private_key: '${GCS_PRIVATE_KEY}' - # Email of the service account - client_email: '${GCS_CLIENT_EMAIL}' - # URI token - token_uri: 'https://oauth2.googleapis.com/token' - -x-metadata: &metadata - # Define static custom metadata - - name: 'custom' - data: - project: 'apm-agent-java' - # Add git metadata - - name: 'git' - # Add github_actions metadata - - name: 'github_actions' - - -# List of artifacts -artifacts: - # Path to use for artifacts discovery - - path: './elastic-apm-agent/target' - # Files pattern to match - files_pattern: 'elastic-apm-agent-(?P\d+\.\d+\.\d+(-\S+)?)\.jar' - # File layout on GCS bucket - output_pattern: '{project}/{github_branch_name}/elastic-apm-java-{app_version}-{github_sha_short}.jar' - # List of metadata processors to use. - metadata: *metadata - - path: './elastic-apm-agent/target' - files_pattern: 'elastic-apm-java-aws-lambda-layer-(?P\d+\.\d+\.\d+(-\S+)?)\.zip' - output_pattern: '{project}/{github_branch_name}/elastic-apm-java-aws-lambda-layer-{app_version}-{github_sha_short}.zip' - metadata: *metadata - - path: './apm-agent-attach/target' - files_pattern: 'apm-agent-attach-(?P\d+\.\d+\.\d+(-\S+)?)\.jar' - output_pattern: '{project}/{github_branch_name}/elastic-apm-java-attach-{app_version}-{github_sha_short}.jar' - metadata: *metadata - - path: './apm-agent-attach-cli/target' - files_pattern: 'apm-agent-attach-cli-(?P\d+\.\d+\.\d+(-\S+)?)\.jar' - output_pattern: '{project}/{github_branch_name}/elastic-apm-java-attach-{app_version}-{github_sha_short}.jar' - metadata: *metadata - - path: './apm-agent-api/target' - files_pattern: 'apm-agent-api-(?P\d+\.\d+\.\d+(-\S+)?)\.jar' - output_pattern: '{project}/{github_branch_name}/elastic-apm-java-api-{app_version}-{github_sha_short}.jar' - metadata: *metadata diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 8d8bd55ad9..1d3ea8d495 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -10,7 +10,6 @@ There are 4 main stages that run on GitHub actions: There are some other stages that run for every push on the main branches: * [Microbenchmark](./microbenchmark.yml) -* [Snapshoty](./snapshoty.yml) * [Sync-branches](./sync-branches.yml) ### Scenarios @@ -53,7 +52,7 @@ The tag release follows the naming convention: `v...`, wher ### OpenTelemetry -There is a GitHub workflow in charge to populate what the workflow run in terms of jobs and steps. Those details can be seen in [here](https://ela.st/oblt-ci-cd-stats) (**NOTE**: only available for Elasticians). +Every workflow and its logs are exported to OpenTelemetry traces/logs/metrics. Those details can be seen [here](https://ela.st/oblt-ci-cd-stats) (**NOTE**: only available for Elasticians). ## Bump automation diff --git a/.github/workflows/snapshoty.yml b/.github/workflows/snapshoty.yml deleted file mode 100644 index 875804ed99..0000000000 --- a/.github/workflows/snapshoty.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -# Publish a snapshot. A "snapshot" is a packaging of the latest *unreleased* APM agent, -# published to a known GCS bucket for use in edge demo/test environments. -name: Snapshoty - -on: - push: - branches: - - main - paths-ignore: - - '*.md' - - '*.asciidoc' - - 'docs/**' - -jobs: - upload: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: ./.github/workflows/maven-goal - with: - command: ./mvnw clean install -DskipTests=true -Dmaven.javadoc.skip=true - - - name: Publish snaphosts - uses: elastic/apm-pipeline-library/.github/actions/snapshoty-simple@current - with: - config: '.ci/snapshoty.yml' - vaultUrl: ${{ secrets.VAULT_ADDR }} - vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} - vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} From 8633793d653ea8dd47e21e67ab6ae955897d7329 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:26:53 +0200 Subject: [PATCH 089/132] [release] fix typo in release workflow (#3671) --- .github/workflows/pre-post-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-post-release.yml b/.github/workflows/pre-post-release.yml index a6d1123e34..4114ed50ad 100644 --- a/.github/workflows/pre-post-release.yml +++ b/.github/workflows/pre-post-release.yml @@ -23,7 +23,7 @@ on: type: string required: true pr_body: - description: : 'pull-request body' + description: 'pull-request body' type: string required: true From f8c435a473d610064a709df3e67bf1cc2fca5489 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:51:20 +0200 Subject: [PATCH 090/132] build: bump docker/login-action from 3.1.0 to 3.2.0 in the github-actions group (#3663) Bumps the github-actions group with 1 update: [docker/login-action](https://github.com/docker/login-action). Updates `docker/login-action` from 3.1.0 to 3.2.0 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/e92390c5fb421da1463c202d546fed0ec5c39f20...0d4c9c5ea7693da7b068278f7b52bda2a190a446) --- .github/workflows/main.yml | 2 +- .github/workflows/release-step-3.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ffaa2cceb..4691fb2baa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -340,7 +340,7 @@ jobs: - uses: actions/checkout@v4 - name: Log in to the Elastic Container registry - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 with: registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index d2884219e0..203c61d9c5 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -137,7 +137,7 @@ jobs: fetch-depth: 0 # Load entire history as it is required for the push-script - name: Log in to the Elastic Container registry - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 with: registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 9bede59356..9ecfbdb82e 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -82,7 +82,7 @@ jobs: - uses: actions/checkout@v4 - name: Log in to the Elastic Container registry - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 with: registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }} username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} From 7c63ade90ec53806c4f5037271657eb6f0205039 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:19:43 +0100 Subject: [PATCH 091/132] build: bump actions/attest-build-provenance in the github-actions group (#3673) Bumps the github-actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance). Updates `actions/attest-build-provenance` from 1.1.2 to 1.2.0 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](https://github.com/actions/attest-build-provenance/compare/173725a1209d09b31f9d30a3890cf2757ebbff0d...49df96e17e918a15956db358890b08e61c704919) --- updated-dependencies: - dependency-name: actions/attest-build-provenance dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release-step-3.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index 203c61d9c5..e0174ff62a 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -106,7 +106,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2 + uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0 with: subject-path: "${{ github.workspace }}/**/target/*.jar" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 9ecfbdb82e..0b67429b9f 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -71,7 +71,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2 + uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0 with: subject-path: "${{ github.workspace }}/**/target/*.jar" From f17e701a0acf2355ed2afe6f8257453ca3563d60 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:54:52 +0200 Subject: [PATCH 092/132] Warn unexpected SpanContext in otel span link (#3672) * add warning with non elastic spancontext * update changelog --- CHANGELOG.asciidoc | 1 + .../tracing/OTelSpanBuilder.java | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 6dee85db93..0103c59e29 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -34,6 +34,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [float] ===== Bug fixes * Restore compatibility with Java 7 - {pull}3657[#3657] +* Avoid `ClassCastException` and issue warning when trying to use otel span links - {pull}3672[#3672] [float] ===== Features diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java index c56200146a..ef550e9d0e 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java @@ -22,16 +22,15 @@ import co.elastic.apm.agent.impl.baggage.Baggage; import co.elastic.apm.agent.impl.transaction.AbstractSpan; import co.elastic.apm.agent.impl.transaction.MultiValueMapAccessor; -import co.elastic.apm.agent.impl.transaction.OTelSpanKind; -import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.impl.transaction.TraceContext; import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.opentelemetry.baggage.OtelBaggage; -import co.elastic.apm.agent.sdk.logging.Logger; -import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.sdk.internal.util.VersionUtils; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.AttributeKey; @@ -53,7 +52,8 @@ class OTelSpanBuilder implements SpanBuilder { - private static final Logger addLinkLogger = LoggerUtils.logOnce(LoggerFactory.getLogger(OTelSpanBuilder.class)); + private static final Logger addLinkLogger1 = LoggerUtils.logOnce(LoggerFactory.getLogger(OTelSpanBuilder.class)); + private static final Logger addLinkLogger2 = LoggerUtils.logOnce(LoggerFactory.getLogger(OTelSpanBuilder.class)); private final String spanName; private final ElasticApmTracer elasticApmTracer; @@ -86,15 +86,19 @@ public SpanBuilder setNoParent() { @Override public SpanBuilder addLink(SpanContext spanContext) { + if (!(spanContext instanceof OTelSpanContext)) { + addLinkLogger2.warn("Adding arbitrary span context to links is currently unsupported"); + return this; + } links.add(spanContext); return this; } @Override - public SpanBuilder addLink(SpanContext spanContext, Attributes attributes1) { + public SpanBuilder addLink(SpanContext spanContext, @Nullable Attributes attributes1) { addLink(spanContext); if (attributes1 != null && !attributes1.isEmpty()) { - addLinkLogger.warn("Adding attributes to links is currently unsupported - the links have been added but with no attributes, the following attributes have been ignored: %s",attributes1); + addLinkLogger1.warn("Adding attributes to links is currently unsupported - the links have been added but with no attributes, the following attributes have been ignored: %s", attributes1); } return this; } @@ -182,7 +186,7 @@ public Span startSpan() { t.setFrameworkName("OpenTelemetry API"); String otelVersion = VersionUtils.getVersion(OpenTelemetry.class, "io.opentelemetry", "opentelemetry-api"); - if(otelVersion != null){ + if (otelVersion != null) { t.setFrameworkVersion(otelVersion); } } From 0ad37da0f74e2022b2c0d713981850771fcef0bd Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 12 Jun 2024 13:15:41 +0200 Subject: [PATCH 093/132] ci: use github secrets for GH token (#3678) --- .github/workflows/pre-post-release.yml | 16 ++++------------ .github/workflows/release-step-3.yml | 15 +++++---------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pre-post-release.yml b/.github/workflows/pre-post-release.yml index 4114ed50ad..18b61057e9 100644 --- a/.github/workflows/pre-post-release.yml +++ b/.github/workflows/pre-post-release.yml @@ -55,24 +55,16 @@ jobs: - validate-tag permissions: contents: write + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} steps: - - uses: elastic/apm-pipeline-library/.github/actions/github-token@current - with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - - - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current - with: - username: ${{ env.GIT_USER }} - email: ${{ env.GIT_EMAIL }} - token: ${{ env.GITHUB_TOKEN }} - - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} token: ${{ env.GITHUB_TOKEN }} + - uses: elastic/oblt-actions/git/setup@v1 + - name: Create the release tag (post phase) if: inputs.phase == 'post' run: | diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index e0174ff62a..6e671d1b56 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -223,21 +223,16 @@ jobs: - post-release permissions: contents: write + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} steps: - - uses: elastic/apm-pipeline-library/.github/actions/github-token@current - with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - - uses: elastic/apm-pipeline-library/.github/actions/setup-git@current - with: - username: ${{ env.GIT_USER }} - email: ${{ env.GIT_EMAIL }} - token: ${{ env.GITHUB_TOKEN }} - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} token: ${{ env.GITHUB_TOKEN }} + + - uses: elastic/oblt-actions/git/setup@v1 + - name: Update major branch if: ${{ ! inputs.dry_run }} run: .ci/release/update-major-branch.sh ${{ env.RELEASE_VERSION }} From 249dbbaa8d3858023d2de6657c78fcf69a9cc68b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 13 Jun 2024 12:16:54 +0200 Subject: [PATCH 094/132] feat(aws-lambda): apm-agent-java (#3680) --- .github/workflows/release-step-3.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index 6e671d1b56..442a430805 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -162,6 +162,9 @@ jobs: # Random region. This needs to be set in GH Actions or the usage of aws-cli will fail. # The default region does not matter, since we are publishing in all regions. AWS_DEFAULT_REGION: eu-west-1 + # TODO: use keyless + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - uses: actions/checkout@v4 with: @@ -170,15 +173,7 @@ jobs: uses: ./.github/workflows/maven-goal with: command: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer - - uses: hashicorp/vault-action@v3.0.0 - with: - url: ${{ secrets.VAULT_ADDR }} - method: approle - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - secrets: | - secret/observability-team/ci/service-account/apm-aws-lambda access_key_id | AWS_ACCESS_KEY_ID ; - secret/observability-team/ci/service-account/apm-aws-lambda secret_access_key | AWS_SECRET_ACCESS_KEY + - name: Publish if: ${{ ! inputs.dry_run }} run: | From 0202d48b229853a04e863ef1662c6415ebac766a Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 13 Jun 2024 13:35:33 +0200 Subject: [PATCH 095/132] github-actions: use buildkite and slack bot GH secrets (#3679) --- .github/workflows/release-step-3.yml | 33 +++++++++++-------------- .github/workflows/snapshot.yml | 36 +++++++++++++--------------- 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index 442a430805..d0a0f82675 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -81,26 +81,23 @@ jobs: env: TARBALL_FILE: artifacts.tar steps: - - id: buildkite + - id: buildkite-run continue-on-error: true - name: Run Deploy - uses: elastic/apm-pipeline-library/.github/actions/buildkite@current + uses: elastic/oblt-actions/buildkite/run@v1 with: - vaultUrl: ${{ secrets.VAULT_ADDR }} - vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} - vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - pipeline: apm-agent-java-release - waitFor: true - printBuildLogs: false - artifactName: releases - artifactPath: ${{ env.TARBALL_FILE }} - buildEnvVars: | + pipeline: "apm-agent-java-release" + token: ${{ secrets.BUILDKITE_TOKEN }} + wait-for: true + env-vars: | dry_run=${{ inputs.dry_run || 'false' }} TARBALL_FILE=${{ env.TARBALL_FILE }} - - uses: actions/download-artifact@v3 + - uses: elastic/oblt-actions/buildkite/download-artifact@v1 with: - name: releases + build-number: ${{ steps.buildkite-run.outputs.build }} + path: "${{ env.TARBALL_FILE }}" + pipeline: ${{ steps.buildkite-run.outputs.pipeline }} + token: ${{ secrets.BUILDKITE_TOKEN }} - name: untar the buildkite tarball run: tar xvf ${{ env.TARBALL_FILE }} @@ -282,10 +279,8 @@ jobs: uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current with: needs: ${{ toJSON(needs) }} - - uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current + - uses: elastic/oblt-actions/slack/notify-result@v1 with: + bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + channel-id: "#apm-agent-java" status: ${{ steps.check.outputs.status }} - vaultUrl: ${{ secrets.VAULT_ADDR }} - vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} - vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - slackChannel: "#apm-agent-java" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 0b67429b9f..3e84224e51 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -46,26 +46,24 @@ jobs: TARBALL_FILE: artifacts.tar if: ${{ contains(needs.validate.outputs.is-snapshot, 'true') }} steps: - - id: buildkite - name: Run Deploy - uses: elastic/apm-pipeline-library/.github/actions/buildkite@current + - id: buildkite-run + continue-on-error: true + uses: elastic/oblt-actions/buildkite/run@v1 with: - vaultUrl: ${{ secrets.VAULT_ADDR }} - vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} - vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - pipeline: apm-agent-java-snapshot - pipelineBranch: ${{ github.ref_name }} - artifactName: snapshots - artifactPath: ${{ env.TARBALL_FILE }} - waitFor: true - printBuildLogs: false - buildEnvVars: | + branch: ${{ github.ref_name }} + pipeline: "apm-agent-java-snapshot" + token: ${{ secrets.BUILDKITE_TOKEN }} + wait-for: true + env-vars: | dry_run=${{ inputs.dry_run || 'false' }} TARBALL_FILE=${{ env.TARBALL_FILE }} - - uses: actions/download-artifact@v3 + - uses: elastic/oblt-actions/buildkite/download-artifact@v1 with: - name: snapshots + build-number: ${{ steps.buildkite-run.outputs.build }} + path: "${{ env.TARBALL_FILE }}" + pipeline: ${{ steps.buildkite-run.outputs.pipeline }} + token: ${{ secrets.BUILDKITE_TOKEN }} - name: untar the buildkite tarball run: tar xvf ${{ env.TARBALL_FILE }} @@ -108,12 +106,10 @@ jobs: with: needs: ${{ toJSON(needs) }} - if: ${{ failure() && ! inputs.dry_run }} - uses: elastic/apm-pipeline-library/.github/actions/slack-message@current + uses: elastic/oblt-actions/slack/send@v1 with: - url: ${{ secrets.VAULT_ADDR }} - roleId: ${{ secrets.VAULT_ROLE_ID }} - secretId: ${{ secrets.VAULT_SECRET_ID }} - channel: "#apm-agent-java" + bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + channel-id: "#apm-agent-java" message: | :ghost: [${{ github.repository }}] Snapshot *${{ github.ref_name }}* didn't get triggered in Buildkite. Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>) From d1286397fde04e7eccc9125f3b97b7bc2663155b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 13 Jun 2024 15:03:20 +0200 Subject: [PATCH 096/132] github-actions: use number output (#3681) --- .github/workflows/release-step-3.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index d0a0f82675..7b90e66a5e 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -94,7 +94,7 @@ jobs: - uses: elastic/oblt-actions/buildkite/download-artifact@v1 with: - build-number: ${{ steps.buildkite-run.outputs.build }} + build-number: ${{ steps.buildkite-run.outputs.number }} path: "${{ env.TARBALL_FILE }}" pipeline: ${{ steps.buildkite-run.outputs.pipeline }} token: ${{ secrets.BUILDKITE_TOKEN }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 3e84224e51..cc7ef381dc 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -60,7 +60,7 @@ jobs: - uses: elastic/oblt-actions/buildkite/download-artifact@v1 with: - build-number: ${{ steps.buildkite-run.outputs.build }} + build-number: ${{ steps.buildkite-run.outputs.number }} path: "${{ env.TARBALL_FILE }}" pipeline: ${{ steps.buildkite-run.outputs.pipeline }} token: ${{ secrets.BUILDKITE_TOKEN }} From 68c1fb98fe9e05c6fe895ea0c3ff1bf0ace794cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:26:54 +0100 Subject: [PATCH 097/132] build: bump io.opentelemetry.semconv:opentelemetry-semconv (#3674) Bumps [io.opentelemetry.semconv:opentelemetry-semconv](https://github.com/open-telemetry/semantic-conventions-java) from 1.23.1-alpha to 1.25.0-alpha. - [Release notes](https://github.com/open-telemetry/semantic-conventions-java/releases) - [Changelog](https://github.com/open-telemetry/semantic-conventions-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/semantic-conventions-java/commits) --- updated-dependencies: - dependency-name: io.opentelemetry.semconv:opentelemetry-semconv dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-opentelemetry/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-opentelemetry/pom.xml b/apm-agent-plugins/apm-opentelemetry/pom.xml index 156e328930..aea7599cd0 100644 --- a/apm-agent-plugins/apm-opentelemetry/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/pom.xml @@ -20,7 +20,7 @@ to make sure that in the future we stay compatible with the previous version. --> 1.32.0 - 1.23.1-alpha + 1.25.0-alpha 8 8 From d86e7962cc670757db302a426c8e752f3cbf6d35 Mon Sep 17 00:00:00 2001 From: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:35:22 +0800 Subject: [PATCH 098/132] Remove unused functions and clean up servlet integration test base (#3683) * Remove unused functions and clean up servlet integration test base Signed-off-by: Adrian Cole * less code Signed-off-by: Adrian Cole --------- Signed-off-by: Adrian Cole --- ...stractServletContainerIntegrationTest.java | 105 +++++------------- .../co/elastic/apm/servlet/WebSphereIT.java | 5 - 2 files changed, 30 insertions(+), 80 deletions(-) diff --git a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java index 07a9b2540b..935a33ab44 100644 --- a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java +++ b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java @@ -28,12 +28,11 @@ import co.elastic.apm.servlet.tests.TestApp; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.dockerjava.api.command.StopContainerCmd; import okhttp3.Headers; import okhttp3.OkHttpClient; import okhttp3.Request; -import okhttp3.RequestBody; import okhttp3.Response; -import okhttp3.ResponseBody; import okhttp3.logging.HttpLoggingInterceptor; import org.junit.After; import org.junit.Test; @@ -49,7 +48,13 @@ import java.io.IOException; import java.nio.file.Paths; import java.time.Duration; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -176,23 +181,10 @@ protected AbstractServletContainerIntegrationTest(AgentTestContainer.AppServer c container.start(); if (runtimeAttachSupported()) { - if (AGENT_VERSION_TO_DOWNLOAD_FROM_MAVEN != null) { - container.startCliRuntimeAttach(AGENT_VERSION_TO_DOWNLOAD_FROM_MAVEN); - } else { - container.startCliRuntimeAttach(AGENT_VERSION_TO_DOWNLOAD_FROM_MAVEN); - } + container.startCliRuntimeAttach(AGENT_VERSION_TO_DOWNLOAD_FROM_MAVEN); } } - private static OkHttpClient setupHttpClient(boolean isDebug) { - final HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger::info); - loggingInterceptor.setLevel(isDebug ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.BASIC); - return new OkHttpClient.Builder() - .addInterceptor(loggingInterceptor) - .readTimeout(isDebug ? 0 : 10, TimeUnit.SECONDS) - .build(); - } - protected void beforeContainerStart(AgentTestContainer.AppServer container) { } @@ -216,9 +208,13 @@ protected boolean runtimeAttachSupported() { @After public final void stopServer() { - container.getDockerClient() - .stopContainerCmd(container.getContainerId()) - .exec(); + if (!container.isRunning()) { + return; // prevent NPE on container.getContainerId() + } + // allow graceful shutdown before killing and removing the container + try (StopContainerCmd stopContainerCmd = container.getDockerClient().stopContainerCmd(container.getContainerId())) { + stopContainerCmd.exec(); + } container.stop(); } @@ -271,29 +267,29 @@ public JsonNode assertTransactionReported(String pathToTest, int expectedRespons return transaction; } - public String executeAndValidateRequest(String pathToTest, String expectedContent, Integer expectedResponseCode, + public void executeAndValidateRequest(String pathToTest, String expectedContent, Integer expectedResponseCode, Map headersMap) throws IOException, InterruptedException { - Response response = executeRequest(pathToTest, headersMap); - if (expectedResponseCode != null) { - assertThat(response.code()) - .withFailMessage(response.toString() + getServerLogs()) - .isEqualTo(expectedResponseCode); + final String responseString; + try (Response response = executeRequest(pathToTest, headersMap)) { + if (expectedResponseCode != null) { + assertThat(response.code()) + .withFailMessage(response + getServerLogs()) + .isEqualTo(expectedResponseCode); + } + responseString = response.body().string(); } - final ResponseBody responseBody = response.body(); - assertThat(responseBody).isNotNull(); - String responseString = responseBody.string(); if (expectedContent != null) { assertThat(responseString) .describedAs("unexpected response content") .contains(expectedContent); } - return responseString; } private void executeStatusRequestAndCheckIgnored(String statusEndpoint) throws IOException { Map headers = Collections.emptyMap(); - Response response = executeRequest(statusEndpoint, headers); - assertThat(response.code()).isEqualTo(200); + try (Response response = executeRequest(statusEndpoint, headers)) { + assertThat(response.code()).isEqualTo(200); + } try { Thread.sleep(200); @@ -308,33 +304,6 @@ private void executeStatusRequestAndCheckIgnored(String statusEndpoint) throws I } - public String executeAndValidatePostRequest(String pathToTest, RequestBody postBody, String expectedContent, Integer expectedResponseCode) throws IOException, InterruptedException { - Response response = executePostRequest(pathToTest, postBody); - if (expectedResponseCode != null) { - assertThat(response.code()) - .withFailMessage(response.toString() + getServerLogs()) - .isEqualTo(expectedResponseCode); - } - final ResponseBody responseBody = response.body(); - assertThat(responseBody).isNotNull(); - String responseString = responseBody.string(); - if (expectedContent != null) { - assertThat(responseString).contains(expectedContent); - } - return responseString; - } - - public Response executePostRequest(String pathToTest, RequestBody postBody) throws IOException { - if (!pathToTest.startsWith("/")) { - pathToTest = "/" + pathToTest; - } - return httpClient.newCall(new Request.Builder() - .post(postBody) - .url(getBaseUrl() + pathToTest) - .build()) - .execute(); - } - public Response executeRequest(String pathToTest, Map headersMap) throws IOException { Headers headers = Headers.of((headersMap != null) ? headersMap : new HashMap<>()); if (!pathToTest.startsWith("/")) { @@ -368,7 +337,7 @@ public List assertSpansTransactionId(Supplier> supplier List reportedSpans; do { reportedSpans = supplier.get(); - } while (reportedSpans.size() == 0 && System.currentTimeMillis() - start < timeout); + } while (reportedSpans.isEmpty() && System.currentTimeMillis() - start < timeout); assertThat(reportedSpans) .describedAs("at least one span is expected") .isNotEmpty(); @@ -386,7 +355,7 @@ public List assertErrorContent(int timeoutMs, Supplier> List reportedErrors; do { reportedErrors = supplier.get(); - } while (reportedErrors.size() == 0 && System.currentTimeMillis() - start < timeoutMs); + } while (reportedErrors.isEmpty() && System.currentTimeMillis() - start < timeoutMs); assertThat(reportedErrors.size()).isEqualTo(1); for (JsonNode error : reportedErrors) { assertThat(error.get("transaction_id").textValue()).isEqualTo(transactionId); @@ -529,16 +498,6 @@ private void validateMetadataEvent(JsonNode metadata) { assertThat(jsonContainer.get("id").textValue()).isEqualTo(container.getContainerId()); } - private void addSpans(List spans, JsonNode payload) { - final JsonNode jsonSpans = payload.get("spans"); - if (jsonSpans != null) { - for (JsonNode jsonSpan : jsonSpans) { - mockReporter.verifyTransactionSchema(jsonSpan); - spans.add(jsonSpan); - } - } - } - private void waitFor(String path) { Wait.forHttp(path) .forPort(webPort) @@ -550,8 +509,4 @@ private void waitFor(String path) { public OkHttpClient getHttpClient() { return httpClient; } - - public boolean isHotSpotBased() { - return true; - } } diff --git a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/WebSphereIT.java b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/WebSphereIT.java index aab9cb0e74..58583b2312 100644 --- a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/WebSphereIT.java +++ b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/WebSphereIT.java @@ -52,11 +52,6 @@ public boolean isExpectedStacktrace(String path) { return true; } - @Override - public boolean isHotSpotBased() { - return false; - } - @Override protected Iterable> getTestClasses() { return Arrays.asList( From cd893419137fd80981505c754ecea5cce6fb0bbd Mon Sep 17 00:00:00 2001 From: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com> Date: Mon, 17 Jun 2024 18:42:02 +0800 Subject: [PATCH 099/132] Uses MockWebServer instead of a docker container for servlet integration tests (#3684) Signed-off-by: Adrian Cole --- .../pom.xml | 6 + ...stractServletContainerIntegrationTest.java | 121 +++++++++++++----- 2 files changed, 94 insertions(+), 33 deletions(-) diff --git a/integration-tests/application-server-integration-tests/pom.xml b/integration-tests/application-server-integration-tests/pom.xml index 56c97e94f5..678cdf478c 100644 --- a/integration-tests/application-server-integration-tests/pom.xml +++ b/integration-tests/application-server-integration-tests/pom.xml @@ -118,6 +118,12 @@ logging-interceptor ${version.okhttp} + + com.squareup.okhttp3 + mockwebserver + ${version.okhttp} + test + org.testcontainers testcontainers diff --git a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java index 935a33ab44..a46f49ea4e 100644 --- a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java +++ b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java @@ -24,7 +24,6 @@ import co.elastic.apm.agent.test.AgentFileAccessor; import co.elastic.apm.agent.test.AgentTestContainer; import co.elastic.apm.agent.test.JavaExecutable; -import co.elastic.apm.agent.testutils.TestContainersUtils; import co.elastic.apm.servlet.tests.TestApp; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -34,11 +33,15 @@ import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.mockwebserver.Dispatcher; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import okio.Buffer; +import okio.InflaterSource; import org.junit.After; import org.junit.Test; -import org.mockserver.model.ClearType; -import org.mockserver.model.HttpRequest; -import org.mockserver.model.HttpResponse; +import org.testcontainers.Testcontainers; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.utility.MountableFile; @@ -46,6 +49,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; +import java.io.UncheckedIOException; import java.nio.file.Paths; import java.time.Duration; import java.util.ArrayList; @@ -55,13 +59,16 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.stream.Collectors; +import java.util.zip.Inflater; import static co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.INTAKE_V2_URL; +import static co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.INTAKE_V2_FLUSH_URL; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockserver.model.HttpRequest.request; /** * When you want to execute the test in the IDE, execute {@code mvn clean package} before. @@ -84,19 +91,14 @@ public abstract class AbstractServletContainerIntegrationTest { @Nullable private static final String AGENT_VERSION_TO_DOWNLOAD_FROM_MAVEN = null; - private static final MockServerContainer mockServerContainer; + private static final MockWebServer apmServer; + private static final Queue receivedIntakeEvents = new ConcurrentLinkedQueue<>(); private static final OkHttpClient httpClient; static { - mockServerContainer = new MockServerContainer() - .withNetworkAliases("apm-server") - .waitingFor(Wait.forHttp(MockServerContainer.HEALTH_ENDPOINT).forStatusCode(200)) - .withNetwork(Network.SHARED); - - if (JavaExecutable.isDebugging()) { - mockServerContainer.withLogConsumer(TestContainersUtils.createSlf4jLogConsumer(MockServerContainer.class)); - } + apmServer = new MockWebServer(); + apmServer.setDispatcher(new ApmDispatcher()); final HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger::info); loggingInterceptor.setLevel(JavaExecutable.isDebugging() ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.BASIC); @@ -105,9 +107,13 @@ public abstract class AbstractServletContainerIntegrationTest { .readTimeout(JavaExecutable.isDebugging() ? 0 : 10, TimeUnit.SECONDS) .build(); - mockServerContainer.start(); - mockServerContainer.getClient().when(request(INTAKE_V2_URL)).respond(HttpResponse.response().withStatusCode(200)); - mockServerContainer.getClient().when(request("/")).respond(HttpResponse.response().withStatusCode(200)); + // Start the mock apm server and expose it to any container as host.testcontainers.internal:$port + try { + apmServer.start(); + Testcontainers.exposeHostPorts(apmServer.getPort()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } } private final MockReporter mockReporter = new MockReporter(); @@ -150,7 +156,7 @@ protected AbstractServletContainerIntegrationTest(AgentTestContainer.AppServer c container .withNetwork(Network.SHARED) - .withEnv("ELASTIC_APM_SERVER_URL", "http://apm-server:1080") + .withEnv("ELASTIC_APM_SERVER_URL", "http://host.testcontainers.internal:" + apmServer.getPort()) .withEnv("ELASTIC_APM_IGNORE_URLS", ignoreUrlConfig) .withEnv("ELASTIC_APM_REPORT_SYNC", "true") .withEnv("ELASTIC_APM_LOG_LEVEL", "DEBUG") @@ -247,7 +253,7 @@ public void testAllScenarios() throws Exception { } public void clearMockServerLog() { - mockServerContainer.getClient().clear(HttpRequest.request(), ClearType.LOG); + receivedIntakeEvents.clear(); } public JsonNode assertTransactionReported(String pathToTest, int expectedResponseCode) { @@ -268,7 +274,7 @@ public JsonNode assertTransactionReported(String pathToTest, int expectedRespons } public void executeAndValidateRequest(String pathToTest, String expectedContent, Integer expectedResponseCode, - Map headersMap) throws IOException, InterruptedException { + Map headersMap) throws IOException, InterruptedException { final String responseString; try (Response response = executeRequest(pathToTest, headersMap)) { if (expectedResponseCode != null) { @@ -423,23 +429,20 @@ public List getEvents(String eventType) { try { final List events = new ArrayList<>(); final ObjectMapper objectMapper = new ObjectMapper(); - for (HttpRequest httpRequest : mockServerContainer.getClient().retrieveRecordedRequests(request(INTAKE_V2_URL))) { - final String bodyAsString = httpRequest.getBodyAsString(); - for (String ndJsonLine : bodyAsString.split("\n")) { - final JsonNode ndJson = objectMapper.readTree(ndJsonLine); - if (ndJson.get(eventType) != null) { - // as inferred spans are created only after the profiling session ends - // they can leak into another test - if (!isInferredSpan(ndJson.get(eventType))) { - validateEventMetadata(bodyAsString); - } - events.add(ndJson.get(eventType)); + for (String bodyAsString : receivedIntakeEvents) { + final JsonNode ndJson = objectMapper.readTree(bodyAsString); + if (ndJson.get(eventType) != null) { + // as inferred spans are created only after the profiling session ends + // they can leak into another test + if (!isInferredSpan(ndJson.get(eventType))) { + validateEventMetadata(bodyAsString); } + events.add(ndJson.get(eventType)); } } return events; } catch (IOException e) { - throw new RuntimeException(e); + throw new UncheckedIOException(e); } } @@ -458,7 +461,7 @@ private void validateEventMetadata(String bodyAsString) { } } } catch (IOException e) { - throw new RuntimeException(e); + throw new UncheckedIOException(e); } } @@ -509,4 +512,56 @@ private void waitFor(String path) { public OkHttpClient getHttpClient() { return httpClient; } + + /** + * This is modeled after {@code co.elastic.apm.awslambda.fakeserver.FakeApmServer}, except + * deflate instead of gzip and OkHttp instead of {@code com.sun.net.httpserver.HttpServer}. + */ + private static final class ApmDispatcher extends Dispatcher { + @Override + public MockResponse dispatch(RecordedRequest request) { + switch (request.getPath()) { + case "/": // health check + return new MockResponse().setBody("{\"version\": \"8.7.1\"}"); + case INTAKE_V2_URL: + case INTAKE_V2_FLUSH_URL: + try { + readIntakeEvents(request); + } catch (IOException e) { + logger.error("Encountered intake request error {}", e); + return new MockResponse().setResponseCode(500); + } + return new MockResponse().setResponseCode(202); + } + logger.error("Encountered unexpected request {}", request); + return new MockResponse().setResponseCode(404); + } + } + + private static void readIntakeEvents(RecordedRequest request) throws IOException { + // The request body is compressed with deflate + final Buffer body; + String encoding = request.getHeader("Content-Encoding"); + if (encoding == null) { + body = request.getBody().buffer(); + } else if (encoding.contains("deflate")) { + Buffer inflated = new Buffer(); + try (InflaterSource deflated = new InflaterSource(request.getBody(), new Inflater())) { + while (deflated.read(inflated, Integer.MAX_VALUE) != -1) ; + } + body = inflated; + } else { + throw new IOException("unsupported encoding: " + encoding); + } + + // read each Newline Delimited JSON event into the queue. + String event; + while ((event = body.readUtf8Line()) != null) { + if (!event.startsWith("{")) { + throw new IOException("not NDJSON " + request); + } else { + receivedIntakeEvents.add(event); + } + } + } } From 0b0082d92686c5ba4fedbc4a251bcefbdbf6b8f8 Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Mon, 17 Jun 2024 13:26:09 +0200 Subject: [PATCH 100/132] Remove unused API and resolve naming ambiguities (#3561) * Rename implementation versions of interfaces to reflect their state as non-API. * Merge main branch. * Fix test imports. * Fix plugin imports. * Fix plugin imports. --- .../AbstractMockApmServerBenchmark.java | 6 +- .../benchmark/LettuceActiveBenchmark.java | 4 +- .../benchmark/LettuceNotActiveBenchmark.java | 4 +- .../apm/agent/benchmark/SizeOfSpan.java | 16 +- .../objectpool/ObjectPoolBenchmark.java | 48 ++-- .../configuration/ConfigurationExporter.java | 3 +- .../ConfigurationExporterTest.java | 3 +- apm-agent-core/README.md | 2 +- .../apm/agent/bci/ElasticApmAgent.java | 35 ++- .../bci/bytebuddy/ErrorLoggingListener.java | 4 +- .../ExternalPluginClassLoader.java | 4 +- .../ApmServerConfigurationSource.java | 2 +- ...ration.java => CoreConfigurationImpl.java} | 15 +- ...ion.java => MetricsConfigurationImpl.java} | 3 +- ....java => ServerlessConfigurationImpl.java} | 5 +- .../apm/agent/configuration/StartupInfo.java | 10 +- .../apm/agent/impl/ActivationListener.java | 18 +- .../elastic/apm/agent/impl/ActiveStack.java | 46 +-- .../apm/agent/impl/ElasticApmTracer.java | 271 ++++++++++-------- .../agent/impl/ElasticApmTracerBuilder.java | 36 +-- ...asticContext.java => EmptyTraceState.java} | 16 +- .../co/elastic/apm/agent/impl/Tracer.java | 166 ----------- .../apm/agent/impl/TracerConfiguration.java | 4 +- .../agent/impl/baggage/BaggageContext.java | 24 +- .../{Baggage.java => BaggageImpl.java} | 27 +- .../impl/baggage/W3CBaggagePropagation.java | 26 +- .../apm/agent/impl/baggage/otel/Parser.java | 6 +- ...tContext.java => AbstractContextImpl.java} | 9 +- .../apm/agent/impl/context/BodyProcessor.java | 20 +- ...{CloudOrigin.java => CloudOriginImpl.java} | 13 +- .../impl/context/{Db.java => DbImpl.java} | 21 +- ...{Destination.java => DestinationImpl.java} | 28 +- .../impl/context/{Http.java => HttpImpl.java} | 17 +- .../{Message.java => MessageImpl.java} | 25 +- .../{Request.java => RequestImpl.java} | 35 +-- .../{Response.java => ResponseImpl.java} | 15 +- .../impl/context/SanitizingWebProcessor.java | 22 +- ...viceOrigin.java => ServiceOriginImpl.java} | 13 +- ...viceTarget.java => ServiceTargetImpl.java} | 19 +- .../context/{Socket.java => SocketImpl.java} | 7 +- ...{SpanContext.java => SpanContextImpl.java} | 20 +- ...ntext.java => TransactionContextImpl.java} | 26 +- .../impl/context/{Url.java => UrlImpl.java} | 17 +- .../impl/context/{User.java => UserImpl.java} | 13 +- ...rrorCapture.java => ErrorCaptureImpl.java} | 54 ++-- .../impl/metadata/CloudMetadataProvider.java | 34 +-- .../apm/agent/impl/metadata/MetaData.java | 24 +- .../metadata/{Node.java => NodeImpl.java} | 6 +- .../agent/impl/metadata/ServiceFactory.java | 12 +- .../{Service.java => ServiceImpl.java} | 26 +- .../apm/agent/impl/metadata/SystemInfo.java | 11 +- .../agent/impl/sampling/ConstantSampler.java | 4 +- .../impl/sampling/ProbabilitySampler.java | 8 +- .../apm/agent/impl/sampling/Sampler.java | 16 +- ....java => StacktraceConfigurationImpl.java} | 3 +- .../AbstractRefCountedContext.java | 2 +- ...bstractSpan.java => AbstractSpanImpl.java} | 75 ++--- .../impl/transaction/DroppedSpanStats.java | 18 +- .../impl/transaction/EpochTickClock.java | 2 +- .../transaction/{Faas.java => FaasImpl.java} | 19 +- ...{FaasTrigger.java => FaasTriggerImpl.java} | 9 +- .../impl/transaction/{Id.java => IdImpl.java} | 17 +- .../impl/transaction/SpanAtomicReference.java | 6 +- .../transaction/{Span.java => SpanImpl.java} | 85 +++--- ...raceContext.java => TraceContextImpl.java} | 95 +++--- .../agent/impl/transaction/TraceState.java | 2 +- ...lasticContext.java => TraceStateImpl.java} | 35 +-- ...extWrapper.java => TraceStateWrapper.java} | 26 +- ...{Transaction.java => TransactionImpl.java} | 67 ++--- .../transaction/UniqueSpanLinkArrayList.java | 20 +- .../agent/logging/ApmServerLogAppender.java | 6 +- .../logging/Log4j2ConfigurationFactory.java | 26 +- ...ion.java => LoggingConfigurationImpl.java} | 5 +- .../apm/agent/metrics/MetricRegistry.java | 14 +- .../elastic/apm/agent/metrics/MetricSet.java | 3 +- .../metrics/builtin/AgentOverheadMetrics.java | 6 +- .../metrics/builtin/AgentReporterMetrics.java | 4 +- ...bjectHandle.java => ObjectHandleImpl.java} | 20 +- ...actory.java => ObjectPoolFactoryImpl.java} | 54 ++-- ...ectPool.java => ObservableObjectPool.java} | 2 +- .../objectpool/impl/AbstractObjectPool.java | 4 +- .../report/AbstractIntakeApiHandler.java | 4 +- .../apm/agent/report/ApmServerClient.java | 16 +- .../apm/agent/report/ApmServerReporter.java | 42 +-- .../report/IntakeV2ReportingEventHandler.java | 2 +- .../report/PartialTransactionReporter.java | 12 +- .../co/elastic/apm/agent/report/Reporter.java | 14 +- ...on.java => ReporterConfigurationImpl.java} | 7 +- .../apm/agent/report/ReporterFactory.java | 12 +- .../apm/agent/report/ReportingEvent.java | 24 +- .../apm/agent/report/processor/Processor.java | 14 +- .../report/serialize/DslJsonSerializer.java | 134 ++++----- .../serialize/MetricRegistryReporter.java | 4 +- .../serialize/SerializationConstants.java | 4 +- .../TraceMethodInstrumentation.java | 24 +- .../ProfilerSharedMemoryWriter.java | 8 +- .../SpanProfilingSamplesCorrelator.java | 22 +- .../UniversalProfilingIntegration.java | 31 +- .../co/elastic/apm/agent/util/ThreadDump.java | 4 +- ...al.pooling.ObjectPooling$ObjectPoolFactory | 2 +- ....configuration.ConfigurationOptionProvider | 12 +- .../agent/AbstractInstrumentationTest.java | 14 +- .../co/elastic/apm/agent/MockReporter.java | 100 +++---- .../elastic/apm/agent/TransactionUtils.java | 44 +-- .../apm/agent/bci/InstrumentationTest.java | 16 +- ...eferencedCountedConcurrentHashMapTest.java | 22 +- .../ApmServerConfigurationSourceTest.java | 6 +- .../configuration/CoreConfigurationTest.java | 30 +- .../agent/configuration/StartupInfoTest.java | 10 +- .../apm/agent/impl/DiscardSpanTest.java | 50 ++-- .../impl/ElasticApmTracerBuilderTest.java | 14 +- .../impl/ElasticApmTracerShutdownTest.java | 4 +- .../apm/agent/impl/ElasticApmTracerTest.java | 151 +++++----- .../elastic/apm/agent/impl/LifecycleTest.java | 6 +- .../apm/agent/impl/SpanTypeBreakdownTest.java | 58 ++-- .../impl/baggage/BaggageBuilderTest.java | 16 +- .../baggage/W3CBaggagePropagationTest.java | 18 +- .../circuitbreaker/CircuitBreakerTest.java | 4 +- .../agent/impl/context/BodyProcessorTest.java | 56 ++-- .../agent/impl/context/DestinationTest.java | 18 +- .../apm/agent/impl/context/MessageTest.java | 10 +- .../context/SanitizingWebProcessorTest.java | 14 +- .../impl/context/ServiceResourceTest.java | 20 +- .../agent/impl/context/ServiceTargetTest.java | 38 +-- .../impl/context/TransactionContextTest.java | 18 +- .../apm/agent/impl/context/UrlTest.java | 30 +- .../apm/agent/impl/metadata/MetaDataMock.java | 6 +- .../apm/agent/impl/metadata/MetaDataTest.java | 34 +-- .../agent/impl/metadata/SystemInfoTest.java | 6 +- .../impl/sampling/ProbabilitySamplerTest.java | 8 +- .../StacktraceConfigurationTest.java | 10 +- .../AbstractCompressionStrategyTest.java | 76 ++--- .../agent/impl/transaction/BaggageTest.java | 64 ++--- .../ExactMatchCompressionStrategyTest.java | 6 +- .../impl/transaction/FastExitSpanTest.java | 24 +- .../apm/agent/impl/transaction/IdTest.java | 8 +- .../SameKindCompressionStrategyTest.java | 6 +- .../impl/transaction/SpanCompressionIT.java | 16 +- .../apm/agent/impl/transaction/SpanTest.java | 38 +-- .../impl/transaction/TraceContextTest.java | 212 +++++++------- .../impl/transaction/TraceContextW3CTest.java | 2 +- .../TraceContinuationStrategyTest.java | 26 +- .../impl/transaction/TransactionTest.java | 28 +- .../logging/ApmServerLogAppenderTest.java | 4 +- .../logging/LoggingConfigurationTest.java | 2 +- .../apm/agent/metrics/MetricRegistryTest.java | 12 +- .../builtin/AgentOverheadMetricsTest.java | 12 +- .../builtin/AgentReporterMetricsTest.java | 12 +- .../metrics/builtin/CGroupMetricsTest.java | 6 +- .../metrics/builtin/JvmFdMetricsTest.java | 8 +- .../metrics/builtin/JvmMemoryMetricsTest.java | 6 +- .../metrics/builtin/SystemMetricsTest.java | 6 +- .../metrics/builtin/ThreadMetricsTest.java | 6 +- .../apm/agent/objectpool/ObjectPoolTest.java | 2 +- .../objectpool/TestObjectPoolFactory.java | 46 +-- .../objectpool/impl/BookkeeperObjectPool.java | 12 +- .../impl/BookkeeperObjectPoolTest.java | 4 +- .../impl/QueueBasedObjectPoolTest.java | 4 +- .../report/ApmServerClientProxySupportIT.java | 2 +- .../apm/agent/report/ApmServerClientTest.java | 34 +-- .../ApmServerReporterIntegrationTest.java | 56 ++-- .../IntakeV2ReportingEventHandlerTest.java | 30 +- .../agent/report/PartialTransactionTest.java | 24 +- .../apm/agent/report/ReporterFactoryTest.java | 22 +- .../apm/agent/report/TestProcessor.java | 8 +- .../serialize/DslJsonSerializerTest.java | 198 +++++++------ .../serialize/MetricSetSerializationTest.java | 6 +- .../serialize/SerializationConstantsTest.java | 4 +- .../assertions/AbstractSpanAssert.java | 16 +- .../testutils/assertions/Assertions.java | 28 +- .../testutils/assertions/BaggageAssert.java | 6 +- .../agent/testutils/assertions/DbAssert.java | 6 +- .../assertions/DestinationAssert.java | 6 +- .../assertions/ElasticContextAssert.java | 4 +- .../assertions/ServiceTargetAssert.java | 6 +- .../testutils/assertions/SpanAssert.java | 6 +- .../TraceMethodInstrumentationTest.java | 16 +- .../UniversalProfilingIntegrationTest.java | 52 ++-- .../example/stacktrace/ErrorCaptureTest.java | 60 ++-- .../StacktraceSerializationTest.java | 14 +- .../java/specs/OutcomeStepsDefinitions.java | 16 +- .../src/test/java/specs/ScenarioState.java | 20 +- .../sdk/bytebuddy/MethodHierarchyMatcher.java | 2 +- .../AbstractApacheHttpClientAdvice.java | 8 +- .../AbstractApacheHttpClientAsyncAdvice.java | 6 +- .../common/ApacheHttpClientAsyncHelper.java | 4 +- .../v3/HttpClient3Instrumentation.java | 4 +- ...LegacyApacheHttpClientInstrumentation.java | 4 +- .../helper/ApacheHttpClient4AsyncHelper.java | 4 +- .../HttpAsyncRequestProducerWrapper.java | 6 +- ...cheHttpAsyncClientInstrumentationTest.java | 4 +- .../helper/ApacheHttpClient5AsyncHelper.java | 6 +- .../helper/AsyncRequestProducerWrapper.java | 6 +- .../v5/helper/RequestChannelWrapper.java | 6 +- ...cheHttpAsyncClientInstrumentationTest.java | 6 +- apm-agent-plugins/apm-api-plugin/pom.xml | 1 - .../AbstractSpanInstrumentation.java | 106 +++---- .../pluginapi/ApiScopeInstrumentation.java | 6 +- .../pluginapi/CaptureSpanInstrumentation.java | 13 +- .../CaptureTransactionInstrumentation.java | 6 +- .../ElasticApmApiInstrumentation.java | 6 +- .../pluginapi/LegacySpanInstrumentation.java | 9 +- .../pluginapi/TracedInstrumentation.java | 10 +- .../pluginapi/TransactionInstrumentation.java | 40 ++- .../pluginapi/ConfigInstrumentationTest.java | 7 +- .../pluginapi/SpanInstrumentationTest.java | 20 +- .../apm/api/AbstractSpanImplAccessor.java | 4 +- .../co/elastic/apm/api/AnnotationApiTest.java | 6 +- .../apm/api/AnnotationInheritanceTest.java | 4 +- .../BlockingQueueContextPropagationTest.java | 8 +- .../api/ElasticApmApiInstrumentationTest.java | 28 +- .../apm/api/SpanDestinationApiTest.java | 9 +- .../elastic/apm/api/SpanDiscardingTest.java | 7 +- .../java/co/elastic/apm/api/SpanExitTest.java | 22 +- ...bstractAsyncHttpClientInstrumentation.java | 4 +- .../apm/agent/awssdk/v1/helper/SQSHelper.java | 4 +- .../apm/agent/awssdk/v1/DynamoDbClientIT.java | 11 +- .../apm/agent/awssdk/v1/S3ClientIT.java | 5 +- .../apm/agent/awssdk/v1/SQSClientIT.java | 16 +- .../apm/agent/awssdk/v1/SQSJmsClientIT.java | 42 ++- .../apm/agent/awssdk/v2/helper/SQSHelper.java | 6 +- ...eSyncClientHandlerInstrumentationTest.java | 8 +- .../apm/agent/awssdk/v2/DynamoDbClientIT.java | 13 +- .../apm/agent/awssdk/v2/S3ClientIT.java | 7 +- .../apm/agent/awssdk/v2/SQSClientIT.java | 22 +- .../apm/agent/awssdk/v2/SQSJmsClientIT.java | 42 ++- .../awssdk/common/AbstractAwsClientIT.java | 20 +- .../awssdk/common/AbstractSQSClientIT.java | 56 ++-- .../agent/awslambda/AbstractLambdaTest.java | 29 +- .../awslambda/AbstractPlainLambdaTest.java | 8 +- .../AbstractStreamHandlerLambdaTest.java | 10 +- .../awslambda/ApiGatewayV1LambdaTest.java | 30 +- .../awslambda/ApiGatewayV2LambdaTest.java | 32 +-- ...ionLoadBalancerRequestEventLambdaTest.java | 32 +-- .../awslambda/BaseGatewayLambdaTest.java | 10 +- .../agent/awslambda/S3EventLambdaTest.java | 18 +- .../agent/awslambda/SNSEventLambdaTest.java | 30 +- .../agent/awslambda/SQSEventLambdaTest.java | 30 +- .../Cassandra3InstrumentationIT.java | 12 +- .../Cassandra4InstrumentationIT.java | 12 +- .../AbstractDubboInstrumentationTest.java | 40 +-- .../AlibabaDubboInstrumentationTest.java | 18 +- .../dubbo/ApacheDubboInstrumentationTest.java | 34 +-- .../agent/ecs_logging/EcsLoggingUtils.java | 4 +- .../EcsServiceEnvironmentTest.java | 4 +- .../agent/ecs_logging/EcsServiceNameTest.java | 4 +- .../ecs_logging/EcsServiceVersionTest.java | 4 +- .../jul/JulEcsMdcInstrumentationTest.java | 8 +- ...sticsearchRestClientInstrumentationIT.java | 6 +- ...bstractEs6_4ClientInstrumentationTest.java | 6 +- ...tClientInstrumentationIT_RealReporter.java | 32 +-- ...sticsearchRestClientInstrumentationIT.java | 14 +- .../v8_x/Elasticsearch8JavaIT.java | 14 +- .../AbstractEsClientInstrumentationTest.java | 32 +-- ...chRestClientInstrumentationHelperTest.java | 24 +- ...naglePayloadSizeFilterInstrumentation.java | 5 +- .../FinagleHttpClientTest.java | 8 +- ...ilsTransactionNameInstrumentationTest.java | 4 +- .../co/elastic/apm/agent/grpc/GrpcHelper.java | 6 +- ...AbstractGrpcClientInstrumentationTest.java | 20 +- .../grpc/AbstractGrpcContextHeadersTest.java | 18 +- ...AbstractGrpcServerInstrumentationTest.java | 14 +- .../HibernateSearchHelper.java | 4 +- .../HibernateSearchAssertionHelper.java | 4 +- .../agent/httpclient/HttpClientHelper.java | 6 +- ...AbstractHttpClientInstrumentationTest.java | 47 ++- .../httpclient/HttpClientHelperTest.java | 24 +- ...BaseServerEndpointInstrumentationTest.java | 12 +- .../apm/agent/concurrent/JavaConcurrent.java | 16 +- ...leCallableForkJoinTaskInstrumentation.java | 5 +- .../AsyncTraceMethodInstrumentationTest.java | 8 +- .../concurrent/ExcludedExecutorClassTest.java | 4 +- .../ExecutorInstrumentationTest.java | 20 +- .../ExecutorServiceDoubleWrappingTest.java | 10 +- .../ExecutorServiceInstrumentationTest.java | 32 +-- .../agent/concurrent/ForkJoinPoolTest.java | 12 +- .../ScheduledExecutorServiceTest.java | 14 +- .../agent/concurrent/ScopeManagementTest.java | 24 +- .../agent/java_ldap/LdapClientAdviceTest.java | 18 +- .../javalin/JavalinInstrumentationTest.java | 16 +- ...xRsTransactionNameInstrumentationTest.java | 4 +- ...xRsTransactionNameInstrumentationTest.java | 4 +- ...nsactionNameInstrumentationTestHelper.java | 36 +-- .../AbstractJaxWsInstrumentationTest.java | 4 +- .../apm/agent/jdbc/helper/JdbcHelper.java | 4 +- .../jdbc/AbstractJdbcInstrumentationTest.java | 30 +- .../jdbc/helper/ConnectionMetaDataTest.java | 4 +- .../apm/agent/httpserver/HttpHandlerTest.java | 24 +- .../jms/jakarta/JmsInstrumentationIT.java | 76 ++--- .../jms/jakarta/JmsMessageListenerTest.java | 21 +- .../JmsMessagePropertyAccessorTest.java | 6 +- .../java/testapp/TestMessageListener.java | 10 +- .../src/test/java/testapp/TestMsgHandler.java | 10 +- .../agent/jms/javax/JmsInstrumentationIT.java | 76 ++--- .../jms/javax/JmsMessageListenerTest.java | 21 +- .../javax/JmsMessagePropertyAccessorTest.java | 6 +- .../java/testapp/TestMessageListener.java | 10 +- .../src/test/java/testapp/TestMsgHandler.java | 10 +- .../agent/jms/JmsInstrumentationHelper.java | 4 +- .../agent/jms/javax/spring/SpringJmsTest.java | 22 +- .../spring/SpringMapMessageListener.java | 4 +- ...actJsfLifecycleExecuteInstrumentation.java | 4 +- ...ractJsfLifecycleRenderInstrumentation.java | 4 +- .../kafka/KafkaConsumerInstrumentation.java | 4 +- .../apm/agent/kafka/KafkaLegacyClientIT.java | 44 +-- .../KafkaInstrumentationHeadersHelper.java | 4 +- .../co/elastic/apm/agent/kafka/KafkaIT.java | 82 +++--- .../apm/agent/kafka/KafkaIT_RealReporter.java | 20 +- .../apm/agent/kafka/KafkaLegacyBrokerIT.java | 64 ++--- .../apm/agent/kafka/KafkaSpringIT.java | 28 +- ...ManagerCorrelationInstrumentationTest.java | 14 +- ...LoggingCorrelationInstrumentationTest.java | 14 +- .../log4j2/Log4j2InstrumentationTest.java | 6 +- .../Log4j2InstrumentationTestVersions.java | 4 +- .../AbstractEcsReformattingHelper.java | 3 - .../loginstr/LoggingInstrumentationTest.java | 26 +- .../CorrelationIdMapAdapterTest.java | 10 +- ...stractErrorLoggingInstrumentationTest.java | 4 +- .../loginstr/reformatting/UtilsTest.java | 6 +- .../MicrometerConfigInstrumentationTest.java | 8 +- .../MicrometerInstrumentationStepTest.java | 6 +- .../MicrometerInstrumentationTest.java | 8 +- ...MicrometerMeterRegistrySerializerTest.java | 4 +- .../MicrometerMetricsReporterTest.java | 14 +- .../AbstractMongoClientInstrumentationIT.java | 13 +- .../OkHttp3ClientAsyncInstrumentation.java | 4 +- .../okhttp/OkHttp3ClientInstrumentation.java | 4 +- .../OkHttpClientAsyncInstrumentation.java | 4 +- .../okhttp/OkHttpClientInstrumentation.java | 4 +- .../proxy/ProxyDoubleHistogramBuilder.java | 4 +- .../proxy/ProxyLongHistogramBuilder.java | 4 +- .../AbstractOtelMetricsTest.java | 20 +- .../otelmetricsdk/MetricExportTimingTest.java | 4 +- .../PrivateUserSdkOtelMetricsTest.java | 4 +- .../WithSpanInstrumentation.java | 14 +- .../opentelemetry/baggage/OtelBaggage.java | 13 +- .../context/OTelContextStorage.java | 4 +- .../tracing/OTelBridgeContext.java | 18 +- .../agent/opentelemetry/tracing/OTelSpan.java | 35 +-- .../tracing/OTelSpanBuilder.java | 20 +- .../tracing/OTelSpanContext.java | 8 +- .../EmbeddedMetricSDKShutdownTest.java | 4 +- .../ElasticOpenTelemetryAnnotationsTest.java | 15 +- .../tracing/ElasticOpenTelemetryTest.java | 51 ++-- .../tracing/OTelSpanDiscardingTest.java | 7 +- .../tracing/OTelSpanLinkTest.java | 8 +- .../specs/OTelBridgeStepsDefinitions.java | 43 ++- apm-agent-plugins/apm-opentelemetry/pom.xml | 1 - .../apm-opentracing-plugin/pom.xml | 1 - .../ApmScopeInstrumentation.java | 6 +- .../ApmSpanBuilderInstrumentation.java | 32 +-- .../ApmSpanInstrumentation.java | 42 +-- .../ElasticApmTracerInstrumentation.java | 4 +- .../ExternalSpanContextInstrumentation.java | 14 +- .../ScopeManagerInstrumentation.java | 6 +- .../SpanContextInstrumentation.java | 18 +- .../apm/agent/process/ProcessHelper.java | 6 +- .../process/ProcessStartInstrumentation.java | 4 +- .../CommonsExecAsyncInstrumentationTest.java | 12 +- .../apm/agent/process/ProcessHelperTest.java | 16 +- .../apm-profiling-plugin/pom.xml | 1 - .../elastic/apm/agent/profiler/CallTree.java | 53 ++-- .../profiler/ProfilingActivationListener.java | 10 +- .../apm/agent/profiler/SamplingProfiler.java | 48 ++-- .../agent/profiler/CallTreeSpanifyTest.java | 28 +- .../apm/agent/profiler/CallTreeTest.java | 47 ++- .../profiler/SamplingProfilerQueueTest.java | 8 +- .../profiler/SamplingProfilerReplay.java | 3 +- .../agent/profiler/SamplingProfilerTest.java | 26 +- ...JobTransactionNameInstrumentationTest.java | 14 +- ...JobTransactionNameInstrumentationTest.java | 8 +- ...JobTransactionNameInstrumentationTest.java | 8 +- .../rabbitmq/ChannelInstrumentation.java | 4 +- .../apm/agent/rabbitmq/RabbitMQIT.java | 108 ++++--- .../agent/rabbitmq/AbstractRabbitMqTest.java | 33 ++- .../elastic/apm/agent/rabbitmq/FanoutIT.java | 12 +- .../apm/agent/rabbitmq/SpringAmqpBatchIT.java | 44 +-- .../apm/agent/reactor/TracedSubscriber.java | 28 +- .../agent/reactor/TracedSubscriberTest.java | 18 +- .../AbstractRedisInstrumentationTest.java | 26 +- .../FutureInstrumentation.java | 11 +- .../FutureInstrumentationSpec.scala | 6 +- .../AbstractScheduledInstrumentationTest.java | 12 +- ...ledTransactionNameInstrumentationTest.java | 8 +- ...ledTransactionNameInstrumentationTest.java | 8 +- .../TimerTaskInstrumentationTest.java | 10 +- .../servlet/JakartaAsyncServletTest.java | 8 +- .../JakartaServletInstrumentationTest.java | 14 +- .../apm/agent/servlet/ServletApiAdvice.java | 4 +- .../servlet/ServletServiceNameHelper.java | 8 +- .../apm/agent/servlet/ApmFilterTest.java | 26 +- .../apm/agent/servlet/AsyncServletTest.java | 8 +- .../InitServiceNameInstrumentationTest.java | 4 +- .../servlet/ServletInstrumentationTest.java | 16 +- .../servlet/ServletTransactionHelperTest.java | 10 +- .../servlet/TestRequestBodyCapturing.java | 28 +- .../apm/agent/sparkjava/RoutesAdviceTest.java | 4 +- .../agent/resttemplate/FeignClientTest.java | 12 +- .../SprintRestTemplateIntegration.java | 12 +- ...ClientExchangeFunctionInstrumentation.java | 5 +- .../TransactionAwareSubscriber.java | 4 +- .../AbstractServerInstrumentationTest.java | 38 +-- .../springwebflux/ServletContainerTest.java | 4 +- .../apm-spring-webflux-testapp/pom.xml | 6 + .../testapp/GreetingAnnotated.java | 9 +- .../testapp/GreetingFunctional.java | 9 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 6 - ...tractSpringServiceNameInstrumentation.java | 10 +- ...ingTransactionNameInstrumentationTest.java | 4 +- ...ctExceptionHandlerInstrumentationTest.java | 4 +- ...trumentationWithExceptionResolverTest.java | 4 +- ...strumentationWithExceptionHandlerTest.java | 4 +- ...erInstrumentationWithGlobalAdviceTest.java | 4 +- ...tractViewRenderingInstrumentationTest.java | 4 +- .../apm/agent/struts/ActionProxyAdvice.java | 4 +- .../agent/struts/ActionProxyAdviceTest.java | 12 +- .../HttpUrlConnectionInstrumentation.java | 5 +- .../HttpUrlConnectionInstrumentationTest.java | 12 +- .../vertx/AbstractVertxWebClientHelper.java | 12 +- .../agent/vertx/GenericHandlerWrapper.java | 8 +- .../apm/agent/vertx/SetTimerWrapper.java | 6 +- .../vertx/helper/AbstractVertxWebTest.java | 14 +- .../helper/CommonVertxServerClientTest.java | 24 +- .../vertx/helper/CommonVertxWebTest.java | 64 ++--- .../helper/HandlerWithCustomNamedSpan.java | 8 +- .../webclient/AbstractVertxWebClientTest.java | 8 +- .../webclient/HttpContextInstrumentation.java | 8 +- .../agent/tracer/BaggageContextBuilder.java | 2 +- .../apm/agent/tracer/GlobalTracer.java | 22 +- ...lasticContext.java => NoopTraceState.java} | 8 +- .../elastic/apm/agent/tracer/NoopTracer.java | 22 +- .../{ElasticContext.java => TraceState.java} | 4 +- .../co/elastic/apm/agent/tracer/Tracer.java | 25 +- .../StacktraceConfiguration.java | 1 + .../tracer/service/ServiceAwareTracer.java | 33 --- .../opentracing/OpenTracingBridgeTest.java | 67 ++--- docs/troubleshooting.asciidoc | 8 +- .../servlet/tests/ExternalPluginTestApp.java | 3 +- .../plugin/PluginInstrumentationTest.java | 10 +- .../apm/spring/boot/SpringBoot1_5IT.java | 6 +- .../spring/boot/AbstractSpringBootTest.java | 8 +- 441 files changed, 4126 insertions(+), 4300 deletions(-) rename apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/{CoreConfiguration.java => CoreConfigurationImpl.java} (98%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/{MetricsConfiguration.java => MetricsConfigurationImpl.java} (97%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/{ServerlessConfiguration.java => ServerlessConfigurationImpl.java} (92%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/{EmptyElasticContext.java => EmptyTraceState.java} (73%) delete mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/impl/Tracer.java rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/{Baggage.java => BaggageImpl.java} (89%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{AbstractContext.java => AbstractContextImpl.java} (89%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{CloudOrigin.java => CloudOriginImpl.java} (83%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Db.java => DbImpl.java} (88%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Destination.java => DestinationImpl.java} (84%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Http.java => HttpImpl.java} (83%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Message.java => MessageImpl.java} (82%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Request.java => RequestImpl.java} (86%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Response.java => ResponseImpl.java} (85%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{ServiceOrigin.java => ServiceOriginImpl.java} (83%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{ServiceTarget.java => ServiceTargetImpl.java} (87%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Socket.java => SocketImpl.java} (85%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{SpanContext.java => SpanContextImpl.java} (77%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{TransactionContext.java => TransactionContextImpl.java} (81%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{Url.java => UrlImpl.java} (94%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/{User.java => UserImpl.java} (87%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/{ErrorCapture.java => ErrorCaptureImpl.java} (83%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/{Node.java => NodeImpl.java} (90%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/{Service.java => ServiceImpl.java} (86%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/{StacktraceConfiguration.java => StacktraceConfigurationImpl.java} (97%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{AbstractSpan.java => AbstractSpanImpl.java} (90%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{Faas.java => FaasImpl.java} (82%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{FaasTrigger.java => FaasTriggerImpl.java} (84%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{Id.java => IdImpl.java} (94%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{Span.java => SpanImpl.java} (88%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{TraceContext.java => TraceContextImpl.java} (89%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{ElasticContext.java => TraceStateImpl.java} (79%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{ElasticContextWrapper.java => TraceStateWrapper.java} (82%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/{Transaction.java => TransactionImpl.java} (89%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/logging/{LoggingConfiguration.java => LoggingConfigurationImpl.java} (98%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/{ObjectHandle.java => ObjectHandleImpl.java} (67%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/{ObjectPoolFactory.java => ObjectPoolFactoryImpl.java} (54%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/{ObjectPool.java => ObservableObjectPool.java} (87%) rename apm-agent-core/src/main/java/co/elastic/apm/agent/report/{ReporterConfiguration.java => ReporterConfigurationImpl.java} (97%) rename apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/{NoopElasticContext.java => NoopTraceState.java} (91%) rename apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/{ElasticContext.java => TraceState.java} (97%) delete mode 100644 apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/service/ServiceAwareTracer.java diff --git a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/AbstractMockApmServerBenchmark.java b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/AbstractMockApmServerBenchmark.java index de5de5b823..10e42b5749 100644 --- a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/AbstractMockApmServerBenchmark.java +++ b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/AbstractMockApmServerBenchmark.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.benchmark; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; import io.undertow.Undertow; @@ -79,8 +79,8 @@ public void setUp(Blackhole blackhole) throws IOException { tracer = new ElasticApmTracerBuilder() .configurationRegistry(ConfigurationRegistry.builder() .addConfigSource(new SimpleSource() - .add(CoreConfiguration.SERVICE_NAME, "benchmark") - .add(CoreConfiguration.INSTRUMENT, Boolean.toString(apmEnabled)) + .add(CoreConfigurationImpl.SERVICE_NAME, "benchmark") + .add(CoreConfigurationImpl.INSTRUMENT, Boolean.toString(apmEnabled)) .add("active", Boolean.toString(apmEnabled)) .add("api_request_size", "10mb") .add("capture_headers", "false") diff --git a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceActiveBenchmark.java b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceActiveBenchmark.java index 043babcc31..c970d16ee2 100644 --- a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceActiveBenchmark.java +++ b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceActiveBenchmark.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.benchmark; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.runner.RunnerException; @@ -34,7 +34,7 @@ public LettuceActiveBenchmark() { @Benchmark public String benchmarkLettuce() { - Transaction transaction = tracer.startRootTransaction(null).withName("transaction").activate(); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("transaction").activate(); try { return sync.get("foo"); } finally { diff --git a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceNotActiveBenchmark.java b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceNotActiveBenchmark.java index 1b1249d51e..7e5c5bec5b 100644 --- a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceNotActiveBenchmark.java +++ b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/LettuceNotActiveBenchmark.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.benchmark; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.runner.RunnerException; @@ -36,7 +36,7 @@ public LettuceNotActiveBenchmark() { @Threads(4) @Benchmark public String benchmarkLettuce() { - Transaction transaction = tracer.startRootTransaction(null).withName("transaction").activate(); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("transaction").activate(); try { return sync.get("foo"); } finally { diff --git a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/SizeOfSpan.java b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/SizeOfSpan.java index 13795b1d4e..5c9e9c6cb8 100644 --- a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/SizeOfSpan.java +++ b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/SizeOfSpan.java @@ -20,10 +20,10 @@ 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.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.util.MathUtils; import org.ehcache.sizeof.SizeOf; @@ -32,15 +32,15 @@ public class SizeOfSpan { public static void main(String[] args) { final SizeOf sizeOf = SizeOf.newInstance(); ElasticApmTracer tracer = new ElasticApmTracerBuilder().buildAndStart(); - final long sizeOfSpan = sizeOf.deepSizeOf(new Span(tracer)); - final long sizeOfTransaction = sizeOf.deepSizeOf(new Transaction(tracer)); - final long sizeOfError = sizeOf.deepSizeOf(new ErrorCapture(tracer)); + final long sizeOfSpan = sizeOf.deepSizeOf(new SpanImpl(tracer)); + final long sizeOfTransaction = sizeOf.deepSizeOf(new TransactionImpl(tracer)); + final long sizeOfError = sizeOf.deepSizeOf(new ErrorCaptureImpl(tracer)); System.out.println("sizeof span: " + sizeOfSpan); System.out.println("sizeof transaction: " + sizeOfTransaction); System.out.println("sizeof error: " + sizeOfError); - final int queueSize = MathUtils.getNextPowerOf2(new ReporterConfiguration().getMaxQueueSize()); + final int queueSize = MathUtils.getNextPowerOf2(new ReporterConfigurationImpl().getMaxQueueSize()); final long sizeOfObjectPools = queueSize * 2 * sizeOfSpan + queueSize * 2 * sizeOfTransaction + queueSize * sizeOfError; diff --git a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/objectpool/ObjectPoolBenchmark.java b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/objectpool/ObjectPoolBenchmark.java index d1742cf30a..43850b3d1e 100644 --- a/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/objectpool/ObjectPoolBenchmark.java +++ b/apm-agent-benchmarks/src/main/java/co/elastic/apm/agent/benchmark/objectpool/ObjectPoolBenchmark.java @@ -21,8 +21,8 @@ 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.ObjectPool; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; import co.elastic.apm.agent.objectpool.impl.ThreadLocalObjectPool; import org.agrona.concurrent.ManyToManyConcurrentArrayQueue; @@ -45,11 +45,11 @@ public class ObjectPoolBenchmark extends AbstractBenchmark { private ElasticApmTracer tracer; - private ObjectPool blockingQueueObjectPool; - private ObjectPool agronaQueueObjectPool; - private ObjectPool threadLocalObjectPool; - private ObjectPool jctoolsQueueObjectPool; - private ObjectPool jctoolsAtomicQueueObjectPool; + private ObservableObjectPool blockingQueueObjectPool; + private ObservableObjectPool agronaQueueObjectPool; + private ObservableObjectPool threadLocalObjectPool; + private ObservableObjectPool jctoolsQueueObjectPool; + private ObservableObjectPool jctoolsAtomicQueueObjectPool; public static void main(String[] args) throws RunnerException { run(ObjectPoolBenchmark.class); @@ -58,11 +58,11 @@ public static void main(String[] args) throws RunnerException { @Setup public void setUp() { tracer = new ElasticApmTracerBuilder().buildAndStart(); - blockingQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new ArrayBlockingQueue<>(256), true, () -> new Transaction(tracer)); - jctoolsQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcArrayQueue<>(256), true, () -> new Transaction(tracer)); - jctoolsAtomicQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue<>(256), true, () -> new Transaction(tracer)); - agronaQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new ManyToManyConcurrentArrayQueue<>(256), true, () -> new Transaction(tracer)); - threadLocalObjectPool = new ThreadLocalObjectPool<>(64, true, () -> new Transaction(tracer)); + blockingQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new ArrayBlockingQueue<>(256), true, () -> new TransactionImpl(tracer)); + jctoolsQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcArrayQueue<>(256), true, () -> new TransactionImpl(tracer)); + jctoolsAtomicQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue<>(256), true, () -> new TransactionImpl(tracer)); + agronaQueueObjectPool = QueueBasedObjectPool.ofRecyclable(new ManyToManyConcurrentArrayQueue<>(256), true, () -> new TransactionImpl(tracer)); + threadLocalObjectPool = new ThreadLocalObjectPool<>(64, true, () -> new TransactionImpl(tracer)); } @TearDown @@ -72,46 +72,46 @@ public void tearDown() { // @Benchmark @Threads(8) - public Transaction testNewOperator() { - return new Transaction(tracer); + public TransactionImpl testNewOperator() { + return new TransactionImpl(tracer); } @Benchmark @Threads(8) - public Transaction testJctoolsAtomicQueueObjectPool() { - Transaction transaction = jctoolsAtomicQueueObjectPool.createInstance(); + public TransactionImpl testJctoolsAtomicQueueObjectPool() { + TransactionImpl transaction = jctoolsAtomicQueueObjectPool.createInstance(); jctoolsAtomicQueueObjectPool.recycle(transaction); return transaction; } // @Benchmark @Threads(8) - public Transaction testArgonaQueueObjectPool() { - Transaction transaction = agronaQueueObjectPool.createInstance(); + public TransactionImpl testArgonaQueueObjectPool() { + TransactionImpl transaction = agronaQueueObjectPool.createInstance(); agronaQueueObjectPool.recycle(transaction); return transaction; } @Benchmark @Threads(8) - public Transaction testJctoolsQueueObjectPool() { - Transaction transaction = jctoolsQueueObjectPool.createInstance(); + public TransactionImpl testJctoolsQueueObjectPool() { + TransactionImpl transaction = jctoolsQueueObjectPool.createInstance(); jctoolsQueueObjectPool.recycle(transaction); return transaction; } //@Benchmark @Threads(8) - public Transaction testBlockingQueueObjectPool() { - Transaction transaction = blockingQueueObjectPool.createInstance(); + public TransactionImpl testBlockingQueueObjectPool() { + TransactionImpl transaction = blockingQueueObjectPool.createInstance(); blockingQueueObjectPool.recycle(transaction); return transaction; } // @Benchmark @Threads(8) - public Transaction testThreadLocalObjectPool() { - Transaction transaction = threadLocalObjectPool.createInstance(); + public TransactionImpl testThreadLocalObjectPool() { + TransactionImpl transaction = threadLocalObjectPool.createInstance(); threadLocalObjectPool.recycle(transaction); return transaction; } diff --git a/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporter.java b/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporter.java index 811054c294..c446b7d6b6 100644 --- a/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporter.java +++ b/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporter.java @@ -20,7 +20,6 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.Tracer; import org.stagemonitor.configuration.ConfigurationOptionProvider; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -39,7 +38,7 @@ public class ConfigurationExporter { public static void main(String[] args) throws Exception { ElasticApmTracer tracer = mock(ElasticApmTracer.class); doReturn(tracer).when(tracer).require(ElasticApmTracer.class); - doReturn(Tracer.TracerState.UNINITIALIZED).when(tracer).getState(); + doReturn(ElasticApmTracer.TracerState.UNINITIALIZED).when(tracer).getState(); GlobalTracer.init(tracer); try { ConfigurationRegistry configurationRegistry = ConfigurationRegistry.builder() diff --git a/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java b/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java index 162fd1155d..dca098e68e 100644 --- a/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java +++ b/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java @@ -21,7 +21,6 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.util.DependencyInjectingServiceLoader; import freemarker.template.Configuration; @@ -89,7 +88,7 @@ void setUp() { renderedDocumentationPath = Paths.get("../../docs/configuration.asciidoc"); ElasticApmTracer tracer = mock(ElasticApmTracer.class); doReturn(tracer).when(tracer).require(ElasticApmTracer.class); - doReturn(Tracer.TracerState.UNINITIALIZED).when(tracer).getState(); + doReturn(ElasticApmTracer.TracerState.UNINITIALIZED).when(tracer).getState(); GlobalTracer.init(tracer); configurationRegistry = ConfigurationRegistry.builder() .optionProviders(ServiceLoader.load(ConfigurationOptionProvider.class)) diff --git a/apm-agent-core/README.md b/apm-agent-core/README.md index d2c704efd0..470b964141 100644 --- a/apm-agent-core/README.md +++ b/apm-agent-core/README.md @@ -19,7 +19,7 @@ It's based on a Disruptor/ring buffer and receives finished transactions potenti 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.agent.report.ReporterConfiguration contains all relevant configuration options for the reporter. +The class co.elastic.apm.agent.report.ReporterConfigurationImpl contains all relevant configuration options for the reporter. ## Lifecycle diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java index d0c7a468c4..9f60cf3363 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java @@ -34,10 +34,9 @@ import co.elastic.apm.agent.bci.modules.ModuleOpener; import co.elastic.apm.agent.common.ThreadUtils; import co.elastic.apm.agent.common.util.SystemStandardOutputLogger; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; -import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.logging.ApmServerLogAppender; import co.elastic.apm.agent.matcher.MethodMatcher; @@ -153,7 +152,7 @@ public static void initialize(@Nullable final String agentArguments, final Instr // silently early abort when agent is disabled to minimize the number of loaded classes List configSources = ElasticApmTracerBuilder.getConfigSources(agentArguments, premain); for (ConfigurationSource configSource : configSources) { - String enabled = configSource.getValue(CoreConfiguration.ENABLED_KEY); + String enabled = configSource.getValue(CoreConfigurationImpl.ENABLED_KEY); if (enabled != null && !Boolean.parseBoolean(enabled)) { return; } @@ -172,7 +171,7 @@ public static void initInstrumentation(ElasticApmTracer tracer, Instrumentation } private static void initInstrumentation(ElasticApmTracer tracer, Instrumentation instrumentation, boolean premain) { - if (!tracer.getConfig(CoreConfiguration.class).isEnabled()) { + if (!tracer.getConfig(CoreConfigurationImpl.class).isEnabled()) { return; } GlobalTracer.init(tracer); @@ -181,12 +180,12 @@ private static void initInstrumentation(ElasticApmTracer tracer, Instrumentation } @Nonnull - private static Iterable loadInstrumentations(Tracer tracer) { + private static Iterable loadInstrumentations(ElasticApmTracer tracer) { List pluginClassLoaders = new ArrayList<>(); pluginClassLoaders.add(PrivilegedActionUtils.getClassLoader(ElasticApmAgent.class)); - pluginClassLoaders.addAll(createExternalPluginClassLoaders(tracer.getConfig(CoreConfiguration.class).getPluginsDir())); + pluginClassLoaders.addAll(createExternalPluginClassLoaders(tracer.getConfig(CoreConfigurationImpl.class).getPluginsDir())); final List instrumentations = DependencyInjectingServiceLoader.load(ElasticApmInstrumentation.class, pluginClassLoaders, tracer); - for (MethodMatcher traceMethod : tracer.getConfig(CoreConfiguration.class).getTraceMethods()) { + for (MethodMatcher traceMethod : tracer.getConfig(CoreConfigurationImpl.class).getTraceMethods()) { instrumentations.add(new TraceMethodInstrumentation(tracer, traceMethod)); } return instrumentations; @@ -234,7 +233,7 @@ public static synchronized void initInstrumentation(final ElasticApmTracer trace private static synchronized void initInstrumentation(final ElasticApmTracer tracer, Instrumentation instrumentation, Iterable instrumentations, boolean premain) { - CoreConfiguration coreConfig = tracer.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = tracer.getConfig(CoreConfigurationImpl.class); if (!coreConfig.isEnabled()) { return; } @@ -291,7 +290,7 @@ public void run() { AgentBuilder agentBuilder = initAgentBuilder(tracer, instrumentation, instrumentations, logger, AgentBuilder.DescriptionStrategy.Default.POOL_ONLY, premain); // Warmup Byte Buddy and agent's invokedynamic linkage paths on the attaching thread before installing it - if (tracer.getConfig(CoreConfiguration.class).shouldWarmupByteBuddy()) { + if (tracer.getConfig(CoreConfigurationImpl.class).shouldWarmupByteBuddy()) { agentBuilder = agentBuilder.with(new InstallationListenerImpl()) .warmUp(NonInstrumented.class) .warmUp(Instrumented.class); @@ -310,7 +309,7 @@ public void onChange(ConfigurationOption configurationOption, Object oldValue, O } public static synchronized Future reInitInstrumentation() { - final Tracer tracer = GlobalTracer.get().require(Tracer.class); + final ElasticApmTracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); if (instrumentation == null) { throw new IllegalStateException("Can't re-init agent before it has been initialized"); } @@ -350,7 +349,7 @@ static synchronized void doReInitInstrumentation(Iterable instrumentations, Logger logger, AgentBuilder.DescriptionStrategy descriptionStrategy, boolean premain) { - final CoreConfiguration coreConfiguration = tracer.getConfig(CoreConfiguration.class); + final CoreConfigurationImpl coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); ElasticApmAgent.instrumentation = instrumentation; final ByteBuddy byteBuddy = new ByteBuddy() .with(TypeValidation.of(logger.isDebugEnabled())) @@ -378,11 +377,11 @@ private static AgentBuilder initAgentBuilder(ElasticApmTracer tracer, Instrument return agentBuilder; } - private static boolean isIncluded(ElasticApmInstrumentation advice, CoreConfiguration coreConfiguration) { + private static boolean isIncluded(ElasticApmInstrumentation advice, CoreConfigurationImpl coreConfiguration) { return isInstrumentationEnabled(advice, coreConfiguration) && coreConfiguration.isInstrumentationEnabled(advice.getInstrumentationGroupNames()); } - private static boolean isInstrumentationEnabled(ElasticApmInstrumentation advice, CoreConfiguration coreConfiguration) { + private static boolean isInstrumentationEnabled(ElasticApmInstrumentation advice, CoreConfigurationImpl coreConfiguration) { return advice.includeWhenInstrumentationIsDisabled() || coreConfiguration.isInstrument(); } @@ -390,8 +389,8 @@ private static AgentBuilder applyAdvice(final ElasticApmTracer tracer, final Age final ElasticApmInstrumentation instrumentation, final ElementMatcher typeMatcher) { final Logger logger = getLogger(); logger.debug("Applying instrumentation {}", instrumentation.getClass().getName()); - final boolean classLoadingMatchingPreFilter = tracer.getConfig(CoreConfiguration.class).isClassLoadingMatchingPreFilter(); - final boolean typeMatchingWithNamePreFilter = tracer.getConfig(CoreConfiguration.class).isTypeMatchingWithNamePreFilter(); + final boolean classLoadingMatchingPreFilter = tracer.getConfig(CoreConfigurationImpl.class).isClassLoadingMatchingPreFilter(); + final boolean typeMatchingWithNamePreFilter = tracer.getConfig(CoreConfigurationImpl.class).isTypeMatchingWithNamePreFilter(); final ElementMatcher.Junction classLoaderMatcher = instrumentation.getClassLoaderMatcher(); final ElementMatcher typeMatcherPreFilter = instrumentation.getTypeMatcherPreFilter(); final ElementMatcher.Junction versionPostFilter = instrumentation.getProtectionDomainPostFilter(); @@ -648,7 +647,7 @@ public static synchronized void reset() { if (instrumentation == null) { return; } - GlobalTracer.get().require(Tracer.class).stop(); + GlobalTracer.get().require(ElasticApmTracer.class).stop(); GlobalTracer.setNoop(); Exception exception = null; if (resettableClassFileTransformer != null) { @@ -678,7 +677,7 @@ public static synchronized void reset() { pluginPackages2pluginClassLoaderCustomizations.clear(); } - private static AgentBuilder getAgentBuilder(final ByteBuddy byteBuddy, final CoreConfiguration coreConfiguration, final Logger logger, + private static AgentBuilder getAgentBuilder(final ByteBuddy byteBuddy, final CoreConfigurationImpl coreConfiguration, final Logger logger, final AgentBuilder.DescriptionStrategy descriptionStrategy, final boolean premain, final boolean useTypePoolCache) { AgentBuilder.LocationStrategy locationStrategy = AgentBuilder.LocationStrategy.ForClassLoader.WEAK; @@ -826,7 +825,7 @@ private static void applyInstrumentation(Class classToInstrument, Collection< appliedInstrumentations = Collections.unmodifiableSet(appliedInstrumentations); dynamicallyInstrumentedClasses.put(classToInstrument, appliedInstrumentations); - CoreConfiguration config = tracer.getConfig(CoreConfiguration.class); + CoreConfigurationImpl config = tracer.getConfig(CoreConfigurationImpl.class); final Logger logger = LoggerFactory.getLogger(ElasticApmAgent.class); final ByteBuddy byteBuddy = new ByteBuddy() .with(TypeValidation.of(logger.isDebugEnabled())) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/bytebuddy/ErrorLoggingListener.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/bytebuddy/ErrorLoggingListener.java index 4428669786..536b3b10eb 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/bytebuddy/ErrorLoggingListener.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/bytebuddy/ErrorLoggingListener.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.bci.bytebuddy; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import net.bytebuddy.agent.builder.AgentBuilder; import net.bytebuddy.utility.JavaModule; import co.elastic.apm.agent.sdk.logging.Logger; @@ -35,7 +35,7 @@ public void onError(String typeName, ClassLoader classLoader, JavaModule module, "You may try setting the '{}' config option to 'true', but notice that it may cause VerificationErrors or other issues.", typeName, ((MinimumClassFileVersionValidator.UnsupportedClassFileVersionException)throwable).getMinVersion(), - CoreConfiguration.INSTRUMENT_ANCIENT_BYTECODE + CoreConfigurationImpl.INSTRUMENT_ANCIENT_BYTECODE ); } else { if (throwable instanceof net.bytebuddy.pool.TypePool.Resolution.NoSuchTypeException) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/classloading/ExternalPluginClassLoader.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/classloading/ExternalPluginClassLoader.java index 6fa9107f7d..4de316323f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/classloading/ExternalPluginClassLoader.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/classloading/ExternalPluginClassLoader.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.bci.classloading; import co.elastic.apm.agent.common.util.AgentInfo; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -38,7 +38,7 @@ import static net.bytebuddy.matcher.ElementMatchers.not; /** - * Loads plugins from {@link CoreConfiguration#getPluginsDir() plugins_dir} + * Loads plugins from {@link CoreConfigurationImpl#getPluginsDir() plugins_dir} * * @see co.elastic.apm.agent.bci.IndyBootstrap */ diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java index 0f63ac2d0c..09c54e7458 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSource.java @@ -160,7 +160,7 @@ private void pollConfig(ConfigurationRegistry configurationRegistry) { */ @Nullable String fetchConfig(final ConfigurationRegistry configurationRegistry) { - if (!configurationRegistry.getConfig(CoreConfiguration.class).isCentralConfigEnabled()) { + if (!configurationRegistry.getConfig(CoreConfigurationImpl.class).isCentralConfigEnabled()) { logger.debug("Remote configuration is disabled"); return null; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfigurationImpl.java similarity index 98% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfigurationImpl.java index b84f4bd172..7c42ebc23e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/CoreConfigurationImpl.java @@ -20,17 +20,12 @@ import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.matcher.MethodMatcher; import co.elastic.apm.agent.matcher.MethodMatcherValueConverter; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.configuration.ListValueConverter; -import co.elastic.apm.agent.tracer.configuration.RegexValidator; -import co.elastic.apm.agent.tracer.configuration.RoundedDoubleConverter; -import co.elastic.apm.agent.tracer.configuration.TimeDuration; -import co.elastic.apm.agent.tracer.configuration.TimeDurationValueConverter; -import co.elastic.apm.agent.tracer.configuration.WildcardMatcherValueConverter; +import co.elastic.apm.agent.tracer.configuration.*; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationOptionProvider; import org.stagemonitor.configuration.converter.AbstractValueConverter; @@ -56,10 +51,10 @@ import java.util.Set; import java.util.concurrent.TimeUnit; -import static co.elastic.apm.agent.logging.LoggingConfiguration.AGENT_HOME_PLACEHOLDER; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.AGENT_HOME_PLACEHOLDER; import static co.elastic.apm.agent.tracer.configuration.RangeValidator.isInRange; -public class CoreConfiguration extends ConfigurationOptionProvider implements co.elastic.apm.agent.tracer.configuration.CoreConfiguration { +public class CoreConfigurationImpl extends ConfigurationOptionProvider implements CoreConfiguration { public static final int DEFAULT_LONG_FIELD_MAX_LENGTH = 10000; private final Logger logger = LoggerFactory.getLogger(getClass()); @@ -246,7 +241,7 @@ public class CoreConfiguration extends ConfigurationOptionProvider implements co .description("Limits the amount of spans that are recorded per transaction.\n\n" + "This is helpful in cases where a transaction creates a very high amount of spans (e.g. thousands of SQL queries).\n\n" + "Setting an upper limit will prevent overloading the agent and the APM server with too much work for such edge cases.\n\n" + - "A message will be logged when the max number of spans has been exceeded but only at a rate of once every " + TimeUnit.MICROSECONDS.toMinutes(Span.MAX_LOG_INTERVAL_MICRO_SECS) + " minutes to ensure performance is not impacted.") + "A message will be logged when the max number of spans has been exceeded but only at a rate of once every " + TimeUnit.MICROSECONDS.toMinutes(SpanImpl.MAX_LOG_INTERVAL_MICRO_SECS) + " minutes to ensure performance is not impacted.") .dynamic(true) .buildWithDefault(500); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/MetricsConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/MetricsConfigurationImpl.java similarity index 97% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/MetricsConfiguration.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/MetricsConfigurationImpl.java index 90c5ff563e..db67ada95f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/MetricsConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/MetricsConfigurationImpl.java @@ -19,6 +19,7 @@ package co.elastic.apm.agent.configuration; import co.elastic.apm.agent.tracer.configuration.ListValueConverter; +import co.elastic.apm.agent.tracer.configuration.MetricsConfiguration; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationOptionProvider; import org.stagemonitor.configuration.converter.DoubleValueConverter; @@ -29,7 +30,7 @@ import java.util.HashSet; import java.util.List; -public class MetricsConfiguration extends ConfigurationOptionProvider implements co.elastic.apm.agent.tracer.configuration.MetricsConfiguration { +public class MetricsConfigurationImpl extends ConfigurationOptionProvider implements MetricsConfiguration { private static final String METRICS_CATEGORY = "Metrics"; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ServerlessConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ServerlessConfigurationImpl.java similarity index 92% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ServerlessConfiguration.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ServerlessConfigurationImpl.java index 36875fbf04..6df65ad344 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ServerlessConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/ServerlessConfigurationImpl.java @@ -19,15 +19,16 @@ package co.elastic.apm.agent.configuration; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationOptionProvider; -public class ServerlessConfiguration extends ConfigurationOptionProvider implements co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration { +public class ServerlessConfigurationImpl extends ConfigurationOptionProvider implements ServerlessConfiguration { public static final String SERVERLESS_CATEGORY = "Serverless"; private final boolean runsOnAwsLambda; - public ServerlessConfiguration() { + public ServerlessConfigurationImpl() { String lambdaName = PrivilegedActionUtils.getEnv("AWS_LAMBDA_FUNCTION_NAME"); this.runsOnAwsLambda = null != lambdaName && !lambdaName.isEmpty(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java index 4de8761af2..b2bb9e1c21 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/configuration/StartupInfo.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.util.VersionUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -63,8 +63,8 @@ public void init(Tracer tracer) { } void logConfiguration(ConfigurationRegistry configurationRegistry, Logger logger) { - final String serviceName = configurationRegistry.getConfig(CoreConfiguration.class).getServiceName(); - final String serviceVersion = configurationRegistry.getConfig(CoreConfiguration.class).getServiceVersion(); + final String serviceName = configurationRegistry.getConfig(CoreConfigurationImpl.class).getServiceName(); + final String serviceVersion = configurationRegistry.getConfig(CoreConfigurationImpl.class).getServiceVersion(); StringBuilder serviceNameAndVersion = new StringBuilder(serviceName); if (serviceVersion != null) { @@ -87,9 +87,9 @@ void logConfiguration(ConfigurationRegistry configurationRegistry, Logger logger } } } - if (configurationRegistry.getConfig(StacktraceConfiguration.class).getApplicationPackages().isEmpty()) { + if (configurationRegistry.getConfig(StacktraceConfigurationImpl.class).getApplicationPackages().isEmpty()) { logger.warn("To enable all features and decrease startup time, please configure {}", - StacktraceConfiguration.APPLICATION_PACKAGES); + StacktraceConfigurationImpl.APPLICATION_PACKAGES); } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActivationListener.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActivationListener.java index 4461a537e9..25e522b578 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActivationListener.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActivationListener.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.impl; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; /** - * A callback for {@link AbstractSpan} activation and deactivation events + * A callback for {@link AbstractSpanImpl} activation and deactivation events *

    * The constructor can optionally have a {@link ElasticApmTracer} parameter. *

    @@ -29,22 +29,22 @@ public interface ActivationListener { /** - * A callback for {@link AbstractSpan#activate()} + * A callback for {@link AbstractSpanImpl#activate()} * - * @param span the {@link AbstractSpan} that is being activated + * @param span the {@link AbstractSpanImpl} that is being activated * @throws Throwable if there was an error while calling this method */ - void beforeActivate(AbstractSpan span) throws Throwable; + void beforeActivate(AbstractSpanImpl span) throws Throwable; /** - * A callback for {@link AbstractSpan#deactivate()} + * A callback for {@link AbstractSpanImpl#deactivate()} *

    - * Note: the corresponding span may already be {@link AbstractSpan#end() ended} and {@link AbstractSpan#resetState() recycled}. - * That's why there is no {@link AbstractSpan} parameter. + * Note: the corresponding span may already be {@link AbstractSpanImpl#end() ended} and {@link AbstractSpanImpl#resetState() recycled}. + * That's why there is no {@link AbstractSpanImpl} parameter. *

    * * @param deactivatedSpan the context that has just been deactivated * @throws Throwable if there was an error while calling this method */ - void afterDeactivate(AbstractSpan deactivatedSpan) throws Throwable; + void afterDeactivate(AbstractSpanImpl deactivatedSpan) throws Throwable; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActiveStack.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActiveStack.java index e0d421b4f0..7bce0fef45 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActiveStack.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ActiveStack.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.impl; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.ElasticContextWrapper; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateWrapper; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -55,11 +55,11 @@ class ActiveStack { * Also, the caller does not have to keep a reference to the previously active span, as that is maintained by the stack. * This makes activating a span allocation-free (assuming the stack has enough pre-allocated slots available). */ - private final Deque> activeContextStack = new ArrayDeque>(); + private final Deque> activeContextStack = new ArrayDeque>(); - private final EmptyElasticContext emptyContext; + private final EmptyTraceState emptyContext; - ActiveStack(int stackMaxDepth, EmptyElasticContext emptyContextForTracer) { + ActiveStack(int stackMaxDepth, EmptyTraceState emptyContextForTracer) { this.stackMaxDepth = stackMaxDepth; this.emptyContext = emptyContextForTracer; } @@ -68,18 +68,18 @@ class ActiveStack { * @return the current context, potentially empty when no span, transaction or baggage is currently active. */ - public ElasticContext currentContext() { - ElasticContext current = activeContextStack.peek(); + public TraceStateImpl currentContext() { + TraceStateImpl current = activeContextStack.peek(); // When the active context is wrapped, the wrapper should be transparent to the caller, thus we always return // the underlying wrapped context. - if (current instanceof ElasticContextWrapper) { - return ((ElasticContextWrapper) current).getWrappedContext(); + if (current instanceof TraceStateWrapper) { + return ((TraceStateWrapper) current).getWrappedContext(); } return current != null ? current : emptyContext; } - boolean activate(ElasticContext context, List activationListeners) { + boolean activate(TraceStateImpl context, List activationListeners) { if (logger.isDebugEnabled()) { logger.debug("Activating {} on thread {}", context, Thread.currentThread().getId()); } @@ -96,7 +96,7 @@ boolean activate(ElasticContext context, List activationL } context.incrementReferences(); - AbstractSpan span = context.getSpan(); + AbstractSpanImpl span = context.getSpan(); if (span != null) { triggerActivationListeners(span, true, activationListeners); } @@ -105,7 +105,7 @@ boolean activate(ElasticContext context, List activationL return true; } - boolean deactivate(ElasticContext context, List activationListeners, boolean assertionsEnabled) { + boolean deactivate(TraceStateImpl context, List activationListeners, boolean assertionsEnabled) { if (logger.isDebugEnabled()) { logger.debug("Deactivating {} on thread {}", context, Thread.currentThread().getId()); } @@ -115,13 +115,13 @@ boolean deactivate(ElasticContext context, List activatio return false; } - ElasticContext activeContext = currentContext(); + TraceStateImpl activeContext = currentContext(); activeContextStack.remove(); try { assertIsActive(context, activeContext, assertionsEnabled); - AbstractSpan span = context.getSpan(); + AbstractSpanImpl span = context.getSpan(); if (null != span) { triggerActivationListeners(span, false, activationListeners); } @@ -131,7 +131,7 @@ boolean deactivate(ElasticContext context, List activatio return true; } - private void triggerActivationListeners(AbstractSpan span, boolean isActivate, List activationListeners) { + private void triggerActivationListeners(AbstractSpanImpl span, boolean isActivate, List activationListeners) { for (int i = 0, size = activationListeners.size(); i < size; i++) { ActivationListener listener = activationListeners.get(i); try { @@ -149,7 +149,7 @@ private void triggerActivationListeners(AbstractSpan span, boolean isActivate } } - private void assertIsActive(ElasticContext context, @Nullable ElasticContext currentlyActive, boolean assertionsEnabled) { + private void assertIsActive(TraceStateImpl context, @Nullable TraceStateImpl currentlyActive, boolean assertionsEnabled) { if (context != currentlyActive) { logger.warn("Deactivating a context ({}) which is not the currently active one ({}). " + "This can happen when not properly deactivating a previous span or context.", context, currentlyActive); @@ -169,17 +169,17 @@ private void assertIsActive(ElasticContext context, @Nullable ElasticContext< * @param wrapper type * @return newly (or previously) created wrapper */ - > T wrapActiveContextIfRequired(Class wrapperClass, Callable wrapFunction, int approximateContextSize) { + > T wrapActiveContextIfRequired(Class wrapperClass, Callable wrapFunction, int approximateContextSize) { // the current context might be either a "regular" one or a "wrapped" one if it has already been wrapped - ElasticContext current = activeContextStack.peek(); + TraceStateImpl current = activeContextStack.peek(); Objects.requireNonNull(current, "active context required for wrapping"); - ElasticContextWrapper wrapper; - if (current instanceof ElasticContextWrapper) { - wrapper = (ElasticContextWrapper) current; + TraceStateWrapper wrapper; + if (current instanceof TraceStateWrapper) { + wrapper = (TraceStateWrapper) current; } else { - wrapper = new ElasticContextWrapper<>(approximateContextSize, current); + wrapper = new TraceStateWrapper<>(approximateContextSize, current); } T wrapped = wrapper.wrapIfRequired(wrapperClass, wrapFunction); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java index 893dfb6c69..a675010497 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java @@ -25,17 +25,18 @@ import co.elastic.apm.agent.common.JvmRuntimeInfo; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.configuration.AutoDetectedServiceInfo; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.MetricsConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.impl.error.RedactedException; import co.elastic.apm.agent.impl.metadata.FaaSMetaDataExtension; import co.elastic.apm.agent.impl.metadata.Framework; import co.elastic.apm.agent.impl.metadata.MetaDataFuture; import co.elastic.apm.agent.impl.metadata.NameAndIdField; import co.elastic.apm.agent.impl.metadata.ServiceFactory; -import co.elastic.apm.agent.impl.transaction.Id; +import co.elastic.apm.agent.impl.transaction.*; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.pooling.Allocator; @@ -44,24 +45,19 @@ import co.elastic.apm.agent.configuration.SpanConfiguration; import co.elastic.apm.agent.context.ClosableLifecycleListenerAdapter; import co.elastic.apm.agent.tracer.LifecycleListener; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.baggage.W3CBaggagePropagation; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.sampling.ProbabilitySampler; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import co.elastic.apm.agent.metrics.MetricRegistry; -import co.elastic.apm.agent.objectpool.ObjectPool; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.Reporter; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.sdk.internal.util.VersionUtils; import co.elastic.apm.agent.sdk.logging.Logger; @@ -116,7 +112,7 @@ public class ElasticApmTracer implements Tracer { static { Set headerNames = new HashSet<>(); - headerNames.addAll(TraceContext.TRACE_TEXTUAL_HEADERS); + headerNames.addAll(TraceContextImpl.TRACE_TEXTUAL_HEADERS); headerNames.add(W3CBaggagePropagation.BAGGAGE_HEADER_NAME); TRACE_HEADER_NAMES = Collections.unmodifiableSet(headerNames); } @@ -126,15 +122,15 @@ public class ElasticApmTracer implements Tracer { private final ConfigurationRegistry configurationRegistry; private final ApmServerClient apmServerClient; private final List lifecycleListeners = new CopyOnWriteArrayList<>(); - private final ObjectPool transactionPool; - private final ObjectPool spanPool; - private final ObjectPool errorPool; - private final ObjectPool spanLinkPool; - private final ObjectPool profilingCorrelationStackTraceIdPool; + private final ObservableObjectPool transactionPool; + private final ObservableObjectPool spanPool; + private final ObservableObjectPool errorPool; + private final ObservableObjectPool spanLinkPool; + private final ObservableObjectPool profilingCorrelationStackTraceIdPool; private final Reporter reporter; - private final ObjectPoolFactory objectPoolFactory; + private final ObjectPoolFactoryImpl objectPoolFactory; - private final EmptyElasticContext emptyContext; + private final EmptyTraceState emptyContext; private final ThreadLocal activeStack = new ThreadLocal() { @Override @@ -146,7 +142,7 @@ protected ActiveStack initialValue() { } }; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; private final int transactionMaxSpans; private final SpanConfiguration spanConfiguration; private final List activationListeners; @@ -172,12 +168,12 @@ protected ActiveStack initialValue() { static { checkClassloader(); - configs.put(co.elastic.apm.agent.tracer.configuration.CoreConfiguration.class, CoreConfiguration.class); - configs.put(co.elastic.apm.agent.tracer.configuration.LoggingConfiguration.class, LoggingConfiguration.class); - configs.put(co.elastic.apm.agent.tracer.configuration.MetricsConfiguration.class, MetricsConfiguration.class); - configs.put(co.elastic.apm.agent.tracer.configuration.ReporterConfiguration.class, ReporterConfiguration.class); - configs.put(co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration.class, ServerlessConfiguration.class); - configs.put(co.elastic.apm.agent.tracer.configuration.StacktraceConfiguration.class, StacktraceConfiguration.class); + configs.put(co.elastic.apm.agent.tracer.configuration.CoreConfiguration.class, CoreConfigurationImpl.class); + configs.put(co.elastic.apm.agent.tracer.configuration.LoggingConfiguration.class, LoggingConfigurationImpl.class); + configs.put(co.elastic.apm.agent.tracer.configuration.MetricsConfiguration.class, MetricsConfigurationImpl.class); + configs.put(co.elastic.apm.agent.tracer.configuration.ReporterConfiguration.class, ReporterConfigurationImpl.class); + configs.put(co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration.class, ServerlessConfigurationImpl.class); + configs.put(co.elastic.apm.agent.tracer.configuration.StacktraceConfiguration.class, StacktraceConfigurationImpl.class); } private static void checkClassloader() { @@ -219,17 +215,17 @@ private static void checkClassloader() { } - ElasticApmTracer(ConfigurationRegistry configurationRegistry, MetricRegistry metricRegistry, Reporter reporter, ObjectPoolFactory poolFactory, + ElasticApmTracer(ConfigurationRegistry configurationRegistry, MetricRegistry metricRegistry, Reporter reporter, ObjectPoolFactoryImpl poolFactory, ApmServerClient apmServerClient, final String ephemeralId, MetaDataFuture metaDataFuture) { - this.emptyContext = new EmptyElasticContext(this); + this.emptyContext = new EmptyTraceState(this); this.metricRegistry = metricRegistry; this.configurationRegistry = configurationRegistry; this.reporter = reporter; this.apmServerClient = apmServerClient; this.ephemeralId = ephemeralId; this.metaDataFuture = metaDataFuture; - int maxPooledElements = configurationRegistry.getConfig(ReporterConfiguration.class).getMaxQueueSize() * 2; - coreConfiguration = configurationRegistry.getConfig(CoreConfiguration.class); + int maxPooledElements = configurationRegistry.getConfig(ReporterConfigurationImpl.class).getMaxQueueSize() * 2; + coreConfiguration = configurationRegistry.getConfig(CoreConfigurationImpl.class); transactionMaxSpans = coreConfiguration.getTransactionMaxSpans(); spanConfiguration = configurationRegistry.getConfig(SpanConfiguration.class); @@ -250,12 +246,12 @@ public void onChange(ConfigurationOption configurationOption, Boolean oldValu errorPool = poolFactory.createErrorPool(maxPooledElements / 2, this); // span links pool allows for 10X the maximum allowed span links per span - spanLinkPool = poolFactory.createSpanLinkPool(AbstractSpan.MAX_ALLOWED_SPAN_LINKS * 10, this); + spanLinkPool = poolFactory.createSpanLinkPool(AbstractSpanImpl.MAX_ALLOWED_SPAN_LINKS * 10, this); - profilingCorrelationStackTraceIdPool = poolFactory.createRecyclableObjectPool(maxPooledElements, new Allocator() { + profilingCorrelationStackTraceIdPool = poolFactory.createRecyclableObjectPool(maxPooledElements, new Allocator() { @Override - public Id createInstance() { - return Id.new128BitId(); + public IdImpl createInstance() { + return IdImpl.new128BitId(); } }); @@ -283,32 +279,38 @@ public void onChange(ConfigurationOption configurationOption, Double oldValue @Override @Nullable - public Transaction startRootTransaction(@Nullable ClassLoader initiatingClassLoader) { + public TransactionImpl startRootTransaction(@Nullable ClassLoader initiatingClassLoader) { return startRootTransaction(sampler, -1, currentContext().getBaggage(), initiatingClassLoader); } - @Override @Nullable - public Transaction startRootTransaction(@Nullable ClassLoader initiatingClassLoader, long epochMicro) { + public TransactionImpl startRootTransaction(@Nullable ClassLoader initiatingClassLoader, long epochMicro) { return startRootTransaction(sampler, epochMicro, currentContext().getBaggage(), initiatingClassLoader); } @Nullable - @Override - public Transaction startRootTransaction(@Nullable ClassLoader initiatingClassLoader, Baggage baseBaggage, long epochMicro) { + public TransactionImpl startRootTransaction(@Nullable ClassLoader initiatingClassLoader, BaggageImpl baseBaggage, long epochMicro) { return startRootTransaction(sampler, epochMicro, baseBaggage, initiatingClassLoader); } - @Nullable - public Transaction startRootTransaction(Sampler sampler, long epochMicros, @Nullable ClassLoader initiatingClassLoader) { + public TransactionImpl startRootTransaction(Sampler sampler, long epochMicros, @Nullable ClassLoader initiatingClassLoader) { return startRootTransaction(sampler, epochMicros, currentContext().getBaggage(), initiatingClassLoader); } - @Override + /** + * Starts a trace-root transaction with a specified sampler and start timestamp + * + * @param sampler the {@link Sampler} instance which is responsible for determining the sampling decision if this is a root transaction + * @param epochMicros the start timestamp + * @param initiatingClassLoader the class loader corresponding to the service which initiated the creation of the transaction. + * Used to determine the service name and to load application-scoped classes like the {@link org.slf4j.MDC}, + * for log correlation. + * @return a transaction that will be the root of the current trace if the agent is currently RUNNING; null otherwise + */ @Nullable - public Transaction startRootTransaction(Sampler sampler, long epochMicros, Baggage baseBaggage, @Nullable ClassLoader initiatingClassLoader) { - Transaction transaction = null; + public TransactionImpl startRootTransaction(Sampler sampler, long epochMicros, BaggageImpl baseBaggage, @Nullable ClassLoader initiatingClassLoader) { + TransactionImpl transaction = null; if (isRunning()) { transaction = createTransaction().startRoot(epochMicros, sampler, baseBaggage); afterTransactionStart(initiatingClassLoader, transaction); @@ -316,29 +318,40 @@ public Transaction startRootTransaction(Sampler sampler, long epochMicros, Bagga return transaction; } - @Override @Nullable - public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, @Nullable ClassLoader initiatingClassLoader) { - return startChildTransaction(headerCarrier, headersGetter, sampler, -1, initiatingClassLoader); + public TransactionImpl startChildTransaction(@Nullable C headerCarrier, HeaderGetter headerGetter, @Nullable ClassLoader initiatingClassLoader) { + return startChildTransaction(headerCarrier, headerGetter, sampler, -1, initiatingClassLoader); } - @Override @Nullable - public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, @Nullable ClassLoader initiatingClassLoader, Baggage baseBaggage, long epochMicros) { + public TransactionImpl startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, @Nullable ClassLoader initiatingClassLoader, BaggageImpl baseBaggage, long epochMicros) { return startChildTransaction(headerCarrier, headersGetter, sampler, epochMicros, initiatingClassLoader); } - @Override + /** + * Starts a transaction as a child of the context headers obtained through the provided {@link HeaderGetter}. + * If the created transaction cannot be started as a child transaction (for example - if no parent context header is + * available), then it will be started as the root transaction of the trace. + * + * @param headerCarrier the Object from which context headers can be obtained, typically a request or a message + * @param headersGetter provides the trace context headers required in order to create a child transaction + * @param sampler the {@link Sampler} instance which is responsible for determining the sampling decision if this is a root transaction + * @param epochMicros the start timestamp + * @param initiatingClassLoader the class loader corresponding to the service which initiated the creation of the transaction. + * Used to determine the service name and to load application-scoped classes like the {@link org.slf4j.MDC}, + * for log correlation. + * @return a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise + */ @Nullable - public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, Sampler sampler, - long epochMicros, @Nullable ClassLoader initiatingClassLoader) { + public TransactionImpl startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, Sampler sampler, + long epochMicros, @Nullable ClassLoader initiatingClassLoader) { return startChildTransaction(headerCarrier, headersGetter, sampler, epochMicros, currentContext().getBaggage(), initiatingClassLoader); } @Nullable - private Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, Sampler sampler, - long epochMicros, Baggage baseBaggage, @Nullable ClassLoader initiatingClassLoader) { - Transaction transaction = null; + private TransactionImpl startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, Sampler sampler, + long epochMicros, BaggageImpl baseBaggage, @Nullable ClassLoader initiatingClassLoader) { + TransactionImpl transaction = null; if (isRunning()) { transaction = createTransaction().start(headerCarrier, headersGetter, epochMicros, sampler, baseBaggage); @@ -347,7 +360,7 @@ private Transaction startChildTransaction(@Nullable C headerCarrier, Head return transaction; } - private void afterTransactionStart(@Nullable ClassLoader initiatingClassLoader, Transaction transaction) { + private void afterTransactionStart(@Nullable ClassLoader initiatingClassLoader, TransactionImpl transaction) { if (logger.isDebugEnabled()) { logger.debug("startTransaction {}", transaction); if (logger.isTraceEnabled()) { @@ -362,12 +375,12 @@ private void afterTransactionStart(@Nullable ClassLoader initiatingClassLoader, profilingIntegration.afterTransactionStart(transaction); } - public Transaction noopTransaction() { + public TransactionImpl noopTransaction() { return createTransaction().startNoop(); } - private Transaction createTransaction() { - Transaction transaction = transactionPool.createInstance(); + private TransactionImpl createTransaction() { + TransactionImpl transaction = transactionPool.createInstance(); while (transaction.getReferenceCount() != 0) { logger.warn("Tried to start a transaction with a non-zero reference count {} {}", transaction.getReferenceCount(), transaction); transaction = transactionPool.createInstance(); @@ -377,14 +390,14 @@ private Transaction createTransaction() { @Override @Nullable - public Transaction currentTransaction() { + public TransactionImpl currentTransaction() { return currentContext().getTransaction(); } @Nullable @Override - public ErrorCapture getActiveError() { - return ErrorCapture.getActive(); + public ErrorCaptureImpl getActiveError() { + return ErrorCaptureImpl.getActive(); } /** @@ -408,12 +421,12 @@ public ErrorCapture getActiveError() { * @param the type of the parent context * @return a new started span */ - public Span startSpan(TraceContext.ChildContextCreator childContextCreator, T parentContext, Baggage baggage) { + public SpanImpl startSpan(TraceContextImpl.ChildContextCreator childContextCreator, T parentContext, BaggageImpl baggage) { return startSpan(childContextCreator, parentContext, baggage, -1); } - public Span startSpan(AbstractSpan parent, Baggage baggage, long epochMicros) { - return startSpan(TraceContext.fromParent(), parent, baggage, epochMicros); + public SpanImpl startSpan(AbstractSpanImpl parent, BaggageImpl baggage, long epochMicros) { + return startSpan(TraceContextImpl.fromParent(), parent, baggage, epochMicros); } /** @@ -421,12 +434,12 @@ public Span startSpan(AbstractSpan parent, Baggage baggage, long epochMicros) * @param epochMicros the start timestamp of the span in microseconds after epoch * @return a new started span */ - public Span startSpan(TraceContext.ChildContextCreator childContextCreator, T parentContext, Baggage baggage, long epochMicros) { + public SpanImpl startSpan(TraceContextImpl.ChildContextCreator childContextCreator, T parentContext, BaggageImpl baggage, long epochMicros) { return createSpan().start(childContextCreator, parentContext, baggage, epochMicros); } - private Span createSpan() { - Span span = spanPool.createInstance(); + private SpanImpl createSpan() { + SpanImpl span = spanPool.createInstance(); while (span.getReferenceCount() != 0) { logger.warn("Tried to start a span with a non-zero reference count {} {}", span.getReferenceCount(), span); span = spanPool.createInstance(); @@ -434,19 +447,17 @@ private Span createSpan() { return span; } - @Override public void captureAndReportException(@Nullable Throwable e, ClassLoader initiatingClassLoader) { - ErrorCapture errorCapture = captureException(System.currentTimeMillis() * 1000, e, currentContext(), initiatingClassLoader); + ErrorCaptureImpl errorCapture = captureException(System.currentTimeMillis() * 1000, e, currentContext(), initiatingClassLoader); if (errorCapture != null) { errorCapture.end(); } } - @Override @Nullable - public String captureAndReportException(long epochMicros, @Nullable Throwable e, ElasticContext parentContext) { + public String captureAndReportException(long epochMicros, @Nullable Throwable e, TraceStateImpl parentContext) { String id = null; - ErrorCapture errorCapture = captureException(epochMicros, e, parentContext, null); + ErrorCaptureImpl errorCapture = captureException(epochMicros, e, parentContext, null); if (errorCapture != null) { id = errorCapture.getTraceContext().getId().toString(); errorCapture.end(); @@ -454,20 +465,19 @@ public String captureAndReportException(long epochMicros, @Nullable Throwable e, return id; } - @Override @Nullable - public ErrorCapture captureException(@Nullable Throwable e, ElasticContext parentContext, @Nullable ClassLoader initiatingClassLoader) { + public ErrorCaptureImpl captureException(@Nullable Throwable e, TraceStateImpl parentContext, @Nullable ClassLoader initiatingClassLoader) { return captureException(System.currentTimeMillis() * 1000, e, parentContext, initiatingClassLoader); } @Nullable @Override - public ErrorCapture captureException(@Nullable Throwable e, @Nullable ClassLoader initiatingClassLoader) { + public ErrorCaptureImpl captureException(@Nullable Throwable e, @Nullable ClassLoader initiatingClassLoader) { return captureException(System.currentTimeMillis() * 1000, e, currentContext(), initiatingClassLoader); } @Nullable - private ErrorCapture captureException(long epochMicros, @Nullable Throwable e, ElasticContext parentContext, @Nullable ClassLoader initiatingClassLoader) { + private ErrorCaptureImpl captureException(long epochMicros, @Nullable Throwable e, TraceStateImpl parentContext, @Nullable ClassLoader initiatingClassLoader) { if (!isRunning() || e == null) { return null; } @@ -484,10 +494,10 @@ private ErrorCapture captureException(long epochMicros, @Nullable Throwable e, E // note: if we add inheritance support for exception filtering, caching would be required for performance if (e != null && !WildcardMatcher.isAnyMatch(coreConfiguration.getIgnoreExceptions(), e.getClass().getName())) { - ErrorCapture error = errorPool.createInstance(); + ErrorCaptureImpl error = errorPool.createInstance(); error.withTimestamp(epochMicros); error.setException(e); - Transaction currentTransaction = currentTransaction(); + TransactionImpl currentTransaction = currentTransaction(); if (currentTransaction != null) { if (currentTransaction.getNameForSerialization().length() > 0) { error.setTransactionName(currentTransaction.getNameForSerialization()); @@ -495,7 +505,7 @@ private ErrorCapture captureException(long epochMicros, @Nullable Throwable e, E error.setTransactionType(currentTransaction.getType()); error.setTransactionSampled(currentTransaction.isSampled()); } - AbstractSpan parent = parentContext.getSpan(); + AbstractSpanImpl parent = parentContext.getSpan(); if (parent != null) { error.asChildOf(parent); // don't discard spans leading up to an error, otherwise they'd point to an invalid parent @@ -508,7 +518,7 @@ private ErrorCapture captureException(long epochMicros, @Nullable Throwable e, E } } parentContext.getBaggage() - .storeBaggageInContext(error.getContext(), getConfig(CoreConfiguration.class).getBaggageToAttach()); + .storeBaggageInContext(error.getContext(), getConfig(CoreConfigurationImpl.class).getBaggageToAttach()); return error; } return null; @@ -533,7 +543,7 @@ public T getConfig(Class configProvider) { return configuration; } - public void endTransaction(Transaction transaction) { + public void endTransaction(TransactionImpl transaction) { if (logger.isDebugEnabled()) { logger.debug("endTransaction {}", transaction); if (logger.isTraceEnabled()) { @@ -551,11 +561,11 @@ public void endTransaction(Transaction transaction) { } } - public void reportPartialTransaction(Transaction transaction) { + public void reportPartialTransaction(TransactionImpl transaction) { reporter.reportPartialTransaction(transaction); } - public void endSpan(Span span) { + public void endSpan(SpanImpl span) { if (logger.isDebugEnabled()) { logger.debug("endSpan {}", span); if (logger.isTraceEnabled()) { @@ -564,7 +574,7 @@ public void endSpan(Span span) { } if (!span.isSampled()) { - Transaction transaction = span.getTransaction(); + TransactionImpl transaction = span.getTransaction(); if (transaction != null) { transaction.captureDroppedSpan(span); } @@ -584,7 +594,7 @@ public void endSpan(Span span) { } if (span.isDiscarded()) { logger.debug("Discarding span {}", span); - Transaction transaction = span.getTransaction(); + TransactionImpl transaction = span.getTransaction(); if (transaction != null) { transaction.captureDroppedSpan(span); } @@ -595,12 +605,12 @@ public void endSpan(Span span) { reportSpan(span); } - private void reportSpan(Span span) { - AbstractSpan parent = span.getParent(); + private void reportSpan(SpanImpl span) { + AbstractSpanImpl parent = span.getParent(); if (parent != null && parent.isDiscarded()) { logger.warn("Reporting a child of an discarded span. The current span '{}' will not be shown in the UI. Consider deactivating span_min_duration.", span); } - Transaction transaction = span.getTransaction(); + TransactionImpl transaction = span.getTransaction(); if (transaction != null) { transaction.getSpanCount().getReported().incrementAndGet(); } @@ -610,35 +620,35 @@ private void reportSpan(Span span) { reporter.report(span); } - public void endError(ErrorCapture error) { + public void endError(ErrorCaptureImpl error) { reporter.report(error); } - public TraceContext createSpanLink() { + public TraceContextImpl createSpanLink() { return spanLinkPool.createInstance(); } - public Id createProfilingCorrelationStackTraceId() { + public IdImpl createProfilingCorrelationStackTraceId() { return profilingCorrelationStackTraceIdPool.createInstance(); } - public void recycle(Transaction transaction) { + public void recycle(TransactionImpl transaction) { transactionPool.recycle(transaction); } - public void recycle(Span span) { + public void recycle(SpanImpl span) { spanPool.recycle(span); } - public void recycle(ErrorCapture error) { + public void recycle(ErrorCaptureImpl error) { errorPool.recycle(error); } - public void recycle(TraceContext traceContext) { + public void recycle(TraceContextImpl traceContext) { spanLinkPool.recycle(traceContext); } - public void recycleProfilingCorrelationStackTraceId(Id id) { + public void recycleProfilingCorrelationStackTraceId(IdImpl id) { profilingCorrelationStackTraceIdPool.recycle(id); } @@ -670,7 +680,7 @@ public synchronized void stop() { } //Shutting down logging resets the log level to OFF - subsequent tests in the class will get no log output, hence the guard if (!assertionsEnabled) { - LoggingConfiguration.shutdown(); + LoggingConfigurationImpl.shutdown(); } } @@ -687,7 +697,7 @@ public Sampler getSampler() { } @Override - public ObjectPoolFactory getObjectPoolFactory() { + public ObjectPoolFactoryImpl getObjectPoolFactory() { return objectPoolFactory; } @@ -729,7 +739,7 @@ void init(List lifecycleListeners) { * jvm parameter); false otherwise */ public synchronized void start(boolean premain) { - long delayInitMs = getConfig(CoreConfiguration.class).getDelayTracerStartMs(); + long delayInitMs = getConfig(CoreConfigurationImpl.class).getDelayTracerStartMs(); if (premain && shouldDelayOnPremain()) { delayInitMs = Math.max(delayInitMs, 5000L); } @@ -853,17 +863,15 @@ public boolean isRunning() { return tracerState == TracerState.RUNNING; } - @Override @Nullable - public Span createExitChildSpan() { - AbstractSpan active = getActive(); + public SpanImpl createExitChildSpan() { + AbstractSpanImpl active = getActive(); if (active == null) { return null; } return active.createExitSpan(); } - @Override public TracerState getState() { return tracerState; } @@ -882,13 +890,13 @@ public T getLifecycleListener(Class listenerClass) { * @return the currently active context, {@literal null} if there is none. */ - public ElasticContext currentContext() { + public TraceStateImpl currentContext() { return activeStack.get().currentContext(); } @Nullable @Override - public AbstractSpan getActive() { + public AbstractSpanImpl getActive() { return currentContext().getSpan(); } @@ -901,15 +909,15 @@ public AbstractSpan getActive() { * @param wrapper type * @return newly (or previously) created wrapper */ - public > T wrapActiveContextIfRequired(Class wrapperClass, Callable wrapFunction) { + public > T wrapActiveContextIfRequired(Class wrapperClass, Callable wrapFunction) { return activeStack.get().wrapActiveContextIfRequired(wrapperClass, wrapFunction, approximateContextSize); } - public void activate(ElasticContext context) { + public void activate(TraceStateImpl context) { activeStack.get().activate(context, activationListeners); } - public Scope activateInScope(final ElasticContext context) { + public Scope activateInScope(final TraceStateImpl context) { // already in scope if (currentContext() == context) { return NoopScope.INSTANCE; @@ -928,7 +936,7 @@ public void close() { }; } - public void deactivate(ElasticContext context) { + public void deactivate(TraceStateImpl context) { activeStack.get().deactivate(context, activationListeners, assertionsEnabled); } @@ -962,7 +970,6 @@ public void setServiceInfoForClassLoader(@Nullable ClassLoader classLoader, Serv } @Nullable - @Override public ServiceInfo getServiceInfoForClassLoader(@Nullable ClassLoader initiatingClassLoader) { if (initiatingClassLoader == null) { return null; @@ -1040,7 +1047,7 @@ public Service createService(String ephemeralId) { return new ServiceFactory().createService( coreConfiguration, ephemeralId, - configurationRegistry.getConfig(ServerlessConfiguration.class).runsOnAwsLambda() + configurationRegistry.getConfig(ServerlessConfigurationImpl.class).runsOnAwsLambda() ); } @@ -1055,7 +1062,7 @@ public Throwable redactExceptionIfRequired(@Nullable Throwable original) { @Override public void flush() { - long flushTimeout = configurationRegistry.getConfig(ServerlessConfiguration.class).getDataFlushTimeout(); + long flushTimeout = configurationRegistry.getConfig(ServerlessConfigurationImpl.class).getDataFlushTimeout(); try { if (!reporter.flush(flushTimeout, TimeUnit.MILLISECONDS, true)) { logger.error("APM data flush haven't completed within {} milliseconds.", flushTimeout); @@ -1102,9 +1109,35 @@ public void schedule(Runnable job, long interval, TimeUnit timeUnit) { sharedPool.scheduleAtFixedRate(job, 0, interval, timeUnit); } - @Override public void reportMetric(JsonWriter metrics) { reporter.reportMetrics(metrics); } + /** + * An enumeration used to represent the current tracer state. + */ + public enum TracerState { + /** + * The agent's state before it has been started for the first time. + */ + UNINITIALIZED, + + /** + * Indicates that the agent is currently fully functional - tracing, monitoring and sending data to the APM server. + */ + RUNNING, + + /** + * The agent is mostly idle, consuming minimal resources, ready to quickly resume back to RUNNING. When the agent + * is PAUSED, it is not tracing and not communicating with the APM server. However, classes are still instrumented + * and threads are still alive. + */ + PAUSED, + + /** + * Indicates that the agent had been stopped. + * NOTE: this state is irreversible- the agent cannot resume if it has already been stopped. + */ + STOPPED + } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java index b68faae5dd..7d422d573f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilder.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.configuration.AgentArgumentsConfigurationSource; import co.elastic.apm.agent.configuration.ApmServerConfigurationSource; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.configuration.PrefixingConfigurationSourceWrapper; import co.elastic.apm.agent.configuration.source.ConfigSources; import co.elastic.apm.agent.configuration.source.SystemPropertyConfigurationSource; @@ -29,14 +29,14 @@ import co.elastic.apm.agent.tracer.LifecycleListener; import co.elastic.apm.agent.impl.metadata.MetaData; import co.elastic.apm.agent.impl.metadata.MetaDataFuture; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.builtin.AgentReporterMetrics; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.Reporter; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.report.ReporterFactory; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.report.serialize.SerializationConstants; @@ -74,7 +74,7 @@ public class ElasticApmTracerBuilder { @Nullable private Reporter reporter; - private ObjectPoolFactory objectPoolFactory; + private ObjectPoolFactoryImpl objectPoolFactory; private final List extraLifecycleListeners; @@ -98,9 +98,9 @@ public ElasticApmTracerBuilder() { public ElasticApmTracerBuilder(List configSources) { this.configSources = configSources; this.ephemeralId = UUID.randomUUID().toString(); - LoggingConfiguration.init(configSources, ephemeralId); + LoggingConfigurationImpl.init(configSources, ephemeralId); logger = LoggerFactory.getLogger(getClass()); - objectPoolFactory = new ObjectPoolFactory(); + objectPoolFactory = new ObjectPoolFactoryImpl(); extraLifecycleListeners = new ArrayList<>(); } @@ -115,7 +115,7 @@ public ElasticApmTracerBuilder reporter(Reporter reporter) { } - public ElasticApmTracerBuilder withObjectPoolFactory(ObjectPoolFactory objectPoolFactory) { + public ElasticApmTracerBuilder withObjectPoolFactory(ObjectPoolFactoryImpl objectPoolFactory) { this.objectPoolFactory = objectPoolFactory; return this; } @@ -158,11 +158,11 @@ private ElasticApmTracer build(boolean startTracer) { apmServerClient = new ApmServerClient(configurationRegistry); } - SerializationConstants.init(configurationRegistry.getConfig(CoreConfiguration.class)); + SerializationConstants.init(configurationRegistry.getConfig(CoreConfigurationImpl.class)); MetaDataFuture metaDataFuture = MetaData.create(configurationRegistry, ephemeralId); DslJsonSerializer payloadSerializer = new DslJsonSerializer( - configurationRegistry.getConfig(StacktraceConfiguration.class), + configurationRegistry.getConfig(StacktraceConfigurationImpl.class), apmServerClient, metaDataFuture ); @@ -178,8 +178,8 @@ private ElasticApmTracer build(boolean startTracer) { lifecycleListeners.add(configurationSource); } - MetricsConfiguration metricsConfig = configurationRegistry.getConfig(MetricsConfiguration.class); - MetricRegistry metricRegistry = new MetricRegistry(configurationRegistry.getConfig(ReporterConfiguration.class), metricsConfig); + MetricsConfigurationImpl metricsConfig = configurationRegistry.getConfig(MetricsConfigurationImpl.class); + MetricRegistry metricRegistry = new MetricRegistry(configurationRegistry.getConfig(ReporterConfigurationImpl.class), metricsConfig); if (reporter == null) { AgentReporterMetrics healthMetrics = new AgentReporterMetrics(metricRegistry, metricsConfig); @@ -229,9 +229,9 @@ private ConfigurationRegistry getDefaultConfigurationRegistry(List getConfigSources(@Nullable String agentA // Optionally loading agent configuration from external file, while it depends on sources above, it has higher // priority and is thus inserted before them. - String configFileLocation = CoreConfiguration.getConfigFileLocation(result, premain); + String configFileLocation = CoreConfigurationImpl.getConfigFileLocation(result, premain); ConfigurationSource configFileSource = ConfigSources.fromFileSystem(configFileLocation); if (configFileSource != null) { result.add(0, configFileSource); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/EmptyElasticContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/EmptyTraceState.java similarity index 73% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/EmptyElasticContext.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/EmptyTraceState.java index cac09a1c49..bf7782b8a8 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/EmptyElasticContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/EmptyTraceState.java @@ -18,27 +18,27 @@ */ package co.elastic.apm.agent.impl; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; import javax.annotation.Nullable; -class EmptyElasticContext extends ElasticContext { +class EmptyTraceState extends TraceStateImpl { - EmptyElasticContext(ElasticApmTracer tracer) { + EmptyTraceState(ElasticApmTracer tracer) { super(tracer); } @Nullable @Override - public AbstractSpan getSpan() { + public AbstractSpanImpl getSpan() { return null; } @Override - public Baggage getBaggage() { - return Baggage.EMPTY; + public BaggageImpl getBaggage() { + return BaggageImpl.EMPTY; } @Override diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/Tracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/Tracer.java deleted file mode 100644 index f645420cd9..0000000000 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/Tracer.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package co.elastic.apm.agent.impl; - -import co.elastic.apm.agent.tracer.service.ServiceInfo; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; - -import javax.annotation.Nullable; - -public interface Tracer extends co.elastic.apm.agent.tracer.service.ServiceAwareTracer, co.elastic.apm.agent.tracer.Tracer { - - @Nullable - @Override - Transaction startRootTransaction(@Nullable ClassLoader initiatingClassLoader); - - @Nullable - Transaction startRootTransaction(@Nullable ClassLoader initiatingClassLoader, long epochMicro); - - @Nullable - Transaction startRootTransaction(@Nullable ClassLoader initiatingClassLoader, Baggage baseBaggage, long epochMicro); - - /** - * Starts a trace-root transaction with a specified sampler and start timestamp - * - * @param sampler the {@link Sampler} instance which is responsible for determining the sampling decision if this is a root transaction - * @param epochMicros the start timestamp - * @param initiatingClassLoader the class loader corresponding to the service which initiated the creation of the transaction. - * Used to determine the service name and to load application-scoped classes like the {@link org.slf4j.MDC}, - * for log correlation. - * @return a transaction that will be the root of the current trace if the agent is currently RUNNING; null otherwise - */ - @Nullable - Transaction startRootTransaction(Sampler sampler, long epochMicros, Baggage baseBaggage, @Nullable ClassLoader initiatingClassLoader); - - @Override - @Nullable - Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, @Nullable ClassLoader initiatingClassLoader); - - @Nullable - Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, @Nullable ClassLoader initiatingClassLoader, Baggage baseBaggage, long epochMicros); - - /** - * Starts a transaction as a child of the context headers obtained through the provided {@link HeaderGetter}. - * If the created transaction cannot be started as a child transaction (for example - if no parent context header is - * available), then it will be started as the root transaction of the trace. - * - * @param headerCarrier the Object from which context headers can be obtained, typically a request or a message - * @param headersGetter provides the trace context headers required in order to create a child transaction - * @param sampler the {@link Sampler} instance which is responsible for determining the sampling decision if this is a root transaction - * @param epochMicros the start timestamp - * @param initiatingClassLoader the class loader corresponding to the service which initiated the creation of the transaction. - * Used to determine the service name and to load application-scoped classes like the {@link org.slf4j.MDC}, - * for log correlation. - * @return a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise - */ - @Nullable - Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headersGetter, Sampler sampler, - long epochMicros, @Nullable ClassLoader initiatingClassLoader); - - - @Override - ElasticContext currentContext(); - - @Override - @Nullable - AbstractSpan getActive(); - - @Override - @Nullable - Transaction currentTransaction(); - - - /** - * Captures an exception without providing an explicit reference to a parent {@link AbstractSpan} - * - * @param e the exception to capture - * @param initiatingClassLoader the class - */ - void captureAndReportException(@Nullable Throwable e, ClassLoader initiatingClassLoader); - - @Nullable - String captureAndReportException(long epochMicros, @Nullable Throwable e, ElasticContext parentContext); - - @Nullable - ErrorCapture captureException(@Nullable Throwable e, ElasticContext parentContext, @Nullable ClassLoader initiatingClassLoader); - - TracerState getState(); - - @Nullable - ServiceInfo getServiceInfoForClassLoader(@Nullable ClassLoader classLoader); - - /** - * Sets the service name and version for all {@link Transaction}s, - * {@link Span}s and {@link ErrorCapture}s which are created by the service which corresponds to the provided {@link ClassLoader}. - *

    - * The main use case is being able to differentiate between multiple services deployed to the same application server. - *

    - * - * @param classLoader the class loader which corresponds to a particular service - * @param serviceInfo the service name and version for this class loader - */ - void setServiceInfoForClassLoader(@Nullable ClassLoader classLoader, ServiceInfo serviceInfo); - - /** - * Called when the container shuts down. - * Cleans up thread pools and other resources. - */ - void stop(); - - @Override - boolean isRunning(); - - @Nullable - Span createExitChildSpan(); - - /** - * An enumeration used to represent the current tracer state. - */ - enum TracerState { - /** - * The agent's state before it has been started for the first time. - */ - UNINITIALIZED, - - /** - * Indicates that the agent is currently fully functional - tracing, monitoring and sending data to the APM server. - */ - RUNNING, - - /** - * The agent is mostly idle, consuming minimal resources, ready to quickly resume back to RUNNING. When the agent - * is PAUSED, it is not tracing and not communicating with the APM server. However, classes are still instrumented - * and threads are still alive. - */ - PAUSED, - - /** - * Indicates that the agent had been stopped. - * NOTE: this state is irreversible- the agent cannot resume if it has already been stopped. - */ - STOPPED - } -} diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java index 1a8394a36e..fd3e7e84b6 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationOptionProvider; @@ -29,7 +29,7 @@ public class TracerConfiguration extends ConfigurationOptionProvider { .key(RECORDING) .aliasKeys("active") .tags("added[1.15.0]") - .configurationCategory(CoreConfiguration.CORE_CATEGORY) + .configurationCategory(CoreConfigurationImpl.CORE_CATEGORY) .description("NOTE: This option was available in older versions through the `active` key. The old key is still \n" + "supported in newer versions, but it is now deprecated.\n" + "\n" + diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageContext.java index 831b731ade..d757a032ef 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageContext.java @@ -18,19 +18,19 @@ */ package co.elastic.apm.agent.impl.baggage; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; import co.elastic.apm.agent.tracer.BaggageContextBuilder; import javax.annotation.Nullable; -public class BaggageContext extends ElasticContext { +public class BaggageContext extends TraceStateImpl { @Nullable - private final AbstractSpan span; - private final Baggage baggage; + private final AbstractSpanImpl span; + private final BaggageImpl baggage; - private BaggageContext(ElasticContext parent, Baggage baggage) { + private BaggageContext(TraceStateImpl parent, BaggageImpl baggage) { super(parent.getTracer()); this.span = parent.getSpan(); this.baggage = baggage; @@ -38,12 +38,12 @@ private BaggageContext(ElasticContext parent, Baggage baggage) { @Nullable @Override - public AbstractSpan getSpan() { + public AbstractSpanImpl getSpan() { return span; } @Override - public Baggage getBaggage() { + public BaggageImpl getBaggage() { return baggage; } @@ -61,16 +61,16 @@ public void decrementReferences() { } } - public static BaggageContext.Builder createBuilder(ElasticContext parent) { + public static BaggageContext.Builder createBuilder(TraceStateImpl parent) { return new Builder(parent); } public static class Builder implements BaggageContextBuilder { - private final ElasticContext parent; - private final Baggage.Builder baggageBuilder; + private final TraceStateImpl parent; + private final BaggageImpl.Builder baggageBuilder; - public Builder(ElasticContext parent) { + public Builder(TraceStateImpl parent) { this.parent = parent; this.baggageBuilder = parent.getBaggage().toBuilder(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/Baggage.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageImpl.java similarity index 89% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/Baggage.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageImpl.java index cecfe45f9e..88934639d5 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/Baggage.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/BaggageImpl.java @@ -19,8 +19,9 @@ package co.elastic.apm.agent.impl.baggage; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.impl.context.AbstractContext; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.context.AbstractContextImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.tracer.Baggage; import javax.annotation.Nullable; import java.nio.charset.StandardCharsets; @@ -32,11 +33,11 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -public class Baggage implements co.elastic.apm.agent.tracer.Baggage { +public class BaggageImpl implements Baggage { private static final String LIFTED_BAGGAGE_ATTRIBUTE_PREFIX = "baggage."; - public static final Baggage EMPTY = new Baggage(Collections.emptyMap(), Collections.emptyMap()); + public static final BaggageImpl EMPTY = new BaggageImpl(Collections.emptyMap(), Collections.emptyMap()); private final Map baggage; @@ -53,7 +54,7 @@ public class Baggage implements co.elastic.apm.agent.tracer.Baggage { * When automatically lifting baggage entries to be stored as span attributes we add the {@link #LIFTED_BAGGAGE_ATTRIBUTE_PREFIX} * to the key. * Because baggage is usually updated rarely but the lifting can happen for very many spans we cache the prefixed string in this map. - * See {@link #storeBaggageInAttributes(AbstractSpan, List)} for the implementation details. + * See {@link #storeBaggageInAttributes(AbstractSpanImpl, List)} for the implementation details. */ private volatile ConcurrentHashMap cachedKeysWithPrefix; @@ -67,7 +68,7 @@ public class Baggage implements co.elastic.apm.agent.tracer.Baggage { */ byte[] cachedSerializedW3CHeaderUtf8 = null; - private Baggage(Map baggage, Map baggageMetadata) { + private BaggageImpl(Map baggage, Map baggageMetadata) { this.baggage = baggage; this.baggageMetadata = baggageMetadata; } @@ -122,7 +123,7 @@ byte[] getCachedSerializedW3CHeaderUtf8() { return this.cachedSerializedW3CHeaderUtf8; } - public void storeBaggageInAttributes(AbstractSpan span, List keyFilter) { + public void storeBaggageInAttributes(AbstractSpanImpl span, List keyFilter) { if (baggage.isEmpty() || keyFilter.isEmpty()) { // early out to prevent unnecessarily allocating an iterator return; @@ -136,7 +137,7 @@ public void storeBaggageInAttributes(AbstractSpan span, List } } - public void storeBaggageInContext(AbstractContext context, List keyFilter) { + public void storeBaggageInContext(AbstractContextImpl context, List keyFilter) { if (baggage.isEmpty() || keyFilter.isEmpty()) { // early out to prevent unnecessarily allocating an iterator return; @@ -168,7 +169,7 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Baggage baggage1 = (Baggage) o; + BaggageImpl baggage1 = (BaggageImpl) o; if (!baggage.equals(baggage1.baggage)) return false; return baggageMetadata.equals(baggage1.baggageMetadata); @@ -183,14 +184,14 @@ public int hashCode() { public static class Builder { - public Builder(Baggage parent) { + public Builder(BaggageImpl parent) { this.parent = parent; this.baggage = parent.baggage; this.baggageMetadata = parent.baggageMetadata; buildCalled = false; } - private final Baggage parent; + private final BaggageImpl parent; private Map baggage; private Map baggageMetadata; @@ -221,7 +222,7 @@ public Builder put(String key, @Nullable String value, @Nullable String metadata * * @return a baggage resulting from this builder. */ - public Baggage build() { + public BaggageImpl build() { buildCalled = true; boolean anyModifications = false; if (baggage != parent.baggage) { @@ -233,7 +234,7 @@ public Baggage build() { baggageMetadata = Collections.unmodifiableMap(baggageMetadata); } if (anyModifications) { - return new Baggage(baggage, baggageMetadata); + return new BaggageImpl(baggage, baggageMetadata); } else { return parent; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagation.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagation.java index 6a52a1712d..dcd498deb8 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagation.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagation.java @@ -40,9 +40,9 @@ public class W3CBaggagePropagation { public static final String BAGGAGE_HEADER_NAME = "baggage"; - private static final HeaderGetter.HeaderConsumer STRING_PARSING_CONSUMER = new HeaderGetter.HeaderConsumer() { + private static final HeaderGetter.HeaderConsumer STRING_PARSING_CONSUMER = new HeaderGetter.HeaderConsumer() { @Override - public void accept(@Nullable String headerValue, Baggage.Builder state) { + public void accept(@Nullable String headerValue, BaggageImpl.Builder state) { if (headerValue != null) { try { new Parser(headerValue).parseInto(state); @@ -54,9 +54,9 @@ public void accept(@Nullable String headerValue, Baggage.Builder state) { }; - private static final HeaderGetter.HeaderConsumer UTF8_BYTES_PARSING_CONSUMER = new HeaderGetter.HeaderConsumer() { + private static final HeaderGetter.HeaderConsumer UTF8_BYTES_PARSING_CONSUMER = new HeaderGetter.HeaderConsumer() { @Override - public void accept(@Nullable byte[] headerValue, Baggage.Builder state) { + public void accept(@Nullable byte[] headerValue, BaggageImpl.Builder state) { if (headerValue != null) { try { STRING_PARSING_CONSUMER.accept(new String(headerValue, StandardCharsets.UTF_8), state); @@ -68,19 +68,19 @@ public void accept(@Nullable byte[] headerValue, Baggage.Builder state) { }; @SuppressWarnings("unchecked") - public static void parse(C carrier, HeaderGetter headerGetter, Baggage.Builder into) { - HeaderGetter.HeaderConsumer consumer; + public static void parse(C carrier, HeaderGetter headerGetter, BaggageImpl.Builder into) { + HeaderGetter.HeaderConsumer consumer; if (headerGetter instanceof TextHeaderGetter) { - consumer = (HeaderGetter.HeaderConsumer) STRING_PARSING_CONSUMER; + consumer = (HeaderGetter.HeaderConsumer) STRING_PARSING_CONSUMER; } else if (headerGetter instanceof UTF8ByteHeaderGetter) { - consumer = (HeaderGetter.HeaderConsumer) UTF8_BYTES_PARSING_CONSUMER; + consumer = (HeaderGetter.HeaderConsumer) UTF8_BYTES_PARSING_CONSUMER; } else { throw new IllegalArgumentException("HeaderGetter must be either a TextHeaderGetter or UTF8ByteHeaderGetter: " + headerGetter.getClass().getName()); } headerGetter.forEach(BAGGAGE_HEADER_NAME, carrier, into, consumer); } - public static void propagate(Baggage baggage, C carrier, HeaderSetter setter) { + public static void propagate(BaggageImpl baggage, C carrier, HeaderSetter setter) { if (baggage.isEmpty()) { return; } @@ -91,7 +91,7 @@ public static void propagate(Baggage baggage, C carrier, HeaderSetter T getTextHeader(Baggage baggage, HeaderSetter setter) { + private static T getTextHeader(BaggageImpl baggage, HeaderSetter setter) { if (setter instanceof TextHeaderSetter) { return (T) getTextHeaderString(baggage); } else if (setter instanceof UTF8ByteHeaderSetter) { @@ -102,13 +102,13 @@ private static T getTextHeader(Baggage baggage, HeaderSetter setter) { } @Nullable - private static byte[] getTextHeaderUtf8Bytes(Baggage baggage) { + private static byte[] getTextHeaderUtf8Bytes(BaggageImpl baggage) { getTextHeaderString(baggage); //ensures that the string-header is computed and cached return baggage.getCachedSerializedW3CHeaderUtf8(); } @Nullable - private static String getTextHeaderString(Baggage baggage) { + private static String getTextHeaderString(BaggageImpl baggage) { String header = baggage.getCachedSerializedW3CHeader(); if (header == null) { header = encodeToHeader(baggage); @@ -121,7 +121,7 @@ private static String getTextHeaderString(Baggage baggage) { } - private static String encodeToHeader(Baggage baggage) { + private static String encodeToHeader(BaggageImpl baggage) { StringBuilder header = new StringBuilder(); for (String key : baggage.keys()) { String value = baggage.get(key); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/otel/Parser.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/otel/Parser.java index d797defbb8..519899291a 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/otel/Parser.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/baggage/otel/Parser.java @@ -26,7 +26,7 @@ package co.elastic.apm.agent.impl.baggage.otel; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import javax.annotation.Nullable; import java.nio.charset.StandardCharsets; @@ -63,7 +63,7 @@ public Parser(String baggageHeader) { reset(0); } - public void parseInto(Baggage.Builder baggageBuilder) { + public void parseInto(BaggageImpl.Builder baggageBuilder) { for (int i = 0, n = baggageHeader.length(); i < n; i++) { char current = baggageHeader.charAt(i); @@ -141,7 +141,7 @@ public void parseInto(Baggage.Builder baggageBuilder) { } private static void putBaggage( - Baggage.Builder baggage, + BaggageImpl.Builder baggage, @Nullable String key, @Nullable String value, @Nullable String metadataValue) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/AbstractContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/AbstractContextImpl.java similarity index 89% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/AbstractContext.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/AbstractContextImpl.java index afcd86a802..de6b883c37 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/AbstractContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/AbstractContextImpl.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.AbstractContext; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; @@ -25,7 +26,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -public abstract class AbstractContext implements Recyclable, co.elastic.apm.agent.tracer.AbstractContext { +public abstract class AbstractContextImpl implements Recyclable, AbstractContext { public static final String REDACTED_CONTEXT_STRING = "[REDACTED]"; @@ -41,7 +42,7 @@ public abstract class AbstractContext implements Recyclable, co.elastic.apm.agen /** * An object containing contextual data for Messages (incoming in case of transactions or outgoing in case of spans) */ - private final Message message = new Message(); + private final MessageImpl message = new MessageImpl(); public Iterator> getLabelIterator() { return labels.entrySet().iterator(); @@ -73,7 +74,7 @@ public boolean hasLabels() { } @Override - public Message getMessage() { + public MessageImpl getMessage() { return message; } @@ -87,7 +88,7 @@ public boolean hasContent() { return !labels.isEmpty() || message.hasContent(); } - public void copyFrom(AbstractContext other) { + public void copyFrom(AbstractContextImpl other) { labels.putAll(other.labels); message.copyFrom(other.message); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyProcessor.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyProcessor.java index 12af85bff8..f68508ad0c 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyProcessor.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyProcessor.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.impl.context; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.processor.Processor; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import org.stagemonitor.configuration.ConfigurationRegistry; import static co.elastic.apm.agent.tracer.configuration.CoreConfiguration.EventType.ALL; @@ -29,30 +29,30 @@ import static co.elastic.apm.agent.tracer.configuration.CoreConfiguration.EventType.TRANSACTIONS; /** - * This processor redacts the body according to the {@link co.elastic.apm.agent.configuration.CoreConfiguration#captureBody} + * This processor redacts the body according to the {@link CoreConfigurationImpl#captureBody} * configuration option */ @SuppressWarnings("JavadocReference") public class BodyProcessor implements Processor { - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; public BodyProcessor(ConfigurationRegistry configurationRegistry) { - coreConfiguration = configurationRegistry.getConfig(CoreConfiguration.class); + coreConfiguration = configurationRegistry.getConfig(CoreConfigurationImpl.class); } @Override - public void processBeforeReport(Transaction transaction) { + public void processBeforeReport(TransactionImpl transaction) { redactBodyIfNecessary(transaction.getContext(), TRANSACTIONS); } @Override - public void processBeforeReport(ErrorCapture error) { + public void processBeforeReport(ErrorCaptureImpl error) { redactBodyIfNecessary(error.getContext(), ERRORS); } - private void redactBodyIfNecessary(TransactionContext context, CoreConfiguration.EventType eventType) { - final CoreConfiguration.EventType eventTypeConfig = coreConfiguration.getCaptureBody(); + private void redactBodyIfNecessary(TransactionContextImpl context, CoreConfigurationImpl.EventType eventType) { + final CoreConfigurationImpl.EventType eventTypeConfig = coreConfiguration.getCaptureBody(); if (eventTypeConfig != eventType && eventTypeConfig != ALL) { if (context.getRequest().getBody() != null) { context.getRequest().redactBody(); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/CloudOrigin.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/CloudOriginImpl.java similarity index 83% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/CloudOrigin.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/CloudOriginImpl.java index 3dbcd57f8b..d5eca191a9 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/CloudOrigin.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/CloudOriginImpl.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.metadata.CloudOrigin; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class CloudOrigin implements Recyclable, co.elastic.apm.agent.tracer.metadata.CloudOrigin { +public class CloudOriginImpl implements Recyclable, CloudOrigin { @Nullable protected String accountId; @@ -42,7 +43,7 @@ public String getAccountId() { } @Override - public CloudOrigin withAccountId(@Nullable String accountId) { + public CloudOriginImpl withAccountId(@Nullable String accountId) { this.accountId = accountId; return this; } @@ -53,7 +54,7 @@ public String getProvider() { } @Override - public CloudOrigin withProvider(@Nullable String provider) { + public CloudOriginImpl withProvider(@Nullable String provider) { this.provider = provider; return this; } @@ -64,7 +65,7 @@ public String getRegion() { } @Override - public CloudOrigin withRegion(@Nullable String region) { + public CloudOriginImpl withRegion(@Nullable String region) { this.region = region; return this; } @@ -75,7 +76,7 @@ public String getServiceName() { } @Override - public CloudOrigin withServiceName(@Nullable String serviceName) { + public CloudOriginImpl withServiceName(@Nullable String serviceName) { this.serviceName = serviceName; return this; } @@ -95,7 +96,7 @@ public boolean hasContent() { serviceName != null; } - public void copyFrom(CloudOrigin other) { + public void copyFrom(CloudOriginImpl other) { accountId = other.accountId; provider = other.provider; region = other.region; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Db.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/DbImpl.java similarity index 88% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Db.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/DbImpl.java index e2f5825b75..ea5090c4c4 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Db.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/DbImpl.java @@ -18,10 +18,11 @@ */ package co.elastic.apm.agent.impl.context; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; import co.elastic.apm.agent.objectpool.Resetter; import co.elastic.apm.agent.report.serialize.SerializationConstants; +import co.elastic.apm.agent.tracer.metadata.Db; import co.elastic.apm.agent.tracer.pooling.Allocator; import co.elastic.apm.agent.tracer.pooling.Recyclable; import org.jctools.queues.atomic.MpmcAtomicArrayQueue; @@ -30,9 +31,9 @@ import java.nio.Buffer; import java.nio.CharBuffer; -public class Db implements Recyclable, co.elastic.apm.agent.tracer.metadata.Db { +public class DbImpl implements Recyclable, Db { - private static final ObjectPool charBufferPool = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, + private static final ObservableObjectPool charBufferPool = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, new Allocator() { @Override public CharBuffer createInstance() { @@ -91,7 +92,7 @@ public String getInstance() { } @Override - public Db withInstance(@Nullable String instance) { + public DbImpl withInstance(@Nullable String instance) { this.instance = instance; return this; } @@ -105,7 +106,7 @@ public String getStatement() { } @Override - public Db withStatement(@Nullable String statement) { + public DbImpl withStatement(@Nullable String statement) { this.statement = statement; return this; } @@ -133,7 +134,7 @@ public String getType() { } @Override - public Db withType(@Nullable String type) { + public DbImpl withType(@Nullable String type) { this.type = type; return this; } @@ -147,7 +148,7 @@ public String getUser() { } @Override - public Db withUser(@Nullable String user) { + public DbImpl withUser(@Nullable String user) { this.user = user; return this; } @@ -163,7 +164,7 @@ public String getDbLink() { /** * DB Link for connections between 2 databases */ - public Db withDbLink(@Nullable String dbLink) { + public DbImpl withDbLink(@Nullable String dbLink) { this.dbLink = dbLink; return this; } @@ -176,7 +177,7 @@ public long getAffectedRowsCount(){ } @Override - public Db withAffectedRowsCount(long count){ + public DbImpl withAffectedRowsCount(long count){ this.affectedRowsCount = count; return this; } @@ -204,7 +205,7 @@ public boolean hasContent() { statementBuffer != null; } - public void copyFrom(Db other) { + public void copyFrom(DbImpl other) { instance = other.instance; statement = other.statement; type = other.type; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Destination.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/DestinationImpl.java similarity index 84% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Destination.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/DestinationImpl.java index 2152dc2c18..1cc0b359b5 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Destination.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/DestinationImpl.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.metadata.Cloud; +import co.elastic.apm.agent.tracer.metadata.Destination; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; @@ -25,7 +27,7 @@ import java.net.InetSocketAddress; import java.net.SocketAddress; -public class Destination implements Recyclable, co.elastic.apm.agent.tracer.metadata.Destination { +public class DestinationImpl implements Recyclable, Destination { /** * An IP (v4 or v6) or a host/domain name. @@ -42,14 +44,14 @@ public class Destination implements Recyclable, co.elastic.apm.agent.tracer.meta private boolean portSetByUser; @Override - public Destination withAddress(@Nullable CharSequence address) { + public DestinationImpl withAddress(@Nullable CharSequence address) { if (address != null && !addressSetByUser) { withAddress(address, 0, address.length()); } return this; } - public Destination withUserAddress(@Nullable CharSequence address) { + public DestinationImpl withUserAddress(@Nullable CharSequence address) { if (address == null || address.length() == 0) { this.address.setLength(0); } else { @@ -64,14 +66,14 @@ public StringBuilder getAddress() { } @Override - public Destination withPort(int port) { + public DestinationImpl withPort(int port) { if (!portSetByUser) { this.port = port; } return this; } - public Destination withUserPort(int port) { + public DestinationImpl withUserPort(int port) { withPort(port); portSetByUser = true; return this; @@ -82,7 +84,7 @@ public int getPort() { } @Override - public Destination withAddressPort(@Nullable String addressPort) { + public DestinationImpl withAddressPort(@Nullable String addressPort) { if (addressPort != null) { int separator = addressPort.lastIndexOf(':'); if (separator > 0) { @@ -137,10 +139,10 @@ private void withAddress(CharSequence address, int start, int end) { } } - private final Cloud cloud = new Cloud(); + private final CloudImpl cloud = new CloudImpl(); @Override - public Cloud getCloud() { + public CloudImpl getCloud() { return cloud; } @@ -159,7 +161,7 @@ public void resetState() { } @Override - public Destination withSocketAddress(SocketAddress socketAddress) { + public DestinationImpl withSocketAddress(SocketAddress socketAddress) { if (socketAddress instanceof InetSocketAddress) { withInetSocketAddress((InetSocketAddress) socketAddress); } @@ -167,7 +169,7 @@ public Destination withSocketAddress(SocketAddress socketAddress) { } @Override - public Destination withInetSocketAddress(InetSocketAddress inetSocketAddress) { + public DestinationImpl withInetSocketAddress(InetSocketAddress inetSocketAddress) { InetAddress inetAddress = inetSocketAddress.getAddress(); if (inetAddress != null) { withInetAddress(inetAddress); @@ -179,16 +181,16 @@ public Destination withInetSocketAddress(InetSocketAddress inetSocketAddress) { } @Override - public Destination withInetAddress(InetAddress inetAddress) { + public DestinationImpl withInetAddress(InetAddress inetAddress) { withAddress(inetAddress.getHostAddress()); return this; } - public static class Cloud implements Recyclable, co.elastic.apm.agent.tracer.metadata.Cloud { + public static class CloudImpl implements Recyclable, Cloud { private final StringBuilder region = new StringBuilder(); @Override - public Cloud withRegion(@Nullable String region) { + public CloudImpl withRegion(@Nullable String region) { this.region.setLength(0); if (region != null) { this.region.append(region); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Http.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java similarity index 83% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Http.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java index 0af4652db8..4995e3ef51 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Http.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java @@ -18,16 +18,17 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.metadata.Http; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class Http implements Recyclable, co.elastic.apm.agent.tracer.metadata.Http { +public class HttpImpl implements Recyclable, Http { /** * URL used by this HTTP outgoing span */ - private final Url url = new Url(); + private final UrlImpl url = new UrlImpl(); /** * HTTP method used by this HTTP outgoing span @@ -48,9 +49,9 @@ public CharSequence getUrl() { } /** - * @return internal {@link Url} instance + * @return internal {@link UrlImpl} instance */ - public Url getInternalUrl() { + public UrlImpl getInternalUrl() { return url; } @@ -65,7 +66,7 @@ public int getStatusCode() { } @Override - public Http withUrl(@Nullable String url) { + public HttpImpl withUrl(@Nullable String url) { if (url != null) { this.url.withFull(url); } @@ -73,13 +74,13 @@ public Http withUrl(@Nullable String url) { } @Override - public Http withMethod(String method) { + public HttpImpl withMethod(String method) { this.method = method; return this; } @Override - public Http withStatusCode(int statusCode) { + public HttpImpl withStatusCode(int statusCode) { this.statusCode = statusCode; return this; } @@ -97,7 +98,7 @@ public boolean hasContent() { statusCode > 0; } - public void copyFrom(Http other) { + public void copyFrom(HttpImpl other) { url.copyFrom(other.url); method = other.method; statusCode = other.statusCode; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Message.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/MessageImpl.java similarity index 82% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Message.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/MessageImpl.java index aa45d22ed5..e2af0dba7d 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Message.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/MessageImpl.java @@ -18,20 +18,21 @@ */ package co.elastic.apm.agent.impl.context; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; import co.elastic.apm.agent.objectpool.Resetter; +import co.elastic.apm.agent.tracer.metadata.Message; import co.elastic.apm.agent.tracer.pooling.Allocator; import co.elastic.apm.agent.tracer.pooling.Recyclable; import org.jctools.queues.atomic.MpmcAtomicArrayQueue; import javax.annotation.Nullable; -import static co.elastic.apm.agent.impl.context.AbstractContext.REDACTED_CONTEXT_STRING; +import static co.elastic.apm.agent.impl.context.AbstractContextImpl.REDACTED_CONTEXT_STRING; -public class Message implements Recyclable, co.elastic.apm.agent.tracer.metadata.Message { +public class MessageImpl implements Recyclable, Message { - private static final ObjectPool stringBuilderPool = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, + private static final ObservableObjectPool stringBuilderPool = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, new Allocator() { @Override public StringBuilder createInstance() { @@ -71,13 +72,13 @@ public String getQueueName() { } @Override - public Message withQueue(@Nullable String queueName) { + public MessageImpl withQueue(@Nullable String queueName) { this.queueName = queueName; return this; } @Override - public Message withRoutingKey(String routingKey) { + public MessageImpl withRoutingKey(String routingKey) { this.routingKey = routingKey; return this; } @@ -109,7 +110,7 @@ public StringBuilder getBodyForRead() { } @Override - public Message withBody(@Nullable String body) { + public MessageImpl withBody(@Nullable String body) { StringBuilder thisBody = getBodyForWrite(); thisBody.setLength(0); thisBody.append(body); @@ -117,7 +118,7 @@ public Message withBody(@Nullable String body) { } @Override - public Message appendToBody(CharSequence bodyContent) { + public MessageImpl appendToBody(CharSequence bodyContent) { getBodyForWrite().append(bodyContent); return this; } @@ -130,13 +131,13 @@ public void redactBody() { } @Override - public Message addHeader(@Nullable String key, @Nullable String value) { + public MessageImpl addHeader(@Nullable String key, @Nullable String value) { headers.add(key, value); return this; } @Override - public Message addHeader(@Nullable String key, @Nullable byte[] value) { + public MessageImpl addHeader(@Nullable String key, @Nullable byte[] value) { headers.add(key, value); return this; } @@ -147,7 +148,7 @@ public long getAge() { @SuppressWarnings("UnusedReturnValue") @Override - public Message withAge(long age) { + public MessageImpl withAge(long age) { this.age = age; return this; } @@ -172,7 +173,7 @@ public void resetState() { routingKey = null; } - public void copyFrom(Message other) { + public void copyFrom(MessageImpl other) { resetState(); this.queueName = other.getQueueName(); if (other.body != null) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/RequestImpl.java similarity index 86% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/RequestImpl.java index a6d2694b4e..ad8af7fd77 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Request.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/RequestImpl.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.impl.context; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.Resetter; import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; import co.elastic.apm.agent.report.serialize.SerializationConstants; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; +import co.elastic.apm.agent.tracer.metadata.Request; import co.elastic.apm.agent.tracer.pooling.Allocator; import co.elastic.apm.agent.tracer.pooling.Recyclable; import org.jctools.queues.atomic.MpmcAtomicArrayQueue; @@ -32,12 +33,12 @@ import java.nio.CharBuffer; import java.util.Enumeration; -import static co.elastic.apm.agent.impl.context.AbstractContext.REDACTED_CONTEXT_STRING; +import static co.elastic.apm.agent.impl.context.AbstractContextImpl.REDACTED_CONTEXT_STRING; -public class Request implements Recyclable, co.elastic.apm.agent.tracer.metadata.Request { +public class RequestImpl implements Recyclable, Request { - private static final ObjectPool charBufferPool = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, + private static final ObservableObjectPool charBufferPool = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, new Allocator() { @Override public CharBuffer createInstance() { @@ -56,12 +57,12 @@ public void recycle(CharBuffer object) { * Should include any headers sent by the requester. Map will be taken by headers if supplied. */ private final PotentiallyMultiValuedMap headers = new PotentiallyMultiValuedMap(); - private final Socket socket = new Socket(); + private final SocketImpl socket = new SocketImpl(); /** * A complete Url, with scheme, host and path. * (Required) */ - private final Url url = new Url(); + private final UrlImpl url = new UrlImpl(); /** * A parsed key-value object of cookies */ @@ -120,13 +121,13 @@ public void redactBody() { setRawBody(REDACTED_CONTEXT_STRING); } - public Request addFormUrlEncodedParameter(String key, String value) { + public RequestImpl addFormUrlEncodedParameter(String key, String value) { this.postParams.add(key, value); return this; } @Override - public Request addFormUrlEncodedParameters(String key, String[] values) { + public RequestImpl addFormUrlEncodedParameters(String key, String[] values) { this.postParams.set(key, values); return this; } @@ -158,7 +159,7 @@ public CharBuffer getBodyBuffer() { } /** - * Returns the body buffer if it was written to and writing to it was finished through {@link Request#endOfBufferInput()} + * Returns the body buffer if it was written to and writing to it was finished through {@link RequestImpl#endOfBufferInput()} * * @return body buffer if it was written to and writing was finished; returns {@code null} otherwise. */ @@ -176,7 +177,7 @@ public PotentiallyMultiValuedMap getFormUrlEncodedParameters() { } @Override - public Request addHeader(String headerName, @Nullable String headerValue) { + public RequestImpl addHeader(String headerName, @Nullable String headerValue) { if (headerValue != null) { headers.add(headerName, headerValue); } @@ -184,7 +185,7 @@ public Request addHeader(String headerName, @Nullable String headerValue) { } @Override - public Request addHeader(String headerName, @Nullable Enumeration headerValues) { + public RequestImpl addHeader(String headerName, @Nullable Enumeration headerValues) { if (headerValues != null) { while (headerValues.hasMoreElements()) { headers.add(headerName, headerValues.nextElement()); @@ -207,7 +208,7 @@ public String getHttpVersion() { } @Override - public Request withHttpVersion(@Nullable String httpVersion) { + public RequestImpl withHttpVersion(@Nullable String httpVersion) { if (httpVersion != null) { this.httpVersion = getHttpVersion(httpVersion); } @@ -238,23 +239,23 @@ public String getMethod() { } @Override - public Request withMethod(@Nullable String method) { + public RequestImpl withMethod(@Nullable String method) { this.method = method; return this; } @Override - public Socket getSocket() { + public SocketImpl getSocket() { return socket; } @Override - public Url getUrl() { + public UrlImpl getUrl() { return url; } @Override - public Request addCookie(String cookieName, String cookieValue) { + public RequestImpl addCookie(String cookieName, String cookieValue) { cookies.add(cookieName, cookieValue); return this; } @@ -284,7 +285,7 @@ public void resetState() { rawBody = null; } - public void copyFrom(Request other) { + public void copyFrom(RequestImpl other) { this.postParams.copyFrom(other.postParams); this.headers.copyFrom(other.headers); this.httpVersion = other.httpVersion; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ResponseImpl.java similarity index 85% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ResponseImpl.java index 4a6ef90b99..50f57c7730 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Response.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ResponseImpl.java @@ -19,12 +19,13 @@ package co.elastic.apm.agent.impl.context; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; +import co.elastic.apm.agent.tracer.metadata.Response; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; import java.util.Collection; -public class Response implements Recyclable, co.elastic.apm.agent.tracer.metadata.Response { +public class ResponseImpl implements Recyclable, Response { /** * A mapping of HTTP headers of the response object @@ -48,7 +49,7 @@ public boolean isFinished() { } @Override - public Response withFinished(boolean finished) { + public ResponseImpl withFinished(boolean finished) { this.finished = finished; return this; } @@ -61,7 +62,7 @@ public Response withFinished(boolean finished) { * @return {@code this}, for fluent method chaining */ @Override - public Response addHeader(String headerName, @Nullable String headerValue) { + public ResponseImpl addHeader(String headerName, @Nullable String headerValue) { if (headerValue != null) { headers.add(headerName, headerValue); } @@ -69,7 +70,7 @@ public Response addHeader(String headerName, @Nullable String headerValue) { } @Override - public Response addHeader(String headerName, @Nullable Collection headerValues) { + public ResponseImpl addHeader(String headerName, @Nullable Collection headerValues) { if (headerValues != null) { for (String headerValue : headerValues) { headers.add(headerName, headerValue); @@ -89,7 +90,7 @@ public boolean isHeadersSent() { } @Override - public Response withHeadersSent(boolean headersSent) { + public ResponseImpl withHeadersSent(boolean headersSent) { this.headersSent = headersSent; return this; } @@ -102,7 +103,7 @@ public int getStatusCode() { } @Override - public Response withStatusCode(int statusCode) { + public ResponseImpl withStatusCode(int statusCode) { this.statusCode = statusCode; return this; } @@ -115,7 +116,7 @@ public void resetState() { statusCode = 0; } - public void copyFrom(Response other) { + public void copyFrom(ResponseImpl other) { this.finished = other.finished; this.headers.copyFrom(other.headers); this.headersSent = other.headersSent; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessor.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessor.java index 45f30d5ab1..4c79fddb99 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessor.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessor.java @@ -18,43 +18,43 @@ */ package co.elastic.apm.agent.impl.context; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.report.processor.Processor; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; import org.stagemonitor.configuration.ConfigurationRegistry; -import static co.elastic.apm.agent.impl.context.AbstractContext.REDACTED_CONTEXT_STRING; +import static co.elastic.apm.agent.impl.context.AbstractContextImpl.REDACTED_CONTEXT_STRING; /** - * Sanitizes web-related fields according to the {@link CoreConfiguration#sanitizeFieldNames} setting + * Sanitizes web-related fields according to the {@link CoreConfigurationImpl#sanitizeFieldNames} setting */ public class SanitizingWebProcessor implements Processor { - private final CoreConfiguration config; + private final CoreConfigurationImpl config; public SanitizingWebProcessor(ConfigurationRegistry configurationRegistry) { - config = configurationRegistry.getConfig(CoreConfiguration.class); + config = configurationRegistry.getConfig(CoreConfigurationImpl.class); } @Override - public void processBeforeReport(Transaction transaction) { + public void processBeforeReport(TransactionImpl transaction) { sanitizeContext(transaction.getContext()); } @Override - public void processBeforeReport(ErrorCapture error) { + public void processBeforeReport(ErrorCaptureImpl error) { sanitizeContext(error.getContext()); } - private void sanitizeContext(TransactionContext context) { + private void sanitizeContext(TransactionContextImpl context) { sanitizeRequest(context.getRequest()); sanitizeMap(context.getResponse().getHeaders()); } - private void sanitizeRequest(Request request) { + private void sanitizeRequest(RequestImpl request) { sanitizeMap(request.getHeaders()); // cookies are stored in Request.cookies // storing it twice would be wasteful diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOriginImpl.java similarity index 83% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOriginImpl.java index 5cdf69b407..a5d65ae213 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOrigin.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceOriginImpl.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.ServiceOrigin; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; @@ -28,7 +29,7 @@ * If a request originated from another service, * the service origin interface can be used to collect information about the origin service. */ -public class ServiceOrigin implements co.elastic.apm.agent.tracer.ServiceOrigin, Recyclable { +public class ServiceOriginImpl implements ServiceOrigin, Recyclable { @Nullable private String id; @@ -44,7 +45,7 @@ public String getId() { } @Override - public ServiceOrigin withId(@Nullable String id) { + public ServiceOriginImpl withId(@Nullable String id) { this.id = id; return this; } @@ -54,7 +55,7 @@ public StringBuilder getName() { } @Override - public ServiceOrigin withName(@Nullable CharSequence name) { + public ServiceOriginImpl withName(@Nullable CharSequence name) { this.name.setLength(0); if (name != null) { this.name.append(name); @@ -62,7 +63,7 @@ public ServiceOrigin withName(@Nullable CharSequence name) { return this; } - public ServiceOrigin appendToName(@Nullable String namePart) { + public ServiceOriginImpl appendToName(@Nullable String namePart) { if (namePart != null) { this.name.append(namePart); } @@ -75,7 +76,7 @@ public String getVersion() { } @Override - public ServiceOrigin withVersion(@Nullable String version) { + public ServiceOriginImpl withVersion(@Nullable String version) { this.version = version; return this; } @@ -93,7 +94,7 @@ public boolean hasContent() { version != null; } - public void copyFrom(ServiceOrigin other) { + public void copyFrom(ServiceOriginImpl other) { id = other.id; withName(other.getName()); version = other.version; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceTarget.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceTargetImpl.java similarity index 87% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceTarget.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceTargetImpl.java index 26433233a6..ba4eaefd1b 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceTarget.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/ServiceTargetImpl.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.ServiceTarget; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class ServiceTarget implements Recyclable, co.elastic.apm.agent.tracer.ServiceTarget { +public class ServiceTargetImpl implements Recyclable, ServiceTarget { @Nullable private String type; @@ -36,12 +37,12 @@ public class ServiceTarget implements Recyclable, co.elastic.apm.agent.tracer.Se private final StringBuilder destinationResource; - public ServiceTarget() { + public ServiceTargetImpl() { this.name = new StringBuilder(); this.destinationResource = new StringBuilder(); } - public ServiceTarget withType(@Nullable String type) { + public ServiceTargetImpl withType(@Nullable String type) { if (typeSetByUser) { return this; } @@ -49,7 +50,7 @@ public ServiceTarget withType(@Nullable String type) { return this; } - public ServiceTarget withUserType(@Nullable String type) { + public ServiceTargetImpl withUserType(@Nullable String type) { this.type = type; this.typeSetByUser = true; return this; @@ -60,7 +61,7 @@ public String getType() { return type; } - public ServiceTarget withName(@Nullable CharSequence name) { + public ServiceTargetImpl withName(@Nullable CharSequence name) { if (name == null || name.length() == 0 || nameSetByUser) { return this; } @@ -70,7 +71,7 @@ public ServiceTarget withName(@Nullable CharSequence name) { return this; } - public ServiceTarget withUserName(@Nullable CharSequence name) { + public ServiceTargetImpl withUserName(@Nullable CharSequence name) { this.name.setLength(0); if (name != null) { this.name.append(name); @@ -89,7 +90,7 @@ public CharSequence getName() { * * @return this */ - public ServiceTarget withNameOnlyDestinationResource() { + public ServiceTargetImpl withNameOnlyDestinationResource() { onlyNameInResource = true; return this; } @@ -101,7 +102,7 @@ public ServiceTarget withNameOnlyDestinationResource() { * @param port network port * @return this */ - public ServiceTarget withHostPortName(@Nullable CharSequence host, int port) { + public ServiceTargetImpl withHostPortName(@Nullable CharSequence host, int port) { if (host == null || host.length() == 0 || nameSetByUser) { return this; } @@ -162,7 +163,7 @@ public boolean isSetByUser() { return typeSetByUser || nameSetByUser; } - public void copyFrom(ServiceTarget other) { + public void copyFrom(ServiceTargetImpl other) { this.withType(other.type); this.withName(other.name); this.typeSetByUser = other.typeSetByUser; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Socket.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SocketImpl.java similarity index 85% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Socket.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SocketImpl.java index 4340dd5e4b..b567526a74 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Socket.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SocketImpl.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.metadata.Socket; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class Socket implements Recyclable, co.elastic.apm.agent.tracer.metadata.Socket { +public class SocketImpl implements Recyclable, Socket { @Nullable private String remoteAddress; @@ -33,7 +34,7 @@ public String getRemoteAddress() { } @Override - public Socket withRemoteAddress(@Nullable String remoteAddress) { + public SocketImpl withRemoteAddress(@Nullable String remoteAddress) { this.remoteAddress = remoteAddress; return this; } @@ -43,7 +44,7 @@ public void resetState() { remoteAddress = null; } - public void copyFrom(Socket other) { + public void copyFrom(SocketImpl other) { this.remoteAddress = other.remoteAddress; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SpanContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SpanContextImpl.java similarity index 77% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SpanContext.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SpanContextImpl.java index f5245d642c..aaf03038c2 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SpanContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/SpanContextImpl.java @@ -19,48 +19,50 @@ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.SpanContext; + /** * Any other arbitrary data captured by the agent, optionally provided by the user */ -public class SpanContext extends AbstractContext implements co.elastic.apm.agent.tracer.SpanContext { +public class SpanContextImpl extends AbstractContextImpl implements SpanContext { /** * An object containing contextual data for database spans */ - private final Db db = new Db(); + private final DbImpl db = new DbImpl(); /** * An object containing contextual data for outgoing HTTP spans */ - private final Http http = new Http(); + private final HttpImpl http = new HttpImpl(); /** * An object containing contextual data for service maps */ - private final Destination destination = new Destination(); + private final DestinationImpl destination = new DestinationImpl(); /** * An object containing contextual data for service target */ - private final ServiceTarget serviceTarget = new ServiceTarget(); + private final ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); @Override - public Db getDb() { + public DbImpl getDb() { return db; } @Override - public Http getHttp() { + public HttpImpl getHttp() { return http; } @Override - public Destination getDestination() { + public DestinationImpl getDestination() { return destination; } @Override - public ServiceTarget getServiceTarget() { + public ServiceTargetImpl getServiceTarget() { return serviceTarget; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContextImpl.java similarity index 81% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContextImpl.java index 05df0e1015..523b70195f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/TransactionContextImpl.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.TransactionContext; + import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -28,7 +30,7 @@ *

    * Any arbitrary contextual information regarding the event, captured by the agent, optionally provided by the user */ -public class TransactionContext extends AbstractContext implements co.elastic.apm.agent.tracer.TransactionContext { +public class TransactionContextImpl extends AbstractContextImpl implements TransactionContext { /** * A flat mapping of user-defined {@link String} keys and {@link String}, {@link Number} or {@link Boolean} values @@ -37,35 +39,35 @@ public class TransactionContext extends AbstractContext implements co.elastic.ap *

    */ private final Map custom = new ConcurrentHashMap<>(); - private final Response response = new Response(); + private final ResponseImpl response = new ResponseImpl(); /** * Request *

    * If a log record was generated as a result of a http request, the http interface can be used to collect this information. */ - private final Request request = new Request(); + private final RequestImpl request = new RequestImpl(); /** * User *

    * Describes the authenticated User for a request. */ - private final User user = new User(); + private final UserImpl user = new UserImpl(); /** * CloudOrigin *

    * Describes the cloud information about the origin of a request. */ - private final CloudOrigin cloudOrigin = new CloudOrigin(); + private final CloudOriginImpl cloudOrigin = new CloudOriginImpl(); /** * ServiceOrigin *

    * Describes the service information about the origin of a request. */ - private final ServiceOrigin serviceOrigin = new ServiceOrigin(); + private final ServiceOriginImpl serviceOrigin = new ServiceOriginImpl(); - public void copyFrom(TransactionContext other) { + public void copyFrom(TransactionContextImpl other) { super.copyFrom(other); response.copyFrom(other.response); request.copyFrom(other.request); @@ -79,7 +81,7 @@ public Object getCustom(String key) { } @Override - public Response getResponse() { + public ResponseImpl getResponse() { return response; } @@ -104,22 +106,22 @@ public boolean hasCustom() { } @Override - public Request getRequest() { + public RequestImpl getRequest() { return request; } @Override - public User getUser() { + public UserImpl getUser() { return user; } @Override - public CloudOrigin getCloudOrigin() { + public CloudOriginImpl getCloudOrigin() { return cloudOrigin; } @Override - public ServiceOrigin getServiceOrigin() { + public ServiceOriginImpl getServiceOrigin() { return serviceOrigin; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Url.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/UrlImpl.java similarity index 94% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Url.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/UrlImpl.java index bd94242d25..915e6250e2 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/Url.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/UrlImpl.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.metadata.Url; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; @@ -27,7 +28,7 @@ import java.net.URL; -public class Url implements Recyclable, co.elastic.apm.agent.tracer.metadata.Url { +public class UrlImpl implements Recyclable, Url { /** * The full, possibly agent-assembled URL of the request, e.g https://example.com:443/search?q=elasticsearch#top. @@ -67,7 +68,7 @@ public String getProtocol() { } @Override - public Url withProtocol(@Nullable String protocol) { + public UrlImpl withProtocol(@Nullable String protocol) { this.protocol = protocol; return this; } @@ -112,7 +113,7 @@ private void updateFull() { * @param value full URL * @return this */ - public Url withFull(CharSequence value) { + public UrlImpl withFull(CharSequence value) { if (!urlNeedsSanitization(value)) { full.setLength(0); full.append(value); @@ -150,7 +151,7 @@ public String getHostname() { } @Override - public Url withHostname(@Nullable String hostname) { + public UrlImpl withHostname(@Nullable String hostname) { this.hostname = hostname; return this; } @@ -163,7 +164,7 @@ public int getPort() { } @Override - public Url withPort(int port) { + public UrlImpl withPort(int port) { this.port = port; return this; } @@ -177,7 +178,7 @@ public String getPathname() { } @Override - public Url withPathname(@Nullable String pathname) { + public UrlImpl withPathname(@Nullable String pathname) { this.pathname = pathname; return this; } @@ -191,7 +192,7 @@ public String getSearch() { } @Override - public Url withSearch(@Nullable String search) { + public UrlImpl withSearch(@Nullable String search) { this.search = search; return this; } @@ -285,7 +286,7 @@ public void resetState() { search = null; } - public void copyFrom(Url other) { + public void copyFrom(UrlImpl other) { this.protocol = other.protocol; this.full.setLength(0); this.full.append(other.full); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/User.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/UserImpl.java similarity index 87% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/User.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/UserImpl.java index 00ea8751c7..880af3ed5f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/User.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/UserImpl.java @@ -18,12 +18,13 @@ */ package co.elastic.apm.agent.impl.context; +import co.elastic.apm.agent.tracer.metadata.User; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class User implements Recyclable, co.elastic.apm.agent.tracer.metadata.User { +public class UserImpl implements Recyclable, User { /** * Domain of the logged in user @@ -59,7 +60,7 @@ public String getDomain() { /** * Domain of the logged in user */ - public User withDomain(@Nullable String domain) { + public UserImpl withDomain(@Nullable String domain) { this.domain = domain; return this; } @@ -75,7 +76,7 @@ public String getId() { /** * Identifier of the logged in user, e.g. the primary key of the user */ - public User withId(@Nullable String id) { + public UserImpl withId(@Nullable String id) { this.id = id; return this; } @@ -91,7 +92,7 @@ public String getEmail() { /** * Email of the logged in user */ - public User withEmail(@Nullable String email) { + public UserImpl withEmail(@Nullable String email) { this.email = email; return this; } @@ -103,7 +104,7 @@ public String getUsername() { } @Override - public User withUsername(@Nullable String username) { + public UserImpl withUsername(@Nullable String username) { this.username = username; return this; } @@ -116,7 +117,7 @@ public void resetState() { username = null; } - public void copyFrom(User other) { + public void copyFrom(UserImpl other) { this.domain = other.domain; this.email = other.email; this.id = other.id; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCapture.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCaptureImpl.java similarity index 83% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCapture.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCaptureImpl.java index 5be5431390..065473b389 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCapture.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/error/ErrorCaptureImpl.java @@ -19,15 +19,15 @@ package co.elastic.apm.agent.impl.error; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.common.util.WildcardMatcher; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.ErrorCapture; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; @@ -37,20 +37,20 @@ /** * Data captured by an agent representing an event occurring in a monitored service */ -public class ErrorCapture implements Recyclable, co.elastic.apm.agent.tracer.ErrorCapture { +public class ErrorCaptureImpl implements Recyclable, ErrorCapture { - private static final Logger logger = LoggerFactory.getLogger(ErrorCapture.class); + private static final Logger logger = LoggerFactory.getLogger(ErrorCaptureImpl.class); - private static final ThreadLocal activeError = new ThreadLocal<>(); + private static final ThreadLocal activeError = new ThreadLocal<>(); - private final TraceContext traceContext; + private final TraceContextImpl traceContext; /** * Context *

    * Any arbitrary contextual information regarding the event, captured by the agent, optionally provided by the user */ - private final TransactionContext context = new TransactionContext(); + private final TransactionContextImpl context = new TransactionContextImpl(); private final ElasticApmTracer tracer; /** * Information about the originally thrown error. @@ -70,9 +70,9 @@ public class ErrorCapture implements Recyclable, co.elastic.apm.agent.tracer.Err private final StringBuilder culprit = new StringBuilder(); - public ErrorCapture(ElasticApmTracer tracer) { + public ErrorCaptureImpl(ElasticApmTracer tracer) { this.tracer = tracer; - traceContext = TraceContext.with128BitId(this.tracer); + traceContext = TraceContextImpl.with128BitId(this.tracer); } /** @@ -80,7 +80,7 @@ public ErrorCapture(ElasticApmTracer tracer) { *

    * Any arbitrary contextual information regarding the event, captured by the agent, optionally provided by the user */ - public TransactionContext getContext() { + public TransactionContextImpl getContext() { return context; } @@ -100,7 +100,7 @@ public long getTimestamp() { return timestamp; } - public ErrorCapture withTimestamp(long epochMs) { + public ErrorCaptureImpl withTimestamp(long epochMs) { this.timestamp = epochMs; return this; } @@ -120,12 +120,12 @@ public void recycle() { } /** - * Creates a reference to a {@link TraceContext} + * Creates a reference to a {@link TraceContextImpl} * * @param parent parent trace context * @return {@code this}, for chaining */ - public ErrorCapture asChildOf(AbstractSpan parent) { + public ErrorCaptureImpl asChildOf(AbstractSpanImpl parent) { this.traceContext.asChildOf(parent.getTraceContext()); if (traceContext.getTraceId().isEmpty()) { logger.debug("Creating an Error as child of {} with a null trace_id", parent.getNameAsString()); @@ -133,13 +133,13 @@ public ErrorCapture asChildOf(AbstractSpan parent) { logger.trace("Stack trace related to Error capture: ", new Throwable()); } } - if (parent instanceof Transaction) { - Transaction transaction = (Transaction) parent; + if (parent instanceof TransactionImpl) { + TransactionImpl transaction = (TransactionImpl) parent; // The error might have occurred in a different thread than the one the transaction was recorded // That's why we have to ensure the visibility of the transaction properties context.copyFrom(transaction.getContextEnsureVisibility()); - } else if (parent instanceof Span) { - Span span = (Span) parent; + } else if (parent instanceof SpanImpl) { + SpanImpl span = (SpanImpl) parent; // TODO copy into SpanContext // https://github.com/elastic/apm-agent-java/issues/279 context.copyFrom(span.getContext()); @@ -148,7 +148,7 @@ public ErrorCapture asChildOf(AbstractSpan parent) { } @Override - public TraceContext getTraceContext() { + public TraceContextImpl getTraceContext() { return traceContext; } @@ -158,7 +158,7 @@ public void setException(Throwable e) { public StringBuilder getCulprit() { // lazily resolve culprit so that java.lang.Throwable.getStackTrace is called outside the application thread - final Collection applicationPackages = tracer.getConfig(StacktraceConfiguration.class).getApplicationPackages(); + final Collection applicationPackages = tracer.getConfig(StacktraceConfigurationImpl.class).getApplicationPackages(); if (exception != null && culprit.length() == 0 && !applicationPackages.isEmpty()) { computeCulprit(exception, applicationPackages); } @@ -201,19 +201,19 @@ private void setCulprit(StackTraceElement stackTraceElement) { } @Override - public ErrorCapture activate() { + public ErrorCaptureImpl activate() { activeError.set(this); return this; } @Override - public ErrorCapture deactivate() { + public ErrorCaptureImpl deactivate() { activeError.remove(); return this; } @Nullable - public static ErrorCapture getActive() { + public static ErrorCaptureImpl getActive() { return activeError.get(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/CloudMetadataProvider.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/CloudMetadataProvider.java index caa060f0b7..6c27226bcf 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/CloudMetadataProvider.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/CloudMetadataProvider.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.impl.metadata; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.util.ExecutorUtils; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.util.UrlConnectionUtils; @@ -44,10 +44,10 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.AWS; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.AZURE; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.GCP; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.NONE; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.AWS; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.AZURE; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.GCP; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.NONE; import static java.nio.charset.StandardCharsets.UTF_8; public class CloudMetadataProvider { @@ -56,16 +56,16 @@ public class CloudMetadataProvider { private static final DslJson dslJson = new DslJson<>(new DslJson.Settings<>()); /** - * This method may block on multiple HTTP calls. See {@link #fetchAndParseCloudProviderInfo(CoreConfiguration.CloudProvider, int)} + * This method may block on multiple HTTP calls. See {@link #fetchAndParseCloudProviderInfo(CoreConfigurationImpl.CloudProvider, int)} * for details. * @param cloudProvider the configured cloud provided - used as an optimization to lookup specific APIs instead of trial-and-error * @param queryTimeoutMs a configured limitation for the maximum duration of each metadata discovery task * @return cloud provide metadata, or {@code null} if requested not to do any lookup by using - * {@link co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider#NONE} + * {@link CoreConfigurationImpl.CloudProvider#NONE} */ @Nullable - static CloudProviderInfo getCloudInfoProvider(final CoreConfiguration.CloudProvider cloudProvider, final int queryTimeoutMs, - ServerlessConfiguration serverlessConfiguration) { + static CloudProviderInfo getCloudInfoProvider(final CoreConfigurationImpl.CloudProvider cloudProvider, final int queryTimeoutMs, + ServerlessConfigurationImpl serverlessConfiguration) { if (serverlessConfiguration.runsOnAwsLambda()) { CloudProviderInfo awsLambdaInfo = new CloudProviderInfo("aws"); @@ -84,18 +84,18 @@ static CloudProviderInfo getCloudInfoProvider(final CoreConfiguration.CloudProvi /** * Automatic discovery of cloud provider and related metadata. This method is fetching data from public APIs * exposed by known cloud provider services through HTTP. - * When a specific {@link co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider} is specified, only + * When a specific {@link CoreConfigurationImpl.CloudProvider} is specified, only * the relevant API will be queried. - * However, when called with {@link co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider#AUTO}, all + * However, when called with {@link CoreConfigurationImpl.CloudProvider#AUTO}, all * known endpoints are queried concurrently. In such cases, blocking is expected to be long, bounded by the * HTTP requests timing out. * - * @param cloudProvider the expected {@link CoreConfiguration.CloudProvider} + * @param cloudProvider the expected {@link CoreConfigurationImpl.CloudProvider} * @param queryTimeoutMs timeout in milliseconds to limit the discovery duration * @return Automatically discovered {@link CloudProviderInfo}, or {@code null} if none found. */ @Nullable - static CloudProviderInfo fetchAndParseCloudProviderInfo(final CoreConfiguration.CloudProvider cloudProvider, final int queryTimeoutMs) { + static CloudProviderInfo fetchAndParseCloudProviderInfo(final CoreConfigurationImpl.CloudProvider cloudProvider, final int queryTimeoutMs) { Throwable unexpectedError = null; CloudProviderInfo cloudProviderInfo = null; @@ -137,7 +137,7 @@ static CloudProviderInfo fetchAndParseCloudProviderInfo(final CoreConfiguration. } @Nullable - private static CloudProviderInfo tryAllCloudProviders(final CoreConfiguration.CloudProvider cloudProvider, final int queryTimeoutMs) + private static CloudProviderInfo tryAllCloudProviders(final CoreConfigurationImpl.CloudProvider cloudProvider, final int queryTimeoutMs) throws InterruptedException, ExecutionException, TimeoutException { ExecutorService executor = ExecutorUtils.createThreadDaemonPool("cloud-metadata", 2, 2); @@ -192,7 +192,7 @@ public CloudProviderInfo call() { return cloudProviderInfo; } - private static void logSummary(CoreConfiguration.CloudProvider cloudProvider, + private static void logSummary(CoreConfigurationImpl.CloudProvider cloudProvider, @Nullable CloudProviderInfo cloudProviderInfo, @Nullable Throwable unexpectedError) { if (cloudProviderInfo == null) { if (cloudProvider == AWS || cloudProvider == AZURE || cloudProvider == GCP) { @@ -213,7 +213,7 @@ private static void logSummary(CoreConfiguration.CloudProvider cloudProvider, } @Nullable - private static CloudProviderInfo getAwsMetadata(int queryTimeoutMs, CoreConfiguration.CloudProvider configuredProvider) throws IOException { + private static CloudProviderInfo getAwsMetadata(int queryTimeoutMs, CoreConfigurationImpl.CloudProvider configuredProvider) throws IOException { String awsTokenUrl = "http://169.254.169.254/latest/api/token"; Map headers = new HashMap<>(1); headers.put("X-aws-ec2-metadata-token-ttl-seconds", "300"); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/MetaData.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/MetaData.java index 147c9b418d..39e3fc46ec 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/MetaData.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/MetaData.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.impl.metadata; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.util.CompletableFuture; import co.elastic.apm.agent.util.ExecutorUtils; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -39,7 +39,7 @@ public class MetaData { * Service * (Required) */ - private final Service service; + private final ServiceImpl service; /** * Process */ @@ -58,7 +58,7 @@ public class MetaData { private final ArrayList globalLabelKeys; private final ArrayList globalLabelValues; - MetaData(ProcessInfo process, Service service, SystemInfo system, @Nullable CloudProviderInfo cloudProviderInfo, + MetaData(ProcessInfo process, ServiceImpl service, SystemInfo system, @Nullable CloudProviderInfo cloudProviderInfo, Map globalLabels, @Nullable FaaSMetaDataExtension faasMetaDataExtension) { this.process = process; this.service = service; @@ -86,8 +86,8 @@ public class MetaData { * Creates a metadata to be used with all events sent by the agent. *

    * NOTE: This method is blocking, possibly for several seconds, on outgoing HTTP requests, fetching for cloud - * metadata, unless the {@link CoreConfiguration#getCloudProvider() cloud_provider} config option is set to - * {@link CoreConfiguration.CloudProvider#NONE NONE}. + * metadata, unless the {@link CoreConfigurationImpl#getCloudProvider() cloud_provider} config option is set to + * {@link CoreConfigurationImpl.CloudProvider#NONE NONE}. *

    * * @param configurationRegistry agent config @@ -99,13 +99,13 @@ public static MetaDataFuture create(ConfigurationRegistry configurationRegistry, ephemeralId = UUID.randomUUID().toString(); } - final CoreConfiguration coreConfiguration = configurationRegistry.getConfig(CoreConfiguration.class); + final CoreConfigurationImpl coreConfiguration = configurationRegistry.getConfig(CoreConfigurationImpl.class); - final ServerlessConfiguration serverlessConfiguration = configurationRegistry.getConfig(ServerlessConfiguration.class); + final ServerlessConfigurationImpl serverlessConfiguration = configurationRegistry.getConfig(ServerlessConfigurationImpl.class); final ServiceFactory serviceFactory = new ServiceFactory(); - final Service service = serviceFactory.createService(coreConfiguration, ephemeralId, serverlessConfiguration.runsOnAwsLambda()); + final ServiceImpl service = serviceFactory.createService(coreConfiguration, ephemeralId, serverlessConfiguration.runsOnAwsLambda()); final ProcessInfo processInformation = ProcessFactory.ForCurrentVM.INSTANCE.getProcessInformation(); - if (!configurationRegistry.getConfig(ReporterConfiguration.class).isIncludeProcessArguments()) { + if (!configurationRegistry.getConfig(ReporterConfigurationImpl.class).isIncludeProcessArguments()) { processInformation.getArgv().clear(); } @@ -163,7 +163,7 @@ public MetaData call() throws Exception { * * @return the service name */ - public Service getService() { + public ServiceImpl getService() { return service; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/Node.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/NodeImpl.java similarity index 90% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/Node.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/NodeImpl.java index 11717c4e1a..4bdfe4d8cd 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/Node.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/NodeImpl.java @@ -18,12 +18,14 @@ */ package co.elastic.apm.agent.impl.metadata; +import co.elastic.apm.agent.tracer.service.Node; + import javax.annotation.Nullable; /** * A representation of a service node, ie JVM */ -public class Node implements co.elastic.apm.agent.tracer.service.Node { +public class NodeImpl implements Node { /** * (Optional) @@ -32,7 +34,7 @@ public class Node implements co.elastic.apm.agent.tracer.service.Node { @Nullable private final String name; - public Node(@Nullable String name) { + public NodeImpl(@Nullable String name) { this.name = name; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceFactory.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceFactory.java index 2a75c6b188..77a134b80e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceFactory.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceFactory.java @@ -24,15 +24,15 @@ public class ServiceFactory { - public Service createService(CoreConfiguration coreConfiguration, String ephemeralId, boolean runsOnAwsLambda) { - Service service = new Service() + public ServiceImpl createService(CoreConfiguration coreConfiguration, String ephemeralId, boolean runsOnAwsLambda) { + ServiceImpl service = new ServiceImpl() .withName(coreConfiguration.getServiceName()) .withVersion(coreConfiguration.getServiceVersion()) .withEnvironment(coreConfiguration.getEnvironment()) .withAgent(new Agent("java", VersionUtils.getAgentVersion(), ephemeralId, coreConfiguration)) .withRuntime(new RuntimeInfo("Java", System.getProperty("java.version"))) .withLanguage(new Language("Java", System.getProperty("java.version"))) - .withNode(new Node(coreConfiguration.getServiceNodeName())); + .withNode(new NodeImpl(coreConfiguration.getServiceNodeName())); if (runsOnAwsLambda) { augmentServiceForAWSLambda(service); @@ -40,17 +40,17 @@ public Service createService(CoreConfiguration coreConfiguration, String ephemer return service; } - private void augmentServiceForAWSLambda(Service service) { + private void augmentServiceForAWSLambda(ServiceImpl service) { String runtimeName = PrivilegedActionUtils.getEnv("AWS_EXECUTION_ENV"); runtimeName = null != runtimeName ? runtimeName : "AWS_Lambda_java"; service.withRuntime(new RuntimeInfo(runtimeName, System.getProperty("java.version"))); - Node node = service.getNode(); + NodeImpl node = service.getNode(); String nodeName = (node != null) ? node.getName() : null; if (nodeName == null || nodeName.isEmpty()) { String serviceNodeName = PrivilegedActionUtils.getEnv("AWS_LAMBDA_LOG_STREAM_NAME"); if (null != serviceNodeName) { - service.withNode(new Node(serviceNodeName)); + service.withNode(new NodeImpl(serviceNodeName)); } } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/Service.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceImpl.java similarity index 86% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/Service.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceImpl.java index 6c44db9159..a1ed4d1309 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/Service.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/ServiceImpl.java @@ -19,13 +19,15 @@ package co.elastic.apm.agent.impl.metadata; +import co.elastic.apm.agent.tracer.service.Service; + import javax.annotation.Nullable; /** * Information about the instrumented Service */ -public class Service implements co.elastic.apm.agent.tracer.service.Service { +public class ServiceImpl implements Service { /** * Name and version of the Elastic APM agent @@ -47,7 +49,7 @@ public class Service implements co.elastic.apm.agent.tracer.service.Service { * Representation of a service node */ @Nullable - private Node node; + private NodeImpl node; /** * Immutable name of the service emitting this event * (Required) @@ -88,7 +90,7 @@ public Agent getAgent() { * Name and version of the Elastic APM agent * (Required) */ - public Service withAgent(Agent agent) { + public ServiceImpl withAgent(Agent agent) { this.agent = agent; return this; } @@ -106,7 +108,7 @@ public Framework getFramework() { * Name and version of the Framework * (Required) */ - public Service withFramework(Framework framework) { + public ServiceImpl withFramework(Framework framework) { this.framework = framework; return this; } @@ -122,21 +124,21 @@ public Language getLanguage() { /** * Name and version of the programming language used */ - public Service withLanguage(Language language) { + public ServiceImpl withLanguage(Language language) { this.language = language; return this; } @Nullable @Override - public Node getNode() { + public NodeImpl getNode() { return node; } /** * Representation of a service node */ - public Service withNode(Node node) { + public ServiceImpl withNode(NodeImpl node) { this.node = node; return this; } @@ -151,7 +153,7 @@ public String getName() { * Immutable name of the service emitting this event * (Required) */ - public Service withName(String name) { + public ServiceImpl withName(String name) { this.name = name; return this; } @@ -165,7 +167,7 @@ public String getEnvironment() { /** * Environment name of the service, e.g. "production" or "staging" */ - public Service withEnvironment(@Nullable String environment) { + public ServiceImpl withEnvironment(@Nullable String environment) { this.environment = environment; return this; } @@ -181,7 +183,7 @@ public RuntimeInfo getRuntime() { /** * Name and version of the language runtime running this service */ - public Service withRuntime(RuntimeInfo runtime) { + public ServiceImpl withRuntime(RuntimeInfo runtime) { this.runtime = runtime; return this; } @@ -195,7 +197,7 @@ public String getVersion() { /** * Version of the service emitting this event */ - public Service withVersion(@Nullable String version) { + public ServiceImpl withVersion(@Nullable String version) { this.version = version; return this; } @@ -211,7 +213,7 @@ public String getId() { /** * ID of the service emitting this event */ - public Service withId(@Nullable String id) { + public ServiceImpl withId(@Nullable String id) { this.id = id; return this; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java index cb2c0f814a..0d6d386782 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/metadata/SystemInfo.java @@ -20,7 +20,8 @@ import co.elastic.apm.agent.common.util.ProcessExecutionUtil; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -65,7 +66,7 @@ public class SystemInfo { private final String architecture; /** - * Hostname configured manually through {@link co.elastic.apm.agent.configuration.CoreConfiguration#hostname}. + * Hostname configured manually through {@link CoreConfigurationImpl#hostname}. */ @SuppressWarnings("JavadocReference") @Nullable @@ -112,13 +113,13 @@ public SystemInfo(String architecture, @Nullable String configuredHostname, @Nul * Creates a {@link SystemInfo} containing auto-discovered info about the system. * This method may block on reading files and executing external processes. * - * @param configuredHostname hostname configured through the {@link co.elastic.apm.agent.configuration.CoreConfiguration#hostname} config + * @param configuredHostname hostname configured through the {@link CoreConfigurationImpl#hostname} config * @param timeoutMillis enables to limit the execution of the system discovery task * @param serverlessConfiguration serverless config * @return a future from which this system's info can be obtained */ @SuppressWarnings("JavadocReference") - public static SystemInfo create(final @Nullable String configuredHostname, final long timeoutMillis, ServerlessConfiguration serverlessConfiguration) { + public static SystemInfo create(final @Nullable String configuredHostname, final long timeoutMillis, ServerlessConfigurationImpl serverlessConfiguration) { final String osName = System.getProperty("os.name"); final String osArch = System.getProperty("os.arch"); @@ -459,7 +460,7 @@ public String getHostname() { } /** - * The hostname manually configured through {@link co.elastic.apm.agent.configuration.CoreConfiguration#hostname} + * The hostname manually configured through {@link CoreConfigurationImpl#hostname} * * @return the manually configured hostname */ diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ConstantSampler.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ConstantSampler.java index 4a700880f0..dc4d59d199 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ConstantSampler.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ConstantSampler.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl.sampling; -import co.elastic.apm.agent.impl.transaction.Id; +import co.elastic.apm.agent.impl.transaction.IdImpl; import co.elastic.apm.agent.impl.transaction.TraceState; /** @@ -49,7 +49,7 @@ public static Sampler of(boolean decision) { } @Override - public boolean isSampled(Id traceId) { + public boolean isSampled(IdImpl traceId) { return decision; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ProbabilitySampler.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ProbabilitySampler.java index c146defd20..21909403ea 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ProbabilitySampler.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/ProbabilitySampler.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl.sampling; -import co.elastic.apm.agent.impl.transaction.Id; +import co.elastic.apm.agent.impl.transaction.IdImpl; import co.elastic.apm.agent.impl.transaction.TraceState; /** @@ -29,9 +29,9 @@ *

    * Implementation notes: *

    - * We are taking advantage of the fact, that the {@link Id} is randomly generated. + * We are taking advantage of the fact, that the {@link IdImpl} is randomly generated. * So instead of generating another random number, - * we just see if the long value returned by {@link Id#getLeastSignificantBits()} + * we just see if the long value returned by {@link IdImpl#getLeastSignificantBits()} * falls into the range between the {@code lowerBound} and the higherBound. * This is a visual representation of the mechanism with a sampling rate of 0.5 (=50%): *
    @@ -70,7 +70,7 @@ public static Sampler of(double samplingRate) {
         }
     
         @Override
    -    public boolean isSampled(Id traceId) {
    +    public boolean isSampled(IdImpl traceId) {
             final long leastSignificantBits = traceId.getLeastSignificantBits();
             return leastSignificantBits > lowerBound && leastSignificantBits < higherBound;
         }
    diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/Sampler.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/Sampler.java
    index 53a48f1b57..65e2bc2adb 100644
    --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/Sampler.java
    +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/sampling/Sampler.java
    @@ -18,22 +18,22 @@
      */
     package co.elastic.apm.agent.impl.sampling;
     
    -import co.elastic.apm.agent.impl.transaction.Id;
    -import co.elastic.apm.agent.impl.transaction.Span;
    -import co.elastic.apm.agent.impl.transaction.Transaction;
    +import co.elastic.apm.agent.impl.transaction.IdImpl;
    +import co.elastic.apm.agent.impl.transaction.SpanImpl;
    +import co.elastic.apm.agent.impl.transaction.TransactionImpl;
     
     /**
    - * A sampler is responsible for determining whether a {@link Transaction} should be sampled.
    + * A sampler is responsible for determining whether a {@link TransactionImpl} should be sampled.
      * 

    * In contrast other tracing systems, * in Elastic APM, - * non-sampled {@link Transaction}s do get reported to the APM server. + * non-sampled {@link TransactionImpl}s do get reported to the APM server. * However, * to keep the size at a minimum, - * the reported {@link Transaction} only contains the transaction name, + * the reported {@link TransactionImpl} only contains the transaction name, * the duration and the id. * Also, - * {@link Span}s of non sampled {@link Transaction}s are not reported. + * {@link SpanImpl}s of non sampled {@link TransactionImpl}s are not reported. *

    */ public interface Sampler { @@ -44,7 +44,7 @@ public interface Sampler { * @param traceId The id of the transaction. * @return The sampling decision. */ - boolean isSampled(Id traceId); + boolean isSampled(IdImpl traceId); /** * @return current sample rate diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationImpl.java similarity index 97% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfiguration.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationImpl.java index 69db9c4dc6..c71ac3c97e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationImpl.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.impl.stacktrace; +import co.elastic.apm.agent.tracer.configuration.StacktraceConfiguration; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.tracer.configuration.TimeDurationValueConverter; import org.stagemonitor.configuration.ConfigurationOption; @@ -26,7 +27,7 @@ import java.util.Collection; import java.util.Collections; -public class StacktraceConfiguration extends ConfigurationOptionProvider implements co.elastic.apm.agent.tracer.configuration.StacktraceConfiguration { +public class StacktraceConfigurationImpl extends ConfigurationOptionProvider implements StacktraceConfiguration { private static final String STACKTRACE_CATEGORY = "Stacktrace"; public static final String APPLICATION_PACKAGES = "application_packages"; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractRefCountedContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractRefCountedContext.java index 9183f4d37c..fd4cc9d7cf 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractRefCountedContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractRefCountedContext.java @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger; -public abstract class AbstractRefCountedContext> extends ElasticContext implements Recyclable { +public abstract class AbstractRefCountedContext> extends TraceStateImpl implements Recyclable { private static final Logger logger = LoggerFactory.getLogger(AbstractRefCountedContext.class); private final AtomicInteger references = new AtomicInteger(); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpan.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpanImpl.java similarity index 90% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpan.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpanImpl.java index acff311f89..d9e1c57c97 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpan.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/AbstractSpanImpl.java @@ -19,15 +19,16 @@ package co.elastic.apm.agent.impl.transaction; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.context.AbstractContext; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.context.AbstractContextImpl; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.sdk.internal.collections.LongList; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; import co.elastic.apm.agent.tracer.pooling.Recyclable; @@ -40,15 +41,15 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -public abstract class AbstractSpan> extends AbstractRefCountedContext implements Recyclable, co.elastic.apm.agent.tracer.AbstractSpan { - private static final Logger logger = LoggerFactory.getLogger(AbstractSpan.class); +public abstract class AbstractSpanImpl> extends AbstractRefCountedContext implements Recyclable, AbstractSpan { + private static final Logger logger = LoggerFactory.getLogger(AbstractSpanImpl.class); private static final Logger oneTimeDuplicatedEndLogger = LoggerUtils.logOnce(logger); private static final Logger oneTimeMaxSpanLinksLogger = LoggerUtils.logOnce(logger); protected static final double MS_IN_MICROS = TimeUnit.MILLISECONDS.toMicros(1); - protected final TraceContext traceContext; + protected final TraceContextImpl traceContext; - protected Baggage baggage = Baggage.EMPTY; + protected BaggageImpl baggage = BaggageImpl.EMPTY; /** * Generic designation of a transaction in the scope of a single service (eg: 'GET /users/:id') @@ -71,7 +72,7 @@ public abstract class AbstractSpan> extends AbstractRe * This use case for child ids is modifying parent/child relationships for profiler-inferred spans. * Inferred spans are sent after a profiling session ends (5s by default) and after stack traces have been processed into inferred spans. * Regular spans are sent right after the event (for example a DB call) has occurred. - * The effect is that a regular span cannot have a {@link TraceContext#parentId} pointing to an inferred span. + * The effect is that a regular span cannot have a {@link TraceContextImpl#parentId} pointing to an inferred span. * That is because the latter did not exist at the time the regular span has been created. *

    *

    @@ -113,11 +114,11 @@ public abstract class AbstractSpan> extends AbstractRe private volatile boolean sync = true; - protected final SpanAtomicReference bufferedSpan = new SpanAtomicReference<>(); + protected final SpanAtomicReference bufferedSpan = new SpanAtomicReference<>(); // Span links handling public static final int MAX_ALLOWED_SPAN_LINKS = 1000; - private final List spanLinks = new UniqueSpanLinkArrayList(); + private final List spanLinks = new UniqueSpanLinkArrayList(); @Nullable private OTelSpanKind otelKind = null; @@ -190,11 +191,11 @@ public long getDuration() { } } - public AbstractSpan(ElasticApmTracer tracer) { + public AbstractSpanImpl(ElasticApmTracer tracer) { super(tracer); - traceContext = TraceContext.with64BitId(this.tracer); - boolean selfTimeCollectionEnabled = !WildcardMatcher.isAnyMatch(tracer.getConfig(ReporterConfiguration.class).getDisableMetrics(), "span.self_time"); - boolean breakdownMetricsEnabled = tracer.getConfig(CoreConfiguration.class).isBreakdownMetricsEnabled(); + traceContext = TraceContextImpl.with64BitId(this.tracer); + boolean selfTimeCollectionEnabled = !WildcardMatcher.isAnyMatch(tracer.getConfig(ReporterConfigurationImpl.class).getDisableMetrics(), "span.self_time"); + boolean breakdownMetricsEnabled = tracer.getConfig(CoreConfigurationImpl.class).isBreakdownMetricsEnabled(); collectBreakdownMetrics = selfTimeCollectionEnabled && breakdownMetricsEnabled; } @@ -215,7 +216,7 @@ public long getSelfDuration() { } public double getDurationMs() { - return getDuration() / AbstractSpan.MS_IN_MICROS; + return getDuration() / AbstractSpanImpl.MS_IN_MICROS; } /** @@ -339,7 +340,7 @@ public long getTimestamp() { } @Override - public TraceContext getTraceContext() { + public TraceContextImpl getTraceContext() { return traceContext; } @@ -371,7 +372,7 @@ public boolean addSpanLink( } boolean added = false; try { - TraceContext childTraceContext = tracer.createSpanLink(); + TraceContextImpl childTraceContext = tracer.createSpanLink(); if (childTraceContext.asChildOf(carrier, headerGetter, false)) { added = spanLinks.add(childTraceContext); } @@ -393,13 +394,13 @@ public boolean addSpanLink( * @param the parent type - AbstractSpan, TraceContext or Tracer * @return {@code true} if added, {@code false} otherwise */ - public boolean addSpanLink(TraceContext.ChildContextCreator childContextCreator, T parent) { + public boolean addSpanLink(TraceContextImpl.ChildContextCreator childContextCreator, T parent) { if (!canAddSpanLink()) { return false; } boolean added = false; try { - TraceContext childTraceContext = tracer.createSpanLink(); + TraceContextImpl childTraceContext = tracer.createSpanLink(); if (childContextCreator.asChildOf(childTraceContext, parent)) { added = spanLinks.add(childTraceContext); } @@ -413,13 +414,13 @@ public boolean addSpanLink(TraceContext.ChildContextCreator childContextC } /** - * Returns a list of links from this span to other spans in the format of child {@link TraceContext}s, of which parent is the linked + * Returns a list of links from this span to other spans in the format of child {@link TraceContextImpl}s, of which parent is the linked * span. For each entry in the returned list, the linked span's {@code traceId} can be retrieved through - * {@link TraceContext#getTraceId()} and the {@code spanId} can be retrieved through {@link TraceContext#getParentId()}. + * {@link TraceContextImpl#getTraceId()} and the {@code spanId} can be retrieved through {@link TraceContextImpl#getParentId()}. * - * @return a list of child {@link TraceContext}s of linked spans + * @return a list of child {@link TraceContextImpl}s of linked spans */ - public List getSpanLinks() { + public List getSpanLinks() { return spanLinks; } @@ -433,7 +434,7 @@ public void resetState() { timestamp.set(0L); endTimestamp.set(0L); traceContext.resetState(); - baggage = Baggage.EMPTY; + baggage = BaggageImpl.EMPTY; childDurations.resetState(); namePriority = PRIORITY_DEFAULT; discardRequested = false; @@ -457,19 +458,19 @@ private void recycleSpanLinks() { } @Override - public Span createSpan() { + public SpanImpl createSpan() { return createSpan(getBaggage()); } - public Span createSpan(long epochMicros) { + public SpanImpl createSpan(long epochMicros) { return createSpan(getBaggage(), epochMicros); } - public Span createSpan(Baggage newBaggage) { + public SpanImpl createSpan(BaggageImpl newBaggage) { return createSpan(newBaggage, traceContext.getClock().getEpochMicros()); } - private Span createSpan(Baggage baggage, long epochMicros) { + private SpanImpl createSpan(BaggageImpl baggage, long epochMicros) { return tracer.startSpan(this, baggage, epochMicros); } @@ -528,7 +529,7 @@ public void addLabel(String key, Boolean value) { } @Override - public abstract AbstractContext getContext(); + public abstract AbstractContextImpl getContext(); /** * Called after the span has been started and its parent references are set @@ -539,7 +540,7 @@ protected void onAfterStart() { // or even after its reported and the last child span is ended incrementReferences(); - List baggageToAttach = tracer.getConfig(CoreConfiguration.class).getBaggageToAttach(); + List baggageToAttach = tracer.getConfig(CoreConfigurationImpl.class).getBaggageToAttach(); baggage.storeBaggageInAttributes(this, baggageToAttach); } @@ -564,7 +565,7 @@ public final void end(long epochMicros) { beforeEnd(epochMicros); this.finished = true; - Span buffered = bufferedSpan.incrementReferencesAndGet(); + SpanImpl buffered = bufferedSpan.incrementReferencesAndGet(); if (buffered != null) { try { if (bufferedSpan.compareAndSet(buffered, null)) { @@ -605,11 +606,11 @@ protected boolean hasCapturedExceptions() { protected abstract void afterEnd(); - public boolean isChildOf(AbstractSpan parent) { + public boolean isChildOf(AbstractSpanImpl parent) { return traceContext.isChildOf(parent.traceContext) || parent.hasChildId(traceContext.getId()); } - private boolean hasChildId(Id spanId) { + private boolean hasChildId(IdImpl spanId) { if (childIds != null) { return childIds.contains(spanId.readLong(0)); } @@ -617,7 +618,7 @@ private boolean hasChildId(Id spanId) { } @Override - public Baggage getBaggage() { + public BaggageImpl getBaggage() { return baggage; } @@ -627,7 +628,7 @@ public Baggage getBaggage() { * * @return the transaction. */ - public abstract Transaction getParentTransaction(); + public abstract TransactionImpl getParentTransaction(); /** * Set start timestamp @@ -714,7 +715,7 @@ public T withUserOutcome(Outcome outcome) { } @Override - public AbstractSpan getSpan() { + public AbstractSpanImpl getSpan() { return this; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java index 74bcf45c95..ada478514e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/DroppedSpanStats.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.impl.transaction; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.util.CharSequenceUtils; @@ -59,7 +59,7 @@ public StatsKey() { cachedHashCode = Integer.MIN_VALUE; } - public StatsKey init(ServiceTarget serviceTarget, Outcome outcome) { + public StatsKey init(ServiceTargetImpl serviceTarget, Outcome outcome) { resetState(); // we have to use a copy as argument is mutable will be recycled this.serviceType = Objects.requireNonNull(serviceTarget.getType()); @@ -148,14 +148,14 @@ public void resetState() { } } - private static final ObjectPool statsKeyObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue(512), false, new Allocator() { + private static final ObservableObjectPool statsKeyObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue(512), false, new Allocator() { @Override public StatsKey createInstance() { return new StatsKey(); } }); - private static final ObjectPool statsObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue(512), false, new Allocator() { + private static final ObservableObjectPool statsObjectPool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue(512), false, new Allocator() { @Override public Stats createInstance() { return new Stats(); @@ -167,12 +167,12 @@ public Stats createInstance() { // only used during testing @Nullable Stats getStats(String serviceType, @Nullable String serviceName, Outcome outcome){ - ServiceTarget st = new ServiceTarget().withType(serviceType).withName(serviceName); + ServiceTargetImpl st = new ServiceTargetImpl().withType(serviceType).withName(serviceName); return statsMap.get(new StatsKey().init(st, outcome)); } - public void captureDroppedSpan(Span span) { - ServiceTarget serviceTarget = span.getContext().getServiceTarget(); + public void captureDroppedSpan(SpanImpl span) { + ServiceTargetImpl serviceTarget = span.getContext().getServiceTarget(); if (!span.isExit() || !serviceTarget.hasContent() ) { return; } @@ -187,7 +187,7 @@ public void captureDroppedSpan(Span span) { stats.sum.addAndGet(span.getDuration()); } - private Stats getOrCreateStats(ServiceTarget serviceTarget, Outcome outcome) { + private Stats getOrCreateStats(ServiceTargetImpl serviceTarget, Outcome outcome) { StatsKey statsKey = statsKeyObjectPool.createInstance().init(serviceTarget, outcome); Stats stats = statsMap.get(statsKey); if (stats != null) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/EpochTickClock.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/EpochTickClock.java index ad205eea0b..e3d5c95422 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/EpochTickClock.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/EpochTickClock.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.tracer.pooling.Recyclable; /** - * This clock makes sure that each {@link Span} and {@link Transaction} uses a consistent clock + * This clock makes sure that each {@link SpanImpl} and {@link TransactionImpl} uses a consistent clock * which does not drift in case of NTP updates or leap seconds. *

    * The clock is initialized with wall clock time when the transaction starts and from there on diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasImpl.java similarity index 82% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasImpl.java index 1299184003..5025320e94 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Faas.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasImpl.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.impl.transaction; +import co.elastic.apm.agent.tracer.Faas; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class Faas implements co.elastic.apm.agent.tracer.Faas, Recyclable { +public class FaasImpl implements Faas, Recyclable { @Nullable private String execution; @@ -38,7 +39,7 @@ public class Faas implements co.elastic.apm.agent.tracer.Faas, Recyclable { private boolean coldStart; - private final FaasTrigger trigger = new FaasTrigger(); + private final FaasTriggerImpl trigger = new FaasTriggerImpl(); @Nullable public String getExecution() { @@ -49,7 +50,7 @@ public boolean isColdStart() { return coldStart; } - public FaasTrigger getTrigger() { + public FaasTriggerImpl getTrigger() { return trigger; } @@ -69,31 +70,31 @@ public String getVersion() { } @Override - public Faas withExecution(@Nullable String execution) { + public FaasImpl withExecution(@Nullable String execution) { this.execution = execution; return this; } @Override - public Faas withColdStart(boolean coldStart) { + public FaasImpl withColdStart(boolean coldStart) { this.coldStart = coldStart; return this; } @Override - public Faas withId(@Nullable String id) { + public FaasImpl withId(@Nullable String id) { this.id = id; return this; } @Override - public Faas withName(@Nullable String name) { + public FaasImpl withName(@Nullable String name) { this.name = name; return this; } @Override - public Faas withVersion(@Nullable String version) { + public FaasImpl withVersion(@Nullable String version) { this.version = version; return this; } @@ -108,7 +109,7 @@ public void resetState() { this.trigger.resetState(); } - public void copyFrom(Faas other) { + public void copyFrom(FaasImpl other) { this.execution = other.execution; this.id = other.id; this.name = other.name; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTriggerImpl.java similarity index 84% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTriggerImpl.java index d3d3fb3775..5e26825f87 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTrigger.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/FaasTriggerImpl.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.impl.transaction; +import co.elastic.apm.agent.tracer.FaasTrigger; import co.elastic.apm.agent.tracer.pooling.Recyclable; import javax.annotation.Nullable; -public class FaasTrigger implements co.elastic.apm.agent.tracer.FaasTrigger, Recyclable { +public class FaasTriggerImpl implements FaasTrigger, Recyclable { @Nullable private String type; @@ -41,13 +42,13 @@ public String getRequestId() { } @Override - public FaasTrigger withType(@Nullable String type) { + public FaasTriggerImpl withType(@Nullable String type) { this.type = type; return this; } @Override - public FaasTrigger withRequestId(@Nullable String requestId) { + public FaasTriggerImpl withRequestId(@Nullable String requestId) { this.requestId = requestId; return this; } @@ -58,7 +59,7 @@ public void resetState() { this.requestId = null; } - public void copyFrom(FaasTrigger other) { + public void copyFrom(FaasTriggerImpl other) { this.type = other.type; this.requestId = other.requestId; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/IdImpl.java similarity index 94% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/IdImpl.java index 899bf68d28..223590ab3c 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Id.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/IdImpl.java @@ -20,6 +20,7 @@ import co.elastic.apm.agent.report.serialize.Base64SerializationUtils; import co.elastic.apm.agent.report.serialize.HexSerializationUtils; +import co.elastic.apm.agent.tracer.Id; import co.elastic.apm.agent.tracer.pooling.Recyclable; import co.elastic.apm.agent.tracer.util.HexUtils; import com.dslplatform.json.JsonWriter; @@ -33,22 +34,22 @@ /** * A 128 bit globally unique ID of the whole trace forest */ -public class Id implements Recyclable, co.elastic.apm.agent.tracer.Id { +public class IdImpl implements Recyclable, Id { private final byte[] data; private boolean empty = true; @Nullable private String cachedStringRepresentation; - public static Id new128BitId() { - return new Id(16); + public static IdImpl new128BitId() { + return new IdImpl(16); } - public static Id new64BitId() { - return new Id(8); + public static IdImpl new64BitId() { + return new IdImpl(8); } - private Id(int idLengthBytes) { + private IdImpl(int idLengthBytes) { data = new byte[idLengthBytes]; } @@ -111,7 +112,7 @@ public void resetState() { onMutation(true); } - public void copyFrom(Id other) { + public void copyFrom(IdImpl other) { System.arraycopy(other.data, 0, data, 0, data.length); this.cachedStringRepresentation = other.cachedStringRepresentation; this.empty = other.empty; @@ -130,7 +131,7 @@ private void onMutation(boolean empty) { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Id that = (Id) o; + IdImpl that = (IdImpl) o; return Arrays.equals(data, that.data); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanAtomicReference.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanAtomicReference.java index d95315a53d..83487c2750 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanAtomicReference.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanAtomicReference.java @@ -20,7 +20,7 @@ import javax.annotation.Nullable; -class SpanAtomicReference> { +class SpanAtomicReference> { @Nullable private V ref; @@ -28,9 +28,9 @@ class SpanAtomicReference> { private final Object LOCK = new Object(); /** - * Increments the referenced {@link AbstractSpan} reference count and returns it. The returned span is guaranteed not to be recycled. + * Increments the referenced {@link AbstractSpanImpl} reference count and returns it. The returned span is guaranteed not to be recycled. * It is then the responsibility of the caller to decrement the ref count appropriately. - * @return the referenced {@link AbstractSpan} with reference count incremented, or {@code null} if no span is referenced + * @return the referenced {@link AbstractSpanImpl} with reference count incremented, or {@code null} if no span is referenced */ @Nullable public V incrementReferencesAndGet() { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Span.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanImpl.java similarity index 88% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Span.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanImpl.java index c4183d2cff..e1d3d50e86 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Span.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/SpanImpl.java @@ -18,15 +18,16 @@ */ package co.elastic.apm.agent.impl.transaction; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.context.Db; -import co.elastic.apm.agent.impl.context.Message; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.impl.context.SpanContext; -import co.elastic.apm.agent.impl.context.Url; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.context.DbImpl; +import co.elastic.apm.agent.impl.context.MessageImpl; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.impl.context.SpanContextImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.util.ResultUtil; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -39,12 +40,12 @@ import java.util.Objects; import java.util.concurrent.TimeUnit; -public class Span extends AbstractSpan implements Recyclable, co.elastic.apm.agent.tracer.Span { +public class SpanImpl extends AbstractSpanImpl implements Recyclable, Span { - private static final Logger logger = LoggerFactory.getLogger(Span.class); + private static final Logger logger = LoggerFactory.getLogger(SpanImpl.class); public static final long MAX_LOG_INTERVAL_MICRO_SECS = TimeUnit.MINUTES.toMicros(5); private static long lastSpanMaxWarningTimestamp; - private final StacktraceConfiguration stacktraceConfiguration; + private final StacktraceConfigurationImpl stacktraceConfiguration; /** * A subtype describing this span (eg 'mysql', 'elasticsearch', 'jsf' etc) @@ -63,14 +64,14 @@ public class Span extends AbstractSpan implements Recyclable, co.elastic.a /** * Any other arbitrary data captured by the agent, optionally provided by the user */ - private final SpanContext context = new SpanContext(); + private final SpanContextImpl context = new SpanContextImpl(); private final Composite composite = new Composite(); @Nullable private Throwable stacktrace; @Nullable - private AbstractSpan parent; + private AbstractSpanImpl parent; @Nullable - private Transaction transaction; + private TransactionImpl transaction; @Nullable private List stackFrames; @@ -86,33 +87,33 @@ public void setNonDiscardable() { } } - public Span(ElasticApmTracer tracer) { + public SpanImpl(ElasticApmTracer tracer) { super(tracer); - this.stacktraceConfiguration = tracer.getConfig(StacktraceConfiguration.class); + this.stacktraceConfiguration = tracer.getConfig(StacktraceConfigurationImpl.class); } - public Span start(TraceContext.ChildContextCreator childContextCreator, T parentContext, Baggage parentBaggage, long epochMicros) { + public SpanImpl start(TraceContextImpl.ChildContextCreator childContextCreator, T parentContext, BaggageImpl parentBaggage, long epochMicros) { this.baggage = parentBaggage; childContextCreator.asChildOf(traceContext, parentContext); - if (parentContext instanceof Transaction) { - this.transaction = (Transaction) parentContext; + if (parentContext instanceof TransactionImpl) { + this.transaction = (TransactionImpl) parentContext; this.parent = this.transaction; - } else if (parentContext instanceof Span) { - final Span parentSpan = (Span) parentContext; + } else if (parentContext instanceof SpanImpl) { + final SpanImpl parentSpan = (SpanImpl) parentContext; this.parent = parentSpan; this.transaction = parentSpan.transaction; } return start(epochMicros); } - private Span start(long epochMicros) { + private SpanImpl start(long epochMicros) { if (transaction != null) { SpanCount spanCount = transaction.getSpanCount(); if (transaction.isSpanLimitReached()) { if (epochMicros - lastSpanMaxWarningTimestamp > MAX_LOG_INTERVAL_MICRO_SECS) { lastSpanMaxWarningTimestamp = epochMicros; logger.warn("Max spans ({}) for transaction {} has been reached. For this transaction and possibly others, further spans will be dropped. See config param 'transaction_max_spans'.", - tracer.getConfig(CoreConfiguration.class).getTransactionMaxSpans(), transaction); + tracer.getConfig(CoreConfigurationImpl.class).getTransactionMaxSpans(), transaction); } logger.debug("Span exceeds transaction_max_spans {}", this); traceContext.setRecorded(false); @@ -149,7 +150,7 @@ protected void onAfterStart() { * Any other arbitrary data captured by the agent, optionally provided by the user */ @Override - public SpanContext getContext() { + public SpanContextImpl getContext() { return context; } @@ -162,13 +163,13 @@ public Composite getComposite() { } @Override - public Span withSubtype(@Nullable String subtype) { + public SpanImpl withSubtype(@Nullable String subtype) { this.subtype = normalizeEmpty(subtype); return this; } @Override - public Span withAction(@Nullable String action) { + public SpanImpl withAction(@Nullable String action) { this.action = normalizeEmpty(action); return this; } @@ -235,11 +236,11 @@ public void beforeEnd(long epochMicros) { // auto-infer context.destination.service.resource as per spec: // https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans-destination.md#contextdestinationserviceresource - ServiceTarget serviceTarget = getContext().getServiceTarget(); + ServiceTargetImpl serviceTarget = getContext().getServiceTarget(); if (isExit() && !serviceTarget.hasContent() && !serviceTarget.isSetByUser()) { - Db db = context.getDb(); - Message message = context.getMessage(); - Url httpUrl = context.getHttp().getInternalUrl(); + DbImpl db = context.getDb(); + MessageImpl message = context.getMessage(); + UrlImpl httpUrl = context.getHttp().getInternalUrl(); String targetServiceType = (subtype != null) ? subtype : type; if (db.hasContent()) { serviceTarget.withType(targetServiceType).withName(db.getInstance()); @@ -286,7 +287,7 @@ protected void afterEnd() { this.incrementReferences(); try { if (transaction != null && transaction.isSpanCompressionEnabled() && parent != null) { - Span parentBuffered = parent.bufferedSpan.incrementReferencesAndGet(); + SpanImpl parentBuffered = parent.bufferedSpan.incrementReferencesAndGet(); try { //per the reference, if it is not compression-eligible or if its parent has already ended, it is reported immediately if (parent.isFinished() || !isCompressionEligible()) { @@ -351,7 +352,7 @@ private boolean isCompressionEligible() { return isExit() && isDiscardable() && (outcomeNotSet() || getOutcome() == Outcome.SUCCESS); } - private boolean tryToCompress(Span sibling) { + private boolean tryToCompress(SpanImpl sibling) { boolean canBeCompressed = isComposite() ? tryToCompressComposite(sibling) : tryToCompressRegular(sibling); if (!canBeCompressed) { return false; @@ -383,7 +384,7 @@ private boolean tryToCompress(Span sibling) { return true; } - private boolean tryToCompressRegular(Span sibling) { + private boolean tryToCompressRegular(SpanImpl sibling) { if (!isSameKind(sibling)) { return false; } @@ -419,7 +420,7 @@ private boolean tryToCompressRegular(Span sibling) { private void setCompressedSpanName() { name.setLength(0); - ServiceTarget serviceTarget = context.getServiceTarget(); + ServiceTargetImpl serviceTarget = context.getServiceTarget(); String serviceType = serviceTarget.getType(); CharSequence serviceName = serviceTarget.getName(); @@ -440,7 +441,7 @@ private void setCompressedSpanName() { } } - private boolean tryToCompressComposite(Span sibling) { + private boolean tryToCompressComposite(SpanImpl sibling) { String compressionStrategy = composite.getCompressionStrategy(); if (compressionStrategy == null) { //lose the compression rather than retry, so that the application proceeds with minimum delay @@ -461,9 +462,9 @@ private boolean tryToCompressComposite(Span sibling) { return false; } - private boolean isSameKind(Span other) { - ServiceTarget serviceTarget = context.getServiceTarget(); - ServiceTarget otherServiceTarget = other.context.getServiceTarget(); + private boolean isSameKind(SpanImpl other) { + ServiceTargetImpl serviceTarget = context.getServiceTarget(); + ServiceTargetImpl otherServiceTarget = other.context.getServiceTarget(); return Objects.equals(type, other.type) && Objects.equals(subtype, other.subtype) && Objects.equals(serviceTarget.getType(), otherServiceTarget.getType()) @@ -492,7 +493,7 @@ public String toString() { return String.format("'%s' %s (%s)", name, traceContext, Integer.toHexString(System.identityHashCode(this))); } - public Span withStacktrace(Throwable stacktrace) { + public SpanImpl withStacktrace(Throwable stacktrace) { this.stacktrace = stacktrace; return this; } @@ -519,7 +520,7 @@ protected void recycle() { } @Override - protected Span thiz() { + protected SpanImpl thiz() { return this; } @@ -534,12 +535,12 @@ public List getStackFrames() { @Override - public Transaction getParentTransaction() { + public TransactionImpl getParentTransaction() { return transaction; } @Nullable - public AbstractSpan getParent() { + public AbstractSpanImpl getParent() { return parent; } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContextImpl.java similarity index 89% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContextImpl.java index cc3df527cb..13a1f5cf20 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceContextImpl.java @@ -18,12 +18,13 @@ */ package co.elastic.apm.agent.impl.transaction; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.sampling.Sampler; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.TraceContext; import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; import co.elastic.apm.agent.tracer.dispatch.HeaderRemover; import co.elastic.apm.agent.tracer.dispatch.HeaderSetter; @@ -59,7 +60,7 @@ *

    *

    */ -public class TraceContext implements Recyclable, co.elastic.apm.agent.tracer.TraceContext { +public class TraceContextImpl implements Recyclable, TraceContext { public static final String ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME = "elastic-apm-traceparent"; public static final String W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME = "traceparent"; @@ -69,7 +70,7 @@ public class TraceContext implements Recyclable, co.elastic.apm.agent.tracer.Tra private static final int TEXT_HEADER_TRACE_ID_OFFSET = 3; private static final int TEXT_HEADER_PARENT_ID_OFFSET = 36; private static final int TEXT_HEADER_FLAGS_OFFSET = 53; - private static final Logger logger = LoggerFactory.getLogger(TraceContext.class); + private static final Logger logger = LoggerFactory.getLogger(TraceContextImpl.class); private static final Double SAMPLE_RATE_ZERO = 0d; @@ -83,31 +84,31 @@ public class TraceContext implements Recyclable, co.elastic.apm.agent.tracer.Tra TRACE_TEXTUAL_HEADERS = Collections.unmodifiableSet(traceParentTextualHeaders); } - private static final ChildContextCreator FROM_PARENT_CONTEXT = new ChildContextCreator() { + private static final ChildContextCreator FROM_PARENT_CONTEXT = new ChildContextCreator() { @Override - public boolean asChildOf(TraceContext child, TraceContext parent) { + public boolean asChildOf(TraceContextImpl child, TraceContextImpl parent) { child.asChildOf(parent); return true; } }; - private static final ChildContextCreator> FROM_PARENT = new ChildContextCreator>() { + private static final ChildContextCreator> FROM_PARENT = new ChildContextCreator>() { @Override - public boolean asChildOf(TraceContext child, AbstractSpan parent) { + public boolean asChildOf(TraceContextImpl child, AbstractSpanImpl parent) { child.asChildOf(parent.getTraceContext()); return true; } }; - private static final HeaderGetter.HeaderConsumer STRING_TRACESTATE_HEADER_CONSUMER = new HeaderGetter.HeaderConsumer() { + private static final HeaderGetter.HeaderConsumer STRING_TRACESTATE_HEADER_CONSUMER = new HeaderGetter.HeaderConsumer() { @Override - public void accept(@Nullable String tracestateHeaderValue, TraceContext state) { + public void accept(@Nullable String tracestateHeaderValue, TraceContextImpl state) { state.addTraceStateHeader(tracestateHeaderValue, CharAccessor.forCharSequence()); } }; - private static final HeaderGetter.HeaderConsumer UTF8_BYTES_TRACESTATE_HEADER_CONSUMER = new HeaderGetter.HeaderConsumer() { + private static final HeaderGetter.HeaderConsumer UTF8_BYTES_TRACESTATE_HEADER_CONSUMER = new HeaderGetter.HeaderConsumer() { @Override - public void accept(@Nullable byte[] tracestateHeaderValue, TraceContext state) { + public void accept(@Nullable byte[] tracestateHeaderValue, TraceContextImpl state) { state.addTraceStateHeader(tracestateHeaderValue, CharAccessor.forAsciiBytes()); } }; @@ -119,13 +120,13 @@ public boolean asChildOf(@Nullable C carrier, HeaderGetter headerGe @SuppressWarnings("unchecked") public boolean asChildOf(@Nullable C carrier, HeaderGetter headerGetter, boolean parseTraceState) { CharAccessor headerValueAccessor; - HeaderGetter.HeaderConsumer traceStateConsumer; + HeaderGetter.HeaderConsumer traceStateConsumer; if (headerGetter instanceof TextHeaderGetter) { headerValueAccessor = (CharAccessor) CharAccessor.forCharSequence(); - traceStateConsumer = (HeaderGetter.HeaderConsumer) STRING_TRACESTATE_HEADER_CONSUMER; + traceStateConsumer = (HeaderGetter.HeaderConsumer) STRING_TRACESTATE_HEADER_CONSUMER; } else if (headerGetter instanceof UTF8ByteHeaderGetter) { headerValueAccessor = (CharAccessor) CharAccessor.forAsciiBytes(); - traceStateConsumer = (HeaderGetter.HeaderConsumer) UTF8_BYTES_TRACESTATE_HEADER_CONSUMER; + traceStateConsumer = (HeaderGetter.HeaderConsumer) UTF8_BYTES_TRACESTATE_HEADER_CONSUMER; } else { throw new IllegalArgumentException("HeaderGetter must be either a TextHeaderGetter or UTF8ByteHeaderGetter: " + headerGetter.getClass().getName()); } @@ -188,18 +189,18 @@ public static void copyTraceContextTextHeaders(S source, TextHeaderGetter // ???????1 -> maybe recorded // ???????0 -> not recorded private static final byte FLAG_RECORDED = 0b0000_0001; - private final Id traceId = Id.new128BitId(); + private final IdImpl traceId = IdImpl.new128BitId(); private final ElasticApmTracer tracer; - private final Id id; - private final Id parentId = Id.new64BitId(); - private final Id transactionId = Id.new64BitId(); + private final IdImpl id; + private final IdImpl parentId = IdImpl.new64BitId(); + private final IdImpl transactionId = IdImpl.new64BitId(); private final StringBuilder outgoingTextHeader = new StringBuilder(TEXT_HEADER_EXPECTED_LENGTH); private byte flags; private boolean discardable = true; private final TraceState traceState; - final CoreConfiguration coreConfiguration; + final CoreConfigurationImpl coreConfiguration; /** * Avoids clock drifts within a transaction. @@ -214,8 +215,8 @@ public static void copyTraceContextTextHeaders(S source, TextHeaderGetter @Nullable private String serviceVersion; - private TraceContext(ElasticApmTracer tracer, Id id) { - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + private TraceContextImpl(ElasticApmTracer tracer, IdImpl id) { + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); traceState = new TraceState(); traceState.setSizeLimit(coreConfiguration.getTracestateSizeLimit()); this.tracer = tracer; @@ -223,33 +224,33 @@ private TraceContext(ElasticApmTracer tracer, Id id) { } /** - * Creates a new {@code traceparent}-compliant {@link TraceContext} with a 64 bit {@link #id}. + * Creates a new {@code traceparent}-compliant {@link TraceContextImpl} with a 64 bit {@link #id}. *

    * Note: the {@link #traceId} will still be 128 bit *

    * * @param tracer a valid tracer */ - public static TraceContext with64BitId(ElasticApmTracer tracer) { - return new TraceContext(tracer, Id.new64BitId()); + public static TraceContextImpl with64BitId(ElasticApmTracer tracer) { + return new TraceContextImpl(tracer, IdImpl.new64BitId()); } /** - * Creates a new {@link TraceContext} with a 128 bit {@link #id}, + * Creates a new {@link TraceContextImpl} with a 128 bit {@link #id}, * suitable for errors, * as those might not have a trace reference and therefore require a larger id in order to be globally unique. * * @param tracer a valid tracer */ - public static TraceContext with128BitId(ElasticApmTracer tracer) { - return new TraceContext(tracer, Id.new128BitId()); + public static TraceContextImpl with128BitId(ElasticApmTracer tracer) { + return new TraceContextImpl(tracer, IdImpl.new128BitId()); } - public static ChildContextCreator fromParentContext() { + public static ChildContextCreator fromParentContext() { return FROM_PARENT_CONTEXT; } - public static ChildContextCreator> fromParent() { + public static ChildContextCreator> fromParent() { return FROM_PARENT; } @@ -348,7 +349,7 @@ public void asRootSpan(Sampler sampler) { onMutation(); } - public void asChildOf(TraceContext parent) { + public void asChildOf(TraceContextImpl parent) { traceId.copyFrom(parent.traceId); parentId.copyFrom(parent.id); transactionId.copyFrom(parent.transactionId); @@ -378,22 +379,22 @@ public void resetState() { } @Override - public Id getTraceId() { + public IdImpl getTraceId() { return traceId; } @Override - public Id getId() { + public IdImpl getId() { return id; } @Override - public Id getParentId() { + public IdImpl getParentId() { return parentId; } @Override - public Id getTransactionId() { + public IdImpl getTransactionId() { return transactionId; } @@ -537,7 +538,7 @@ StringBuilder getOutgoingTraceParentTextHeader() { return outgoingTextHeader; } - private void fillTraceParentHeader(StringBuilder sb, Id spanId) { + private void fillTraceParentHeader(StringBuilder sb, IdImpl spanId) { sb.append("00-"); traceId.writeAsHex(sb); sb.append('-'); @@ -546,7 +547,7 @@ private void fillTraceParentHeader(StringBuilder sb, Id spanId) { HexUtils.writeByteAsHex(flags, sb); } - public boolean isChildOf(TraceContext other) { + public boolean isChildOf(TraceContextImpl other) { return other.getTraceId().equals(traceId) && other.getId().equals(parentId); } @@ -554,7 +555,7 @@ public boolean hasContent() { return !id.isEmpty(); } - public void copyFrom(TraceContext other) { + public void copyFrom(TraceContextImpl other) { traceId.copyFrom(other.traceId); id.copyFrom(other.id); parentId.copyFrom(other.parentId); @@ -612,20 +613,20 @@ public String getServiceVersion() { * @param epochMicros the span start time * @return the newly started span */ - public Span createSpan(long epochMicros) { - return tracer.startSpan(fromParentContext(), this, Baggage.EMPTY, epochMicros); + public SpanImpl createSpan(long epochMicros) { + return tracer.startSpan(fromParentContext(), this, BaggageImpl.EMPTY, epochMicros); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - TraceContext that = (TraceContext) o; + TraceContextImpl that = (TraceContextImpl) o; return id.equals(that.id) && traceId.equals(that.traceId); } - public boolean idEquals(@Nullable TraceContext o) { + public boolean idEquals(@Nullable TraceContextImpl o) { if (this == o) return true; if (o == null) return false; return id.equals(o.id); @@ -694,16 +695,16 @@ public byte getFlags() { } public interface ChildContextCreator { - boolean asChildOf(TraceContext child, T parent); + boolean asChildOf(TraceContextImpl child, T parent); } - public TraceContext copy() { - final TraceContext copy; + public TraceContextImpl copy() { + final TraceContextImpl copy; final int idLength = id.getLength(); if (idLength == 8) { - copy = TraceContext.with64BitId(tracer); + copy = TraceContextImpl.with64BitId(tracer); } else if (idLength == 16) { - copy = TraceContext.with128BitId(tracer); + copy = TraceContextImpl.with128BitId(tracer); } else { throw new IllegalStateException("Id has invalid length: " + idLength); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceState.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceState.java index 006ad35131..e8b48f68c4 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceState.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceState.java @@ -303,7 +303,7 @@ void appendTracestateHeaderValue(String headerValue, StringBuilder tracestateBuf public static boolean includesElasticVendor(HeaderGetter headers, C parent){ boolean[] tracestateIncludesElasticVendor = new boolean[1]; HeaderGetter.HeaderConsumer rawHeaderConsumer = TraceState.ELASTIC_TRACESTATE_HEADER_CHECKER; - headers.forEach(TraceContext.TRACESTATE_HEADER_NAME, parent, tracestateIncludesElasticVendor, rawHeaderConsumer); + headers.forEach(TraceContextImpl.TRACESTATE_HEADER_NAME, parent, tracestateIncludesElasticVendor, rawHeaderConsumer); return tracestateIncludesElasticVendor[0]; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/ElasticContext.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceStateImpl.java similarity index 79% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/ElasticContext.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceStateImpl.java index a59d74dfcc..5bfe590323 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/ElasticContext.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceStateImpl.java @@ -19,30 +19,31 @@ package co.elastic.apm.agent.impl.transaction; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.baggage.BaggageContext; import co.elastic.apm.agent.impl.baggage.W3CBaggagePropagation; import co.elastic.apm.agent.tracer.Scope; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.dispatch.HeaderGetter; import co.elastic.apm.agent.tracer.dispatch.HeaderSetter; import co.elastic.apm.agent.tracer.dispatch.HeaderUtils; import javax.annotation.Nullable; -public abstract class ElasticContext> implements co.elastic.apm.agent.tracer.ElasticContext { +public abstract class TraceStateImpl> implements TraceState { protected final ElasticApmTracer tracer; - protected ElasticContext(ElasticApmTracer tracer) { + protected TraceStateImpl(ElasticApmTracer tracer) { this.tracer = tracer; } @Nullable @Override - public abstract AbstractSpan getSpan(); + public abstract AbstractSpanImpl getSpan(); @Override - public abstract Baggage getBaggage(); + public abstract BaggageImpl getBaggage(); public final ElasticApmTracer getTracer() { return tracer; @@ -52,8 +53,8 @@ public final ElasticApmTracer getTracer() { * @return transaction associated to this context, {@literal null} if there is none */ @Nullable - public final Transaction getTransaction() { - AbstractSpan contextSpan = getSpan(); + public final TransactionImpl getTransaction() { + AbstractSpanImpl contextSpan = getSpan(); return contextSpan != null ? contextSpan.getParentTransaction() : null; } @@ -83,15 +84,15 @@ public BaggageContext.Builder withUpdatedBaggage() { @Nullable @Override - public co.elastic.apm.agent.impl.transaction.Span createSpan() { - AbstractSpan currentSpan = getSpan(); + public SpanImpl createSpan() { + AbstractSpanImpl currentSpan = getSpan(); return currentSpan == null ? null : currentSpan.createSpan(getBaggage()); } @Nullable @Override - public final co.elastic.apm.agent.impl.transaction.Span createExitSpan() { - AbstractSpan contextSpan = getSpan(); + public final SpanImpl createExitSpan() { + AbstractSpanImpl contextSpan = getSpan(); if (contextSpan == null || contextSpan.isExit()) { return null; } @@ -109,14 +110,14 @@ public final void propagateContext(C carrier, HeaderSetter headerSette @Override public void propagateContext(C1 carrier, HeaderSetter headerSetter, @Nullable C2 carrier2, @Nullable HeaderGetter headerGetter) { - AbstractSpan contextSpan = getSpan(); + AbstractSpanImpl contextSpan = getSpan(); if (contextSpan != null) { - if (headerGetter == null || carrier2 == null || !HeaderUtils.containsAny(TraceContext.TRACE_TEXTUAL_HEADERS, carrier2, headerGetter)) { + if (headerGetter == null || carrier2 == null || !HeaderUtils.containsAny(TraceContextImpl.TRACE_TEXTUAL_HEADERS, carrier2, headerGetter)) { contextSpan.setNonDiscardable(); contextSpan.getTraceContext().propagateTraceContext(carrier, headerSetter); } } - Baggage baggage = getBaggage(); + BaggageImpl baggage = getBaggage(); if (!baggage.isEmpty()) { if (headerGetter == null || carrier2 == null || headerGetter.getFirstHeader(W3CBaggagePropagation.BAGGAGE_HEADER_NAME, carrier2) == null) { W3CBaggagePropagation.propagate(baggage, carrier, headerSetter); @@ -126,15 +127,15 @@ public void propagateContext(C1 carrier, HeaderSetter headerSett @Override public boolean isPropagationRequired(C carrier, HeaderGetter headerGetter) { - AbstractSpan contextSpan = getSpan(); - boolean traceContextPropagationRequired = contextSpan != null && !HeaderUtils.containsAny(TraceContext.TRACE_TEXTUAL_HEADERS, carrier, headerGetter); + AbstractSpanImpl contextSpan = getSpan(); + boolean traceContextPropagationRequired = contextSpan != null && !HeaderUtils.containsAny(TraceContextImpl.TRACE_TEXTUAL_HEADERS, carrier, headerGetter); boolean baggagePropagationRequired = !getBaggage().isEmpty() && headerGetter.getFirstHeader(W3CBaggagePropagation.BAGGAGE_HEADER_NAME, carrier) == null; return traceContextPropagationRequired || baggagePropagationRequired; } @Override public final boolean shouldSkipChildSpanCreation() { - Transaction contextTransaction = getTransaction(); + TransactionImpl contextTransaction = getTransaction(); return contextTransaction == null || contextTransaction.checkSkipChildSpanCreation(); } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/ElasticContextWrapper.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceStateWrapper.java similarity index 82% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/ElasticContextWrapper.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceStateWrapper.java index aa08522c89..cf7a3e1969 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/ElasticContextWrapper.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TraceStateWrapper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.impl.transaction; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.tracer.Scope; import javax.annotation.Nullable; @@ -29,37 +29,37 @@ import java.util.concurrent.Callable; /** - * Implementation of {@link ElasticContext} that allows to wrap an existing {@link ElasticContext} object in order to + * Implementation of {@link TraceStateImpl} that allows to wrap an existing {@link TraceStateImpl} object in order to * integrate it with an alternate Tracing API. This is required in the following cases: *
      *
    • an active Elastic span/transaction is accessed from OpenTelemetry API
    • *
    • an active OpenTelemetry span created by one external plugin is accessed from another external plugin
    • *
    *

    - * When such cases occur, the currently active {@link ElasticContext} in {@link co.elastic.apm.agent.impl.ElasticApmTracer} + * When such cases occur, the currently active {@link TraceStateImpl} in {@link co.elastic.apm.agent.impl.ElasticApmTracer} * is replaced with an instance of this class in order to store references to the wrapper objects that allow to expose * the active span to the alternate Tracing API. *

    *

    - * This replacement is transparent to the creator of the original active {@link ElasticContext}. Calling (and + * This replacement is transparent to the creator of the original active {@link TraceStateImpl}. Calling (and * optionally register) the wrapper is done through {@link ElasticApmTracer#wrapActiveContextIfRequired(Class, Callable)} *

    * * @param */ -public class ElasticContextWrapper> extends ElasticContext { +public class TraceStateWrapper> extends TraceStateImpl { /** * Original wrapped context */ - private final ElasticContext context; + private final TraceStateImpl context; /** * Contains other stored wrappers, one entry per type */ - private final Map, ElasticContext> contextWrappers; + private final Map, TraceStateImpl> contextWrappers; - public ElasticContextWrapper(int initialSize, ElasticContext context) { + public TraceStateWrapper(int initialSize, TraceStateImpl context) { super(context.tracer); this.contextWrappers = new HashMap<>(initialSize, 1.0f); this.context = context; @@ -73,8 +73,8 @@ public ElasticContextWrapper(int initialSize, ElasticContext context) { * @param type of context wrapper * @return newly or previously created wrapper */ - public > C wrapIfRequired(Class wrapperType, Callable wrapFunction) { - ElasticContext wrapped = contextWrappers.get(wrapperType); + public > C wrapIfRequired(Class wrapperType, Callable wrapFunction) { + TraceStateImpl wrapped = contextWrappers.get(wrapperType); if (wrapped == null) { try { wrapped = Objects.requireNonNull(wrapFunction.call()); @@ -90,7 +90,7 @@ public > C wrapIfRequired(Class wrapperType, Call /** * @return original context that was wrapped in this wrapper */ - public ElasticContext getWrappedContext() { + public TraceStateImpl getWrappedContext() { return context; } @@ -116,12 +116,12 @@ private static UnsupportedOperationException activationNotSupported() { @Override @Nullable - public AbstractSpan getSpan() { + public AbstractSpanImpl getSpan() { return context.getSpan(); } @Override - public Baggage getBaggage() { + public BaggageImpl getBaggage() { throw new UnsupportedOperationException("Baggage should not be accessed on context wrapper"); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TransactionImpl.java similarity index 89% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TransactionImpl.java index 83213a352c..0a0750125e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/Transaction.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/TransactionImpl.java @@ -19,14 +19,15 @@ package co.elastic.apm.agent.impl.transaction; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpanConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.baggage.W3CBaggagePropagation; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.TransactionContext; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; import co.elastic.apm.agent.impl.sampling.Sampler; +import co.elastic.apm.agent.tracer.Transaction; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.Timer; @@ -41,13 +42,13 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; -import static co.elastic.apm.agent.configuration.CoreConfiguration.TraceContinuationStrategy.RESTART; -import static co.elastic.apm.agent.configuration.CoreConfiguration.TraceContinuationStrategy.RESTART_EXTERNAL; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.TraceContinuationStrategy.RESTART; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.TraceContinuationStrategy.RESTART_EXTERNAL; /** * Data captured by an agent representing an event occurring in a monitored service */ -public class Transaction extends AbstractSpan implements co.elastic.apm.agent.tracer.Transaction { +public class TransactionImpl extends AbstractSpanImpl implements Transaction { /** * Mutable labels instance used when reporting transaction metrics. @@ -60,7 +61,7 @@ public class Transaction extends AbstractSpan implements co.elastic *

    * Any arbitrary contextual information regarding the event, captured by the agent, optionally provided by the user */ - private final TransactionContext context = new TransactionContext(); + private final TransactionContextImpl context = new TransactionContextImpl(); private final SpanCount spanCount = new SpanCount(); private final DroppedSpanStats droppedSpanStats = new DroppedSpanStats(); /** @@ -74,7 +75,7 @@ public class Transaction extends AbstractSpan implements co.elastic */ private final KeyListConcurrentHashMap> timerBySpanTypeAndSubtype = new KeyListConcurrentHashMap<>(); private final WriterReaderPhaser phaser = new WriterReaderPhaser(); - private final CoreConfiguration coreConfig; + private final CoreConfigurationImpl coreConfig; private final SpanConfiguration spanConfig; /** @@ -108,49 +109,49 @@ public class Transaction extends AbstractSpan implements co.elastic @Nullable private Throwable pendingException; - private final ArrayList profilingCorrelationStackTraceIds = new ArrayList<>(); + private final ArrayList profilingCorrelationStackTraceIds = new ArrayList<>(); /** * Faas *

    * If a services is executed as a serverless function (function as a service), FaaS-specific information can be collected within this object. */ - private final Faas faas = new Faas(); + private final FaasImpl faas = new FaasImpl(); private final AtomicBoolean wasActivated = new AtomicBoolean(); @Override - public Transaction getParentTransaction() { + public TransactionImpl getParentTransaction() { return this; } - public Transaction(ElasticApmTracer tracer) { + public TransactionImpl(ElasticApmTracer tracer) { super(tracer); - coreConfig = tracer.getConfig(CoreConfiguration.class); + coreConfig = tracer.getConfig(CoreConfigurationImpl.class); spanConfig = tracer.getConfig(SpanConfiguration.class); } - public Transaction startRoot(long epochMicros, Sampler sampler, Baggage baggage) { + public TransactionImpl startRoot(long epochMicros, Sampler sampler, BaggageImpl baggage) { this.baggage = baggage; traceContext.asRootSpan(sampler); onTransactionStart(epochMicros); return this; } - public Transaction start( + public TransactionImpl start( @Nullable C parent, HeaderGetter headerGetter, long epochMicros, Sampler sampler, - Baggage baseBaggage + BaggageImpl baseBaggage ) { if (parent == null) { return startRoot(epochMicros, sampler, baseBaggage); } - Baggage.Builder baggageBuilder = baseBaggage.toBuilder(); + BaggageImpl.Builder baggageBuilder = baseBaggage.toBuilder(); W3CBaggagePropagation.parse(parent, headerGetter, baggageBuilder); this.baggage = baggageBuilder.build(); - CoreConfiguration.TraceContinuationStrategy traceContinuationStrategy = coreConfig.getTraceContinuationStrategy(); + CoreConfigurationImpl.TraceContinuationStrategy traceContinuationStrategy = coreConfig.getTraceContinuationStrategy(); boolean restartTrace = false; if (traceContinuationStrategy.equals(RESTART)) { restartTrace = true; @@ -186,7 +187,7 @@ private void onTransactionStart(long epochMicros) { onAfterStart(); } - public Transaction startNoop() { + public TransactionImpl startNoop() { this.name.append("noop"); this.noop = true; onAfterStart(); @@ -194,7 +195,7 @@ public Transaction startNoop() { } @Override - public Transaction activate() { + public TransactionImpl activate() { // why first the get() and then the getAndSet() here? get() is a cheap operation (volatile read) // while getAndSet() is an atomic operation with the corresponding performance penalty // therefore we only pay the price of the atomic operation on the first activation @@ -214,7 +215,7 @@ private void onFirstActivation() { } @Override - public TransactionContext getContext() { + public TransactionContextImpl getContext() { return context; } @@ -224,7 +225,7 @@ public TransactionContext getContext() { * @return the transaction context * @see #getContext() */ - public TransactionContext getContextEnsureVisibility() { + public TransactionContextImpl getContextEnsureVisibility() { synchronized (this) { return context; } @@ -239,7 +240,7 @@ public String getResult() { } @Override - public Transaction withResultIfUnset(@Nullable String result) { + public TransactionImpl withResultIfUnset(@Nullable String result) { if (this.result == null) { this.result = result; } @@ -247,7 +248,7 @@ public Transaction withResultIfUnset(@Nullable String result) { } @Override - public Transaction withResult(@Nullable String result) { + public TransactionImpl withResult(@Nullable String result) { this.result = result; return this; } @@ -267,7 +268,7 @@ public void beforeEnd(long epochMicros) { if (outcomeNotSet()) { // set outcome from HTTP status if not already set - Response response = getContext().getResponse(); + ResponseImpl response = getContext().getResponse(); Outcome outcome; int httpStatus = response.getStatusCode(); @@ -295,7 +296,7 @@ public SpanCount getSpanCount() { return spanCount; } - public void captureDroppedSpan(Span span) { + public void captureDroppedSpan(SpanImpl span) { if (span.isSampled()) { spanCount.getDropped().incrementAndGet(); } @@ -349,7 +350,7 @@ public void resetState() { } private void recycleProfilingCorrelationStackTraceIds() { - for (Id toRecycle : profilingCorrelationStackTraceIds) { + for (IdImpl toRecycle : profilingCorrelationStackTraceIds) { tracer.recycleProfilingCorrelationStackTraceId(toRecycle); } if (profilingCorrelationStackTraceIds.size() > 100) { @@ -441,7 +442,7 @@ public String getFrameworkVersion() { *

    * If a services is executed as a serverless function (function as a service), FaaS-specific information can be collected within this object. */ - public Faas getFaas() { + public FaasImpl getFaas() { return faas; } @@ -468,7 +469,7 @@ public CharSequence getNameForSerialization() { } @Override - protected Transaction thiz() { + protected TransactionImpl thiz() { return this; } @@ -569,8 +570,8 @@ public Throwable getPendingTransactionException() { return this.pendingException; } - public void addProfilerCorrelationStackTrace(Id idToCopy) { - Id id = tracer.createProfilingCorrelationStackTraceId(); + public void addProfilerCorrelationStackTrace(IdImpl idToCopy) { + IdImpl id = tracer.createProfilingCorrelationStackTraceId(); id.copyFrom(idToCopy); synchronized (profilingCorrelationStackTraceIds) { this.profilingCorrelationStackTraceIds.add(id); @@ -581,7 +582,7 @@ public void addProfilerCorrelationStackTrace(Id idToCopy) { * Returns the list of stacktrace-IDs from the profiler associated with this transaction * To protect agains concurrent modifications, consumers must synchronize on the returned list. */ - public List getProfilingCorrelationStackTraceIds() { + public List getProfilingCorrelationStackTraceIds() { return profilingCorrelationStackTraceIds; } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/UniqueSpanLinkArrayList.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/UniqueSpanLinkArrayList.java index 54a76845b8..28c91c13ed 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/UniqueSpanLinkArrayList.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/transaction/UniqueSpanLinkArrayList.java @@ -24,16 +24,16 @@ import java.util.Set; /** - * A {@link TraceContext} list that enforces uniqueness for the purpose of span links storage. - * We cannot naturally use {@link Set} implementations because {@link TraceContext#equals} is comparing own ID with other's ID. This is + * A {@link TraceContextImpl} list that enforces uniqueness for the purpose of span links storage. + * We cannot naturally use {@link Set} implementations because {@link TraceContextImpl#equals} is comparing own ID with other's ID. This is * inappropriate for span links, which we consider equal if their parent IDs are equal. * So instead, we use a limited subclass of {@link ArrayList} that maintains a parent ID cache for equality checks. * As a side benefit, this gives us the ability to iterate over span links based on index and avoid the related iterator allocation, which * we wouldn't have if using a {@link Set}. */ -public class UniqueSpanLinkArrayList extends ArrayList { +public class UniqueSpanLinkArrayList extends ArrayList { - private final Set parentIdSet = new HashSet<>(); + private final Set parentIdSet = new HashSet<>(); @Override public boolean retainAll(Collection c) { @@ -41,12 +41,12 @@ public boolean retainAll(Collection c) { } @Override - public TraceContext set(int index, TraceContext traceContext) { + public TraceContextImpl set(int index, TraceContextImpl traceContext) { throw new UnsupportedOperationException(); } @Override - public boolean add(TraceContext traceContext) { + public boolean add(TraceContextImpl traceContext) { if (parentIdSet.add(traceContext.getParentId())) { return super.add(traceContext); } @@ -54,12 +54,12 @@ public boolean add(TraceContext traceContext) { } @Override - public void add(int index, TraceContext traceContext) { + public void add(int index, TraceContextImpl traceContext) { throw new UnsupportedOperationException(); } @Override - public TraceContext remove(int index) { + public TraceContextImpl remove(int index) { throw new UnsupportedOperationException(); } @@ -75,12 +75,12 @@ public void clear() { } @Override - public boolean addAll(Collection c) { + public boolean addAll(Collection c) { throw new UnsupportedOperationException(); } @Override - public boolean addAll(int index, Collection c) { + public boolean addAll(int index, Collection c) { throw new UnsupportedOperationException(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java index 97074fe210..a8ffe69a9d 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/ApmServerLogAppender.java @@ -47,7 +47,7 @@ public class ApmServerLogAppender extends AbstractAppender { private static ApmServerLogAppender INSTANCE; @Nullable - private volatile LoggingConfiguration config; + private volatile LoggingConfigurationImpl config; @Nullable private volatile Reporter reporter; @@ -105,12 +105,12 @@ public LifecycleListener getInitListener() { return new AbstractLifecycleListener() { @Override public void init(Tracer tracer) throws Exception { - initStreaming(tracer.getConfig(LoggingConfiguration.class), tracer.require(ElasticApmTracer.class).getReporter()); + initStreaming(tracer.getConfig(LoggingConfigurationImpl.class), tracer.require(ElasticApmTracer.class).getReporter()); } }; } - private void initStreaming(LoggingConfiguration config, Reporter reporter) { + private void initStreaming(LoggingConfigurationImpl config, Reporter reporter) { if (isAgentInitialized()) { throw new IllegalStateException("streaming already initialized"); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/Log4j2ConfigurationFactory.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/Log4j2ConfigurationFactory.java index e5da6fe806..54007e47fe 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/Log4j2ConfigurationFactory.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/Log4j2ConfigurationFactory.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.common.util.SystemStandardOutputLogger; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.AutoDetectedServiceInfo; import co.elastic.apm.agent.tracer.configuration.ByteValue; import co.elastic.apm.agent.report.ApmServerReporter; @@ -46,15 +46,15 @@ import java.net.URI; import java.util.List; -import static co.elastic.apm.agent.logging.LoggingConfiguration.AGENT_HOME_PLACEHOLDER; -import static co.elastic.apm.agent.logging.LoggingConfiguration.DEFAULT_LOG_FILE; -import static co.elastic.apm.agent.logging.LoggingConfiguration.DEPRECATED_LOG_FILE_KEY; -import static co.elastic.apm.agent.logging.LoggingConfiguration.DEPRECATED_LOG_LEVEL_KEY; -import static co.elastic.apm.agent.logging.LoggingConfiguration.LOG_FILE_KEY; -import static co.elastic.apm.agent.logging.LoggingConfiguration.LOG_FORMAT_FILE_KEY; -import static co.elastic.apm.agent.logging.LoggingConfiguration.LOG_FORMAT_SOUT_KEY; -import static co.elastic.apm.agent.logging.LoggingConfiguration.LOG_LEVEL_KEY; -import static co.elastic.apm.agent.logging.LoggingConfiguration.SYSTEM_OUT; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.AGENT_HOME_PLACEHOLDER; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.DEFAULT_LOG_FILE; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.DEPRECATED_LOG_FILE_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.DEPRECATED_LOG_LEVEL_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.LOG_FILE_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.LOG_FORMAT_FILE_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.LOG_FORMAT_SOUT_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.LOG_LEVEL_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.SYSTEM_OUT; public class Log4j2ConfigurationFactory extends ConfigurationFactory { @@ -156,7 +156,7 @@ Configuration getConfiguration() { private Level getLogLevel() { String rawLogLevelValue = getValue(LOG_LEVEL_KEY, sources, getValue(DEPRECATED_LOG_LEVEL_KEY, sources, Level.INFO.toString())); - LogLevel logLevel = LoggingConfiguration.mapLogLevel(new EnumValueConverter<>(LogLevel.class).convert(rawLogLevelValue)); + LogLevel logLevel = LoggingConfigurationImpl.mapLogLevel(new EnumValueConverter<>(LogLevel.class).convert(rawLogLevelValue)); return Level.valueOf(logLevel.toString()); } @@ -186,7 +186,7 @@ private LayoutComponentBuilder createLayout(ConfigurationBuilder builder, String logFile, LayoutComponentBuilder layout) { - ByteValue size = ByteValue.of(getValue("log_file_size", sources, LoggingConfiguration.DEFAULT_MAX_SIZE)); + ByteValue size = ByteValue.of(getValue("log_file_size", sources, LoggingConfigurationImpl.DEFAULT_MAX_SIZE)); AppenderComponentBuilder appender = builder.newAppender("rolling", "RollingFile") .addAttribute("fileName", logFile) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/LoggingConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/LoggingConfigurationImpl.java similarity index 98% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/logging/LoggingConfiguration.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/logging/LoggingConfigurationImpl.java index 3f17505f61..3ae8e4dfd9 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/LoggingConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/logging/LoggingConfigurationImpl.java @@ -24,6 +24,7 @@ import co.elastic.apm.agent.tracer.configuration.ByteValue; import co.elastic.apm.agent.tracer.configuration.ByteValueConverter; import co.elastic.apm.agent.tracer.configuration.LogEcsReformatting; +import co.elastic.apm.agent.tracer.configuration.LoggingConfiguration; import co.elastic.apm.agent.tracer.configuration.WildcardMatcherValueConverter; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -65,7 +66,7 @@ * so that the documentation gets generated for the options in this class. *

    */ -public class LoggingConfiguration extends ConfigurationOptionProvider implements co.elastic.apm.agent.tracer.configuration.LoggingConfiguration { +public class LoggingConfigurationImpl extends ConfigurationOptionProvider implements LoggingConfiguration { public static final String SYSTEM_OUT = "System.out"; static final String LOG_LEVEL_KEY = "log_level"; @@ -349,7 +350,7 @@ private static void setLogLevel(@Nullable LogLevel level) { } } else { // it should be safe to obtain a logger here - LoggerFactory.getLogger(LoggingConfiguration.class).warn("Unexpected type of LoggerContextFactory - {}, " + + LoggerFactory.getLogger(LoggingConfigurationImpl.class).warn("Unexpected type of LoggerContextFactory - {}, " + "cannot update logging level", contextFactory); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java index 9c1cdeb285..5c1ee1febe 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricRegistry.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.metrics; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; @@ -46,7 +46,7 @@ public class MetricRegistry { private static final Logger logger = LoggerFactory.getLogger(MetricRegistry.class); private final WriterReaderPhaser phaser = new WriterReaderPhaser(); - private final ReporterConfiguration reporterConfiguration; + private final ReporterConfigurationImpl reporterConfiguration; private final Set metricsProviders = Collections.newSetFromMap(new ConcurrentHashMap()); private final int metricSetLimit; @@ -72,7 +72,7 @@ public void addMetricValue(String metric, Labels labels, double value) { } }; - public MetricRegistry(ReporterConfiguration reporterConfiguration, MetricsConfiguration metricsConfiguration) { + public MetricRegistry(ReporterConfigurationImpl reporterConfiguration, MetricsConfigurationImpl metricsConfiguration) { this.reporterConfiguration = reporterConfiguration; this.metricSetLimit = metricsConfiguration.getMetricSetLimit(); } @@ -90,7 +90,7 @@ public void addMetricsProvider(MetricsProvider provider) { * Tags can be used to create different graphs based for each value of a specific tag name, using a terms aggregation. * Note that there will be a {@link MetricSet} created for each distinct set of labels. * @param metric this supplier will be called for every reporting cycle - * ({@link co.elastic.apm.agent.report.ReporterConfiguration#metricsInterval metrics_interval)}) + * ({@link ReporterConfigurationImpl#metricsInterval metrics_interval)}) * @see #add(String, Labels, DoubleSupplier) */ public void addUnlessNan(String name, Labels labels, DoubleSupplier metric) { @@ -111,7 +111,7 @@ public void addUnlessNan(String name, Labels labels, DoubleSupplier metric) { * Tags can be used to create different graphs based for each value of a specific tag name, using a terms aggregation. * Note that there will be a {@link MetricSet} created for each distinct set of labels. * @param metric this supplier will be called for every reporting cycle - * ({@link co.elastic.apm.agent.report.ReporterConfiguration#metricsInterval metrics_interval)}) + * ({@link ReporterConfigurationImpl#metricsInterval metrics_interval)}) * @see #add(String, Labels, DoubleSupplier) */ public void addUnlessNegative(String name, Labels labels, DoubleSupplier metric) { @@ -131,7 +131,7 @@ public void addUnlessNegative(String name, Labels labels, DoubleSupplier metric) * Tags can be used to create different graphs based for each value of a specific tag name, using a terms aggregation. * Note that there will be a {@link MetricSet} created for each distinct set of labels. * @param metric this supplier will be called for every reporting cycle - * ({@link co.elastic.apm.agent.report.ReporterConfiguration#metricsInterval metrics_interval)}) + * ({@link ReporterConfigurationImpl#metricsInterval metrics_interval)}) */ public void add(String name, Labels labels, DoubleSupplier metric) { if (isDisabled(name)) { diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java index 8bb1bc6f85..414d3efa88 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/MetricSet.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.metrics; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.tracer.pooling.Recyclable; @@ -32,7 +33,7 @@ * A metric set is a collection of metrics which have the same labels. *

    * A metric set corresponds to one document per - * {@link co.elastic.apm.agent.report.ReporterConfiguration#metricsInterval metrics_interval} in Elasticsearch. + * {@link ReporterConfigurationImpl#metricsInterval metrics_interval} in Elasticsearch. * An alternative would be to have one document per metric but having one document for all metrics with the same labels saves disk space. *

    * Example of some serialized metric sets: diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java index 3413f95f8a..346f4e13b2 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetrics.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.Tracer; @@ -116,11 +116,11 @@ public AgentOverheadMetrics() { @Override public void start(Tracer tracer) throws Exception { MetricRegistry metricRegistry = tracer.require(ElasticApmTracer.class).getMetricRegistry(); - MetricsConfiguration config = tracer.getConfig(MetricsConfiguration.class); + MetricsConfigurationImpl config = tracer.getConfig(MetricsConfigurationImpl.class); bindTo(metricRegistry, config); } - void bindTo(MetricRegistry metricRegistry, MetricsConfiguration config) { + void bindTo(MetricRegistry metricRegistry, MetricsConfigurationImpl config) { boolean overheadMetricsEnabled = config.isOverheadMetricsEnabled(); cpuOverheadMetricEnabled = !metricRegistry.isDisabled(CPU_OVERHEAD_METRIC) && overheadMetricsEnabled; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java index e946bb90e1..fb1e069348 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetrics.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricCollector; import co.elastic.apm.agent.metrics.MetricRegistry; @@ -77,7 +77,7 @@ public class AgentReporterMetrics implements ReporterMonitor { private final AtomicDouble maxQueueSize = new AtomicDouble(0.0); private final AtomicDouble minQueueSize = new AtomicDouble(0.0); - public AgentReporterMetrics(final MetricRegistry registry, MetricsConfiguration configuration) { + public AgentReporterMetrics(final MetricRegistry registry, MetricsConfigurationImpl configuration) { this.metricRegistry = registry; boolean allEnabled = configuration.isReporterHealthMetricsEnabled(); this.totalEventsMetricEnabled = allEnabled && !registry.isDisabled(TOTAL_EVENTS_METRIC); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectHandle.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectHandleImpl.java similarity index 67% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectHandle.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectHandleImpl.java index c66afae82d..fc1e59e04e 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectHandle.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectHandleImpl.java @@ -20,12 +20,12 @@ import javax.annotation.Nullable; -public class ObjectHandle implements co.elastic.apm.agent.tracer.pooling.ObjectHandle, co.elastic.apm.agent.sdk.internal.pooling.ObjectHandle { +public class ObjectHandleImpl implements co.elastic.apm.agent.tracer.pooling.ObjectHandle, co.elastic.apm.agent.sdk.internal.pooling.ObjectHandle { - public static class Allocator implements co.elastic.apm.agent.tracer.pooling.Allocator> { + public static class Allocator implements co.elastic.apm.agent.tracer.pooling.Allocator> { @Nullable - private ObjectPool> pool; + private ObservableObjectPool> pool; private final co.elastic.apm.agent.tracer.pooling.Allocator delegate; @@ -33,29 +33,29 @@ public Allocator(co.elastic.apm.agent.tracer.pooling.Allocator delegate) { this.delegate = delegate; } - public void setPool(@Nullable ObjectPool> pool) { + public void setPool(@Nullable ObservableObjectPool> pool) { this.pool = pool; } @Override - public ObjectHandle createInstance() { + public ObjectHandleImpl createInstance() { if (pool == null) { throw new IllegalStateException("Pool has not been initialized!"); } - return new ObjectHandle<>(pool, delegate.createInstance()); + return new ObjectHandleImpl<>(pool, delegate.createInstance()); } } - public static final Resetter> NOOP_RESETTER = new Resetter>() { + public static final Resetter> NOOP_RESETTER = new Resetter>() { @Override - public void recycle(ObjectHandle object) { + public void recycle(ObjectHandleImpl object) { } }; - private final ObjectPool> owner; + private final ObservableObjectPool> owner; private final T pooledObject; - public ObjectHandle(ObjectPool> owner, T pooledObject) { + public ObjectHandleImpl(ObservableObjectPool> owner, T pooledObject) { this.owner = owner; this.pooledObject = pooledObject; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPoolFactory.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPoolFactoryImpl.java similarity index 54% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPoolFactory.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPoolFactoryImpl.java index 748d9d71e4..e3bf9d2297 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPoolFactory.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPoolFactoryImpl.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.objectpool; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; import co.elastic.apm.agent.sdk.internal.pooling.ObjectPooling; import co.elastic.apm.agent.tracer.pooling.Allocator; @@ -31,28 +31,28 @@ import java.util.concurrent.Callable; -import static co.elastic.apm.agent.objectpool.ObjectHandle.NOOP_RESETTER; +import static co.elastic.apm.agent.objectpool.ObjectHandleImpl.NOOP_RESETTER; -public class ObjectPoolFactory implements co.elastic.apm.agent.tracer.pooling.ObjectPoolFactory, ObjectPooling.ObjectPoolFactory { +public class ObjectPoolFactoryImpl implements co.elastic.apm.agent.tracer.pooling.ObjectPoolFactory, ObjectPooling.ObjectPoolFactory { private static final int DEFAULT_RESOURCE_POOL_SIZE = Math.max(16, Runtime.getRuntime().availableProcessors() * 2); @Override - public ObjectPool createRecyclableObjectPool(int maxCapacity, Allocator allocator) { + public ObservableObjectPool createRecyclableObjectPool(int maxCapacity, Allocator allocator) { return QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue((maxCapacity)), false, allocator); } @Override - public ObjectPool> createHandlePool(Allocator allocator) { - ObjectHandle.Allocator handleAlloc = new ObjectHandle.Allocator(allocator); - QueueBasedObjectPool> result = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue>((DEFAULT_RESOURCE_POOL_SIZE)), false, handleAlloc, NOOP_RESETTER); + public ObservableObjectPool> createHandlePool(Allocator allocator) { + ObjectHandleImpl.Allocator handleAlloc = new ObjectHandleImpl.Allocator(allocator); + QueueBasedObjectPool> result = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue>((DEFAULT_RESOURCE_POOL_SIZE)), false, handleAlloc, NOOP_RESETTER); handleAlloc.setPool(result); return result; } @Override - public ObjectPool> createHandlePool(final Callable allocator) { + public ObservableObjectPool> createHandlePool(final Callable allocator) { return createHandlePool(new Allocator() { @Override public T createInstance() { @@ -65,38 +65,38 @@ public T createInstance() { }); } - public ObjectPool createTransactionPool(int maxCapacity, final ElasticApmTracer tracer) { - return createRecyclableObjectPool(maxCapacity, new Allocator() { + public ObservableObjectPool createTransactionPool(int maxCapacity, final ElasticApmTracer tracer) { + return createRecyclableObjectPool(maxCapacity, new Allocator() { @Override - public Transaction createInstance() { - return new Transaction(tracer); + public TransactionImpl createInstance() { + return new TransactionImpl(tracer); } }); } - public ObjectPool createSpanPool(int maxCapacity, final ElasticApmTracer tracer) { - return createRecyclableObjectPool(maxCapacity, new Allocator() { + public ObservableObjectPool createSpanPool(int maxCapacity, final ElasticApmTracer tracer) { + return createRecyclableObjectPool(maxCapacity, new Allocator() { @Override - public Span createInstance() { - return new Span(tracer); + public SpanImpl createInstance() { + return new SpanImpl(tracer); } }); } - public ObjectPool createErrorPool(int maxCapacity, final ElasticApmTracer tracer) { - return createRecyclableObjectPool(maxCapacity, new Allocator() { + public ObservableObjectPool createErrorPool(int maxCapacity, final ElasticApmTracer tracer) { + return createRecyclableObjectPool(maxCapacity, new Allocator() { @Override - public ErrorCapture createInstance() { - return new ErrorCapture(tracer); + public ErrorCaptureImpl createInstance() { + return new ErrorCaptureImpl(tracer); } }); } - public ObjectPool createSpanLinkPool(int maxCapacity, final ElasticApmTracer tracer) { - return createRecyclableObjectPool(maxCapacity, new Allocator() { + public ObservableObjectPool createSpanLinkPool(int maxCapacity, final ElasticApmTracer tracer) { + return createRecyclableObjectPool(maxCapacity, new Allocator() { @Override - public TraceContext createInstance() { - return TraceContext.with64BitId(tracer); + public TraceContextImpl createInstance() { + return TraceContextImpl.with64BitId(tracer); } }); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPool.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObservableObjectPool.java similarity index 87% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPool.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObservableObjectPool.java index 0296b7fb0f..475763d4cf 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObjectPool.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/ObservableObjectPool.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.objectpool; -public interface ObjectPool extends co.elastic.apm.agent.tracer.pooling.ObjectPool, co.elastic.apm.agent.sdk.internal.pooling.ObjectPool { +public interface ObservableObjectPool extends co.elastic.apm.agent.tracer.pooling.ObjectPool, co.elastic.apm.agent.sdk.internal.pooling.ObjectPool { /** * @return number of available objects in pool diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java index 4348d64d68..8630baf455 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java @@ -18,14 +18,14 @@ */ package co.elastic.apm.agent.objectpool.impl; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.Resetter; import co.elastic.apm.agent.tracer.pooling.Allocator; import javax.annotation.Nullable; import java.util.concurrent.atomic.AtomicInteger; -public abstract class AbstractObjectPool implements ObjectPool { +public abstract class AbstractObjectPool implements ObservableObjectPool { protected final Allocator allocator; protected final Resetter resetter; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/AbstractIntakeApiHandler.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/AbstractIntakeApiHandler.java index 750364da06..5fea031483 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/AbstractIntakeApiHandler.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/AbstractIntakeApiHandler.java @@ -40,7 +40,7 @@ public class AbstractIntakeApiHandler { private static final Logger logger = LoggerFactory.getLogger(AbstractIntakeApiHandler.class); private static final Object WAIT_LOCK = new Object(); - protected final ReporterConfiguration reporterConfiguration; + protected final ReporterConfigurationImpl reporterConfiguration; protected final DslJsonSerializer.Writer payloadSerializer; protected final ApmServerClient apmServerClient; protected Deflater deflater; @@ -55,7 +55,7 @@ public class AbstractIntakeApiHandler { private volatile boolean healthy = true; private long requestStartedNanos; - protected AbstractIntakeApiHandler(ReporterConfiguration reporterConfiguration, DslJsonSerializer payloadSerializer, ApmServerClient apmServerClient) { + protected AbstractIntakeApiHandler(ReporterConfigurationImpl reporterConfiguration, DslJsonSerializer payloadSerializer, ApmServerClient apmServerClient) { this.reporterConfiguration = reporterConfiguration; this.payloadSerializer = payloadSerializer.newWriter(); this.apmServerClient = apmServerClient; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java index 1bc971d72f..9c9d198c0c 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.report; import co.elastic.apm.agent.common.util.Version; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.report.ssl.SslUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -76,9 +76,9 @@ public class ApmServerClient { private static final Version VERSION_8_6 = Version.of("8.6.0"); private static final Version VERSION_8_7_1 = Version.of("8.7.1"); - private final ReporterConfiguration reporterConfiguration; + private final ReporterConfigurationImpl reporterConfiguration; - private final ServerlessConfiguration serverlessConfiguration; + private final ServerlessConfigurationImpl serverlessConfiguration; @Nullable private volatile List serverUrls; @Nullable @@ -89,10 +89,10 @@ public class ApmServerClient { private final String userAgent; public ApmServerClient(ConfigurationRegistry configs) { - this.reporterConfiguration = configs.getConfig(ReporterConfiguration.class); + this.reporterConfiguration = configs.getConfig(ReporterConfigurationImpl.class); this.healthChecker = new ApmServerHealthChecker(this); - this.serverlessConfiguration = configs.getConfig(ServerlessConfiguration.class); - this.userAgent = getUserAgent(configs.getConfig(CoreConfiguration.class)); + this.serverlessConfiguration = configs.getConfig(ServerlessConfigurationImpl.class); + this.userAgent = getUserAgent(configs.getConfig(CoreConfigurationImpl.class)); } public void start() { @@ -418,7 +418,7 @@ public interface ConnectionHandler { T withConnection(HttpURLConnection connection) throws IOException; } - private static String getUserAgent(CoreConfiguration coreConfiguration) { + private static String getUserAgent(CoreConfigurationImpl coreConfiguration) { StringBuilder userAgent = new StringBuilder(); userAgent.append("apm-agent-java/").append(VersionUtils.getAgentVersion()); String serviceName = coreConfiguration.getServiceName(); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerReporter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerReporter.java index 37e84b2fc4..8b8aabfc93 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerReporter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerReporter.java @@ -18,11 +18,11 @@ */ package co.elastic.apm.agent.report; -import co.elastic.apm.agent.configuration.CoreConfiguration; -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.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.disruptor.ExponentionallyIncreasingSleepingWaitStrategy; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.sdk.logging.Logger; @@ -44,24 +44,24 @@ import java.util.concurrent.locks.LockSupport; /** - * This reporter asynchronously reports {@link Transaction}s to the APM server + * This reporter asynchronously reports {@link TransactionImpl}s to the APM server *

    - * It uses a Disruptor/ring buffer to decouple the {@link Transaction} producing threads from the thread that actually sends the payload + * It uses a Disruptor/ring buffer to decouple the {@link TransactionImpl} producing threads from the thread that actually sends the payload *

    */ public class ApmServerReporter implements Reporter { private static final Logger logger = LoggerFactory.getLogger(ApmServerReporter.class); - private static final EventTranslatorOneArg TRANSACTION_EVENT_TRANSLATOR = new EventTranslatorOneArg() { + private static final EventTranslatorOneArg TRANSACTION_EVENT_TRANSLATOR = new EventTranslatorOneArg() { @Override - public void translateTo(ReportingEvent event, long sequence, Transaction t) { + public void translateTo(ReportingEvent event, long sequence, TransactionImpl t) { event.setTransaction(t); } }; - private static final EventTranslatorOneArg SPAN_EVENT_TRANSLATOR = new EventTranslatorOneArg() { + private static final EventTranslatorOneArg SPAN_EVENT_TRANSLATOR = new EventTranslatorOneArg() { @Override - public void translateTo(ReportingEvent event, long sequence, Span s) { + public void translateTo(ReportingEvent event, long sequence, SpanImpl s) { event.setSpan(s); } }; @@ -85,9 +85,9 @@ public void translateTo(ReportingEvent event, long sequence) { event.setWakeupEvent(); } }; - private static final EventTranslatorOneArg ERROR_EVENT_TRANSLATOR = new EventTranslatorOneArg() { + private static final EventTranslatorOneArg ERROR_EVENT_TRANSLATOR = new EventTranslatorOneArg() { @Override - public void translateTo(ReportingEvent event, long sequence, ErrorCapture error) { + public void translateTo(ReportingEvent event, long sequence, ErrorCaptureImpl error) { event.setError(error); } }; @@ -133,16 +133,16 @@ public void translateTo(ReportingEvent event, long sequence, byte[] bytes) { private final PartialTransactionReporter partialTransactionReporter; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; public ApmServerReporter(boolean dropTransactionIfQueueFull, - ReporterConfiguration reporterConfiguration, - CoreConfiguration coreConfiguration, + ReporterConfigurationImpl reporterConfiguration, + CoreConfigurationImpl coreConfiguration, ReportingEventHandler reportingEventHandler, ReporterMonitor monitor, ApmServerClient apmServer, DslJsonSerializer serializer, - ObjectPoolFactory poolFactory + ObjectPoolFactoryImpl poolFactory ) { this.dropTransactionIfQueueFull = dropTransactionIfQueueFull; @@ -168,14 +168,14 @@ public void start() { } @Override - public void reportPartialTransaction(Transaction transaction) { + public void reportPartialTransaction(TransactionImpl transaction) { if (!coreConfiguration.isContextPropagationOnly()) { partialTransactionReporter.reportPartialTransaction(transaction); } } @Override - public void report(Transaction transaction) { + public void report(TransactionImpl transaction) { if (!tryAddEventToRingBuffer(transaction, TRANSACTION_EVENT_TRANSLATOR, ReportingEvent.ReportingEventType.TRANSACTION)) { transaction.decrementReferences(); } @@ -185,7 +185,7 @@ public void report(Transaction transaction) { } @Override - public void report(Span span) { + public void report(SpanImpl span) { if (!tryAddEventToRingBuffer(span, SPAN_EVENT_TRANSLATOR, ReportingEvent.ReportingEventType.SPAN)) { span.decrementReferences(); } @@ -287,7 +287,7 @@ public void close() { } @Override - public void report(ErrorCapture error) { + public void report(ErrorCaptureImpl error) { if (!tryAddEventToRingBuffer(error, ERROR_EVENT_TRANSLATOR, ReportingEvent.ReportingEventType.ERROR)) { error.recycle(); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandler.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandler.java index 72ea93cb44..2264b34138 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandler.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandler.java @@ -60,7 +60,7 @@ public class IntakeV2ReportingEventHandler extends AbstractIntakeApiHandler impl private long reported; private long dropped; - public IntakeV2ReportingEventHandler(ReporterConfiguration reporterConfiguration, ProcessorEventHandler processorEventHandler, + public IntakeV2ReportingEventHandler(ReporterConfigurationImpl reporterConfiguration, ProcessorEventHandler processorEventHandler, DslJsonSerializer payloadSerializer, ApmServerClient apmServerClient) { super(reporterConfiguration, payloadSerializer, apmServerClient); this.processorEventHandler = processorEventHandler; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/PartialTransactionReporter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/PartialTransactionReporter.java index 0a74c09b9c..e88e5d603b 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/PartialTransactionReporter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/PartialTransactionReporter.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.report; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.objectpool.ObjectPool; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.report.serialize.SerializationConstants; import co.elastic.apm.agent.sdk.logging.Logger; @@ -37,11 +37,11 @@ class PartialTransactionReporter { private final ApmServerClient apmServer; - private final ObjectPool writerPool; + private final ObservableObjectPool writerPool; private volatile boolean extensionSupportsPartialTransactions = true; - public PartialTransactionReporter(ApmServerClient apmServer, final DslJsonSerializer payloadSerializer, ObjectPoolFactory poolFactory) { + public PartialTransactionReporter(ApmServerClient apmServer, final DslJsonSerializer payloadSerializer, ObjectPoolFactoryImpl poolFactory) { this.apmServer = apmServer; writerPool = poolFactory.createRecyclableObjectPool(WRITER_POOL_SIZE, new Allocator() { @Override @@ -51,7 +51,7 @@ public DslJsonSerializer.Writer createInstance() { }); } - public void reportPartialTransaction(Transaction transaction) { + public void reportPartialTransaction(TransactionImpl transaction) { if (!extensionSupportsPartialTransactions) { return; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/Reporter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/Reporter.java index 777a8d82ef..10974dbd9b 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/Reporter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/Reporter.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.report; -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.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.dslplatform.json.JsonWriter; import java.io.Closeable; @@ -30,13 +30,13 @@ public interface Reporter extends Closeable { void start(); - void reportPartialTransaction(Transaction transaction); + void reportPartialTransaction(TransactionImpl transaction); - void report(Transaction transaction); + void report(TransactionImpl transaction); - void report(Span span); + void report(SpanImpl span); - void report(ErrorCapture error); + void report(ErrorCaptureImpl error); void reportMetrics(JsonWriter jsonWriter); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfigurationImpl.java similarity index 97% rename from apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java rename to apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfigurationImpl.java index 5a7965c317..cf6149b27d 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfigurationImpl.java @@ -20,6 +20,7 @@ import co.elastic.apm.agent.tracer.configuration.ByteValue; import co.elastic.apm.agent.tracer.configuration.ByteValueConverter; +import co.elastic.apm.agent.tracer.configuration.ReporterConfiguration; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.tracer.configuration.TimeDurationValueConverter; import co.elastic.apm.agent.common.util.WildcardMatcher; @@ -37,7 +38,7 @@ import static co.elastic.apm.agent.tracer.configuration.RangeValidator.isNotInRange; -public class ReporterConfiguration extends ConfigurationOptionProvider implements co.elastic.apm.agent.tracer.configuration.ReporterConfiguration { +public class ReporterConfigurationImpl extends ConfigurationOptionProvider implements ReporterConfiguration { public static final String REPORTER_CATEGORY = "Reporter"; public static final URL LOCAL_APM_SERVER_URL = UrlValueConverter.INSTANCE.convert("http://127.0.0.1:8200"); @@ -226,8 +227,8 @@ public String getApiKey() { /** * Provides the combined output of two config options - {@code server_url} and {@code server_urls}, with precedence - * for the singular form. If {@link ReporterConfiguration#serverUrl} is set with an empty string and - * {@link ReporterConfiguration#serverUrls} is not set, this method is expected to provide an empty list. + * for the singular form. If {@link ReporterConfigurationImpl#serverUrl} is set with an empty string and + * {@link ReporterConfigurationImpl#serverUrls} is not set, this method is expected to provide an empty list. * * Algorithm: * 1. if the server_url value is set, then: diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterFactory.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterFactory.java index de15fb9b0b..b5e32623eb 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterFactory.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterFactory.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.report; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.processor.ProcessorEventHandler; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -32,17 +32,17 @@ public Reporter createReporter(ConfigurationRegistry configurationRegistry, ApmServerClient apmServerClient, DslJsonSerializer payloadSerializer, ReporterMonitor monitor, - ObjectPoolFactory poolFactory) { + ObjectPoolFactoryImpl poolFactory) { - ReporterConfiguration reporterConfiguration = configurationRegistry.getConfig(ReporterConfiguration.class); - CoreConfiguration coreConfig = configurationRegistry.getConfig(CoreConfiguration.class); + ReporterConfigurationImpl reporterConfiguration = configurationRegistry.getConfig(ReporterConfigurationImpl.class); + CoreConfigurationImpl coreConfig = configurationRegistry.getConfig(CoreConfigurationImpl.class); ReportingEventHandler reportingEventHandler = getReportingEventHandler(configurationRegistry, reporterConfiguration, payloadSerializer, apmServerClient); return new ApmServerReporter(true, reporterConfiguration, coreConfig, reportingEventHandler, monitor, apmServerClient, payloadSerializer, poolFactory); } @Nonnull private ReportingEventHandler getReportingEventHandler(ConfigurationRegistry configurationRegistry, - ReporterConfiguration reporterConfiguration, + ReporterConfigurationImpl reporterConfiguration, DslJsonSerializer payloadSerializer, ApmServerClient apmServerClient) { ProcessorEventHandler processorEventHandler = ProcessorEventHandler.loadProcessors(configurationRegistry); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReportingEvent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReportingEvent.java index 1547b2cff4..62158bc664 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReportingEvent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReportingEvent.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.report; -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.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; @@ -39,14 +39,14 @@ public class ReportingEvent { @Nullable - private Transaction transaction; + private TransactionImpl transaction; @Nullable private ReportingEventType type; @Nullable - private ErrorCapture error; + private ErrorCaptureImpl error; @Nullable - private Span span; + private SpanImpl span; @Nullable private JsonWriter jsonWriter; @Nullable @@ -71,11 +71,11 @@ public void resetState() { } @Nullable - public Transaction getTransaction() { + public TransactionImpl getTransaction() { return transaction; } - public void setTransaction(Transaction transaction) { + public void setTransaction(TransactionImpl transaction) { this.transaction = transaction; this.type = TRANSACTION; } @@ -96,21 +96,21 @@ public ReportingEventType getType() { } @Nullable - public ErrorCapture getError() { + public ErrorCaptureImpl getError() { return error; } @Nullable - public Span getSpan() { + public SpanImpl getSpan() { return span; } - public void setError(ErrorCapture error) { + public void setError(ErrorCaptureImpl error) { this.error = error; this.type = ERROR; } - public void setSpan(Span span) { + public void setSpan(SpanImpl span) { this.span = span; this.type = SPAN; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/processor/Processor.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/processor/Processor.java index ca9e4ae23d..a4535edc46 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/processor/Processor.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/processor/Processor.java @@ -18,12 +18,12 @@ */ package co.elastic.apm.agent.report.processor; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.stagemonitor.configuration.ConfigurationRegistry; /** - * A processor is executed right before a event (a {@link Transaction} or {@link ErrorCapture}) gets reported. + * A processor is executed right before a event (a {@link TransactionImpl} or {@link ErrorCaptureImpl}) gets reported. *

    * You can use this for example to sanitize certain information. *

    @@ -34,16 +34,16 @@ public interface Processor { /** - * This method is executed before the provided {@link Transaction} is reported. + * This method is executed before the provided {@link TransactionImpl} is reported. * * @param transaction The transaction to process. */ - void processBeforeReport(Transaction transaction); + void processBeforeReport(TransactionImpl transaction); /** - * This method is executed before the provided {@link ErrorCapture} is reported. + * This method is executed before the provided {@link ErrorCaptureImpl} is reported. * * @param error The error to process. */ - void processBeforeReport(ErrorCapture error); + void processBeforeReport(ErrorCaptureImpl error); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java index a14b296bb3..89759bed42 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java @@ -18,47 +18,23 @@ */ package co.elastic.apm.agent.report.serialize; -import co.elastic.apm.agent.impl.context.AbstractContext; -import co.elastic.apm.agent.impl.context.CloudOrigin; -import co.elastic.apm.agent.impl.context.Db; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.context.Headers; -import co.elastic.apm.agent.impl.context.Http; -import co.elastic.apm.agent.impl.context.Message; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.ServiceOrigin; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.impl.context.Socket; -import co.elastic.apm.agent.impl.context.SpanContext; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.context.Url; -import co.elastic.apm.agent.impl.context.User; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.context.*; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.Agent; import co.elastic.apm.agent.impl.metadata.CloudProviderInfo; import co.elastic.apm.agent.impl.metadata.Framework; import co.elastic.apm.agent.impl.metadata.Language; import co.elastic.apm.agent.impl.metadata.MetaData; import co.elastic.apm.agent.impl.metadata.NameAndIdField; -import co.elastic.apm.agent.impl.metadata.Node; +import co.elastic.apm.agent.impl.metadata.NodeImpl; import co.elastic.apm.agent.impl.metadata.ProcessInfo; import co.elastic.apm.agent.impl.metadata.RuntimeInfo; -import co.elastic.apm.agent.impl.metadata.Service; +import co.elastic.apm.agent.impl.metadata.ServiceImpl; import co.elastic.apm.agent.impl.metadata.SystemInfo; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Composite; -import co.elastic.apm.agent.impl.transaction.DroppedSpanStats; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.FaasTrigger; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.OTelSpanKind; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.SpanCount; -import co.elastic.apm.agent.impl.transaction.StackFrame; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.*; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.sdk.internal.collections.LongList; @@ -103,7 +79,7 @@ public class DslJsonSerializer { private static final List excludedStackFramesPrefixes = Arrays.asList("java.lang.reflect.", "com.sun.", "sun.", "jdk.internal."); - private final StacktraceConfiguration stacktraceConfiguration; + private final StacktraceConfigurationImpl stacktraceConfiguration; private final ApmServerClient apmServerClient; private final Future metaData; @@ -111,7 +87,7 @@ public class DslJsonSerializer { private byte[] serializedMetaData; private boolean serializedActivationMethod; - public DslJsonSerializer(StacktraceConfiguration stacktraceConfiguration, ApmServerClient apmServerClient, final Future metaData) { + public DslJsonSerializer(StacktraceConfigurationImpl stacktraceConfiguration, ApmServerClient apmServerClient, final Future metaData) { this.stacktraceConfiguration = stacktraceConfiguration; this.apmServerClient = apmServerClient; this.metaData = metaData; @@ -182,7 +158,7 @@ private static void serializeGlobalLabels(ArrayList globalLabelKeys, Arr } } - private static void serializeService(final Service service, final StringBuilder replaceBuilder, final JsonWriter jw, boolean supportsAgentActivationMethod) { + private static void serializeService(final ServiceImpl service, final StringBuilder replaceBuilder, final JsonWriter jw, boolean supportsAgentActivationMethod) { DslJsonUtil.writeFieldName("service", jw); jw.writeByte(JsonWriter.OBJECT_START); @@ -205,7 +181,7 @@ private static void serializeService(final Service service, final StringBuilder serializeFramework(framework, replaceBuilder, jw); } - final Node node = service.getNode(); + final NodeImpl node = service.getNode(); if (node != null && node.hasContents()) { serializeNode(node, replaceBuilder, jw); } @@ -219,7 +195,7 @@ private static void serializeService(final Service service, final StringBuilder jw.writeByte(JsonWriter.OBJECT_END); } - private static void serializeService(@Nullable final CharSequence serviceName, @Nullable final CharSequence serviceVersion, @Nullable ServiceTarget serviceTarget, final StringBuilder replaceBuilder, final JsonWriter jw) { + private static void serializeService(@Nullable final CharSequence serviceName, @Nullable final CharSequence serviceVersion, @Nullable ServiceTargetImpl serviceTarget, final StringBuilder replaceBuilder, final JsonWriter jw) { boolean hasServiceTarget = (serviceTarget != null && serviceTarget.hasContent()); if (serviceName == null && !hasServiceTarget) { return; @@ -302,7 +278,7 @@ private static void serializeFramework(final Framework framework, final StringBu jw.writeByte(COMMA); } - private static void serializeNode(final Node node, final StringBuilder replaceBuilder, final JsonWriter jw) { + private static void serializeNode(final NodeImpl node, final StringBuilder replaceBuilder, final JsonWriter jw) { DslJsonUtil.writeFieldName("node", jw); jw.writeByte(JsonWriter.OBJECT_START); writeLastField("configured_name", node.getName(), replaceBuilder, jw); @@ -771,7 +747,7 @@ public void blockUntilReady() throws Exception { DslJsonSerializer.this.waitForMetadata(); } - public void serializeTransactionNdJson(Transaction transaction) { + public void serializeTransactionNdJson(TransactionImpl transaction) { jw.writeByte(JsonWriter.OBJECT_START); writeFieldName("transaction"); serializeTransaction(transaction); @@ -779,7 +755,7 @@ public void serializeTransactionNdJson(Transaction transaction) { jw.writeByte(NEW_LINE); } - public void serializeSpanNdJson(Span span) { + public void serializeSpanNdJson(SpanImpl span) { jw.writeByte(JsonWriter.OBJECT_START); writeFieldName("span"); serializeSpan(span); @@ -787,7 +763,7 @@ public void serializeSpanNdJson(Span span) { jw.writeByte(NEW_LINE); } - public void serializeErrorNdJson(ErrorCapture error) { + public void serializeErrorNdJson(ErrorCaptureImpl error) { jw.writeByte(JsonWriter.OBJECT_START); writeFieldName("error"); serializeError(error); @@ -861,7 +837,7 @@ public void serializeLogNdJson(byte[] bytesLog) { jw.writeByte(NEW_LINE); } - private void serializeError(ErrorCapture errorCapture) { + private void serializeError(ErrorCaptureImpl errorCapture) { jw.writeByte(JsonWriter.OBJECT_START); writeTimestamp(errorCapture.getTimestamp()); @@ -876,7 +852,7 @@ private void serializeError(ErrorCapture errorCapture) { jw.writeByte(JsonWriter.OBJECT_END); } - private void serializeErrorTransactionInfo(ErrorCapture.TransactionInfo errorTransactionInfo) { + private void serializeErrorTransactionInfo(ErrorCaptureImpl.TransactionInfo errorTransactionInfo) { writeFieldName("transaction"); jw.writeByte(JsonWriter.OBJECT_START); writeField("name", errorTransactionInfo.getName()); @@ -913,7 +889,7 @@ private void recursiveSerializeException(@Nullable Throwable exception) { jw.writeByte(JsonWriter.OBJECT_END); } - public String toJsonString(final Transaction transaction) { + public String toJsonString(final TransactionImpl transaction) { jw.reset(); serializeTransaction(transaction); final String s = jw.toString(); @@ -921,7 +897,7 @@ public String toJsonString(final Transaction transaction) { return s; } - public String toJsonString(Span span) { + public String toJsonString(SpanImpl span) { jw.reset(); serializeSpan(span); final String s = jw.toString(); @@ -929,7 +905,7 @@ public String toJsonString(Span span) { return s; } - public String toJsonString(final ErrorCapture error) { + public String toJsonString(final ErrorCaptureImpl error) { jw.reset(); serializeError(error); final String s = jw.toString(); @@ -958,8 +934,8 @@ private void serializeFramework(final String frameworkName, final @Nullable Stri jw.writeByte(COMMA); } - private void serializeTransaction(final Transaction transaction) { - TraceContext traceContext = transaction.getTraceContext(); + private void serializeTransaction(final TransactionImpl transaction) { + TraceContextImpl traceContext = transaction.getTraceContext(); jw.writeByte(OBJECT_START); writeTimestamp(transaction.getTimestamp()); @@ -985,7 +961,7 @@ private void serializeTransaction(final Transaction transaction) { jw.writeByte(OBJECT_END); } - private void serializeTraceContext(TraceContext traceContext, boolean serializeTransactionId) { + private void serializeTraceContext(TraceContextImpl traceContext, boolean serializeTransactionId) { // errors might only have an id writeNonLastIdField("id", traceContext.getId()); if (!traceContext.getTraceId().isEmpty()) { @@ -1000,8 +976,8 @@ private void serializeTraceContext(TraceContext traceContext, boolean serializeT } } - private void serializeSpan(final Span span) { - TraceContext traceContext = span.getTraceContext(); + private void serializeSpan(final SpanImpl span) { + TraceContextImpl traceContext = span.getTraceContext(); jw.writeByte(OBJECT_START); writeField("name", span.getNameForSerialization()); writeTimestamp(span.getTimestamp()); @@ -1032,7 +1008,7 @@ private void serializeSpan(final Span span) { jw.writeByte(OBJECT_END); } - private void serializeSpanLinks(List spanLinks) { + private void serializeSpanLinks(List spanLinks) { if (!spanLinks.isEmpty()) { writeFieldName("links"); jw.writeByte(ARRAY_START); @@ -1040,7 +1016,7 @@ private void serializeSpanLinks(List spanLinks) { if (i > 0) { jw.writeByte(COMMA); } - TraceContext traceContext = spanLinks.get(i); + TraceContextImpl traceContext = spanLinks.get(i); jw.writeByte(OBJECT_START); writeNonLastIdField("trace_id", traceContext.getTraceId()); writeIdField("span_id", traceContext.getParentId()); @@ -1051,18 +1027,18 @@ private void serializeSpanLinks(List spanLinks) { } } - private void serializeOTel(Span span) { - serializeOtel(span, Collections.emptyList()); + private void serializeOTel(SpanImpl span) { + serializeOtel(span, Collections.emptyList()); } - private void serializeOTel(Transaction transaction) { - List profilingCorrelationStackTraceIds = transaction.getProfilingCorrelationStackTraceIds(); + private void serializeOTel(TransactionImpl transaction) { + List profilingCorrelationStackTraceIds = transaction.getProfilingCorrelationStackTraceIds(); synchronized (profilingCorrelationStackTraceIds) { serializeOtel(transaction, profilingCorrelationStackTraceIds); } } - private void serializeOtel(AbstractSpan span, List profilingStackTraceIds) { + private void serializeOtel(AbstractSpanImpl span, List profilingStackTraceIds) { OTelSpanKind kind = span.getOtelKind(); Map attributes = span.getOtelAttributes(); @@ -1146,7 +1122,7 @@ private void serializeComposite(Composite composite) { jw.writeByte(COMMA); } - private void serializeServiceNameWithFramework(@Nullable final Transaction transaction, final TraceContext traceContext, final ServiceOrigin serviceOrigin) { + private void serializeServiceNameWithFramework(@Nullable final TransactionImpl transaction, final TraceContextImpl traceContext, final ServiceOriginImpl serviceOrigin) { String serviceName = traceContext.getServiceName(); String serviceVersion = traceContext.getServiceVersion(); boolean isFrameworkNameNotNull = transaction != null && transaction.getFrameworkName() != null; @@ -1166,7 +1142,7 @@ private void serializeServiceNameWithFramework(@Nullable final Transaction trans } } - private void serializeServiceOrigin(final ServiceOrigin serviceOrigin) { + private void serializeServiceOrigin(final ServiceOriginImpl serviceOrigin) { writeFieldName("origin"); jw.writeByte(OBJECT_START); if (null != serviceOrigin.getId()) { @@ -1180,7 +1156,7 @@ private void serializeServiceOrigin(final ServiceOrigin serviceOrigin) { jw.writeByte(COMMA); } - private void serializeCloudOrigin(final CloudOrigin cloudOrigin) { + private void serializeCloudOrigin(final CloudOriginImpl cloudOrigin) { writeFieldName("cloud"); jw.writeByte(OBJECT_START); @@ -1216,7 +1192,7 @@ private void serializeCloudOrigin(final CloudOrigin cloudOrigin) { * * @param span serialized span */ - private void serializeSpanType(Span span) { + private void serializeSpanType(SpanImpl span) { writeFieldName("type"); String type = span.getType(); if (type != null) { @@ -1342,7 +1318,7 @@ private void serializeStackTraceElement(StackFrame frame, StringBuilder replaceB jw.writeByte(OBJECT_END); } - private void serializeSpanContext(SpanContext context, TraceContext traceContext) { + private void serializeSpanContext(SpanContextImpl context, TraceContextImpl traceContext) { writeFieldName("context"); jw.writeByte(OBJECT_START); @@ -1359,7 +1335,7 @@ private void serializeSpanContext(SpanContext context, TraceContext traceContext jw.writeByte(COMMA); } - private void serializeDestination(Destination destination, @Nullable CharSequence resource) { + private void serializeDestination(DestinationImpl destination, @Nullable CharSequence resource) { if (destination.hasContent() || resource != null) { writeFieldName("destination"); jw.writeByte(OBJECT_START); @@ -1406,7 +1382,7 @@ private void serializeService(boolean hasCloudContent, CharSequence resource) { } } - private void serializeDestinationCloud(boolean isCloudHasContent, Destination.Cloud cloud) { + private void serializeDestinationCloud(boolean isCloudHasContent, DestinationImpl.CloudImpl cloud) { if (isCloudHasContent) { writeFieldName("cloud"); jw.writeByte(OBJECT_START); @@ -1415,7 +1391,7 @@ private void serializeDestinationCloud(boolean isCloudHasContent, Destination.Cl } } - private void serializeMessageContext(final Message message) { + private void serializeMessageContext(final MessageImpl message) { if (message.hasContent()) { writeFieldName("message"); jw.writeByte(OBJECT_START); @@ -1463,7 +1439,7 @@ private void serializeMessageHeaders(Headers headers) { } } - private void serializeFaas(final Faas faas) { + private void serializeFaas(final FaasImpl faas) { if (faas.hasContent()) { writeFieldName("faas"); jw.writeByte(OBJECT_START); @@ -1478,7 +1454,7 @@ private void serializeFaas(final Faas faas) { } } - private void serializeFaasTrigger(final FaasTrigger trigger) { + private void serializeFaasTrigger(final FaasTriggerImpl trigger) { if (trigger.hasContent()) { writeFieldName("trigger"); jw.writeByte(OBJECT_START); @@ -1489,7 +1465,7 @@ private void serializeFaasTrigger(final FaasTrigger trigger) { } } - private void serializeDbContext(final Db db) { + private void serializeDbContext(final DbImpl db) { if (db.hasContent()) { writeFieldName("db"); jw.writeByte(OBJECT_START); @@ -1519,7 +1495,7 @@ private void serializeDbContext(final Db db) { } } - private void serializeHttpContext(final Http http) { + private void serializeHttpContext(final HttpImpl http) { if (http.hasContent()) { writeFieldName("http"); jw.writeByte(OBJECT_START); @@ -1574,7 +1550,7 @@ private void serializeDroppedSpanStats(final DroppedSpanStats droppedSpanStats) jw.writeByte(COMMA); } - private void serializeContext(@Nullable final Transaction transaction, final TransactionContext context, TraceContext traceContext) { + private void serializeContext(@Nullable final TransactionImpl transaction, final TransactionContextImpl context, TraceContextImpl traceContext) { writeFieldName("context"); jw.writeByte(OBJECT_START); serializeServiceNameWithFramework(transaction, traceContext, context.getServiceOrigin()); @@ -1602,7 +1578,7 @@ private void serializeContext(@Nullable final Transaction transaction, final Tra } // visible for testing - void serializeLabels(AbstractContext context) { + void serializeLabels(AbstractContextImpl context) { if (context.hasLabels()) { serializeStringKeyScalarValueMap(context.getLabelIterator(), replaceBuilder, jw, false, apmServerClient.supportsNonStringLabels()); } else { @@ -1611,7 +1587,7 @@ void serializeLabels(AbstractContext context) { } } - private void serializeResponse(final Response response) { + private void serializeResponse(final ResponseImpl response) { if (response.hasContent()) { writeFieldName("response"); jw.writeByte(OBJECT_START); @@ -1625,7 +1601,7 @@ private void serializeResponse(final Response response) { } } - private void serializeRequest(final Request request) { + private void serializeRequest(final RequestImpl request) { if (request.hasContent()) { writeFieldName("request"); jw.writeByte(OBJECT_START); @@ -1660,7 +1636,7 @@ private void serializeRequest(final Request request) { } // visible for testing - void serializeUrl(final Url url) { + void serializeUrl(final UrlImpl url) { jw.writeByte(OBJECT_START); writeField("full", url.getFull()); writeField("hostname", url.getHostname()); @@ -1682,7 +1658,7 @@ void serializeUrl(final Url url) { jw.writeByte(OBJECT_END); } - private void serializeSocket(final Socket socket) { + private void serializeSocket(final SocketImpl socket) { writeFieldName("socket"); jw.writeByte(OBJECT_START); writeLastField("remote_address", socket.getRemoteAddress()); @@ -1740,7 +1716,7 @@ private void serializePotentiallyMultiValuedEntry(String key, @Nullable Object v } } - private void serializeUser(final User user) { + private void serializeUser(final UserImpl user) { writeFieldName("user"); jw.writeByte(OBJECT_START); writeField("domain", user.getDomain()); @@ -1834,12 +1810,12 @@ private void writeFieldName(final String fieldName) { DslJsonUtil.writeFieldName(fieldName, jw); } - private void writeNonLastIdField(String fieldName, Id id) { + private void writeNonLastIdField(String fieldName, IdImpl id) { writeIdField(fieldName, id); jw.writeByte(COMMA); } - private void writeIdField(String fieldName, Id id) { + private void writeIdField(String fieldName, IdImpl id) { writeFieldName(fieldName); jw.writeByte(JsonWriter.QUOTE); id.writeAsHex(jw); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java index 04327f4f0f..565f74b0ec 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/MetricRegistryReporter.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.report.serialize; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.tracer.AbstractLifecycleListener; @@ -26,7 +27,6 @@ import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.report.Reporter; -import co.elastic.apm.agent.report.ReporterConfiguration; import com.dslplatform.json.JsonWriter; import java.util.List; @@ -49,7 +49,7 @@ public MetricRegistryReporter(ElasticApmTracer tracer) { @Override public void start(Tracer tracer) { - long intervalMs = tracer.getConfig(ReporterConfiguration.class).getMetricsIntervalMs(); + long intervalMs = tracer.getConfig(ReporterConfigurationImpl.class).getMetricsIntervalMs(); if (intervalMs > 0) { tracer.require(ElasticApmTracer.class) .getSharedSingleThreadedPool() diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java index bd927d1b8f..b036d7cc52 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/SerializationConstants.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.report.serialize; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; import javax.annotation.Nullable; @@ -43,7 +43,7 @@ private SerializationConstants(int maxLongStringValueLength) { this.maxLongStringValueLength = maxLongStringValueLength; } - public static void init(CoreConfiguration coreConfiguration) { + public static void init(CoreConfigurationImpl coreConfiguration) { INSTANCE = new SerializationConstants(coreConfiguration.getLongFieldMaxLength()); } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentation.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentation.java index 5d2477c282..ed3efebec5 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentation.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentation.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.tracemethods; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; import co.elastic.apm.agent.matcher.MethodMatcher; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.sdk.logging.Logger; @@ -59,11 +59,11 @@ public class TraceMethodInstrumentation extends ElasticApmInstrumentation { private final MethodMatcher methodMatcher; - private final CoreConfiguration config; + private final CoreConfigurationImpl config; public TraceMethodInstrumentation(Tracer tracer, MethodMatcher methodMatcher) { this.methodMatcher = methodMatcher; - config = tracer.getConfig(CoreConfiguration.class); + config = tracer.getConfig(CoreConfigurationImpl.class); } @Override @@ -135,7 +135,7 @@ public static class TraceMethodAdvice { private static final long traceMethodThresholdMicros; static { - CoreConfiguration config = tracer.getConfig(CoreConfiguration.class); + CoreConfigurationImpl config = tracer.getConfig(CoreConfigurationImpl.class); traceMethodThresholdMicros = config.getTraceMethodsDurationThreshold().getMicros(); } @@ -143,9 +143,9 @@ public static class TraceMethodAdvice { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static Object onMethodEnter(@Advice.Origin Class clazz, @SimpleMethodSignatureOffsetMappingFactory.SimpleMethodSignature String signature) { - AbstractSpan span = null; - ElasticContext activeContext = tracer.currentContext(); - final AbstractSpan parentSpan = tracer.getActive(); + AbstractSpanImpl span = null; + TraceStateImpl activeContext = tracer.currentContext(); + final AbstractSpanImpl parentSpan = tracer.getActive(); if (parentSpan == null) { span = tracer.startRootTransaction(PrivilegedActionUtils.getClassLoader(clazz)); if (span != null) { @@ -167,11 +167,11 @@ public static Object onMethodEnter(@Advice.Origin Class clazz, @Advice.OnMethodExit(suppress = Throwable.class, onThrowable = Throwable.class, inline = false) public static void onMethodExit(@Advice.Enter @Nullable Object spanObj, @Advice.Thrown @Nullable Throwable t) { - AbstractSpan span = (AbstractSpan) spanObj; + AbstractSpanImpl span = (AbstractSpanImpl) spanObj; if (span != null) { span.captureException(t); final long endTime = span.getTraceContext().getClock().getEpochMicros(); - if (span instanceof Span) { + if (span instanceof SpanImpl) { long durationMicros = endTime - span.getTimestamp(); if (traceMethodThresholdMicros > 0 && durationMicros < traceMethodThresholdMicros && t == null) { span.requestDiscarding(); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/ProfilerSharedMemoryWriter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/ProfilerSharedMemoryWriter.java index 259fb7687a..ae5dbb285f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/ProfilerSharedMemoryWriter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/ProfilerSharedMemoryWriter.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.universalprofiling; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.otel.UniversalProfilingCorrelation; @@ -80,7 +80,7 @@ private static void memoryStoreStoreBarrier() { writeForMemoryBarrier = 42; } - static void updateThreadCorrelationStorage(@Nullable AbstractSpan newSpan) { + static void updateThreadCorrelationStorage(@Nullable AbstractSpanImpl newSpan) { try { ByteBuffer tls = UniversalProfilingCorrelation.getCurrentThreadStorage(true, TLS_STORAGE_SIZE); // tls might be null if unsupported or something went wrong on initialization @@ -91,7 +91,7 @@ static void updateThreadCorrelationStorage(@Nullable AbstractSpan newSpan) { tls.putChar(TLS_MINOR_VERSION_OFFSET, (char) 1); if (newSpan != null) { - Transaction tx = newSpan.getParentTransaction(); + TransactionImpl tx = newSpan.getParentTransaction(); tls.put(TLS_TRACE_PRESENT_OFFSET, (byte) 1); tls.put(TLS_TRACE_FLAGS_OFFSET, newSpan.getTraceContext().getFlags()); tls.position(TLS_TRACE_ID_OFFSET); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/SpanProfilingSamplesCorrelator.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/SpanProfilingSamplesCorrelator.java index 90d6b36981..c471d1282a 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/SpanProfilingSamplesCorrelator.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/SpanProfilingSamplesCorrelator.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.universalprofiling; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.Reporter; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -43,7 +43,7 @@ public class SpanProfilingSamplesCorrelator { * However, this is highly unlikely (see birthday problem) and even if * it were to happen, the only consequences would be a potentially incorrect correlation for the two colliding transactions. */ - private final ConcurrentHashMap transactionsById = new ConcurrentHashMap<>(); + private final ConcurrentHashMap transactionsById = new ConcurrentHashMap<>(); private final Reporter reporter; @@ -89,17 +89,17 @@ public void setSpanBufferDurationNanos(long nanos) { spanBufferDurationNanos = nanos; } - public void onTransactionStart(Transaction transaction) { + public void onTransactionStart(TransactionImpl transaction) { if (transaction.isSampled()) { transactionsById.put(transaction.getTraceContext().getId(), transaction); } } - public void stopCorrelating(Transaction transaction) { + public void stopCorrelating(TransactionImpl transaction) { transactionsById.remove(transaction.getTraceContext().getId()); } - public void reportOrBufferTransaction(Transaction transaction) { + public void reportOrBufferTransaction(TransactionImpl transaction) { if (!transactionsById.containsKey(transaction.getTraceContext().getId())) { // transaction is not being correlated, e.g. because it was not sampled // therefore no need to buffer it @@ -130,8 +130,8 @@ public void reportOrBufferTransaction(Transaction transaction) { } public synchronized void correlate( - Id traceId, Id transactionId, Id stackTraceId, int count) { - Transaction tx = transactionsById.get(transactionId); + IdImpl traceId, IdImpl transactionId, IdImpl stackTraceId, int count) { + TransactionImpl tx = transactionsById.get(transactionId); if (tx != null) { // this branch should be true practically always unless there was a collision in transactionsById // nonetheless for the unlikely case that it happens, we at least prevent wrongly adding data to another transaction @@ -182,7 +182,7 @@ public synchronized void shutdownAndFlushAll() { private static class BufferedTransaction implements MoveableEvent { - Transaction transaction; + TransactionImpl transaction; long endNanoTimestamp; @Override @@ -198,9 +198,9 @@ public void clear() { endNanoTimestamp = -1; } - public static final EventTranslatorTwoArg TRANSLATOR = new EventTranslatorTwoArg() { + public static final EventTranslatorTwoArg TRANSLATOR = new EventTranslatorTwoArg() { @Override - public void translateTo(BufferedTransaction event, long sequence, Transaction transaction, Long timestamp) { + public void translateTo(BufferedTransaction event, long sequence, TransactionImpl transaction, Long timestamp) { event.transaction = transaction; event.endNanoTimestamp = timestamp; } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java index accfe2b8d2..2fc3226bf0 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegration.java @@ -18,15 +18,15 @@ */ package co.elastic.apm.agent.universalprofiling; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.UniversalProfilingConfiguration; import co.elastic.apm.agent.impl.ActivationListener; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.metadata.SystemInfo; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.util.ExecutorUtils; @@ -42,7 +42,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.time.Duration; import java.util.Random; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -77,13 +76,13 @@ public class UniversalProfilingIntegration { private ActivationListener activationListener = new ActivationListener() { @Override - public void beforeActivate(AbstractSpan span) { + public void beforeActivate(AbstractSpanImpl span) { ProfilerSharedMemoryWriter.updateThreadCorrelationStorage(span); } @Override - public void afterDeactivate(@Nullable AbstractSpan deactivatedSpan) { - ElasticContext currentContext = tracer.currentContext(); + public void afterDeactivate(@Nullable AbstractSpanImpl deactivatedSpan) { + TraceStateImpl currentContext = tracer.currentContext(); ProfilerSharedMemoryWriter.updateThreadCorrelationStorage(currentContext.getSpan()); } }; @@ -103,7 +102,7 @@ public void start(ElasticApmTracer tracer) { socketPath = openProfilerSocket(config.getSocketDir()); - CoreConfiguration coreConfig = tracer.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = tracer.getConfig(CoreConfigurationImpl.class); ByteBuffer processCorrelationStorage = ProfilerSharedMemoryWriter.generateProcessCorrelationStorage( coreConfig.getServiceName(), coreConfig.getEnvironment(), socketPath); UniversalProfilingCorrelation.setProcessStorage(processCorrelationStorage); @@ -158,7 +157,7 @@ public void stop() { } } - public void afterTransactionStart(Transaction startedTransaction) { + public void afterTransactionStart(TransactionImpl startedTransaction) { if (correlator != null) { correlator.onTransactionStart(startedTransaction); } @@ -174,7 +173,7 @@ public void afterTransactionStart(Transaction startedTransaction) { * * @param endedTransaction the transaction to be reported */ - public void correlateAndReport(Transaction endedTransaction) { + public void correlateAndReport(TransactionImpl endedTransaction) { if (correlator != null) { correlator.reportOrBufferTransaction(endedTransaction); } else { @@ -182,7 +181,7 @@ public void correlateAndReport(Transaction endedTransaction) { } } - public void drop(Transaction endedTransaction) { + public void drop(TransactionImpl endedTransaction) { if (correlator != null) { correlator.stopCorrelating(endedTransaction); } @@ -249,9 +248,9 @@ private void handleMessage(ProfilerRegistrationMessage message) { correlator.setSpanBufferDurationNanos(delayMillis * 1_000_000L); } - private final Id tempTraceId = Id.new128BitId(); - private final Id tempSpanId = Id.new64BitId(); - private final Id tempStackTraceId = Id.new128BitId(); + private final IdImpl tempTraceId = IdImpl.new128BitId(); + private final IdImpl tempSpanId = IdImpl.new64BitId(); + private final IdImpl tempStackTraceId = IdImpl.new128BitId(); private void handleMessage(TraceCorrelationMessage message) { tempTraceId.fromBytes(message.getTraceId(), 0); tempSpanId.fromBytes(message.getLocalRootSpanId(), 0); diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java index 999c9a6d79..dfee46f2c7 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/util/ThreadDump.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.util; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractLifecycleListener; @@ -45,7 +45,7 @@ public class ThreadDump extends AbstractLifecycleListener { @Override public void start(Tracer tracer) throws Exception { - long threadDumpInterval = tracer.getConfig(CoreConfiguration.class).getThreadDumpInterval(); + long threadDumpInterval = tracer.getConfig(CoreConfigurationImpl.class).getThreadDumpInterval(); if (threadDumpInterval <= 0) { return; } diff --git a/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.internal.pooling.ObjectPooling$ObjectPoolFactory b/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.internal.pooling.ObjectPooling$ObjectPoolFactory index d860744b17..cc1ef54dd3 100644 --- a/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.internal.pooling.ObjectPooling$ObjectPoolFactory +++ b/apm-agent-core/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.internal.pooling.ObjectPooling$ObjectPoolFactory @@ -1 +1 @@ -co.elastic.apm.agent.objectpool.ObjectPoolFactory +co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl diff --git a/apm-agent-core/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider b/apm-agent-core/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider index 878419acfb..a3d0ed31db 100644 --- a/apm-agent-core/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider +++ b/apm-agent-core/src/main/resources/META-INF/services/org.stagemonitor.configuration.ConfigurationOptionProvider @@ -1,10 +1,10 @@ co.elastic.apm.agent.impl.TracerConfiguration -co.elastic.apm.agent.configuration.CoreConfiguration -co.elastic.apm.agent.report.ReporterConfiguration -co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration -co.elastic.apm.agent.logging.LoggingConfiguration +co.elastic.apm.agent.configuration.CoreConfigurationImpl +co.elastic.apm.agent.report.ReporterConfigurationImpl +co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl +co.elastic.apm.agent.logging.LoggingConfigurationImpl co.elastic.apm.agent.impl.circuitbreaker.CircuitBreakerConfiguration -co.elastic.apm.agent.configuration.MetricsConfiguration -co.elastic.apm.agent.configuration.ServerlessConfiguration +co.elastic.apm.agent.configuration.MetricsConfigurationImpl +co.elastic.apm.agent.configuration.ServerlessConfigurationImpl co.elastic.apm.agent.configuration.SpanConfiguration co.elastic.apm.agent.configuration.UniversalProfilingConfiguration diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/AbstractInstrumentationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/AbstractInstrumentationTest.java index c6dda2d014..f48781dee4 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/AbstractInstrumentationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/AbstractInstrumentationTest.java @@ -20,13 +20,13 @@ import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.collections.WeakConcurrentProviderImpl; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpanConfiguration; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.impl.TracerInternalApiUtils; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.report.ApmServerClient; import net.bytebuddy.agent.ByteBuddyAgent; @@ -49,7 +49,7 @@ public abstract class AbstractInstrumentationTest { /** * Set to a valid path in order to make byte buddy dump instrumented classes. - * We cannot use the {@link co.elastic.apm.agent.configuration.CoreConfiguration#bytecodeDumpPath} config because + * We cannot use the {@link CoreConfigurationImpl#bytecodeDumpPath} config because * the way it works is by setting the related byte buddy system property, which is set statically, and since we use * Mockito for agent configs, byte buddy gets loaded early and this property gets set before our configuration * can be applied. @@ -99,7 +99,7 @@ protected void disableRecyclingValidation() { validateRecycling = false; } - public static Tracer getTracer() { + public static ElasticApmTracer getTracer() { return tracer; } @@ -150,8 +150,8 @@ public final void cleanUp() { * @param name transaction name * @return root transaction */ - protected Transaction startTestRootTransaction(String name) { - Transaction transaction = tracer.startRootTransaction(null); + protected TransactionImpl startTestRootTransaction(String name) { + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); @@ -168,7 +168,7 @@ protected Transaction startTestRootTransaction(String name) { * * @return root transaction */ - protected Transaction startTestRootTransaction() { + protected TransactionImpl startTestRootTransaction() { return startTestRootTransaction("test root transaction"); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java index 6fe269b495..8a332e39cb 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java @@ -18,15 +18,15 @@ */ package co.elastic.apm.agent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.MetaData; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.IntakeV2ReportingEventHandler; import co.elastic.apm.agent.report.Reporter; @@ -96,17 +96,17 @@ public class MockReporter implements Reporter { */ private boolean gcWhenAssertingRecycling; - private final List transactions = Collections.synchronizedList(new ArrayList<>()); + private final List transactions = Collections.synchronizedList(new ArrayList<>()); - private final List partialTransactions = Collections.synchronizedList(new ArrayList<>()); - private final List spans = Collections.synchronizedList(new ArrayList<>()); - private final List errors = Collections.synchronizedList(new ArrayList<>()); + private final List partialTransactions = Collections.synchronizedList(new ArrayList<>()); + private final List spans = Collections.synchronizedList(new ArrayList<>()); + private final List errors = Collections.synchronizedList(new ArrayList<>()); private final List bytes = new CopyOnWriteArrayList<>(); private final List logs = Collections.synchronizedList(new ArrayList<>()); private final ObjectMapper objectMapper; private final boolean verifyJsonSchema; - private Consumer partialTransactionHandler; + private Consumer partialTransactionHandler; private boolean closed; @@ -197,7 +197,7 @@ public void start() { } @Override - public synchronized void reportPartialTransaction(Transaction transaction) { + public synchronized void reportPartialTransaction(TransactionImpl transaction) { if (closed) { return; } @@ -209,12 +209,12 @@ public synchronized void reportPartialTransaction(Transaction transaction) { } } - public void setPartialTransactionHandler(Consumer transactionHandler) { + public void setPartialTransactionHandler(Consumer transactionHandler) { this.partialTransactionHandler = transactionHandler; } @Override - public synchronized void report(Transaction transaction) { + public synchronized void report(TransactionImpl transaction) { if (closed) { return; } @@ -237,7 +237,7 @@ public synchronized void report(Transaction transaction) { } @Override - public synchronized void report(Span span) { + public synchronized void report(SpanImpl span) { if (closed) { return; } @@ -266,7 +266,7 @@ public synchronized void report(Span span) { } - private void verifySpanType(Span span) { + private void verifySpanType(SpanImpl span) { String type = span.getType(); assertThat(type) .describedAs("span type is mandatory") @@ -299,11 +299,11 @@ private void verifySpanType(Span span) { } - private void verifyDestinationFields(Span span) { + private void verifyDestinationFields(SpanImpl span) { if (!span.isExit()) { return; } - Destination destination = span.getContext().getDestination(); + DestinationImpl destination = span.getContext().getDestination(); if (checkDestinationAddress && !SPAN_TYPES_WITHOUT_ADDRESS.contains(span.getSubtype())) { // see if this span's subtype is not supported for its type Collection unsupportedSubtypes = SPAN_SUBTYPES_WITHOUT_ADDRESS.getOrDefault(span.getType(), Collections.emptySet()); @@ -316,7 +316,7 @@ private void verifyDestinationFields(Span span) { } } - private void verifyServiceTarget(Span span) { + private void verifyServiceTarget(SpanImpl span) { if (!span.isExit() || !checkServiceTarget) { return; } @@ -335,7 +335,7 @@ private void verifyServiceTarget(Span span) { * * @param transaction transaction to serialize */ - public void verifyTransactionSchema(Transaction transaction) { + public void verifyTransactionSchema(TransactionImpl transaction) { verifyJsonSchemas(dsl -> dsl.toJsonString(transaction), si -> si.transactionSchema, si -> si.transactionSchemaPath); } @@ -344,7 +344,7 @@ public void verifyTransactionSchema(Transaction transaction) { * * @param span span to serialize */ - public void verifySpanSchema(Span span) { + public void verifySpanSchema(SpanImpl span) { verifyJsonSchemas(dsl -> dsl.toJsonString(span), si -> si.spanSchema, si -> si.spanSchemaPath); } @@ -353,7 +353,7 @@ public void verifySpanSchema(Span span) { * * @param error error to serialize */ - public void verifyErrorSchema(ErrorCapture error) { + public void verifyErrorSchema(ErrorCaptureImpl error) { verifyJsonSchemas(dsl -> dsl.toJsonString(error), si -> si.errorSchema, si -> si.errorSchemaPath); } @@ -416,11 +416,11 @@ private JsonNode asJson(String jsonContent) { } } - public synchronized List getTransactions() { + public synchronized List getTransactions() { return Collections.unmodifiableList(transactions); } - public synchronized List getPartialTransactions() { + public synchronized List getPartialTransactions() { return Collections.unmodifiableList(partialTransactions); } @@ -428,14 +428,14 @@ public synchronized int getNumReportedTransactions() { return transactions.size(); } - public synchronized Transaction getFirstTransaction() { + public synchronized TransactionImpl getFirstTransaction() { assertThat(transactions) .describedAs("at least one transaction expected, none have been reported (yet)") .isNotEmpty(); return transactions.get(0); } - public Transaction getFirstTransaction(long timeoutMs) { + public TransactionImpl getFirstTransaction(long timeoutMs) { awaitUntilAsserted(timeoutMs, () -> assertThat(getTransactions()).isNotEmpty()); return getFirstTransaction(); } @@ -450,12 +450,12 @@ public void assertNoTransaction(long timeoutMs) { awaitUntilTimeout(timeoutMs, this::assertNoTransaction); } - public Span getFirstSpan(long timeoutMs) { + public SpanImpl getFirstSpan(long timeoutMs) { awaitUntilAsserted(timeoutMs, () -> assertThat(getSpans()).isNotEmpty()); return getFirstSpan(); } - public ErrorCapture getFirstError(long timeoutMs) { + public ErrorCaptureImpl getFirstError(long timeoutMs) { awaitUntilAsserted(timeoutMs, () -> assertThat(getErrors()).isNotEmpty()); return getFirstError(); } @@ -501,7 +501,7 @@ public void awaitLogsCount(int count) { } @Override - public synchronized void report(ErrorCapture error) { + public synchronized void report(ErrorCaptureImpl error) { if (closed) { return; } @@ -537,14 +537,14 @@ public boolean flush() { return true; } - public synchronized Span getFirstSpan() { + public synchronized SpanImpl getFirstSpan() { assertThat(spans) .describedAs("at least one span expected, none have been reported") .isNotEmpty(); return spans.get(0); } - public synchronized List getSpans() { + public synchronized List getSpans() { return Collections.unmodifiableList(spans); } @@ -561,11 +561,11 @@ public synchronized List getLogs() { .collect(Collectors.toList()); } - public Span getSpanByName(String name) { - Optional optional = getSpans().stream().filter(s -> s.getNameAsString().equals(name)).findAny(); + public SpanImpl getSpanByName(String name) { + Optional optional = getSpans().stream().filter(s -> s.getNameAsString().equals(name)).findAny(); assertThat(optional) .withFailMessage("No span with name '%s' found in reported spans %s", name, - getSpans().stream().map(Span::getNameAsString).collect(Collectors.toList())) + getSpans().stream().map(SpanImpl::getNameAsString).collect(Collectors.toList())) .isPresent(); return optional.get(); } @@ -574,7 +574,7 @@ public synchronized int getNumReportedSpans() { return spans.size(); } - public synchronized List getErrors() { + public synchronized List getErrors() { return Collections.unmodifiableList(errors); } @@ -586,7 +586,7 @@ public synchronized int getNumReportedLogs() { return logs.size(); } - public synchronized ErrorCapture getFirstError() { + public synchronized ErrorCaptureImpl getFirstError() { assertThat(errors) .describedAs("at least one error expected, none have been reported") .isNotEmpty(); @@ -631,13 +631,13 @@ public synchronized void resetWithoutRecycling() { } /** - * Calls {@link AbstractSpan#decrementReferences()} for all reported transactions and spans to emulate the references being decremented + * Calls {@link AbstractSpanImpl#decrementReferences()} for all reported transactions and spans to emulate the references being decremented * after reporting to the APM Server. * See {@link IntakeV2ReportingEventHandler#writeEvent(ReportingEvent)} */ public synchronized void decrementReferences() { - transactions.forEach(Transaction::decrementReferences); - spans.forEach(Span::decrementReferences); + transactions.forEach(TransactionImpl::decrementReferences); + spans.forEach(SpanImpl::decrementReferences); } /** @@ -646,18 +646,18 @@ public synchronized void decrementReferences() { */ public synchronized void assertRecycledAfterDecrementingReferences() { - List transactions = getTransactions(); - List transactionsToFlush = transactions.stream() + List transactions = getTransactions(); + List transactionsToFlush = transactions.stream() .filter(t -> !hasEmptyTraceContext(t)) .collect(Collectors.toList()); - List spans = getSpans(); - List spansToFlush = spans.stream() + List spans = getSpans(); + List spansToFlush = spans.stream() .filter(s -> !hasEmptyTraceContext(s)) .collect(Collectors.toList()); - transactionsToFlush.forEach(Transaction::decrementReferences); - spansToFlush.forEach(Span::decrementReferences); + transactionsToFlush.forEach(TransactionImpl::decrementReferences); + spansToFlush.forEach(SpanImpl::decrementReferences); if (gcWhenAssertingRecycling) { System.gc(); @@ -691,7 +691,7 @@ public synchronized void assertRecycledAfterDecrementingReferences() { // errors are recycled directly because they have no reference counter - errors.forEach(ErrorCapture::recycle); + errors.forEach(ErrorCaptureImpl::recycle); } /** @@ -739,7 +739,7 @@ public void awaitUntilTimeout(long timeoutMs, ThrowingRunnable runnable) { } } - private static boolean hasEmptyTraceContext(AbstractSpan item) { + private static boolean hasEmptyTraceContext(AbstractSpanImpl item) { return item.getTraceContext().getId().isEmpty(); } @@ -794,7 +794,7 @@ private enum SchemaInstance { this.errorSchemaPath = errorSchema; ConfigurationRegistry spyConfig = SpyConfiguration.createSpyConfig(); - StacktraceConfiguration stacktraceConfiguration = spyConfig.getConfig(StacktraceConfiguration.class); + StacktraceConfigurationImpl stacktraceConfiguration = spyConfig.getConfig(StacktraceConfigurationImpl.class); Future metaData = MetaData.create(spyConfig, null); ApmServerClient client = mock(ApmServerClient.class); @@ -805,7 +805,7 @@ private enum SchemaInstance { doReturn(isLatest).when(client).supportsNonStringLabels(); doReturn(isLatest).when(client).supportsLogsEndpoint(); - SerializationConstants.init(spyConfig.getConfig(CoreConfiguration.class)); + SerializationConstants.init(spyConfig.getConfig(CoreConfigurationImpl.class)); this.serializer = new DslJsonSerializer(stacktraceConfiguration, client, metaData).newWriter(); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/TransactionUtils.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/TransactionUtils.java index 637915aea1..f1212d257e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/TransactionUtils.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/TransactionUtils.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.TransactionContext; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import java.util.ArrayList; @@ -32,15 +32,15 @@ public class TransactionUtils { - public static void fillTransaction(Transaction t) { - t.startRoot((long) 0, ConstantSampler.of(true), Baggage.EMPTY) + public static void fillTransaction(TransactionImpl t) { + t.startRoot((long) 0, ConstantSampler.of(true), BaggageImpl.EMPTY) .withName("GET /api/types") .withType("request") .withResult("success") .withOutcome(Outcome.SUCCESS); - TransactionContext context = t.getContext(); - Request request = context.getRequest(); + TransactionContextImpl context = t.getContext(); + RequestImpl request = context.getRequest(); request.withHttpVersion("1.1"); request.withMethod("POST"); request.withBodyBuffer().append("Hello World"); @@ -77,10 +77,10 @@ public static void fillTransaction(Transaction t) { context.addCustom("some_other_value", "foo bar"); } - public static List getSpans(Transaction t) { - List spans = new ArrayList<>(); - Span span = new Span(MockTracer.create()) - .start(TraceContext.fromParent(), t, Baggage.EMPTY, -1) + public static List getSpans(TransactionImpl t) { + List spans = new ArrayList<>(); + SpanImpl span = new SpanImpl(MockTracer.create()) + .start(TraceContextImpl.fromParent(), t, BaggageImpl.EMPTY, -1) .withName("SELECT FROM product_types") .withType("db") .withSubtype("postgresql") @@ -95,21 +95,21 @@ public static List getSpans(Transaction t) { span.addLabel("framework", "some-framework"); spans.add(span); - spans.add(new Span(MockTracer.create()) - .start(TraceContext.fromParent(), t, Baggage.EMPTY, -1) + spans.add(new SpanImpl(MockTracer.create()) + .start(TraceContextImpl.fromParent(), t, BaggageImpl.EMPTY, -1) .withName("GET /api/types") .withType("request")); - spans.add(new Span(MockTracer.create()) - .start(TraceContext.fromParent(), t, Baggage.EMPTY, -1) + spans.add(new SpanImpl(MockTracer.create()) + .start(TraceContextImpl.fromParent(), t, BaggageImpl.EMPTY, -1) .withName("GET /api/types") .withType("request")); - spans.add(new Span(MockTracer.create()) - .start(TraceContext.fromParent(), t, Baggage.EMPTY, -1) + spans.add(new SpanImpl(MockTracer.create()) + .start(TraceContextImpl.fromParent(), t, BaggageImpl.EMPTY, -1) .withName("GET /api/types") .withType("request")); - span = new Span(MockTracer.create()) - .start(TraceContext.fromParent(), t, Baggage.EMPTY, -1) + span = new SpanImpl(MockTracer.create()) + .start(TraceContextImpl.fromParent(), t, BaggageImpl.EMPTY, -1) .appendToName("GET ") .appendToName("test.elastic.co") .withType("ext") diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java index 53e2954672..a82ef60852 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java @@ -20,10 +20,10 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.bytebuddy.Instrumented; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.sdk.DynamicTransformer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; @@ -79,14 +79,14 @@ class InstrumentationTest { private ElasticApmTracer tracer; private ConfigurationRegistry configurationRegistry; - private CoreConfiguration coreConfig; + private CoreConfigurationImpl coreConfig; private String privateString; @BeforeEach void setup() { tracer = MockTracer.createRealTracer(); configurationRegistry = tracer.getConfigurationRegistry(); - coreConfig = configurationRegistry.getConfig(CoreConfiguration.class); + coreConfig = configurationRegistry.getConfig(CoreConfigurationImpl.class); } @AfterEach @@ -476,7 +476,7 @@ void testAdviceWithAgentParameterType() { } @Nullable - public AbstractSpan getSpanFromThreadLocal() { + public AbstractSpanImpl getSpanFromThreadLocal() { return null; } @@ -989,7 +989,7 @@ public static class AgentTypeReturnInstrumentation extends ElasticApmInstrumenta public static class AdviceClass { @Advice.OnMethodEnter(inline = false) - public static Span onEnter() { + public static SpanImpl onEnter() { return null; } } @@ -1020,7 +1020,7 @@ public static Object onEnter() { } @Advice.OnMethodExit(inline = false) - private static void onExit(@Advice.Enter Span span) { + private static void onExit(@Advice.Enter SpanImpl span) { } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/collections/ReferencedCountedConcurrentHashMapTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/collections/ReferencedCountedConcurrentHashMapTest.java index 4cfd423d29..8dfabb7e9e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/collections/ReferencedCountedConcurrentHashMapTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/collections/ReferencedCountedConcurrentHashMapTest.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.collections; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.impl.context.AbstractContext; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.AbstractContextImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -132,7 +132,7 @@ void execute(WeakMap map, Object key, TestSpan value) { void clear() { WeakMap map = WeakConcurrentProviderImpl.createWeakReferenceCountedMap(); - List> list = new ArrayList<>(); + List> list = new ArrayList<>(); for (int i = 0; i < 5; i++) { TestSpan span = new TestSpan(); list.add(span); @@ -153,7 +153,7 @@ void weakMapDecrementOnStaleKeyGC() { key = new Object(); TestSpan span = new TestSpan(); - WeakMap> map = WeakConcurrentProviderImpl.createWeakReferenceCountedMap(); + WeakMap> map = WeakConcurrentProviderImpl.createWeakReferenceCountedMap(); map.put(key, span); @@ -173,15 +173,15 @@ void weakMapDecrementOnStaleKeyGC() { } - private void checkRefCount(List> spans, int expected) { + private void checkRefCount(List> spans, int expected) { spans.forEach(span -> checkRefCount(span, expected)); } - private void checkRefCount(AbstractSpan span, int expected) { + private void checkRefCount(AbstractSpanImpl span, int expected) { assertThat(span.getReferenceCount()).isEqualTo(expected); } - private static class TestSpan extends AbstractSpan { + private static class TestSpan extends AbstractSpanImpl { public TestSpan() { super(MockTracer.create()); @@ -189,12 +189,12 @@ public TestSpan() { @Nullable @Override - public Transaction getParentTransaction() { + public TransactionImpl getParentTransaction() { return null; } @Override - public AbstractContext getContext() { + public AbstractContextImpl getContext() { return null; } @@ -217,7 +217,7 @@ protected void recycle() { protected TestSpan thiz() { return null; } - + } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSourceTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSourceTest.java index 1346de5bba..d1dece2a7e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSourceTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/ApmServerConfigurationSourceTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.configuration; import co.elastic.apm.agent.impl.metadata.MetaDataMock; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.sdk.logging.Logger; @@ -77,7 +77,7 @@ public void setUp() throws Exception { apmServerClient.start(List.of(new URL("http", "localhost", mockApmServer.port(), "/"))); mockLogger = mock(Logger.class); configurationSource = new ApmServerConfigurationSource( - new DslJsonSerializer(mock(StacktraceConfiguration.class), apmServerClient, MetaDataMock.create()), + new DslJsonSerializer(mock(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create()), apmServerClient, mockLogger ); @@ -100,7 +100,7 @@ public void testLoadRemoteConfig() throws Exception { @Test public void testRemoteConfigDisabled() { - doReturn(false).when(config.getConfig(CoreConfiguration.class)).isCentralConfigEnabled(); + doReturn(false).when(config.getConfig(CoreConfigurationImpl.class)).isCentralConfigEnabled(); configurationSource.fetchConfig(config); assertThat(configurationSource.getValue("foo")).isNull(); mockApmServer.verify(0, postRequestedFor(urlEqualTo("/config/v1/agents"))); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/CoreConfigurationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/CoreConfigurationTest.java index a1ea6cab6c..8ba2257a4b 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/CoreConfigurationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/CoreConfigurationTest.java @@ -32,7 +32,7 @@ class CoreConfigurationTest { @Test void testWithoutDisabledAndEnabledInstrumentations() { - CoreConfiguration config = getCoreConfiguration("", ""); + CoreConfigurationImpl config = getCoreConfiguration("", ""); assertThat(config.isInstrumentationEnabled("foo")).isTrue(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("foo"))).isTrue(); assertThat(config.isInstrumentationEnabled(Arrays.asList("foo", "bar"))).isTrue(); @@ -40,7 +40,7 @@ void testWithoutDisabledAndEnabledInstrumentations() { @Test void testWithDisabledInstrumentations() { - CoreConfiguration config = getCoreConfiguration("", "foo"); + CoreConfigurationImpl config = getCoreConfiguration("", "foo"); assertThat(config.isInstrumentationEnabled("foo")).isFalse(); assertThat(config.isInstrumentationEnabled("bar")).isTrue(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("foo"))).isFalse(); @@ -50,7 +50,7 @@ void testWithDisabledInstrumentations() { @Test void testWithEnabledInstrumentations() { - CoreConfiguration config = getCoreConfiguration("foo", ""); + CoreConfigurationImpl config = getCoreConfiguration("foo", ""); assertThat(config.isInstrumentationEnabled("foo")).isTrue(); assertThat(config.isInstrumentationEnabled("bar")).isFalse(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("foo"))).isTrue(); @@ -60,7 +60,7 @@ void testWithEnabledInstrumentations() { @Test void testWithDisabledAndEnabledInstrumentations() { - CoreConfiguration config = getCoreConfiguration("foo", "foo"); + CoreConfigurationImpl config = getCoreConfiguration("foo", "foo"); assertThat(config.isInstrumentationEnabled("foo")).isFalse(); assertThat(config.isInstrumentationEnabled("bar")).isFalse(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("foo"))).isFalse(); @@ -70,20 +70,20 @@ void testWithDisabledAndEnabledInstrumentations() { @Test void testWithEnabledInstrumentationsButDisabledExperimentalInstrumentations() { - CoreConfiguration config = getCoreConfiguration("experimental", ""); + CoreConfigurationImpl config = getCoreConfiguration("experimental", ""); assertThat(config.isInstrumentationEnabled("experimental")).isFalse(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("experimental"))).isFalse(); } @Test void testWithEnabledInstrumentationsAndEnabledExperimentalInstrumentations() { - CoreConfiguration config = ConfigurationRegistry.builder() - .addOptionProvider(new CoreConfiguration()) + CoreConfigurationImpl config = ConfigurationRegistry.builder() + .addOptionProvider(new CoreConfigurationImpl()) .addConfigSource(SimpleSource.forTest("enable_instrumentations", "experimental")) .addConfigSource(SimpleSource.forTest("disable_instrumentations", "")) .addConfigSource(SimpleSource.forTest("enable_experimental_instrumentations", "true")) .build() - .getConfig(CoreConfiguration.class); + .getConfig(CoreConfigurationImpl.class); assertThat(config.isInstrumentationEnabled("experimental")).isTrue(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("experimental"))).isTrue(); @@ -93,30 +93,30 @@ void testWithEnabledInstrumentationsAndEnabledExperimentalInstrumentations() { @Test void testLegacyDefaultDisabledInstrumentation() { - CoreConfiguration config = getCoreConfiguration("", "incubating"); + CoreConfigurationImpl config = getCoreConfiguration("", "incubating"); assertThat(config.isInstrumentationEnabled("experimental")).isFalse(); assertThat(config.isInstrumentationEnabled(Collections.singletonList("experimental"))).isFalse(); } @Test void testPreventBroadElasticApmExclusionFromInstrumentation() { - CoreConfiguration coreConfig = ConfigurationRegistry.builder() - .addOptionProvider(new CoreConfiguration()) + CoreConfigurationImpl coreConfig = ConfigurationRegistry.builder() + .addOptionProvider(new CoreConfigurationImpl()) .addConfigSource(SimpleSource.forTest("classes_excluded_from_instrumentation", "co.elastic.apm.*, co.elastic.*, foo.bar.*")) .build() - .getConfig(CoreConfiguration.class); + .getConfig(CoreConfigurationImpl.class); assertThat(coreConfig.getClassesExcludedFromInstrumentation()) .containsExactly(WildcardMatcher.valueOf("foo.bar.*")); } - private static CoreConfiguration getCoreConfiguration(String enabledInstrumentations, String disabledInstrumentations) { + private static CoreConfigurationImpl getCoreConfiguration(String enabledInstrumentations, String disabledInstrumentations) { ConfigurationRegistry configurationRegistry = ConfigurationRegistry.builder() - .addOptionProvider(new CoreConfiguration()) + .addOptionProvider(new CoreConfigurationImpl()) .addConfigSource(SimpleSource.forTest("enable_instrumentations", enabledInstrumentations)) .addConfigSource(SimpleSource.forTest("disable_instrumentations", disabledInstrumentations)) .build(); - return configurationRegistry.getConfig(CoreConfiguration.class); + return configurationRegistry.getConfig(CoreConfigurationImpl.class); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/StartupInfoTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/StartupInfoTest.java index aed7cba9db..e099f8e0d2 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/StartupInfoTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/configuration/StartupInfoTest.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.tracer.configuration.TimeDurationValueConverter; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import co.elastic.apm.agent.sdk.logging.Logger; @@ -45,13 +45,13 @@ class StartupInfoTest { @BeforeEach void setUp() { - LoggingConfiguration.init(List.of(), ""); + LoggingConfigurationImpl.init(List.of(), ""); config = new TestConfig(); this.configurationRegistry = ConfigurationRegistry.builder() .addOptionProvider(config) - .addOptionProvider(new CoreConfiguration()) - .addOptionProvider(new StacktraceConfiguration()) + .addOptionProvider(new CoreConfigurationImpl()) + .addOptionProvider(new StacktraceConfigurationImpl()) .addConfigSource(new SimpleSource().add("duration", "1")) .build(); startupInfo = new StartupInfo(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/DiscardSpanTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/DiscardSpanTest.java index f646f480e5..5099a0dce7 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/DiscardSpanTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/DiscardSpanTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -50,10 +50,10 @@ void cleanupAndCheck() { @Test void testContextPropagatingSpansAreNonDiscardable() { - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); try { - Span span = transaction.createSpan().requestDiscarding(); + SpanImpl span = transaction.createSpan().requestDiscarding(); try { span.propagateContext(new HashMap<>(), TextHeaderMapAccessor.INSTANCE, null); assertThat(span.isDiscardable()).isFalse(); @@ -71,10 +71,10 @@ void testContextPropagatingSpansAreNonDiscardable() { @Test void testErrorCapturingMakesSpansNonDiscardable() { - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); try { - Span span = transaction.createSpan(); + SpanImpl span = transaction.createSpan(); try { span.requestDiscarding().appendToName("non-discardable").captureException(new Exception()); assertThat(span.isDiscardable()).isFalse(); @@ -84,7 +84,7 @@ void testErrorCapturingMakesSpansNonDiscardable() { } finally { transaction.end(); } - assertThat(reporter.getSpans().stream().map(Span::getNameAsString)).containsExactly("non-discardable"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getNameAsString)).containsExactly("non-discardable"); assertThat(transaction.getSpanCount().getTotal()).hasValue(1); assertThat(transaction.getSpanCount().getDropped()).hasValue(0); @@ -93,12 +93,12 @@ void testErrorCapturingMakesSpansNonDiscardable() { @Test void testParentsOfContextPropagatingSpansAreNonDiscardable() { - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); try { - Span parentSpan = transaction.createSpan().requestDiscarding(); + SpanImpl parentSpan = transaction.createSpan().requestDiscarding(); try { - Span contextPropagatingSpan = parentSpan.createSpan(); + SpanImpl contextPropagatingSpan = parentSpan.createSpan(); try { contextPropagatingSpan.propagateContext(new HashMap<>(), TextHeaderMapAccessor.INSTANCE, null); assertThat(contextPropagatingSpan.isDiscardable()).isFalse(); @@ -120,8 +120,8 @@ void testParentsOfContextPropagatingSpansAreNonDiscardable() { @Test void testDiscardSpanLimit() { - doReturn(2).when(tracer.getConfigurationRegistry().getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); - Transaction transaction = tracer.startRootTransaction(null); + doReturn(2).when(tracer.getConfigurationRegistry().getConfig(CoreConfigurationImpl.class)).getTransactionMaxSpans(); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); try { transaction.createSpan().appendToName("1st").end(); @@ -131,7 +131,7 @@ void testDiscardSpanLimit() { } finally { transaction.end(); } - assertThat(reporter.getSpans().stream().map(Span::getNameAsString)).containsExactly("1st", "2nd"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getNameAsString)).containsExactly("1st", "2nd"); assertThat(transaction.getSpanCount().getTotal()).hasValue(4); assertThat(transaction.getSpanCount().getDropped()).hasValue(2); assertThat(transaction.getSpanCount().getReported()).hasValue(2); @@ -139,13 +139,13 @@ void testDiscardSpanLimit() { @Test void testDiscardSpanLimitNesting() { - doReturn(2).when(tracer.getConfigurationRegistry().getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); - Transaction transaction = tracer.startRootTransaction(null); + doReturn(2).when(tracer.getConfigurationRegistry().getConfig(CoreConfigurationImpl.class)).getTransactionMaxSpans(); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); try { - Span first = transaction.createSpan().appendToName("1st"); + SpanImpl first = transaction.createSpan().appendToName("1st"); try { - Span second = first.createSpan().appendToName("2nd"); + SpanImpl second = first.createSpan().appendToName("2nd"); try { second.createSpan().appendToName("exceeds limit").end(); } finally { @@ -157,7 +157,7 @@ void testDiscardSpanLimitNesting() { } finally { transaction.end(); } - assertThat(reporter.getSpans().stream().map(Span::getNameAsString)).containsExactly("2nd", "1st"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getNameAsString)).containsExactly("2nd", "1st"); assertThat(transaction.getSpanCount().getTotal()).hasValue(3); assertThat(transaction.getSpanCount().getDropped()).hasValue(1); assertThat(transaction.getSpanCount().getReported()).hasValue(2); @@ -165,15 +165,15 @@ void testDiscardSpanLimitNesting() { @Test void testDiscardSpanLimitNesting2() { - doReturn(2).when(tracer.getConfigurationRegistry().getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); - Transaction transaction = tracer.startRootTransaction(null); + doReturn(2).when(tracer.getConfigurationRegistry().getConfig(CoreConfigurationImpl.class)).getTransactionMaxSpans(); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); try { - Span first = transaction.createSpan().appendToName("1st"); + SpanImpl first = transaction.createSpan().appendToName("1st"); try { - Span second = first.createSpan().requestDiscarding().appendToName("discarded 1"); + SpanImpl second = first.createSpan().requestDiscarding().appendToName("discarded 1"); try { - Span exceedsLimit1 = second.createSpan().requestDiscarding().appendToName("exceeds limit 1"); + SpanImpl exceedsLimit1 = second.createSpan().requestDiscarding().appendToName("exceeds limit 1"); try { assertThat(exceedsLimit1.isSampled()).isFalse(); } finally { @@ -191,7 +191,7 @@ void testDiscardSpanLimitNesting2() { } finally { transaction.end(); } - assertThat(reporter.getSpans().stream().map(Span::getNameAsString)).containsExactly("1st", "2nd"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getNameAsString)).containsExactly("1st", "2nd"); assertThat(transaction.getSpanCount().getTotal()).hasValue(5); assertThat(transaction.getSpanCount().getDropped()).hasValue(3); assertThat(transaction.getSpanCount().getReported()).hasValue(2); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilderTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilderTest.java index 137fec21e1..2400286107 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilderTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerBuilderTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -36,22 +36,22 @@ class ElasticApmTracerBuilderTest { @AfterEach void tearDown() { - System.clearProperty("elastic.apm." + CoreConfiguration.CONFIG_FILE); + System.clearProperty("elastic.apm." + CoreConfigurationImpl.CONFIG_FILE); } @Test void testConfigFileLocation(@TempDir Path tempDir) throws IOException { Path file = Files.createFile(tempDir.resolve("elastic-apm-test.properties")); Files.write(file, List.of("instrument=false")); - System.setProperty("elastic.apm." + CoreConfiguration.CONFIG_FILE, file.toString()); + System.setProperty("elastic.apm." + CoreConfigurationImpl.CONFIG_FILE, file.toString()); ConfigurationRegistry configurationRegistry = new ElasticApmTracerBuilder().build().getConfigurationRegistry(); - CoreConfiguration config = configurationRegistry.getConfig(CoreConfiguration.class); + CoreConfigurationImpl config = configurationRegistry.getConfig(CoreConfigurationImpl.class); // tests that changing non-dynamic properties also works assertThat(config.isInstrument()).isFalse(); - configurationRegistry.getString(CoreConfiguration.CONFIG_FILE); - assertThat(configurationRegistry.getString(CoreConfiguration.CONFIG_FILE)).isEqualTo(file.toString()); + configurationRegistry.getString(CoreConfigurationImpl.CONFIG_FILE); + assertThat(configurationRegistry.getString(CoreConfigurationImpl.CONFIG_FILE)).isEqualTo(file.toString()); } @Test @@ -62,7 +62,7 @@ void testTempAttacherPropertiesFile(@TempDir Path tempDir) throws Exception { List configSources = ElasticApmTracerBuilder.getConfigSources("c=" + file.toAbsolutePath(), false); ConfigurationRegistry configurationRegistry = new ElasticApmTracerBuilder(configSources).build().getConfigurationRegistry(); - CoreConfiguration config = configurationRegistry.getConfig(CoreConfiguration.class); + CoreConfigurationImpl config = configurationRegistry.getConfig(CoreConfigurationImpl.class); assertThat(config.isInstrument()).isFalse(); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerShutdownTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerShutdownTest.java index f0f71f165c..385900e4aa 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerShutdownTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerShutdownTest.java @@ -53,10 +53,10 @@ void testUsingSharedPoolOnShutdown() { @Test void testTracerStateIsRunningInTaskSubmittedInShutdownHook() { - AtomicReference tracerStateInShutdownHook = new AtomicReference<>(); + AtomicReference tracerStateInShutdownHook = new AtomicReference<>(); tracerImpl.addShutdownHook(() -> tracerImpl.getSharedSingleThreadedPool().submit(() -> tracerStateInShutdownHook.set(tracerImpl.getState()))); tracerImpl.stop(); reporter.awaitUntilAsserted(() -> assertThat(tracerStateInShutdownHook.get()).isNotNull()); - assertThat(tracerStateInShutdownHook.get()).isEqualTo(Tracer.TracerState.RUNNING); + assertThat(tracerStateInShutdownHook.get()).isEqualTo(ElasticApmTracer.TracerState.RUNNING); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java index 6ef0970c47..3dc3775f92 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java @@ -21,20 +21,17 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.configuration.AutoDetectedServiceInfo; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.*; import co.elastic.apm.agent.impl.baggage.BaggageContext; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.configuration.source.ConfigSources; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.report.ApmServerClient; @@ -110,10 +107,10 @@ void cleanupAndCheck() { @Test void testThreadLocalStorage() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { assertThat(tracerImpl.currentTransaction()).isSameAs(transaction); - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { assertThat(tracerImpl.currentTransaction()).isSameAs(transaction); assertThat(tracerImpl.getActive()).isSameAs(span); @@ -128,14 +125,14 @@ void testThreadLocalStorage() { @Test void testNestedSpan() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { assertThat(tracerImpl.currentTransaction()).isSameAs(transaction); - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { assertThat(tracerImpl.getActive()).isSameAs(span); assertThat(span.isChildOf(transaction)).isTrue(); - Span nestedSpan = tracerImpl.getActive().createSpan(); + SpanImpl nestedSpan = tracerImpl.getActive().createSpan(); try (Scope nestedSpanScope = nestedSpan.activateInScope()) { assertThat(tracerImpl.getActive()).isSameAs(nestedSpan); assertThat(nestedSpan.isChildOf(span)).isTrue(); @@ -152,11 +149,11 @@ void testNestedSpan() { @Test void testDisableStacktraces() { - doReturn(-1L).when(tracerImpl.getConfig(StacktraceConfiguration.class)).getSpanStackTraceMinDurationMs(); + doReturn(-1L).when(tracerImpl.getConfig(StacktraceConfigurationImpl.class)).getSpanStackTraceMinDurationMs(); - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { span.end(); } @@ -167,10 +164,10 @@ void testDisableStacktraces() { @Test void testEnableStacktraces() throws InterruptedException { - doReturn(0L).when(tracerImpl.getConfig(StacktraceConfiguration.class)).getSpanStackTraceMinDurationMs(); - Transaction transaction = startTestRootTransaction(); + doReturn(0L).when(tracerImpl.getConfig(StacktraceConfigurationImpl.class)).getSpanStackTraceMinDurationMs(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { Thread.sleep(10); stackTraceEndSpan(span); @@ -184,17 +181,17 @@ void testEnableStacktraces() throws InterruptedException { && stackTraceElement.getClassName().equals(ElasticApmTracerTest.class.getName()))).hasSize(1); } - private static void stackTraceEndSpan(Span span) { + private static void stackTraceEndSpan(SpanImpl span) { // dummy method used just to verify that the captured stack trace contains it span.end(); } @Test void testDisableStacktracesForFastSpans() { - doReturn(100L).when(tracerImpl.getConfig(StacktraceConfiguration.class)).getSpanStackTraceMinDurationMs(); - Transaction transaction = startTestRootTransaction(); + doReturn(100L).when(tracerImpl.getConfig(StacktraceConfigurationImpl.class)).getSpanStackTraceMinDurationMs(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { span.end(); } @@ -206,10 +203,10 @@ void testDisableStacktracesForFastSpans() { @Test void testEnableStacktracesForSlowSpans() throws InterruptedException { - doReturn(1L).when(tracerImpl.getConfig(StacktraceConfiguration.class)).getSpanStackTraceMinDurationMs(); - Transaction transaction = startTestRootTransaction(); + doReturn(1L).when(tracerImpl.getConfig(StacktraceConfigurationImpl.class)).getSpanStackTraceMinDurationMs(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { Thread.sleep(10); span.end(); @@ -220,7 +217,7 @@ void testEnableStacktracesForSlowSpans() throws InterruptedException { } @Nullable - private Transaction startTestRootTransaction() { + private TransactionImpl startTestRootTransaction() { return tracerImpl.startRootTransaction(getClass().getClassLoader()); } @@ -228,7 +225,7 @@ private Transaction startTestRootTransaction() { void testRecordException() { tracerImpl.captureAndReportException(new Exception("test"), getClass().getClassLoader()); assertThat(reporter.getErrors()).hasSize(1); - ErrorCapture error = reporter.getFirstError(); + ErrorCaptureImpl error = reporter.getFirstError(); assertThat(error.getException()).isNotNull(); assertThat(error.getTraceContext().hasContent()).isTrue(); assertThat(error.getTraceContext().getTraceId().isEmpty()).isTrue(); @@ -243,7 +240,7 @@ void testDoesNotRecordIgnoredExceptions() { .map(WildcardMatcher::valueOf) .collect(Collectors.toList()); - doReturn(wildcardList).when(config.getConfig(CoreConfiguration.class)).getIgnoreExceptions(); + doReturn(wildcardList).when(config.getConfig(CoreConfigurationImpl.class)).getIgnoreExceptions(); tracerImpl.captureAndReportException(new DummyException1(), getClass().getClassLoader()); tracerImpl.captureAndReportException(new DummyException2(), getClass().getClassLoader()); @@ -252,9 +249,9 @@ void testDoesNotRecordIgnoredExceptions() { @Test void testTransactionNameGrouping() { - doReturn(List.of(WildcardMatcher.valueOf("GET /foo/*/bar"))).when(config.getConfig(CoreConfiguration.class)).getTransactionNameGroups(); + doReturn(List.of(WildcardMatcher.valueOf("GET /foo/*/bar"))).when(config.getConfig(CoreConfigurationImpl.class)).getTransactionNameGroups(); - Transaction transaction = tracerImpl.startRootTransaction(null).appendToName("GET ").appendToName("/foo/42/bar"); + TransactionImpl transaction = tracerImpl.startRootTransaction(null).appendToName("GET ").appendToName("/foo/42/bar"); try (Scope scope = transaction.activateInScope()) { transaction.captureException(new RuntimeException("Test error capturing")); } @@ -292,7 +289,7 @@ void testRecordExceptionWithTraceNotSampled() { } private void innerRecordExceptionWithTrace(boolean sampled) { - Transaction transaction = tracerImpl.startRootTransaction(ConstantSampler.of(sampled), -1, null); + TransactionImpl transaction = tracerImpl.startRootTransaction(ConstantSampler.of(sampled), -1, null); transaction.withType("request"); try (Scope scope = transaction.activateInScope()) { transaction.getContext().getRequest() @@ -302,10 +299,10 @@ private void innerRecordExceptionWithTrace(boolean sampled) { .withPathname("/foo"); tracerImpl.currentTransaction().captureException(new Exception("from transaction")); - Span span = transaction.createSpan().activate(); + SpanImpl span = transaction.createSpan().activate(); span.captureException(new Exception("from span")); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors).hasSize(2); // 1st one is from transaction @@ -320,12 +317,12 @@ private void innerRecordExceptionWithTrace(boolean sampled) { transaction.end(); } - private ErrorCapture validateSingleError(AbstractSpan span, boolean sampled, Transaction correspondingTransaction) { + private ErrorCaptureImpl validateSingleError(AbstractSpanImpl span, boolean sampled, TransactionImpl correspondingTransaction) { assertThat(reporter.getErrors()).hasSize(1); return validateError(reporter.getFirstError(), span, sampled, correspondingTransaction); } - private ErrorCapture validateError(ErrorCapture error, AbstractSpan span, boolean sampled, Transaction transaction) { + private ErrorCaptureImpl validateError(ErrorCaptureImpl error, AbstractSpanImpl span, boolean sampled, TransactionImpl transaction) { assertThat(error.getTraceContext().isChildOf(span.getTraceContext())) .describedAs("error trace context [%s] should be a child of span trace context [%s]", error.getTraceContext(), span.getTraceContext()) .isTrue(); @@ -340,17 +337,17 @@ private ErrorCapture validateError(ErrorCapture error, AbstractSpan span, boo @Test void testEnableDropSpans() { setupWithCustomConfig(conf -> { - doReturn(1).when(conf.getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); + doReturn(1).when(config.getConfig(CoreConfigurationImpl.class)).getTransactionMaxSpans(); }); - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { assertThat(tracerImpl.getActive()).isSameAs(span); //ensure ActiveStack limit is not reached assertThat(span.isSampled()).isTrue(); span.end(); } - Span span2 = tracerImpl.getActive().createSpan(); + SpanImpl span2 = tracerImpl.getActive().createSpan(); try (Scope spanScope = span2.activateInScope()) { assertThat(span2.isSampled()).isFalse(); span2.end(); @@ -366,7 +363,7 @@ void testEnableDropSpans() { @Test void testActivationStackOverflow() { - doReturn(2).when(config.getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); + doReturn(2).when(config.getConfig(CoreConfigurationImpl.class)).getTransactionMaxSpans(); ElasticApmTracer tracer = new ElasticApmTracerBuilder() .configurationRegistry(config) @@ -376,18 +373,18 @@ void testActivationStackOverflow() { .buildAndStart(); doWithNestedBaggageActivations(() -> { - Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); + TransactionImpl transaction = tracer.startRootTransaction(getClass().getClassLoader()); assertThat(tracer.getActive()).isNull(); try (Scope scope = transaction.activateInScope()) { assertThat(tracer.getActive()).isEqualTo(transaction); - Span child1 = transaction.createSpan(); + SpanImpl child1 = transaction.createSpan(); try (Scope childScope = child1.activateInScope()) { assertThat(tracer.getActive()).isEqualTo(child1); - Span grandchild1 = child1.createSpan(); + SpanImpl grandchild1 = child1.createSpan(); try (Scope grandchildScope = grandchild1.activateInScope()) { // latter activation should not be applied due to activation stack overflow assertThat(tracer.getActive()).isEqualTo(child1); - Span ggc = grandchild1.createSpan(); + SpanImpl ggc = grandchild1.createSpan(); try (Scope ggcScope = ggc.activateInScope()) { assertThat(tracer.getActive()).isEqualTo(child1); ggc.end(); @@ -398,10 +395,10 @@ void testActivationStackOverflow() { child1.end(); } assertThat(tracer.getActive()).isEqualTo(transaction); - Span child2 = transaction.createSpan(); + SpanImpl child2 = transaction.createSpan(); try (Scope childScope = child2.activateInScope()) { assertThat(tracer.getActive()).isEqualTo(child2); - Span grandchild2 = child2.createSpan(); + SpanImpl grandchild2 = child2.createSpan(); try (Scope grandchildScope = grandchild2.activateInScope()) { // latter activation should not be applied due to activation stack overflow assertThat(tracer.getActive()).isEqualTo(child2); @@ -419,7 +416,7 @@ void testActivationStackOverflow() { assertThat(reporter.getSpans()).hasSize(2); } - private void doWithNestedBaggageActivations(Runnable r, Tracer tracer, int nestedCount) { + private void doWithNestedBaggageActivations(Runnable r, ElasticApmTracer tracer, int nestedCount) { if (nestedCount == 0) { r.run(); return; @@ -438,11 +435,11 @@ void testPause() { @Test void testPauseMidTransaction() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { assertThat(tracerImpl.currentTransaction()).isSameAs(transaction); tracerImpl.pause(); - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { span.withName("test"); assertThat(span.getNameAsString()).isEqualTo("test"); @@ -450,7 +447,7 @@ void testPauseMidTransaction() { assertThat(span.isChildOf(transaction)).isTrue(); span.end(); } - Span span2 = tracerImpl.getActive().createSpan(); + SpanImpl span2 = tracerImpl.getActive().createSpan(); try (Scope spanScope = span2.activateInScope()) { span2.withName("test2"); assertThat(span2.getNameAsString()).isEqualTo("test2"); @@ -480,12 +477,12 @@ void testSamplingNone_dropUnsampled() throws IOException { void testSamplingNone(boolean keepUnsampled) throws IOException { - config.getConfig(CoreConfiguration.class).getSampleRate().update(0.0, SpyConfiguration.CONFIG_SOURCE_NAME); - Transaction transaction = startTestRootTransaction().withType("request"); + config.getConfig(CoreConfigurationImpl.class).getSampleRate().update(0.0, SpyConfiguration.CONFIG_SOURCE_NAME); + TransactionImpl transaction = startTestRootTransaction().withType("request"); try (Scope scope = transaction.activateInScope()) { transaction.setUser("1", "jon.doe@example.com", "jondoe", "domain"); - Span span = tracerImpl.getActive().createSpan(); + SpanImpl span = tracerImpl.getActive().createSpan(); try (Scope spanScope = span.activateInScope()) { span.end(); } @@ -519,8 +516,8 @@ void testSamplingNone(boolean keepUnsampled) throws IOException { @Test void testTransactionWithParentReference() { - final Map headerMap = Map.of(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - final Transaction transaction = tracerImpl.startChildTransaction(headerMap, TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(false), 0, null); + final Map headerMap = Map.of(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + final TransactionImpl transaction = tracerImpl.startChildTransaction(headerMap, TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(false), 0, null); // the traced flag in the header overrides the sampler assertThat(transaction.isSampled()).isTrue(); assertThat(transaction.getTraceContext().getParentId().toString()).isEqualTo("b9c7c989f97918e1"); @@ -532,8 +529,8 @@ void testTransactionWithParentReference() { @Test void testTimestamps() { - final Transaction transaction = tracerImpl.startChildTransaction(new HashMap<>(), TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(true), 0, null); - final Span span = transaction.createSpan(10); + final TransactionImpl transaction = tracerImpl.startChildTransaction(new HashMap<>(), TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(true), 0, null); + final SpanImpl span = transaction.createSpan(10); span.end(20); transaction.end(30); @@ -546,8 +543,8 @@ void testTimestamps() { @Test void testTimestampSanitization() { - final Transaction transaction = tracerImpl.startChildTransaction(new HashMap<>(), TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(true), 10, null); - final Span span = transaction.createSpan(20); + final TransactionImpl transaction = tracerImpl.startChildTransaction(new HashMap<>(), TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(true), 10, null); + final SpanImpl span = transaction.createSpan(20); span.end(10); transaction.end(5); @@ -560,7 +557,7 @@ void testTimestampSanitization() { @Test void testStartSpanAfterTransactionHasEnded() { - final Transaction transaction = startTestRootTransaction(); + final TransactionImpl transaction = startTestRootTransaction(); assertThat(transaction).isNotNull(); transaction.incrementReferences(); transaction.end(); @@ -568,7 +565,7 @@ void testStartSpanAfterTransactionHasEnded() { try (Scope transactionScope = transaction.activateInScope()) { assertThat(tracerImpl.getActive()).isEqualTo(transaction); - final Span span = tracerImpl.startSpan(transaction, Baggage.EMPTY, -1); + final SpanImpl span = tracerImpl.startSpan(transaction, BaggageImpl.EMPTY, -1); assertThat(span).isNotNull(); try (Scope scope = span.activateInScope()) { assertThat(tracerImpl.currentTransaction()).isNotNull(); @@ -584,7 +581,7 @@ void testStartSpanAfterTransactionHasEnded() { @Test void testActivateDeactivateTwice() { - final Transaction transaction = startTestRootTransaction(); + final TransactionImpl transaction = startTestRootTransaction(); assertThat(tracerImpl.currentTransaction()).isNull(); tracerImpl.activate(transaction); assertThat(tracerImpl.currentTransaction()).isEqualTo(transaction); @@ -601,12 +598,12 @@ void testActivateDeactivateTwice() { @Test void testEmptyContextActivation() { - final Transaction transaction = startTestRootTransaction(); + final TransactionImpl transaction = startTestRootTransaction(); assertThat(tracerImpl.currentContext().getTransaction()).isNull(); tracerImpl.activate(transaction); assertThat(tracerImpl.currentContext().getTransaction()).isEqualTo(transaction); - EmptyElasticContext empty = new EmptyElasticContext(tracerImpl); + EmptyTraceState empty = new EmptyTraceState(tracerImpl); empty.activate(); assertThat(tracerImpl.currentContext().getTransaction()).isNull(); @@ -671,7 +668,7 @@ void testNotOverrideServiceNameWhenDefaultServiceNameConfigured() { startTestRootTransaction().end(); - CoreConfiguration coreConfig = localConfig.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = localConfig.getConfig(CoreConfigurationImpl.class); assertThat(AutoDetectedServiceInfo.autoDetect(System.getProperties(), System.getenv())) .isEqualTo(ServiceInfo.of(coreConfig.getServiceName())); @@ -684,8 +681,8 @@ void testNotOverrideServiceNameWhenDefaultServiceNameConfigured() { } } - private static void checkServiceInfo(Transaction transaction, ServiceInfo expected) { - TraceContext traceContext = transaction.getTraceContext(); + private static void checkServiceInfo(TransactionImpl transaction, ServiceInfo expected) { + TraceContextImpl traceContext = transaction.getTraceContext(); assertThat(traceContext.getServiceName()).isEqualTo(expected.getServiceName()); assertThat(traceContext.getServiceVersion()).isEqualTo(expected.getServiceVersion()); } @@ -724,33 +721,33 @@ void testNotOverrideServiceVersionWhenServiceVersionConfigured() { @Test void testCaptureExceptionAndGetErrorId() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); String errorId = transaction.captureExceptionAndGetErrorId(new Exception("test")); transaction.end(); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(reporter.getErrors()).hasSize(1); assertThat(errorId).isNotNull(); - ErrorCapture error = reporter.getFirstError(); + ErrorCaptureImpl error = reporter.getFirstError(); assertThat(error.getTraceContext().getId().toString()).isEqualTo(errorId); } @Test void testCaptureExceptionWithTransactionName() { - Transaction transaction = startTestRootTransaction().withName("My Transaction"); + TransactionImpl transaction = startTestRootTransaction().withName("My Transaction"); try (Scope scope = transaction.activateInScope()) { transaction.captureException(new Exception("test")); transaction.end(); } assertThat(reporter.getErrors()).hasSize(1); - ErrorCapture error = reporter.getFirstError(); + ErrorCaptureImpl error = reporter.getFirstError(); assertThat(error.getTransactionInfo().getName().toString()).isEqualTo("My Transaction"); } @Test void testContextWrapping() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try (Scope scope = transaction.activateInScope()) { assertThat(tracerImpl.currentContext()) @@ -785,7 +782,7 @@ void testUnknownConfiguration() { } - private static final class TestContext extends ElasticContext { + private static final class TestContext extends TraceStateImpl { private TestContext() { super(null); @@ -793,12 +790,12 @@ private TestContext() { @Nullable @Override - public AbstractSpan getSpan() { + public AbstractSpanImpl getSpan() { return null; } @Override - public Baggage getBaggage() { + public BaggageImpl getBaggage() { return null; } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java index ddf693bd5e..36ed3365f9 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/LifecycleTest.java @@ -34,9 +34,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import static co.elastic.apm.agent.impl.Tracer.TracerState.PAUSED; -import static co.elastic.apm.agent.impl.Tracer.TracerState.RUNNING; -import static co.elastic.apm.agent.impl.Tracer.TracerState.STOPPED; +import static co.elastic.apm.agent.impl.ElasticApmTracer.TracerState.PAUSED; +import static co.elastic.apm.agent.impl.ElasticApmTracer.TracerState.RUNNING; +import static co.elastic.apm.agent.impl.ElasticApmTracer.TracerState.STOPPED; import static org.assertj.core.api.Assertions.assertThat; public class LifecycleTest { diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java index d8147bdf33..b8892047db 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/SpanTypeBreakdownTest.java @@ -20,12 +20,12 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricSet; import co.elastic.apm.agent.metrics.Timer; @@ -78,7 +78,7 @@ void testBreakdown_noSpans() { */ @Test void testBreakdown_disabled() { - doReturn(false).when(tracer.getConfig(CoreConfiguration.class)).isBreakdownMetricsEnabled(); + doReturn(false).when(tracer.getConfig(CoreConfigurationImpl.class)).isBreakdownMetricsEnabled(); createTransaction() .end(30); tracer.getMetricRegistry().flipPhaseAndReport(metricSets -> { @@ -94,7 +94,7 @@ void testBreakdown_disabled() { */ @Test void testBreakdown_singleDbSpan() { - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.createSpan(10).withType("db").withSubtype("mysql").end(20); transaction.end(30); @@ -114,7 +114,7 @@ void testBreakdown_singleDbSpan() { @Test void testBreakdown_singleDbSpan_breakdownMetricsDisabled() { tracer = MockTracer.createRealTracer(reporter, SpyConfiguration.createSpyConfig(SimpleSource.forTest("disable_metrics", "span.self_time"))); - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.createSpan(10).withType("db").withSubtype("mysql").end(20); transaction.end(30); @@ -132,7 +132,7 @@ void testBreakdown_singleDbSpan_breakdownMetricsDisabled() { */ @Test void testBreakdown_singleAppSpan() { - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.createSpan(10).withType("app").end(20); transaction.end(30); @@ -150,9 +150,9 @@ void testBreakdown_singleAppSpan() { */ @Test void testBreakdown_concurrentDbSpans_fullyOverlapping() { - final Transaction transaction = createTransaction(); - final Span span1 = transaction.createSpan(10).withType("db").withSubtype("mysql"); - final Span span2 = transaction.createSpan(10).withType("db").withSubtype("mysql"); + final TransactionImpl transaction = createTransaction(); + final SpanImpl span1 = transaction.createSpan(10).withType("db").withSubtype("mysql"); + final SpanImpl span2 = transaction.createSpan(10).withType("db").withSubtype("mysql"); span1.end(20); span2.end(20); transaction.end(30); @@ -173,9 +173,9 @@ void testBreakdown_concurrentDbSpans_fullyOverlapping() { */ @Test void testBreakdown_concurrentDbSpans_partiallyOverlapping() { - final Transaction transaction = createTransaction(); - final Span span1 = transaction.createSpan(10).withType("db").withSubtype("mysql"); - final Span span2 = transaction.createSpan(15).withType("db").withSubtype("mysql"); + final TransactionImpl transaction = createTransaction(); + final SpanImpl span1 = transaction.createSpan(10).withType("db").withSubtype("mysql"); + final SpanImpl span2 = transaction.createSpan(15).withType("db").withSubtype("mysql"); span1.end(20); span2.end(25); transaction.end(30); @@ -196,7 +196,7 @@ void testBreakdown_concurrentDbSpans_partiallyOverlapping() { */ @Test void testBreakdown_serialDbSpans_notOverlapping_withoutGap() { - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.createSpan(5).withType("db").withSubtype("mysql").end(15); transaction.createSpan(15).withType("db").withSubtype("mysql").end(25); transaction.end(30); @@ -217,7 +217,7 @@ void testBreakdown_serialDbSpans_notOverlapping_withoutGap() { */ @Test void testBreakdown_serialDbSpans_notOverlapping_withGap() { - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.createSpan(10).withType("db").withSubtype("mysql").end(15); transaction.createSpan(20).withType("db").withSubtype("redis").end(25); transaction.end(30); @@ -240,9 +240,9 @@ void testBreakdown_serialDbSpans_notOverlapping_withGap() { */ @Test void testBreakdown_asyncGrandchildExceedsChild() { - final Transaction transaction = createTransaction(); - final Span app = transaction.createSpan(10).withType("app"); - final Span db = app.createSpan(15).withType("db").withSubtype("mysql"); + final TransactionImpl transaction = createTransaction(); + final SpanImpl app = transaction.createSpan(10).withType("app"); + final SpanImpl db = app.createSpan(15).withType("db").withSubtype("mysql"); app.end(20); db.end(25); transaction.end(30); @@ -266,11 +266,11 @@ void testBreakdown_asyncGrandchildExceedsChild() { */ @Test void testBreakdown_asyncGrandchildExceedsChildAndTransaction() { - final Transaction transaction = createTransaction(); - final Span app = transaction.createSpan(10).withType("app"); + final TransactionImpl transaction = createTransaction(); + final SpanImpl app = transaction.createSpan(10).withType("app"); transaction.end(20); reporter.decrementReferences(); - final Span db = app.createSpan(20).withType("db").withSubtype("mysql"); + final SpanImpl db = app.createSpan(20).withType("db").withSubtype("mysql"); app.end(30); db.end(30); @@ -300,8 +300,8 @@ void testBreakdown_asyncGrandchildExceedsChildAndTransaction() { */ @Test void testBreakdown_singleDbSpan_exceedingParent() { - final Transaction transaction = createTransaction(); - final Span span = transaction.createSpan(10).withType("db").withSubtype("mysql"); + final TransactionImpl transaction = createTransaction(); + final SpanImpl span = transaction.createSpan(10).withType("db").withSubtype("mysql"); transaction.end(20); span.end(30); @@ -326,11 +326,11 @@ void testBreakdown_singleDbSpan_exceedingParent() { */ @Test void testBreakdown_spanStartedAfterParentEnded() { - final Transaction transaction = createTransaction() + final TransactionImpl transaction = createTransaction() .activate(); transaction.end(10); - final AbstractSpan active = tracer.getActive(); + final AbstractSpanImpl active = tracer.getActive(); assertThat(active).isSameAs(transaction); assertThat(transaction.getTraceContext().getId().isEmpty()).isFalse(); active.createSpan(20).withType("db").withSubtype("mysql").end(30); @@ -347,7 +347,7 @@ void testBreakdown_spanStartedAfterParentEnded() { @Test void testBreakdown_serviceName() { - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.getTraceContext().setServiceInfo("service_name", null); transaction.createSpan(11).withType("db").withSubtype("mysql").end(23); transaction.end(27); @@ -362,7 +362,7 @@ void testBreakdown_serviceName() { @Test void testBreakdown_serviceNameAndVersion() { - final Transaction transaction = createTransaction(); + final TransactionImpl transaction = createTransaction(); transaction.getTraceContext().setServiceInfo("service_name", "service_version"); transaction.createSpan(11).withType("db").withSubtype("mysql").end(23); transaction.end(27); @@ -375,7 +375,7 @@ void testBreakdown_serviceNameAndVersion() { }); } - private Transaction createTransaction() { + private TransactionImpl createTransaction() { return tracer.startRootTransaction(ConstantSampler.of(true), 0, getClass().getClassLoader()) .withName("test") .withType("request"); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/BaggageBuilderTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/BaggageBuilderTest.java index a3cc870a47..e540203fb7 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/BaggageBuilderTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/BaggageBuilderTest.java @@ -27,23 +27,23 @@ public class BaggageBuilderTest { @Test public void verifyBaggageReuseOnNoModification() { - Baggage base = Baggage.builder() + BaggageImpl base = BaggageImpl.builder() .put("foo", "bar") .build(); - Baggage newlyBuilt = base.toBuilder().build(); + BaggageImpl newlyBuilt = base.toBuilder().build(); assertThat(newlyBuilt).isSameAs(base); } @Test public void verifyBaggageBuilderPreserversOriginalBaggage() { - Baggage base = Baggage.builder() + BaggageImpl base = BaggageImpl.builder() .put("foo", "bar") .put("bar", "baz") .build(); - Baggage newlyBuilt = base.toBuilder() + BaggageImpl newlyBuilt = base.toBuilder() .put("foo", "not-bar") .build(); @@ -57,12 +57,12 @@ public void verifyBaggageBuilderPreserversOriginalBaggage() { @Test public void testEntryRemoval() { - Baggage base = Baggage.builder() + BaggageImpl base = BaggageImpl.builder() .put("foo", "bar") .put("bar", "baz") .build(); - Baggage newlyBuilt = base.toBuilder() + BaggageImpl newlyBuilt = base.toBuilder() .put("foo", null) .build(); @@ -77,12 +77,12 @@ public void testEntryRemoval() { @Test public void verifyMetadataPreserved() { - Baggage base = Baggage.builder() + BaggageImpl base = BaggageImpl.builder() .put("foo", "bar", "meta1") .put("bar", "baz", "meta2") .build(); - Baggage newlyBuilt = base.toBuilder() + BaggageImpl newlyBuilt = base.toBuilder() .put("foo", "not-bar") .put("new", "newval", "new_meta") .build(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagationTest.java index 13490f3c5b..9ca945f50c 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/baggage/W3CBaggagePropagationTest.java @@ -42,7 +42,7 @@ public class Propagation { @Test public void testComplexValue() { - Baggage baggage = Baggage.builder() + BaggageImpl baggage = BaggageImpl.builder() .put("foo", "bar") .put("my_key!", "hello, world!?%ä=", "metadata=blub") .build(); @@ -55,7 +55,7 @@ public void testComplexValue() { } @NotNull - private Map doPropagate(Baggage baggage) { + private Map doPropagate(BaggageImpl baggage) { Map resultHeaders = new HashMap<>(); W3CBaggagePropagation.propagate(baggage, resultHeaders, TextHeaderMapAccessor.INSTANCE); @@ -68,7 +68,7 @@ private Map doPropagate(Baggage baggage) { @Test public void testEmptyBaggage() { - Baggage baggage = Baggage.builder().build(); + BaggageImpl baggage = BaggageImpl.builder().build(); Map resultHeaders = doPropagate(baggage); @@ -77,7 +77,7 @@ public void testEmptyBaggage() { @Test public void testInvalidKeysIgnored() { - Baggage baggage = Baggage.builder() + BaggageImpl baggage = BaggageImpl.builder() .put("foo", "bar") .put("bad,key", "42") .build(); @@ -92,7 +92,7 @@ public void testInvalidKeysIgnored() { @Test public void testOnlyInvalidKeys() { - Baggage baggage = Baggage.builder() + BaggageImpl baggage = BaggageImpl.builder() .put("bad,key", "42") .build(); @@ -113,7 +113,7 @@ public void testComplexValueString() { "bar=baz2" }; - Baggage.Builder resultBuilder = Baggage.builder(); + BaggageImpl.Builder resultBuilder = BaggageImpl.builder(); W3CBaggagePropagation.parse(baggageHeaders, new TextBaggageheaderGetter(), resultBuilder); assertThat(resultBuilder.build()) @@ -122,7 +122,7 @@ public void testComplexValueString() { .containsEntry("bar", "baz2", null) .containsEntry("foo", "bar2", "overridden=meta"); - Baggage.Builder utf8ResultBuilder = Baggage.builder(); + BaggageImpl.Builder utf8ResultBuilder = BaggageImpl.builder(); W3CBaggagePropagation.parse(baggageHeaders, new UTF8BaggageheaderGetter(), utf8ResultBuilder); assertThat(utf8ResultBuilder.build()).isEqualTo(resultBuilder.build()); } @@ -130,11 +130,11 @@ public void testComplexValueString() { @Test public void testNoValue() { - Baggage.Builder textResultBuilder = Baggage.builder(); + BaggageImpl.Builder textResultBuilder = BaggageImpl.builder(); W3CBaggagePropagation.parse(Collections.emptyMap(), TextHeaderMapAccessor.INSTANCE, textResultBuilder); assertThat(textResultBuilder.build()).hasSize(0); - Baggage.Builder utf8ResultBuilder = Baggage.builder(); + BaggageImpl.Builder utf8ResultBuilder = BaggageImpl.builder(); W3CBaggagePropagation.parse(Collections.emptyMap(), Utf8HeaderMapAccessor.INSTANCE, utf8ResultBuilder); assertThat(textResultBuilder.build()).hasSize(0); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreakerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreakerTest.java index 98a6733494..5ba6a11314 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreakerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/circuitbreaker/CircuitBreakerTest.java @@ -37,8 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import static co.elastic.apm.agent.impl.Tracer.TracerState.PAUSED; -import static co.elastic.apm.agent.impl.Tracer.TracerState.RUNNING; +import static co.elastic.apm.agent.impl.ElasticApmTracer.TracerState.PAUSED; +import static co.elastic.apm.agent.impl.ElasticApmTracer.TracerState.RUNNING; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.awaitility.Awaitility.await; import static org.mockito.Mockito.doReturn; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyProcessorTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyProcessorTest.java index 53b10837f6..e93b7f3cba 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyProcessorTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyProcessorTest.java @@ -19,38 +19,38 @@ package co.elastic.apm.agent.impl.context; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.stagemonitor.configuration.ConfigurationRegistry; -import static co.elastic.apm.agent.impl.context.AbstractContext.REDACTED_CONTEXT_STRING; +import static co.elastic.apm.agent.impl.context.AbstractContextImpl.REDACTED_CONTEXT_STRING; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; class BodyProcessorTest { private BodyProcessor bodyProcessor; - private CoreConfiguration config; + private CoreConfigurationImpl config; private ElasticApmTracer tracer; @BeforeEach void setUp() { ConfigurationRegistry configurationRegistry = SpyConfiguration.createSpyConfig(); bodyProcessor = new BodyProcessor(configurationRegistry); - config = configurationRegistry.getConfig(CoreConfiguration.class); + config = configurationRegistry.getConfig(CoreConfigurationImpl.class); tracer = MockTracer.create(configurationRegistry); } @Test void processBeforeReport_Transaction_EventTypeAll() { - doReturn(CoreConfiguration.EventType.ALL).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(config).getCaptureBody(); - final Transaction transaction = processTransaction(); + final TransactionImpl transaction = processTransaction(); assertThat(transaction.getContext().getRequest().getBody().toString()).isEqualTo("foo"); assertThat(transaction.getContext().getMessage().getBodyForRead().toString()).isEqualTo("bar"); @@ -58,9 +58,9 @@ void processBeforeReport_Transaction_EventTypeAll() { @Test void processBeforeReport_Transaction_EventTypeTransaction() { - doReturn(CoreConfiguration.EventType.TRANSACTIONS).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.TRANSACTIONS).when(config).getCaptureBody(); - final Transaction transaction = processTransaction(); + final TransactionImpl transaction = processTransaction(); assertThat(transaction.getContext().getRequest().getBody().toString()).isEqualTo("foo"); assertThat(transaction.getContext().getMessage().getBodyForRead().toString()).isEqualTo("bar"); @@ -68,9 +68,9 @@ void processBeforeReport_Transaction_EventTypeTransaction() { @Test void processBeforeReport_Transaction_EventTypeError() { - doReturn(CoreConfiguration.EventType.ERRORS).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ERRORS).when(config).getCaptureBody(); - final Transaction transaction = processTransaction(); + final TransactionImpl transaction = processTransaction(); assertThat(transaction.getContext().getRequest().getBody().toString()).isEqualTo(REDACTED_CONTEXT_STRING); assertThat(transaction.getContext().getMessage().getBodyForRead().toString()).isEqualTo(REDACTED_CONTEXT_STRING); @@ -78,9 +78,9 @@ void processBeforeReport_Transaction_EventTypeError() { @Test void processBeforeReport_Transaction_EventTypeOff() { - doReturn(CoreConfiguration.EventType.OFF).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.OFF).when(config).getCaptureBody(); - final Transaction transaction = processTransaction(); + final TransactionImpl transaction = processTransaction(); assertThat(transaction.getContext().getRequest().getBody().toString()).isEqualTo(REDACTED_CONTEXT_STRING); assertThat(transaction.getContext().getMessage().getBodyForRead().toString()).isEqualTo(REDACTED_CONTEXT_STRING); @@ -88,9 +88,9 @@ void processBeforeReport_Transaction_EventTypeOff() { @Test void processBeforeReport_Error_EventTypeAll() { - doReturn(CoreConfiguration.EventType.ALL).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(config).getCaptureBody(); - final ErrorCapture error = processError(); + final ErrorCaptureImpl error = processError(); assertThat(error.getContext().getRequest().getBody().toString()).isEqualTo("foo"); assertThat(error.getContext().getMessage().getBodyForRead().toString()).isEqualTo("bar"); @@ -98,9 +98,9 @@ void processBeforeReport_Error_EventTypeAll() { @Test void processBeforeReport_Error_EventTypeTransaction() { - doReturn(CoreConfiguration.EventType.TRANSACTIONS).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.TRANSACTIONS).when(config).getCaptureBody(); - final ErrorCapture error = processError(); + final ErrorCaptureImpl error = processError(); assertThat(error.getContext().getRequest().getBody().toString()).isEqualTo(REDACTED_CONTEXT_STRING); assertThat(error.getContext().getMessage().getBodyForRead().toString()).isEqualTo(REDACTED_CONTEXT_STRING); @@ -108,9 +108,9 @@ void processBeforeReport_Error_EventTypeTransaction() { @Test void processBeforeReport_Error_EventTypeError() { - doReturn(CoreConfiguration.EventType.ERRORS).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ERRORS).when(config).getCaptureBody(); - final ErrorCapture error = processError(); + final ErrorCaptureImpl error = processError(); assertThat(error.getContext().getRequest().getBody().toString()).isEqualTo("foo"); assertThat(error.getContext().getMessage().getBodyForRead().toString()).isEqualTo("bar"); @@ -118,17 +118,17 @@ void processBeforeReport_Error_EventTypeError() { @Test void processBeforeReport_Error_EventTypeOff() { - doReturn(CoreConfiguration.EventType.OFF).when(config).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.OFF).when(config).getCaptureBody(); - final ErrorCapture error = processError(); + final ErrorCaptureImpl error = processError(); assertThat(error.getContext().getRequest().getBody().toString()).isEqualTo(REDACTED_CONTEXT_STRING); assertThat(error.getContext().getMessage().getBodyForRead().toString()).isEqualTo(REDACTED_CONTEXT_STRING); } - private Transaction processTransaction() { - final Transaction transaction = new Transaction(tracer); - Request request = transaction.getContext().getRequest(); + private TransactionImpl processTransaction() { + final TransactionImpl transaction = new TransactionImpl(tracer); + RequestImpl request = transaction.getContext().getRequest(); request.withBodyBuffer().append("foo"); request.endOfBufferInput(); transaction.getContext().getMessage().withBody("bar"); @@ -136,9 +136,9 @@ private Transaction processTransaction() { return transaction; } - private ErrorCapture processError() { - final ErrorCapture error = new ErrorCapture(tracer); - Request request = error.getContext().getRequest(); + private ErrorCaptureImpl processError() { + final ErrorCaptureImpl error = new ErrorCaptureImpl(tracer); + RequestImpl request = error.getContext().getRequest(); request.withBodyBuffer().append("foo"); request.endOfBufferInput(); error.getContext().getMessage().withBody("bar"); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/DestinationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/DestinationTest.java index 93bd5c2354..a312fa73e3 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/DestinationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/DestinationTest.java @@ -56,7 +56,7 @@ void invalidPortShouldIgnore() { @Test void setAddressTwiceShouldReset() { - Destination destination = new Destination(); + DestinationImpl destination = new DestinationImpl(); assertThat(destination.withAddress("aaa").withAddress("bb").getAddress().toString()) .isEqualTo("bb"); @@ -67,7 +67,7 @@ void userAddressHavePriority() { checkAddress("user-before", d -> d.withUserAddress("user-before").withAddress("address")); checkAddress("user-after", d -> d.withAddress("user-before").withUserAddress("user-after")); - Destination emptyUserAddress = new Destination().withAddress("host").withUserAddress(""); + DestinationImpl emptyUserAddress = new DestinationImpl().withAddress("host").withUserAddress(""); assertThat(emptyUserAddress.getAddress()).isEmpty(); assertThat(emptyUserAddress.hasContent()).isFalse(); } @@ -79,17 +79,17 @@ void userPortHavePriority() { checkPort(33, d -> d.withPort(42).withUserPort(33)); checkPort(33, d -> d.withUserPort(33).withPort(42)); } - - private static void checkPort(int expected, Function operations) { - Destination destination = new Destination(); + + private static void checkPort(int expected, Function operations) { + DestinationImpl destination = new DestinationImpl(); operations.apply(destination); assertThat(destination.getPort()).isEqualTo(expected); assertThat(destination.hasContent()).isTrue(); } - private static void checkAddress(String expected, Function operations) { - Destination destination = new Destination(); + private static void checkAddress(String expected, Function operations) { + DestinationImpl destination = new DestinationImpl(); operations.apply(destination); assertThat(destination.getAddress().toString()) // call to toString required otherwise comparison fails .isEqualTo(expected); @@ -102,7 +102,7 @@ private void checkSetAddress(String input, String expectedAddress) { } private void checkSetHostAndPort(String input, String expectedHost, int expectedPort) { - Destination destination = new Destination(); + DestinationImpl destination = new DestinationImpl(); destination.withAddressPort(input); assertThat(destination.hasContent()).isTrue(); @@ -112,7 +112,7 @@ private void checkSetHostAndPort(String input, String expectedHost, int expected } private void checkInvalidHostAndPort(String input) { - Destination destination = new Destination(); + DestinationImpl destination = new DestinationImpl(); destination.withAddressPort(input); assertThat(destination.hasContent()).isFalse(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/MessageTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/MessageTest.java index 46200a1894..eae6bd7855 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/MessageTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/MessageTest.java @@ -28,7 +28,7 @@ class MessageTest { @Test void testResetState() { - Message message = createMessage(100L, "test-body", "test-q", "test-*", Map.of("test-header", "test-value")); + MessageImpl message = createMessage(100L, "test-body", "test-q", "test-*", Map.of("test-header", "test-value")); message.resetState(); @@ -41,8 +41,8 @@ void testResetState() { @Test void testCopyFrom() { - Message firstMessage = createMessage(100L, "test-body", "test-q", "test-*", Map.of("test-header", "test-value")); - Message secondMessage = createMessage(999L, "updated-body", "updated-test-q", "updated-test-*", Map.of("updated-test-header", "updated-test-value")); + MessageImpl firstMessage = createMessage(100L, "test-body", "test-q", "test-*", Map.of("test-header", "test-value")); + MessageImpl secondMessage = createMessage(999L, "updated-body", "updated-test-q", "updated-test-*", Map.of("updated-test-header", "updated-test-value")); firstMessage.copyFrom(secondMessage); @@ -59,8 +59,8 @@ void testCopyFrom() { assertThat(firstMessageBody.toString()).isEqualTo("updated-body"); } - private Message createMessage(long age, String body, String queue, String routingKey, Map headers) { - Message message = new Message() + private MessageImpl createMessage(long age, String body, String queue, String routingKey, Map headers) { + MessageImpl message = new MessageImpl() .withAge(age) .withBody(body) .withQueue(queue) diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessorTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessorTest.java index ee573b6cbe..c00931bb75 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessorTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/SanitizingWebProcessorTest.java @@ -20,12 +20,12 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static co.elastic.apm.agent.impl.context.AbstractContext.REDACTED_CONTEXT_STRING; +import static co.elastic.apm.agent.impl.context.AbstractContextImpl.REDACTED_CONTEXT_STRING; import static org.assertj.core.api.Assertions.assertThat; class SanitizingWebProcessorTest { @@ -39,7 +39,7 @@ void setUp() { @Test void processTransactions() { - Transaction transaction = new Transaction(MockTracer.create()); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()); fillContext(transaction.getContext()); processor.processBeforeReport(transaction); @@ -49,7 +49,7 @@ void processTransactions() { @Test void processErrors() { - final ErrorCapture errorCapture = new ErrorCapture(MockTracer.create()); + final ErrorCaptureImpl errorCapture = new ErrorCaptureImpl(MockTracer.create()); fillContext(errorCapture.getContext()); processor.processBeforeReport(errorCapture); @@ -57,7 +57,7 @@ void processErrors() { assertContainsNoSensitiveInformation(errorCapture.getContext()); } - private void fillContext(TransactionContext context) { + private void fillContext(TransactionContextImpl context) { context.getRequest().addCookie("JESESSIONID", "CAFEBABE"); context.getRequest().addCookie("non-sensitive", "foo"); context.getRequest().addFormUrlEncodedParameter("cretidCard", "1234 1234 1234 1234"); @@ -70,7 +70,7 @@ private void fillContext(TransactionContext context) { context.getResponse().addHeader("Content-Length", "-1"); } - private void assertContainsNoSensitiveInformation(TransactionContext context) { + private void assertContainsNoSensitiveInformation(TransactionContextImpl context) { assertThat(context.getRequest().getCookies().get("JESESSIONID")).isEqualTo(REDACTED_CONTEXT_STRING); assertThat(context.getRequest().getCookies().get("non-sensitive")).isEqualTo("foo"); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceResourceTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceResourceTest.java index 7dfad3fd21..ed65ee8274 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceResourceTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceResourceTest.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.assertions.ServiceTargetAssert; import com.fasterxml.jackson.databind.JsonNode; import org.junit.jupiter.api.AfterAll; @@ -44,7 +44,7 @@ public class ServiceResourceTest { - private static Transaction root; + private static TransactionImpl root; @BeforeAll static void startRootTransaction() { @@ -60,7 +60,7 @@ static void endTransaction() { @ParameterizedTest @MethodSource("getTestCases") void testServiceResourceInference(JsonNode testCase) { - Span span = createSpan(testCase); + SpanImpl span = createSpan(testCase); // increment reference count to prevent recycling while test executes span.incrementReferences(); @@ -70,7 +70,7 @@ void testServiceResourceInference(JsonNode testCase) { JsonNode jsonServiceTarget = testCase.get("expected_service_target"); - ServiceTarget serviceTarget = span.getContext().getServiceTarget(); + ServiceTargetImpl serviceTarget = span.getContext().getServiceTarget(); ServiceTargetAssert testAssertion = assertThat(serviceTarget) .describedAs(getTextValueOrNull(testCase, "failure_message")); @@ -97,8 +97,8 @@ void testServiceResourceInference(JsonNode testCase) { span.decrementReferences(); } - private Span createSpan(JsonNode testCase) { - Span span = root.createSpan(); + private SpanImpl createSpan(JsonNode testCase) { + SpanImpl span = root.createSpan(); JsonNode spanJson = testCase.get("span"); span.withType(spanJson.get("type").textValue()); JsonNode subtypeJsonNode = spanJson.get("subtype"); @@ -110,7 +110,7 @@ private Span createSpan(JsonNode testCase) { } JsonNode contextJson = spanJson.get("context"); if (contextJson != null) { - SpanContext context = span.getContext(); + SpanContextImpl context = span.getContext(); JsonNode dbJson = contextJson.get("db"); if (dbJson != null) { context.getDb() @@ -119,7 +119,7 @@ private Span createSpan(JsonNode testCase) { } JsonNode messageJson = contextJson.get("message"); if (messageJson != null) { - Message message = context.getMessage(); + MessageImpl message = context.getMessage(); message.withBody(getTextValueOrNull(messageJson, "body")); JsonNode queueJson = messageJson.get("queue"); if (queueJson != null) { @@ -130,7 +130,7 @@ private Span createSpan(JsonNode testCase) { if (httpJson != null) { String urlValue = getTextValueOrNull(httpJson, "url"); if (urlValue != null) { - Url url = context.getHttp().getInternalUrl(); + UrlImpl url = context.getHttp().getInternalUrl(); try { url.fillFrom(new URI(urlValue)); } catch (URISyntaxException e) { diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceTargetTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceTargetTest.java index e04d37b7df..390fa774d6 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceTargetTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/ServiceTargetTest.java @@ -31,7 +31,7 @@ class ServiceTargetTest { @Test void createEmpty() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); assertThat(serviceTarget).isEmpty(); assertThat(serviceTarget).isNotSetByUser(); assertThat(serviceTarget).hasNoName(); @@ -40,7 +40,7 @@ void createEmpty() { @Test void typeOnly() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); String serviceType = "service-type"; assertThat(serviceTarget.withType(serviceType)) @@ -58,7 +58,7 @@ void typeOnly() { @Test void typeAndName() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); assertThat(serviceTarget.withType("service-type").withName("service-name")) .hasType("service-type") @@ -78,7 +78,7 @@ void typeAndName() { @Test void userValuePriority_userValuesAfter() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); serviceTarget.withType("type").withName("name"); assertThat(serviceTarget).hasType("type").hasName("name").isNotSetByUser(); @@ -89,7 +89,7 @@ void userValuePriority_userValuesAfter() { @Test void userValuePriority_userValuesBefore() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); assertThat(serviceTarget.withUserType("user-type")).hasType("user-type").isSetByUser(); assertThat(serviceTarget.withUserName("user-name")).hasName("user-name").isSetByUser(); @@ -103,7 +103,7 @@ void userValuePriority_userValuesBefore() { @Test void userValuePriority_userValuesStillModifiable() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); assertThat(serviceTarget.withUserType("user-type")).hasType("user-type").isSetByUser(); assertThat(serviceTarget.withUserName("user-name")).hasName("user-name").isSetByUser(); @@ -116,7 +116,7 @@ void userValuePriority_userValuesStillModifiable() { void emptyOrNullUserDestinationResourceIsIgnored() { // using null or empty value should allow user to empty service target Stream.of("", null).forEach(value -> { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); assertThat(serviceTarget.withUserName(value)) .isEmpty() .isSetByUser(); @@ -126,7 +126,7 @@ void emptyOrNullUserDestinationResourceIsIgnored() { @Test void userResourceWithoutExplicitType() { - ServiceTarget serviceTarget = new ServiceTarget(); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl(); serviceTarget.withName("user-resource").withNameOnlyDestinationResource(); assertThat(serviceTarget) .hasName("user-resource") @@ -135,7 +135,7 @@ void userResourceWithoutExplicitType() { @Test void setDestinationResourceFromHostAndPort() { - ServiceTarget serviceTarget = new ServiceTarget().withType("test").withName("name"); + ServiceTargetImpl serviceTarget = new ServiceTargetImpl().withType("test").withName("name"); assertThat(serviceTarget) .describedAs("destination resource should be inferred from type an name") .hasDestinationResource("test/name"); @@ -170,29 +170,29 @@ void setDestinationResourceFromHostAndPort() { @Test void testCopy() { testCopy(st -> st.withType("type"), - ServiceTarget::getType); + ServiceTargetImpl::getType); testCopy(st -> st.withType("type").withName("name"), - ServiceTarget::getType, + ServiceTargetImpl::getType, st -> st.getName().toString()); testCopy(st -> st.withUserType("user-type").withUserName("user-resource").withNameOnlyDestinationResource(), - ServiceTarget::getType, + ServiceTargetImpl::getType, st -> st.getName().toString(), st -> st.getDestinationResource().toString(), - ServiceTarget::isSetByUser); + ServiceTargetImpl::isSetByUser); } - private void testCopy(Function setOperation, Function... getOperations) { - ServiceTarget original = new ServiceTarget(); + private void testCopy(Function setOperation, Function... getOperations) { + ServiceTargetImpl original = new ServiceTargetImpl(); setOperation.apply(original); - ServiceTarget copy = new ServiceTarget(); + ServiceTargetImpl copy = new ServiceTargetImpl(); copy.copyFrom(original); List results = new ArrayList<>(); - for (Function operation : getOperations) { + for (Function operation : getOperations) { Object resultOnOriginal = operation.apply(original); Object resultOnCopy = operation.apply(copy); assertThat(resultOnCopy).isEqualTo(resultOnOriginal); @@ -212,7 +212,7 @@ private void testCopy(Function setOperation, Funct @Test void testHostPort() { - ServiceTarget st = new ServiceTarget() + ServiceTargetImpl st = new ServiceTargetImpl() .withHostPortName("host", 99) .withNameOnlyDestinationResource(); @@ -229,7 +229,7 @@ void testHostPort() { @Test void emptyOrNullUserType() { Stream.of("", null).forEach(type -> { - ServiceTarget st = new ServiceTarget().withUserType(type).withName("name"); + ServiceTargetImpl st = new ServiceTargetImpl().withUserType(type).withName("name"); assertThat(st).hasDestinationResource("name"); }); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/TransactionContextTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/TransactionContextTest.java index 3d0456b29c..e414422a39 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/TransactionContextTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/TransactionContextTest.java @@ -27,33 +27,33 @@ class TransactionContextTest { @Test void testCopyFrom() { - TransactionContext context = createContext(); - TransactionContext copyOfContext = new TransactionContext(); + TransactionContextImpl context = createContext(); + TransactionContextImpl copyOfContext = new TransactionContextImpl(); copyOfContext.copyFrom(context); assertThat(toJson(context)).isEqualTo(toJson(copyOfContext)); } @Test void testCopyFromCopiesTags() { - TransactionContext context = new TransactionContext(); + TransactionContextImpl context = new TransactionContextImpl(); context.addLabel("foo", "bar"); - TransactionContext copyOfContext = new TransactionContext(); + TransactionContextImpl copyOfContext = new TransactionContextImpl(); copyOfContext.copyFrom(context); assertThat(copyOfContext.getLabel("foo")).isEqualTo("bar"); } @Test void testCopyFromDoNotCopyCustom() { - TransactionContext context = new TransactionContext(); + TransactionContextImpl context = new TransactionContextImpl(); context.addCustom("foo", "bar"); - TransactionContext copyOfContext = new TransactionContext(); + TransactionContextImpl copyOfContext = new TransactionContextImpl(); copyOfContext.copyFrom(context); assertThat(copyOfContext.hasCustom()).isFalse(); } - private TransactionContext createContext() { - TransactionContext context = new TransactionContext(); - Request request = context.getRequest(); + private TransactionContextImpl createContext() { + TransactionContextImpl context = new TransactionContextImpl(); + RequestImpl request = context.getRequest(); request.withHttpVersion("1.1"); request.withMethod("POST"); request.withBodyBuffer().append("Hello World"); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/UrlTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/UrlTest.java index 038589ba35..507318d77c 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/UrlTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/UrlTest.java @@ -33,22 +33,22 @@ class UrlTest { @Test void testResetState() { - final Url url = sampleUrl(); + final UrlImpl url = sampleUrl(); url.resetState(); - assertThat(toJson(url)).isEqualTo(toJson(new Url())); + assertThat(toJson(url)).isEqualTo(toJson(new UrlImpl())); } @Test void testCopyOf() { - final Url url = sampleUrl(); - final Url copy = new Url(); + final UrlImpl url = sampleUrl(); + final UrlImpl copy = new UrlImpl(); copy.copyFrom(url); assertThat(toJson(url)).isEqualTo(toJson(copy)); - assertThat(toJson(url)).isNotEqualTo(toJson(new Url())); + assertThat(toJson(url)).isNotEqualTo(toJson(new UrlImpl())); } - private Url sampleUrl() { - return new Url() + private UrlImpl sampleUrl() { + return new UrlImpl() .withHostname("localhost") .withPathname("/foo") .withPort(8080) @@ -59,27 +59,27 @@ private Url sampleUrl() { @Test void computeFullFromProperties() { // default port on http - assertThat(new Url().withProtocol("http") + assertThat(new UrlImpl().withProtocol("http") .withHostname("localhost") .withPort(80) .getFull().toString()).isEqualTo("http://localhost"); // non default port on http + path - assertThat(new Url().withProtocol("http") + assertThat(new UrlImpl().withProtocol("http") .withHostname("localhost") .withPort(8080) .withPathname("/hello") .getFull().toString()).isEqualTo("http://localhost:8080/hello"); // default port on https + search string - assertThat(new Url().withProtocol("https") + assertThat(new UrlImpl().withProtocol("https") .withHostname("hostname") .withPort(443) .withSearch("hello=world") .getFull().toString()).isEqualTo("https://hostname?hello=world"); // non default port on https - assertThat(new Url().withProtocol("https") + assertThat(new UrlImpl().withProtocol("https") .withHostname("hostname") .withPort(447) .getFull().toString()).isEqualTo("https://hostname:447"); @@ -100,11 +100,11 @@ void computeFullFromProperties() { "https://user:pwd@localhost:447/ https://localhost:447/ https localhost 447 / " }) void fillFromURIorURL(String uriString, String full, String protocol, String host, int port, String path, String query) throws MalformedURLException { - Url urlFromUri = new Url(); + UrlImpl urlFromUri = new UrlImpl(); URI uri = URI.create(uriString); urlFromUri.fillFrom(uri); - Url urlFromUrl = new Url(); + UrlImpl urlFromUrl = new UrlImpl(); urlFromUrl.fillFrom(uri.toURL()); Stream.of(urlFromUri, urlFromUrl).forEach(url -> { @@ -123,7 +123,7 @@ void fillFromURIorURL(String uriString, String full, String protocol, String hos "http://user:password@localhost/path?query=help http://localhost/path?query=help" }) void withFull(String input, String expected) { - Url url = new Url(); + UrlImpl url = new UrlImpl(); url.withFull(input); assertThat(url.getFull().toString()).isEqualTo(expected); @@ -141,7 +141,7 @@ void withFull(String input, String expected) { @Test void getFullUpdatesFullWhenRequired() { - Url url = new Url(); + UrlImpl url = new UrlImpl(); StringBuilder full = url.getFull(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataMock.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataMock.java index 6de3f37f85..c42132697a 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataMock.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataMock.java @@ -33,7 +33,7 @@ public class MetaDataMock { * * @return a mock future, already containing the medata info */ - public static Future create(ProcessInfo process, Service service, SystemInfo system, @Nullable CloudProviderInfo cloudProviderInfo, + public static Future create(ProcessInfo process, ServiceImpl service, SystemInfo system, @Nullable CloudProviderInfo cloudProviderInfo, Map globalLabels, @Nullable FaaSMetaDataExtension faaSMetaDataExtension) { return create(new MetaData(process, service, system, cloudProviderInfo, globalLabels, faaSMetaDataExtension)); } @@ -46,7 +46,7 @@ public static Future create(ProcessInfo process, Service service, Syst public static Future create() { return create(new MetaData( new ProcessInfo("test-process"), - new Service(), + new ServiceImpl(), new SystemInfo("x64", "localhost", null, "platform"), null, Collections.emptyMap(), @@ -64,7 +64,7 @@ public static Future create(MetaData value) { public static MetaData createDefaultMock() { return spy(new MetaData( new ProcessInfo("test-process"), - new Service(), + new ServiceImpl(), new SystemInfo("x64", "localhost", null, "platform"), null, Collections.emptyMap(), diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataTest.java index 7ff614d91b..25c2c9e9f0 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/MetaDataTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.impl.metadata; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.util.CustomEnvVariables; import org.junit.jupiter.api.BeforeAll; @@ -38,9 +38,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.AUTO; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.AWS; -import static co.elastic.apm.agent.configuration.CoreConfiguration.CloudProvider.NONE; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.AUTO; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.AWS; +import static co.elastic.apm.agent.configuration.CoreConfigurationImpl.CloudProvider.NONE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.doReturn; @@ -48,20 +48,20 @@ class MetaDataTest extends CustomEnvVariables { private static ConfigurationRegistry config; - private static CoreConfiguration coreConfiguration; - private static ServerlessConfiguration serverlessConfiguration; + private static CoreConfigurationImpl coreConfiguration; + private static ServerlessConfigurationImpl serverlessConfiguration; @Nullable - private static CoreConfiguration.CloudProvider currentCloudProvider; + private static CoreConfigurationImpl.CloudProvider currentCloudProvider; @BeforeAll static void setup() { config = SpyConfiguration.createSpyConfig(); - coreConfiguration = config.getConfig(CoreConfiguration.class); - serverlessConfiguration = config.getConfig(ServerlessConfiguration.class); + coreConfiguration = config.getConfig(CoreConfigurationImpl.class); + serverlessConfiguration = config.getConfig(ServerlessConfigurationImpl.class); // calling the blocking method directly, so we can start tests only after proper discovery CloudProviderInfo cloudProviderInfo = CloudMetadataProvider.fetchAndParseCloudProviderInfo(AUTO, 1000); if (cloudProviderInfo != null) { - currentCloudProvider = CoreConfiguration.CloudProvider.valueOf(cloudProviderInfo.getProvider().toUpperCase()); + currentCloudProvider = CoreConfigurationImpl.CloudProvider.valueOf(cloudProviderInfo.getProvider().toUpperCase()); } } @@ -83,7 +83,7 @@ void testCloudProvider_NONE_and_configured_hostname() throws InterruptedExceptio void testCloudProvider_ForAWSLambda_fromEnvVariables() throws Exception { MetaData awsLambdaMetaData = createAwsLambdaMetaData(); - Service service = awsLambdaMetaData.getService(); + ServiceImpl service = awsLambdaMetaData.getService(); assertThat(Objects.requireNonNull(service.getRuntime()).getName()).isEqualTo("lambda-execution"); assertThat(Objects.requireNonNull(service.getNode()).getName()).isEqualTo("lambda-log-stream"); Framework framework = service.getFramework(); @@ -106,7 +106,7 @@ void testCloudProvider_ForAWSLambda_fromConfiguration() throws Exception { doReturn("test-service-version").when(coreConfiguration).getServiceVersion(); MetaData awsLambdaMetaData = createAwsLambdaMetaData(); - Service service = awsLambdaMetaData.getService(); + ServiceImpl service = awsLambdaMetaData.getService(); assertThat(service.getName()).isEqualTo("test-service"); assertThat(service.getVersion()).isEqualTo("test-service-version"); assertThat(Objects.requireNonNull(service.getNode()).getName()).isEqualTo("test-service-node-name"); @@ -135,8 +135,8 @@ private MetaData createAwsLambdaMetaData() throws Exception { } @ParameterizedTest - @EnumSource(value = CoreConfiguration.CloudProvider.class, names = {"AWS", "GCP", "AZURE"}) - void testCloudProvider_SingleProvider(CoreConfiguration.CloudProvider provider) throws InterruptedException, ExecutionException, TimeoutException { + @EnumSource(value = CoreConfigurationImpl.CloudProvider.class, names = {"AWS", "GCP", "AZURE"}) + void testCloudProvider_SingleProvider(CoreConfigurationImpl.CloudProvider provider) throws InterruptedException, ExecutionException, TimeoutException { doReturn(provider).when(coreConfiguration).getCloudProvider(); Future metaDataFuture = MetaData.create(config, null); // In AWS we may need two timeouts - one for the API token and one for the metadata itself @@ -179,11 +179,11 @@ void testCloudProvider_AUTO() throws InterruptedException, ExecutionException, T verifyMetaData(metaData, AUTO); } - private void verifyMetaData(MetaData metaData, CoreConfiguration.CloudProvider cloudProvider) { + private void verifyMetaData(MetaData metaData, CoreConfigurationImpl.CloudProvider cloudProvider) { verifyMetaData(metaData, cloudProvider, null); } - private void verifyMetaData(MetaData metaData, CoreConfiguration.CloudProvider cloudProvider, @Nullable String configuredHostname) { + private void verifyMetaData(MetaData metaData, CoreConfigurationImpl.CloudProvider cloudProvider, @Nullable String configuredHostname) { assertThat(metaData.getService()).isNotNull(); assertThat(metaData.getProcess()).isNotNull(); SystemInfo system = metaData.getSystem(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/SystemInfoTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/SystemInfoTest.java index c107d7a267..7740915c01 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/SystemInfoTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/metadata/SystemInfoTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl.metadata; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.util.CustomEnvVariables; import org.junit.jupiter.api.Test; @@ -34,11 +34,11 @@ public class SystemInfoTest extends CustomEnvVariables { private static final SystemInfo systemInfo; private static final boolean isWindows; - private static final ServerlessConfiguration serverlessConfiguration; + private static final ServerlessConfigurationImpl serverlessConfiguration; static { - serverlessConfiguration = config.getConfig(ServerlessConfiguration.class); + serverlessConfiguration = config.getConfig(ServerlessConfigurationImpl.class); systemInfo = SystemInfo.create("hostname", 0, serverlessConfiguration); isWindows = SystemInfo.isWindows(systemInfo.getPlatform()); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/sampling/ProbabilitySamplerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/sampling/ProbabilitySamplerTest.java index 216c593d11..aa49f1d0e9 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/sampling/ProbabilitySamplerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/sampling/ProbabilitySamplerTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl.sampling; -import co.elastic.apm.agent.impl.transaction.Id; +import co.elastic.apm.agent.impl.transaction.IdImpl; import co.elastic.apm.agent.impl.transaction.TraceState; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -58,7 +58,7 @@ void headerCaching(double rate) { @Test void isSampledEmpiricalTest() { int sampledTransactions = 0; - Id id = Id.new128BitId(); + IdImpl id = IdImpl.new128BitId(); for (int i = 0; i < ITERATIONS; i++) { id.setToRandomValue(); if (sampler.isSampled(id)) { @@ -71,7 +71,7 @@ void isSampledEmpiricalTest() { @Test void testSamplingUpperBoundary() { long upperBound = Long.MAX_VALUE / 2; - final Id transactionId = Id.new128BitId(); + final IdImpl transactionId = IdImpl.new128BitId(); transactionId.fromLongs((long) 0, upperBound - 1); assertThat(ProbabilitySampler.of(0.5).isSampled(transactionId)).isTrue(); @@ -86,7 +86,7 @@ void testSamplingUpperBoundary() { @Test void testSamplingLowerBoundary() { long lowerBound = -Long.MAX_VALUE / 2; - final Id transactionId = Id.new128BitId(); + final IdImpl transactionId = IdImpl.new128BitId(); transactionId.fromLongs((long) 0, lowerBound + 1); assertThat(ProbabilitySampler.of(0.5).isSampled(transactionId)).isTrue(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationTest.java index fb285b04c8..9ab5b69994 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/stacktrace/StacktraceConfigurationTest.java @@ -31,7 +31,7 @@ class StacktraceConfigurationTest { void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceMinDurationNonDefault_thenGetValueFromSpanStackTraceMinDuration() { ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(SimpleSource.forTest("span_frames_min_duration", "10ms").add("span_stack_trace_min_duration", "15ms")); - long actual = configRegistry.getConfig(StacktraceConfiguration.class).getSpanStackTraceMinDurationMs(); + long actual = configRegistry.getConfig(StacktraceConfigurationImpl.class).getSpanStackTraceMinDurationMs(); assertThat(actual).isEqualTo(15); } @@ -39,7 +39,7 @@ void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceMinDurationNonDefault_ void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceDefault_whenSpanFramesNonDefault_thenGetValueFromSpanFramesMinDuration() { ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(SimpleSource.forTest("span_frames_min_duration", "15ms")); - long actual = configRegistry.getConfig(StacktraceConfiguration.class).getSpanStackTraceMinDurationMs(); + long actual = configRegistry.getConfig(StacktraceConfigurationImpl.class).getSpanStackTraceMinDurationMs(); assertThat(actual).isEqualTo(15); } @@ -47,7 +47,7 @@ void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceDefault_whenSpanFrames void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceDefault_whenSpanFramesMinDurationIsZero_thenGetSwappedValueOfSpanFramesMinDuration() { ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(SimpleSource.forTest("span_frames_min_duration", "0ms")); - long actual = configRegistry.getConfig(StacktraceConfiguration.class).getSpanStackTraceMinDurationMs(); + long actual = configRegistry.getConfig(StacktraceConfigurationImpl.class).getSpanStackTraceMinDurationMs(); assertThat(actual).isEqualTo(-1); } @@ -55,7 +55,7 @@ void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceDefault_whenSpanFrames void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceDefault_whenSpanFramesMinDurationIsNegative_thenGetSwappedValueOfSpanFramesMinDuration() { ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(SimpleSource.forTest("span_frames_min_duration", "-1ms")); - long actual = configRegistry.getConfig(StacktraceConfiguration.class).getSpanStackTraceMinDurationMs(); + long actual = configRegistry.getConfig(StacktraceConfigurationImpl.class).getSpanStackTraceMinDurationMs(); assertThat(actual).isEqualTo(0); } @@ -63,7 +63,7 @@ void testGetSpanStackTraceMinDurationMs_whenSpanStackTraceDefault_whenSpanFrames void testGetSpanStackTraceMinDurationMs_defaultValue() { ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(); - long actual = configRegistry.getConfig(StacktraceConfiguration.class).getSpanStackTraceMinDurationMs(); + long actual = configRegistry.getConfig(StacktraceConfigurationImpl.class).getSpanStackTraceMinDurationMs(); assertThat(actual).isEqualTo(5); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/AbstractCompressionStrategyTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/AbstractCompressionStrategyTest.java index 99c576f68b..b5aa5fe896 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/AbstractCompressionStrategyTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/AbstractCompressionStrategyTest.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpanConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.context.ServiceTarget; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.tracer.dispatch.TextHeaderSetter; @@ -81,9 +81,9 @@ void testCompositeSpanIsNotCreatedWhenCompressionIsNotEnabled() { startExitSpan(t).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(3); - assertThat(reportedSpans).filteredOn(Span::isComposite).isEmpty(); + assertThat(reportedSpans).filteredOn(SpanImpl::isComposite).isEmpty(); } finally { doReturn(true).when(tracer.getConfig(SpanConfiguration.class)).isSpanCompressionEnabled(); } @@ -92,16 +92,16 @@ void testCompositeSpanIsNotCreatedWhenCompressionIsNotEnabled() { @Test void testCompositeSpanIsCreated() { runInTransactionScope(t -> { - Span span1 = startExitSpan(t); + SpanImpl span1 = startExitSpan(t); span1.setStartTimestamp(0); span1.end(1234); - Span span2 = startExitSpan(t); + SpanImpl span2 = startExitSpan(t); span2.setStartTimestamp(2345); span2.end(3456); - Span span3 = startExitSpan(t); + SpanImpl span3 = startExitSpan(t); span3.setStartTimestamp(3456); span3.end(4567); - Span span4 = startExitSpan(t); + SpanImpl span4 = startExitSpan(t); span4.setStartTimestamp(3467); span4.end(4556); }); @@ -110,7 +110,7 @@ void testCompositeSpanIsCreated() { startExitSpan(t).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 4); assertThat(reportedSpans.get(0).getComposite().getSum()).isEqualTo(1234 + (3456 - 2345) + (4567 - 3456) + (4556 - 3467)); @@ -129,7 +129,7 @@ void testUnknownOutcomeStopsRegularCompression() { startExitSpan(t).withOutcome(Outcome.UNKNOWN).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -147,7 +147,7 @@ void testUnknownOutcomeStopsCompositeCompression() { startExitSpan(t).withOutcome(Outcome.UNKNOWN).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -164,7 +164,7 @@ void testFailedOutcomeStopsRegularCompression() { startExitSpan(t).withOutcome(Outcome.FAILURE).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -182,7 +182,7 @@ void testFailedOutcomeStopsCompositeCompression() { startExitSpan(t).withOutcome(Outcome.FAILURE).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -196,14 +196,14 @@ void testFailedOutcomeStopsCompositeCompression() { void testContextPropagationStopsRegularCompression() { runInTransactionScope(t -> { startExitSpan(t).end(); - Span span = startExitSpan(t); + SpanImpl span = startExitSpan(t); span.propagateContext(new HashMap(), (TextHeaderSetter>) (h, v, c) -> { c.put(h, v); }, null); span.end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -218,14 +218,14 @@ void testContextPropagationStopsCompositeCompression() { runInTransactionScope(t -> { startExitSpan(t).end(); startExitSpan(t).end(); - Span span = startExitSpan(t); + SpanImpl span = startExitSpan(t); span.propagateContext(new HashMap(), (TextHeaderSetter>) (h, v, c) -> { c.put(h, v); }, null); span.end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -242,7 +242,7 @@ void testNonExitSpanStopsRegularCompression() { startSpan(t).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -260,7 +260,7 @@ void testNonExitSpanStopsCompositeCompression() { startSpan(t).end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -277,7 +277,7 @@ void testDifferentTypeStopsRegularCompression() { startExitSpan(t).withType("another_type").end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -295,7 +295,7 @@ void testDifferentTypeStopsCompositeCompression() { startExitSpan(t).withType("another_type").end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -312,7 +312,7 @@ void testDifferentSubtypeStopsRegularCompression() { startExitSpan(t).withSubtype("another_subtype").end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -330,7 +330,7 @@ void testDifferentSubtypeStopsCompositeCompression() { startExitSpan(t).withSubtype("another_subtype").end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -344,7 +344,7 @@ void testDifferentSubtypeStopsCompositeCompression() { void testSpanExceedingMaxDurationStopsRegularCompression() { runInTransactionScope(t -> { startExitSpan(t).end(); - Span span = startExitSpan(t); + SpanImpl span = startExitSpan(t); try { Thread.sleep(100); } catch (InterruptedException e) { @@ -353,7 +353,7 @@ void testSpanExceedingMaxDurationStopsRegularCompression() { span.end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -368,7 +368,7 @@ void testSpanExceedingMaxDurationStopsCompositeCompression() { runInTransactionScope(t -> { startExitSpan(t).end(); startExitSpan(t).end(); - Span span = startExitSpan(t); + SpanImpl span = startExitSpan(t); try { Thread.sleep(100); } catch (InterruptedException e) { @@ -377,7 +377,7 @@ void testSpanExceedingMaxDurationStopsCompositeCompression() { span.end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -391,7 +391,7 @@ void testSpanExceedingMaxDurationStopsCompositeCompression() { void testDifferentDestinationServiceResourceStopsRegularCompression() { runInTransactionScope(t -> { startExitSpan(t).end(); - Span span = startExitSpan(t); + SpanImpl span = startExitSpan(t); // set alternative resource from user API assertThat(span.getContext().getServiceTarget().withUserType(null).withUserName("another_resource").withNameOnlyDestinationResource()) @@ -401,7 +401,7 @@ void testDifferentDestinationServiceResourceStopsRegularCompression() { span.end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -416,10 +416,10 @@ void testDifferentDestinationServiceResourceStopsCompositeCompression() { runInTransactionScope(t -> { startExitSpan(t).end(); startExitSpan(t).end(); - Span span = startExitSpan(t); + SpanImpl span = startExitSpan(t); // set alternative resource from type - ServiceTarget serviceTarget = span.getContext().getServiceTarget(); + ServiceTargetImpl serviceTarget = span.getContext().getServiceTarget(); serviceTarget.resetState(); assertThat(serviceTarget.withType("another")) .hasType("another") @@ -428,7 +428,7 @@ void testDifferentDestinationServiceResourceStopsCompositeCompression() { span.end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -438,8 +438,8 @@ void testDifferentDestinationServiceResourceStopsCompositeCompression() { assertThat(spanCount.getDropped().get()).isEqualTo(1); } - protected static void runInTransactionScope(Consumer> r) { - Transaction transaction = tracer.startRootTransaction(null).withName("Some Transaction"); + protected static void runInTransactionScope(Consumer> r) { + TransactionImpl transaction = tracer.startRootTransaction(null).withName("Some Transaction"); try { r.accept(transaction); } finally { @@ -447,24 +447,24 @@ protected static void runInTransactionScope(Consumer> r) { } } - protected Span startExitSpan(AbstractSpan parent) { - Span span = startSpan(parent).asExit(); + protected SpanImpl startExitSpan(AbstractSpanImpl parent) { + SpanImpl span = startSpan(parent).asExit(); span.getContext().getServiceTarget().withType("service-type").withName("service-name"); return span; } - protected Span startSpan(AbstractSpan parent) { + protected SpanImpl startSpan(AbstractSpanImpl parent) { return parent.createSpan().withName(getSpanName()).withType("some_type").withSubtype("some_subtype"); } protected abstract String getSpanName(); - protected void assertCompositeSpan(Span span, int count) { + protected void assertCompositeSpan(SpanImpl span, int count) { assertThat(span.isComposite()).isTrue(); assertThat(span.getComposite().getCount()).isEqualTo(count); assertThat(span.getComposite().getCompressionStrategy()).isEqualTo(compressionStrategy); assertThat(span.getNameAsString()).isEqualTo(getCompositeSpanName(span)); } - protected abstract String getCompositeSpanName(Span span); + protected abstract String getCompositeSpanName(SpanImpl span); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/BaggageTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/BaggageTest.java index 1dbfe383eb..86e55f56b0 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/BaggageTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/BaggageTest.java @@ -20,16 +20,16 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; import co.elastic.apm.agent.impl.baggage.BaggageContext; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Scope; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -67,7 +67,7 @@ public void checkChildTransactionBaggageParsingWithTracestate() { headers.put("traceparent", "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); headers.put("baggage", "key1=val1,key2=val2"); - Transaction transaction = tracer.startChildTransaction(headers, TextHeaderMapAccessor.INSTANCE, null); + TransactionImpl transaction = tracer.startChildTransaction(headers, TextHeaderMapAccessor.INSTANCE, null); assertThat(transaction.getTraceContext()) .satisfies(tc -> assertThat(tc.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c")) .satisfies(tc -> Assertions.assertThat(tc.getParentId().toString()).isEqualTo("b9c7c989f97918e1")); @@ -82,7 +82,7 @@ public void checkChildTransactionBaggageParsingWithoutTracestate() { Map headers = new HashMap<>(); headers.put("baggage", "key1=val1,key2=val2"); - Transaction transaction = tracer.startChildTransaction(headers, TextHeaderMapAccessor.INSTANCE, null); + TransactionImpl transaction = tracer.startChildTransaction(headers, TextHeaderMapAccessor.INSTANCE, null); assertThat(transaction) .hasBaggageCount(2) .hasBaggage("key1", "val1") @@ -95,12 +95,12 @@ public void checkChildTransactionOverridesCurrentBaggage() { Map headers = new HashMap<>(); headers.put("baggage", "key1=val1"); - ElasticContext baggageContext = tracer.currentContext().withUpdatedBaggage() + TraceState baggageContext = tracer.currentContext().withUpdatedBaggage() .put("key1", "rootval1") .put("key2", "rootval2") .buildContext() .activate(); - Transaction transaction = tracer.startChildTransaction(headers, TextHeaderMapAccessor.INSTANCE, null); + TransactionImpl transaction = tracer.startChildTransaction(headers, TextHeaderMapAccessor.INSTANCE, null); baggageContext.deactivate(); @@ -112,12 +112,12 @@ public void checkChildTransactionOverridesCurrentBaggage() { @Test public void checkRootTransactionInheritsCurrentBaggage() { - ElasticContext baggageContext = tracer.currentContext().withUpdatedBaggage() + TraceState baggageContext = tracer.currentContext().withUpdatedBaggage() .put("key1", "rootval1") .put("key2", "rootval2") .buildContext() .activate(); - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); baggageContext.deactivate(); assertThat(transaction) @@ -129,10 +129,10 @@ public void checkRootTransactionInheritsCurrentBaggage() { @Test public void checkSpanInheritsParentBaggage() { - Transaction transaction; - Span span1, span2, span3, span4; + TransactionImpl transaction; + SpanImpl span1, span2, span3, span4; - ElasticContext baggage1 = tracer.currentContext().withUpdatedBaggage() + TraceState baggage1 = tracer.currentContext().withUpdatedBaggage() .put("key1", "rootval1") .put("key2", "rootval2") .buildContext(); @@ -142,7 +142,7 @@ public void checkSpanInheritsParentBaggage() { span1 = tracer.currentContext().createSpan(); - ElasticContext baggage2 = tracer.currentContext().withUpdatedBaggage() + TraceState baggage2 = tracer.currentContext().withUpdatedBaggage() .put("key1", "baggage2_override") .buildContext(); try (Scope sc2 = baggage2.activateInScope()) { @@ -153,7 +153,7 @@ public void checkSpanInheritsParentBaggage() { span3 = tracer.currentContext().createSpan(); - ElasticContext baggage3 = tracer.currentContext().withUpdatedBaggage() + TraceState baggage3 = tracer.currentContext().withUpdatedBaggage() .put("key3", "baggage3_override") .remove("key2") .buildContext(); @@ -194,7 +194,7 @@ public void checkSpanInheritsParentBaggage() { @Test public void checkBaggagePropagationWithoutTrace() { - ElasticContext baggage = tracer.currentContext().withUpdatedBaggage() + TraceState baggage = tracer.currentContext().withUpdatedBaggage() .put("key", "val") .buildContext(); @@ -217,12 +217,12 @@ public void checkBaggagePropagationWithoutTrace() { @Test public void checkBaggagePropagationFromTransaction() { - ElasticContext baggage = tracer.currentContext().withUpdatedBaggage() + TraceState baggage = tracer.currentContext().withUpdatedBaggage() .put("key", "val") .buildContext() .activate(); - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); baggage.deactivate(); @@ -239,13 +239,13 @@ public void checkBaggagePropagationFromTransaction() { @Test public void checkBaggagePropagationFromSpan() { - ElasticContext baggage = tracer.currentContext().withUpdatedBaggage() + TraceState baggage = tracer.currentContext().withUpdatedBaggage() .put("key", "val") .buildContext() .activate(); - Transaction transaction = tracer.startRootTransaction(null); - Span span = transaction.createSpan(); + TransactionImpl transaction = tracer.startRootTransaction(null); + SpanImpl span = transaction.createSpan(); baggage.deactivate(); @@ -265,17 +265,17 @@ public void checkBaggagePropagationFromSpan() { public void checkBaggageLiftingToAttributes() { doReturn(List.of(WildcardMatcher.valueOf("foo*"), WildcardMatcher.valueOf("bar*"))) - .when(config.getConfig(CoreConfiguration.class)).getBaggageToAttach(); + .when(config.getConfig(CoreConfigurationImpl.class)).getBaggageToAttach(); - ElasticContext baggage = tracer.currentContext().withUpdatedBaggage() + TraceState baggage = tracer.currentContext().withUpdatedBaggage() .put("foo.key", "foo_val") .put("ignore", "ignore") .buildContext() .activate(); - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); - Span span = transaction + SpanImpl span = transaction .withUpdatedBaggage() .put("foo.key", "foo_updated_val") .put("bar.key", "bar_val") @@ -298,16 +298,16 @@ public void checkBaggageLiftingToAttributes() { @Test void testStandaloneExceptionCapturesBaggage() { doReturn(List.of(WildcardMatcher.valueOf("foo*"), WildcardMatcher.valueOf("bar*"))) - .when(config.getConfig(CoreConfiguration.class)).getBaggageToAttach(); + .when(config.getConfig(CoreConfigurationImpl.class)).getBaggageToAttach(); BaggageContext parentCtx = tracer.currentContext().withUpdatedBaggage() .put("foo.bar", "foo_val") .put("ignoreme", "ignore") .buildContext(); - ErrorCapture errorCapture = tracer.captureException(new RuntimeException(), parentCtx, null); + ErrorCaptureImpl errorCapture = tracer.captureException(new RuntimeException(), parentCtx, null); - TransactionContext ctx = errorCapture.getContext(); + TransactionContextImpl ctx = errorCapture.getContext(); assertThat(ctx.getLabel("baggage.foo.bar")).isEqualTo("foo_val"); assertThat(ctx.getLabel("baggage.ignoreme")).isNull(); } @@ -316,9 +316,9 @@ void testStandaloneExceptionCapturesBaggage() { @Test void testExceptionInheritsBaggageFromParentSpan() { doReturn(List.of(WildcardMatcher.valueOf("foo*"), WildcardMatcher.valueOf("bar*"))) - .when(config.getConfig(CoreConfiguration.class)).getBaggageToAttach(); + .when(config.getConfig(CoreConfigurationImpl.class)).getBaggageToAttach(); - Span parentSpan = tracer.startRootTransaction(null) + SpanImpl parentSpan = tracer.startRootTransaction(null) .withUpdatedBaggage() .put("foo.bar", "foo_val") .put("ignoreme", "ignore") @@ -328,9 +328,9 @@ void testExceptionInheritsBaggageFromParentSpan() { parentSpan.captureException(new RuntimeException()); assertThat(mockReporter.getErrors()).hasSize(1); - ErrorCapture errorCapture = mockReporter.getErrors().get(0); + ErrorCaptureImpl errorCapture = mockReporter.getErrors().get(0); - TransactionContext ctx = errorCapture.getContext(); + TransactionContextImpl ctx = errorCapture.getContext(); assertThat(ctx.getLabel("baggage.foo.bar")).isEqualTo("foo_val"); assertThat(ctx.getLabel("baggage.ignoreme")).isNull(); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/ExactMatchCompressionStrategyTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/ExactMatchCompressionStrategyTest.java index 64ad5d4c42..f750f0a985 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/ExactMatchCompressionStrategyTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/ExactMatchCompressionStrategyTest.java @@ -46,7 +46,7 @@ void testDifferentNameStopsRegularCompression() { startExitSpan(t).withName("Another Name").end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertThat(reportedSpans.get(0).isComposite()).isFalse(); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -60,7 +60,7 @@ void testDifferentNameStopsCompositeCompression() { startExitSpan(t).withName("Another Name").end(); }); - List reportedSpans = reporter.getSpans(); + List reportedSpans = reporter.getSpans(); assertThat(reportedSpans).hasSize(2); assertCompositeSpan(reportedSpans.get(0), 2); assertThat(reportedSpans.get(1).isComposite()).isFalse(); @@ -72,7 +72,7 @@ protected String getSpanName() { } @Override - protected String getCompositeSpanName(Span span) { + protected String getCompositeSpanName(SpanImpl span) { return getSpanName(); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/FastExitSpanTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/FastExitSpanTest.java index 47d3d45baf..44ae314789 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/FastExitSpanTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/FastExitSpanTest.java @@ -59,7 +59,7 @@ void resetReporter() { @Test void testExitSpanBelowDuration() { - Transaction transaction = startTransaction(); + TransactionImpl transaction = startTransaction(); try { // each combination of (outcome,service target type, service target name) should have its own bucket for (Outcome outcome : Outcome.values()) { @@ -67,7 +67,7 @@ void testExitSpanBelowDuration() { startExitSpan(transaction, 0L).withOutcome(outcome).end(49_999L); // with service target name - Span spanWithServiceTargetName = startExitSpan(transaction, 0L).withOutcome(outcome); + SpanImpl spanWithServiceTargetName = startExitSpan(transaction, 0L).withOutcome(outcome); spanWithServiceTargetName.getContext().getDb().withInstance("db-name"); spanWithServiceTargetName.end(49_999L); } @@ -99,15 +99,15 @@ void testExitSpanBelowDuration() { @Test void testCompositeExitSpanBelowDurationAndMoreThanOneDroppedSpanStatsEntry() { - Transaction transaction = startTransaction(); + TransactionImpl transaction = startTransaction(); try { - Span span = startExitSpan(transaction, 0L); + SpanImpl span = startExitSpan(transaction, 0L); span.end(10_000L); startExitSpan(transaction, 10_000L).end(20_000L); startExitSpan(transaction, 20_000L).end(30_000L); assertThat(span.isComposite()).isTrue(); //second span destination to ensure more than one dropped span stats entry - Span span2 = startExitSpan(transaction, 30_000L, "mysql"); + SpanImpl span2 = startExitSpan(transaction, 30_000L, "mysql"); span2.end(40_000L); startExitSpan(transaction, 40_000L, "mysql").end(50_000L); assertThat(span2.isComposite()).isTrue(); @@ -129,7 +129,7 @@ void testCompositeExitSpanBelowDurationAndMoreThanOneDroppedSpanStatsEntry() { @Test void testExitSpanAboveDuration() { - Transaction transaction = startTransaction(); + TransactionImpl transaction = startTransaction(); try { startExitSpan(transaction, 0L).end(50_001L); } finally { @@ -148,9 +148,9 @@ void testExitSpanAboveDuration() { @Test void testCompositeExitSpanAboveDuration() { - Transaction transaction = startTransaction(); + TransactionImpl transaction = startTransaction(); try { - Span span = startExitSpan(transaction, 0L); + SpanImpl span = startExitSpan(transaction, 0L); span.end(20_000L); startExitSpan(transaction, 20_000L).end(40_000L); startExitSpan(transaction, 40_000L).end(60_000L); @@ -170,16 +170,16 @@ void testCompositeExitSpanAboveDuration() { assertThat(droppedSpanStats.getStats("postgresql", null, Outcome.SUCCESS)).isNull(); } - private Transaction startTransaction() { + private TransactionImpl startTransaction() { return tracer.startRootTransaction(null).withName("Some Transaction"); } - protected Span startExitSpan(AbstractSpan parent, long startTimestamp) { + protected SpanImpl startExitSpan(AbstractSpanImpl parent, long startTimestamp) { return startExitSpan(parent, startTimestamp, "postgresql"); } - protected Span startExitSpan(AbstractSpan parent, long startTimestamp, String subtype) { - Span span = parent.createExitSpan().withName("Some Name").withType("db").withSubtype(subtype); + protected SpanImpl startExitSpan(AbstractSpanImpl parent, long startTimestamp, String subtype) { + SpanImpl span = parent.createExitSpan().withName("Some Name").withType("db").withSubtype(subtype); span.getContext().getDestination().withAddress("127.0.0.1").withPort(5432); span.setStartTimestamp(startTimestamp); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/IdTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/IdTest.java index dddc596a3f..734240c5ac 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/IdTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/IdTest.java @@ -26,7 +26,7 @@ class IdTest { @Test void testReInit() { - final Id id = Id.new64BitId(); + final IdImpl id = IdImpl.new64BitId(); id.fromHexString("0000000000000001", 0); assertThat(id.toString()).isEqualTo("0000000000000001"); @@ -39,7 +39,7 @@ void testReInit() { @Test void testReset() { - final Id id = Id.new64BitId(); + final IdImpl id = IdImpl.new64BitId(); id.fromHexString("0000000000000001", 0); assertThat(id.toString()).isEqualTo("0000000000000001"); @@ -52,7 +52,7 @@ void testReset() { @Test void testInitEmpty() { - final Id id = Id.new64BitId(); + final IdImpl id = IdImpl.new64BitId(); assertThat(id.toString()).isEqualTo("0000000000000000"); assertThat(id.isEmpty()).isTrue(); @@ -67,7 +67,7 @@ void testInitEmpty() { @Test void testFromAndToLong() { - final Id id = Id.new128BitId(); + final IdImpl id = IdImpl.new128BitId(); id.fromLongs(21, 42); assertThat(id.isEmpty()).isFalse(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SameKindCompressionStrategyTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SameKindCompressionStrategyTest.java index bd8b2b1692..2f1e776cae 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SameKindCompressionStrategyTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SameKindCompressionStrategyTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.impl.transaction; -import co.elastic.apm.agent.impl.context.ServiceTarget; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; class SameKindCompressionStrategyTest extends AbstractCompressionStrategyTest { @@ -34,9 +34,9 @@ protected String getSpanName() { } @Override - protected String getCompositeSpanName(Span span) { + protected String getCompositeSpanName(SpanImpl span) { StringBuilder name = new StringBuilder().append("Calls to "); - ServiceTarget serviceTarget = span.getContext().getServiceTarget(); + ServiceTargetImpl serviceTarget = span.getContext().getServiceTarget(); name.append(serviceTarget.getType()); name.append("/"); name.append(serviceTarget.getName()); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanCompressionIT.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanCompressionIT.java index d83082b0b5..a4b2d43a59 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanCompressionIT.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanCompressionIT.java @@ -111,8 +111,8 @@ void testParallelNonCompressibleExitSpanCreationWithRecycling() { } - private static void runInTransactionScope(BiFunction, Integer, Runnable> r) { - Transaction transaction = tracer.startRootTransaction(null).withName("Some Transaction"); + private static void runInTransactionScope(BiFunction, Integer, Runnable> r) { + TransactionImpl transaction = tracer.startRootTransaction(null).withName("Some Transaction"); try { CompletableFuture[] tasks = new CompletableFuture[numberOfSpans]; for (int i = 0; i < numberOfSpans; ++i) { @@ -125,25 +125,25 @@ private static void runInTransactionScope(BiFunction, Integer, R } } - private static void createSpan(AbstractSpan parent, long startTimestamp, long endTimestamp) { - Span span = parent.createSpan().withName("Some Name").withType("app"); + private static void createSpan(AbstractSpanImpl parent, long startTimestamp, long endTimestamp) { + SpanImpl span = parent.createSpan().withName("Some Name").withType("app"); span.setStartTimestamp(startTimestamp); span.end(endTimestamp); } - private static void createExitSpan(AbstractSpan parent, long startTimestamp, long endTimestamp, String subtype) { - Span span = parent.createSpan().asExit().withName("Some Other Name").withType("db").withSubtype(subtype); + private static void createExitSpan(AbstractSpanImpl parent, long startTimestamp, long endTimestamp, String subtype) { + SpanImpl span = parent.createSpan().asExit().withName("Some Other Name").withType("db").withSubtype(subtype); span.getContext().getDestination().withAddress("127.0.0.1").withPort(5432); span.setStartTimestamp(startTimestamp); span.end(endTimestamp); } - private static void assertReportedSpans(List reportedSpans) { + private static void assertReportedSpans(List reportedSpans) { int numberOfReportedSpans = reportedSpans.stream() .mapToInt(s -> s.isComposite() ? s.getComposite().getCount() : 1) .sum(); assertThat(numberOfReportedSpans).isEqualTo(numberOfReportedSpans); - assertThat(reportedSpans).filteredOn(Span::isComposite) + assertThat(reportedSpans).filteredOn(SpanImpl::isComposite) .allSatisfy(span -> { int numberOfCompositeSpans = span.getComposite().getCount(); assertThat(span.getDuration()).isGreaterThanOrEqualTo(1000L + numberOfCompositeSpans - 1L); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanTest.java index 7b7bbae19b..6e571b0570 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/SpanTest.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; import co.elastic.apm.agent.impl.Utf8HeaderMapAccessor; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.tracer.Outcome; @@ -51,7 +51,7 @@ void setUp() { @Test void resetState() { - Span span = new Span(tracer) + SpanImpl span = new SpanImpl(tracer) .withName("SELECT FROM product_types") .withType("db") .withSubtype("postgresql") @@ -72,9 +72,9 @@ void resetState() { @Test void testOutcomeExplicitlyToUnknown() { - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); - Span span = transaction.createSpan() + SpanImpl span = transaction.createSpan() .withName("SELECT FROM product_types") .withType("db") .withSubtype("postgresql") @@ -89,7 +89,7 @@ void testOutcomeExplicitlyToUnknown() { @Test void normalizeEmptyFields() { - Span span = new Span(tracer) + SpanImpl span = new SpanImpl(tracer) .withName("span"); assertThat(span.withType("").getType()).isNull(); @@ -101,11 +101,11 @@ void normalizeEmptyFields() { @MethodSource("typeTestArguments") void normalizeType(String type, String expectedType) { - Transaction transaction = new Transaction(tracer); - transaction.startRoot(0, ConstantSampler.of(true), Baggage.EMPTY); + TransactionImpl transaction = new TransactionImpl(tracer); + transaction.startRoot(0, ConstantSampler.of(true), BaggageImpl.EMPTY); try { - Span span = new Span(tracer); - span.start(TraceContext.fromParent(), transaction, Baggage.EMPTY, -1L); + SpanImpl span = new SpanImpl(tracer); + span.start(TraceContextImpl.fromParent(), transaction, BaggageImpl.EMPTY, -1L); assertThat(span.getType()) .describedAs("span type should not be set by default") .isNull(); @@ -129,12 +129,12 @@ static Stream typeTestArguments() { @Test void testSpanLinks() { TestObjectPoolFactory objectPoolFactory = (TestObjectPoolFactory) tracer.getObjectPoolFactory(); - Transaction transaction = tracer.startRootTransaction(null); - Span testSpan = Objects.requireNonNull(transaction).createSpan(); + TransactionImpl transaction = tracer.startRootTransaction(null); + SpanImpl testSpan = Objects.requireNonNull(transaction).createSpan(); assertThat(objectPoolFactory.getSpanLinksPool().getObjectsInPool()).isEqualTo(0); assertThat(objectPoolFactory.getSpanLinksPool().getRequestedObjectCount()).isEqualTo(0); assertThat(testSpan.getSpanLinks()).isEmpty(); - Span parent1 = transaction.createSpan(); + SpanImpl parent1 = transaction.createSpan(); Map textTraceContextCarrier = new HashMap<>(); parent1.propagateContext(textTraceContextCarrier, TextHeaderMapAccessor.INSTANCE, null); assertThat(testSpan.addSpanLink( @@ -144,7 +144,7 @@ void testSpanLinks() { assertThat(objectPoolFactory.getSpanLinksPool().getObjectsInPool()).isEqualTo(0); assertThat(objectPoolFactory.getSpanLinksPool().getRequestedObjectCount()).isEqualTo(1); assertThat(testSpan.getSpanLinks()).hasSize(1); - Span parent2 = transaction.createSpan(); + SpanImpl parent2 = transaction.createSpan(); Map utfTraceContextCarrier = new HashMap<>(); parent2.propagateContext(utfTraceContextCarrier, Utf8HeaderMapAccessor.INSTANCE, null); assertThat(testSpan.addSpanLink( @@ -153,7 +153,7 @@ void testSpanLinks() { ).isTrue(); assertThat(objectPoolFactory.getSpanLinksPool().getObjectsInPool()).isEqualTo(0); assertThat(objectPoolFactory.getSpanLinksPool().getRequestedObjectCount()).isEqualTo(2); - List spanLinks = testSpan.getSpanLinks(); + List spanLinks = testSpan.getSpanLinks(); assertThat(spanLinks).hasSize(2); assertThat(spanLinks.get(0).getTraceId()).isEqualTo(parent1.getTraceContext().getTraceId()); assertThat(spanLinks.get(0).getParentId()).isEqualTo(parent1.getTraceContext().getId()); @@ -166,10 +166,10 @@ void testSpanLinks() { @Test void testSpanLinksUniqueness() { - Transaction transaction = tracer.startRootTransaction(null); - Span testSpan = Objects.requireNonNull(transaction).createSpan(); + TransactionImpl transaction = tracer.startRootTransaction(null); + SpanImpl testSpan = Objects.requireNonNull(transaction).createSpan(); assertThat(testSpan.getSpanLinks()).isEmpty(); - Span parent1 = transaction.createSpan(); + SpanImpl parent1 = transaction.createSpan(); Map textTraceContextCarrier = new HashMap<>(); parent1.propagateContext(textTraceContextCarrier, TextHeaderMapAccessor.INSTANCE, null); assertThat(testSpan.addSpanLink( @@ -195,11 +195,11 @@ void testSpanLinksUniqueness() { } /** - * A utility to enable arbitrary tests to set an existing {@link Span} state without making this functionality globally accessible + * A utility to enable arbitrary tests to set an existing {@link SpanImpl} state without making this functionality globally accessible * @param recorded should the provided trace context be recorded * @param span a span of which state is to be set */ - public static void setRecorded(boolean recorded, Span span) { + public static void setRecorded(boolean recorded, SpanImpl span) { span.getTraceContext().setRecorded(recorded); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextTest.java index e1f5c0a1d1..0425a58567 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; @@ -66,18 +66,18 @@ public void setup() { /** * Test flow: * 1. create a parent context from a fixed string - * 2. create a child based on the string header - test {@link TraceContext#asChildOf(String)} - * 3. create a grandchild based on byte[] utf8 header - test {@link TraceContext#propagateTraceContext(Object, HeaderSetter)} - * and {@link TraceContext#asChildOf(Object, HeaderGetter, boolean)} with utf8 encoded byte[]s - * 4. create a second grandchild based on text header - test both {@link TraceContext#getOutgoingTraceParentTextHeader()} - * and {@link TraceContext#asChildOf(String)} + * 2. create a child based on the string header - test {@link TraceContextImpl#asChildOf(String)} + * 3. create a grandchild based on byte[] utf8 header - test {@link TraceContextImpl#propagateTraceContext(Object, HeaderSetter)} + * and {@link TraceContextImpl#asChildOf(Object, HeaderGetter, boolean)} with utf8 encoded byte[]s + * 4. create a second grandchild based on text header - test both {@link TraceContextImpl#getOutgoingTraceParentTextHeader()} + * and {@link TraceContextImpl#asChildOf(String)} * * @param flagsValue tested flags * @param isSampled whether to test context propagation of sampled trace or not */ private void mixTextAndBinaryParsingAndContextPropagation(String flagsValue, boolean isSampled) { - Map textHeaderMap = Map.of(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-" + flagsValue); - final TraceContext child = TraceContext.with64BitId(tracer); + Map textHeaderMap = Map.of(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-" + flagsValue); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); assertThat(child.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c"); assertThat(child.getParentId().toString()).isEqualTo("b9c7c989f97918e1"); @@ -85,7 +85,7 @@ private void mixTextAndBinaryParsingAndContextPropagation(String flagsValue, boo assertThat(child.isSampled()).isEqualTo(isSampled); // create a grandchild to ensure proper regenerated trace context - final TraceContext grandchild1 = TraceContext.with64BitId(tracer); + final TraceContextImpl grandchild1 = TraceContextImpl.with64BitId(tracer); final Map binaryHeaderMap = new HashMap<>(); child.propagateTraceContext(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE); assertThat(grandchild1.asChildOf(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE)).isTrue(); @@ -96,7 +96,7 @@ private void mixTextAndBinaryParsingAndContextPropagation(String flagsValue, boo String childHeader = child.getOutgoingTraceParentTextHeader().toString(); assertThat(childHeader).endsWith("-" + flagsValue); - final TraceContext grandchild2 = TraceContext.with64BitId(tracer); + final TraceContextImpl grandchild2 = TraceContextImpl.with64BitId(tracer); assertThat(grandchild2.asChildOf(childHeader)).isTrue(); assertThat(grandchild2.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c"); assertThat(grandchild2.getParentId().toString()).isEqualTo(child.getId().toString()); @@ -121,8 +121,8 @@ void parseFromTraceParentHeaderUnsupportedFlag() { @Test void testChildOfElasticTraceparentHeader() { - Map textHeaderMap = Map.of(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - final TraceContext child = TraceContext.with64BitId(tracer); + Map textHeaderMap = Map.of(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); assertThat(child.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c"); assertThat(child.getParentId().toString()).isEqualTo("b9c7c989f97918e1"); @@ -133,10 +133,10 @@ void testChildOfElasticTraceparentHeader() { @Test void testW3CTraceparentHeaderPrecedence() { Map textHeaderMap = Map.of( - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00", - TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-dd8448eb211c80319c0af7651916cd43-f97918e1b9c7c989-01" + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00", + TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-dd8448eb211c80319c0af7651916cd43-f97918e1b9c7c989-01" ); - final TraceContext child = TraceContext.with64BitId(tracer); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); assertThat(child.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c"); assertThat(child.getParentId().toString()).isEqualTo("b9c7c989f97918e1"); @@ -147,11 +147,11 @@ void testW3CTraceparentHeaderPrecedence() { @Test void testInvalidElasticTraceparentHeader() { Map textHeaderMap = Map.of( - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01", + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01", // one char too short trace ID - TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-d8448eb211c80319c0af7651916cd43-f97918e1b9c7c989-00" + TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-d8448eb211c80319c0af7651916cd43-f97918e1b9c7c989-00" ); - final TraceContext child = TraceContext.with64BitId(tracer); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); // we should fallback to try the W3C header assertThat(child.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c"); @@ -162,39 +162,39 @@ void testInvalidElasticTraceparentHeader() { @Test void testElasticTraceparentHeaderDisabled() { - Map textHeaderMap = Map.of(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - final TraceContext child = TraceContext.with64BitId(tracer); + Map textHeaderMap = Map.of(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); Map outgoingHeaders = new HashMap<>(); - doReturn(false).when(config.getConfig(CoreConfiguration.class)).isElasticTraceparentHeaderEnabled(); + doReturn(false).when(config.getConfig(CoreConfigurationImpl.class)).isElasticTraceparentHeaderEnabled(); child.propagateTraceContext(outgoingHeaders, TextHeaderMapAccessor.INSTANCE); - assertThat(outgoingHeaders.get(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); - assertThat(outgoingHeaders.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNull(); + assertThat(outgoingHeaders.get(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); + assertThat(outgoingHeaders.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNull(); } @Test void testTraceContextTextHeadersRemoval() { Map headerMap = new HashMap<>(); - headerMap.put(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - headerMap.put(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - headerMap.put(TraceContext.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux"); - TraceContext.removeTraceContextHeaders(headerMap, TextHeaderMapAccessor.INSTANCE); - assertThat(headerMap.get(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNull(); - assertThat(headerMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNull(); - assertThat(headerMap.get(TraceContext.TRACESTATE_HEADER_NAME)).isNull(); + headerMap.put(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + headerMap.put(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + headerMap.put(TraceContextImpl.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux"); + TraceContextImpl.removeTraceContextHeaders(headerMap, TextHeaderMapAccessor.INSTANCE); + assertThat(headerMap.get(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNull(); + assertThat(headerMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNull(); + assertThat(headerMap.get(TraceContextImpl.TRACESTATE_HEADER_NAME)).isNull(); } @Test void testTraceContextHeadersCopy() { Map original = new HashMap<>(); - original.put(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - original.put(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); - original.put(TraceContext.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux"); + original.put(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + original.put(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + original.put(TraceContextImpl.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux"); Map copy = new HashMap<>(); - TraceContext.copyTraceContextTextHeaders(original, TextHeaderMapAccessor.INSTANCE, copy, TextHeaderMapAccessor.INSTANCE); - assertThat(copy.get(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); - assertThat(copy.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); - assertThat(copy.get(TraceContext.TRACESTATE_HEADER_NAME)).isNotNull(); + TraceContextImpl.copyTraceContextTextHeaders(original, TextHeaderMapAccessor.INSTANCE, copy, TextHeaderMapAccessor.INSTANCE); + assertThat(copy.get(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); + assertThat(copy.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); + assertThat(copy.get(TraceContextImpl.TRACESTATE_HEADER_NAME)).isNotNull(); } @Test @@ -203,7 +203,7 @@ void testTracestateHeader() { incomingHeaders.add("traceparent", "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); incomingHeaders.add("tracestate", "foo=bar"); incomingHeaders.add("tracestate", "baz=qux,quux=quuz"); - final TraceContext child = TraceContext.with64BitId(tracer); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(incomingHeaders, MultiValueMapAccessor.INSTANCE)).isTrue(); assertThat(child.getTraceId().toString()).isEqualTo("0af7651916cd43dd8448eb211c80319c"); assertThat(child.getParentId().toString()).isEqualTo("b9c7c989f97918e1"); @@ -212,43 +212,43 @@ void testTracestateHeader() { PotentiallyMultiValuedMap outgoingHeaders = new PotentiallyMultiValuedMap(); child.propagateTraceContext(outgoingHeaders, MultiValueMapAccessor.INSTANCE); assertThat(outgoingHeaders.size()).isEqualTo(3); - assertThat(outgoingHeaders.getFirst(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); - assertThat(outgoingHeaders.getAll(TraceContext.TRACESTATE_HEADER_NAME)).hasSize(1); - assertThat(outgoingHeaders.getFirst(TraceContext.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux,quux=quuz"); + assertThat(outgoingHeaders.getFirst(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); + assertThat(outgoingHeaders.getAll(TraceContextImpl.TRACESTATE_HEADER_NAME)).hasSize(1); + assertThat(outgoingHeaders.getFirst(TraceContextImpl.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux,quux=quuz"); } @Test void testTracestateHeaderSizeLimit() { - doReturn(20).when(config.getConfig(CoreConfiguration.class)).getTracestateSizeLimit(); + doReturn(20).when(config.getConfig(CoreConfigurationImpl.class)).getTracestateSizeLimit(); PotentiallyMultiValuedMap incomingHeaders = new PotentiallyMultiValuedMap(); incomingHeaders.add("traceparent", "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); incomingHeaders.add("tracestate", "foo=bar"); incomingHeaders.add("tracestate", "baz=qux,quux=quuz"); - final TraceContext child = TraceContext.with64BitId(tracer); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(incomingHeaders, MultiValueMapAccessor.INSTANCE)).isTrue(); PotentiallyMultiValuedMap outgoingHeaders = new PotentiallyMultiValuedMap(); child.propagateTraceContext(outgoingHeaders, MultiValueMapAccessor.INSTANCE); assertThat(outgoingHeaders.size()).isEqualTo(3); - assertThat(outgoingHeaders.getFirst(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); - assertThat(outgoingHeaders.getAll(TraceContext.TRACESTATE_HEADER_NAME)).hasSize(1); - assertThat(outgoingHeaders.getFirst(TraceContext.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux"); + assertThat(outgoingHeaders.getFirst(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotNull(); + assertThat(outgoingHeaders.getAll(TraceContextImpl.TRACESTATE_HEADER_NAME)).hasSize(1); + assertThat(outgoingHeaders.getFirst(TraceContextImpl.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux"); } @Test void testNoTracestateWhenInvalidTraceparentHeader() { Map textHeaderMap = Map.of( // one char too short trace ID - TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-d8448eb211c80319c0af7651916cd43-f97918e1b9c7c989-00", - TraceContext.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux" + TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-d8448eb211c80319c0af7651916cd43-f97918e1b9c7c989-00", + TraceContextImpl.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux" ); - final TraceContext child = TraceContext.with64BitId(tracer); + final TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isFalse(); assertThat(child.isRecorded()).isFalse(); Map outgoingHeaders = new HashMap<>(); child.propagateTraceContext(outgoingHeaders, TextHeaderMapAccessor.INSTANCE); - assertThat(outgoingHeaders.get(TraceContext.TRACESTATE_HEADER_NAME)).isNull(); + assertThat(outgoingHeaders.get(TraceContextImpl.TRACESTATE_HEADER_NAME)).isNull(); } private void verifyTraceContextContents(String traceContext, String expectedTraceId, String expectedParentId, @@ -262,7 +262,7 @@ private void verifyTraceContextContents(String traceContext, String expectedTrac @Test void outgoingHeader() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); final String header = "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-03"; assertThat(traceContext.asChildOf(header)).isTrue(); String parentId = traceContext.getId().toString(); @@ -270,13 +270,13 @@ void outgoingHeader() { "0af7651916cd43dd8448eb211c80319c", parentId, "00", "03"); Map headerMap = new HashMap<>(); traceContext.propagateTraceContext(headerMap, Utf8HeaderMapAccessor.INSTANCE); - verifyTraceContextContents(headerMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), + verifyTraceContextContents(headerMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), "0af7651916cd43dd8448eb211c80319c", parentId, "00", "03"); } @Test void outgoingHeaderRootSpan() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.asRootSpan(ConstantSampler.of(true)); assertThat(traceContext.isSampled()).isTrue(); String outgoingStringHeader = traceContext.getOutgoingTraceParentTextHeader().toString(); @@ -285,13 +285,13 @@ void outgoingHeaderRootSpan() { traceContext.getId().toString(), "00", "01"); Map headerMap = new HashMap<>(); traceContext.propagateTraceContext(headerMap, Utf8HeaderMapAccessor.INSTANCE); - verifyTraceContextContents(headerMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), traceContext.getTraceId().toString(), + verifyTraceContextContents(headerMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), traceContext.getTraceId().toString(), traceContext.getId().toString(), "00", "01"); } @Test void parseFromTraceParentHeader_notSampled() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); final String header = "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00"; assertThat(traceContext.asChildOf(header)).isTrue(); assertThat(traceContext.isSampled()).isFalse(); @@ -300,7 +300,7 @@ void parseFromTraceParentHeader_notSampled() { @Test void testResetState() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.asChildOf("00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00"); traceContext.resetState(); assertThat(traceContext.getIncomingTraceParentHeader()).isEqualTo("00-00000000000000000000000000000000-0000000000000000-00"); @@ -308,7 +308,7 @@ void testResetState() { @Test void testResetOutgoingTextHeader() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); String traceParentHeader = traceContext.getOutgoingTraceParentTextHeader().toString(); traceContext.asChildOf("00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00"); assertThat(traceContext.getOutgoingTraceParentTextHeader().toString()).isNotEqualTo(traceParentHeader); @@ -317,14 +317,14 @@ void testResetOutgoingTextHeader() { @Test void testCopyFrom() { Map textHeaderMap = Map.of( - TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01", - TraceContext.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux" + TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01", + TraceContextImpl.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux" ); - final TraceContext first = TraceContext.with64BitId(tracer); + final TraceContextImpl first = TraceContextImpl.with64BitId(tracer); assertThat(first.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); - textHeaderMap = Map.of(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-8448ebb9c7c989f97918e11916cd43dd-211c80319c0af765-00"); - final TraceContext second = TraceContext.with64BitId(tracer); + textHeaderMap = Map.of(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-8448ebb9c7c989f97918e11916cd43dd-211c80319c0af765-00"); + final TraceContextImpl second = TraceContextImpl.with64BitId(tracer); assertThat(second.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); assertThat(first.getTraceId()).isNotEqualTo(second.getTraceId()); @@ -333,9 +333,9 @@ void testCopyFrom() { assertThat(first.getOutgoingTraceParentTextHeader()).isNotEqualTo(second.getOutgoingTraceParentTextHeader()); Map binaryHeaderMap = new HashMap<>(); first.propagateTraceContext(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE); - String firstOutgoingHeader = binaryHeaderMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME); + String firstOutgoingHeader = binaryHeaderMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME); second.propagateTraceContext(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE); - assertThat(binaryHeaderMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotEqualTo(firstOutgoingHeader); + assertThat(binaryHeaderMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isNotEqualTo(firstOutgoingHeader); second.copyFrom(first); assertThat(first.getTraceId()).isEqualTo(second.getTraceId()); @@ -343,39 +343,39 @@ void testCopyFrom() { assertThat(first.isSampled()).isEqualTo(second.isSampled()); assertThat(first.getOutgoingTraceParentTextHeader().toString()).isEqualTo(second.getOutgoingTraceParentTextHeader().toString()); second.propagateTraceContext(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE); - assertThat(binaryHeaderMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isEqualTo(firstOutgoingHeader); + assertThat(binaryHeaderMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME)).isEqualTo(firstOutgoingHeader); } @Test void testAsChildOfHeaders() { Map textHeaderMap = Map.of( - TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01", - TraceContext.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux" + TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01", + TraceContextImpl.TRACESTATE_HEADER_NAME, "foo=bar,baz=qux" ); - final TraceContext first = TraceContext.with64BitId(tracer); + final TraceContextImpl first = TraceContextImpl.with64BitId(tracer); assertThat(first.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE)).isTrue(); - final TraceContext second = TraceContext.with64BitId(tracer); + final TraceContextImpl second = TraceContextImpl.with64BitId(tracer); second.asChildOf(first); HashMap textHeaders = new HashMap<>(); second.propagateTraceContext(textHeaders, TextHeaderMapAccessor.INSTANCE); - assertThat(textHeaders.get(TraceContext.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux"); - assertThat(textHeaders.get(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).startsWith("00-0af7651916cd43dd8448eb211c80319c-"); + assertThat(textHeaders.get(TraceContextImpl.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux"); + assertThat(textHeaders.get(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).startsWith("00-0af7651916cd43dd8448eb211c80319c-"); - final TraceContext firstUtf8 = TraceContext.with64BitId(tracer); + final TraceContextImpl firstUtf8 = TraceContextImpl.with64BitId(tracer); assertThat(firstUtf8.asChildOf(textHeaderMap, Utf8HeaderMapAccessor.INSTANCE)).isTrue(); HashMap utf8Headers = new HashMap<>(); firstUtf8.propagateTraceContext(utf8Headers, Utf8HeaderMapAccessor.INSTANCE); - assertThat(utf8Headers.get(TraceContext.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux"); - assertThat(utf8Headers.get(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).startsWith("00-0af7651916cd43dd8448eb211c80319c-"); + assertThat(utf8Headers.get(TraceContextImpl.TRACESTATE_HEADER_NAME)).isEqualTo("foo=bar,baz=qux"); + assertThat(utf8Headers.get(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME)).startsWith("00-0af7651916cd43dd8448eb211c80319c-"); } @Test void testRandomValue() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.asRootSpan(ConstantSampler.of(true)); assertThat(traceContext.getTraceId().isEmpty()).isFalse(); assertThat(traceContext.getParentId().isEmpty()).isTrue(); @@ -384,7 +384,7 @@ void testRandomValue() { @Test void testSetSampled() { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.asRootSpan(ConstantSampler.of(false)); // not sampled means zero sample rate @@ -411,16 +411,16 @@ void testSetSampled() { @Test void testRootSpanShouldAddsSampleRateToTraceState() { - final TraceContext traceContext = createRootSpan(0.42d); + final TraceContextImpl traceContext = createRootSpan(0.42d); String traceState = traceContext.getTraceState().toTextHeader(); assertThat(traceState).isEqualTo("es=s:0.42"); } - private TraceContext createRootSpan(double sampleRate) { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + private TraceContextImpl createRootSpan(double sampleRate) { + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); Sampler sampler = mock(Sampler.class); - doReturn(true).when(sampler).isSampled(any(Id.class)); + doReturn(true).when(sampler).isSampled(any(IdImpl.class)); doReturn(sampleRate).when(sampler).getSampleRate(); doReturn(TraceState.getHeaderValue(sampleRate)).when(sampler).getTraceStateHeader(); @@ -431,9 +431,9 @@ private TraceContext createRootSpan(double sampleRate) { @Test void testTracedChildSpanWithoutTraceState() { Map headers = Map.of( - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01" + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01" ); - TraceContext child = createChildSpanFromHeaders(headers); + TraceContextImpl child = createChildSpanFromHeaders(headers); assertThat(child.isSampled()).isTrue(); assertThat(child.getSampleRate()).isNaN(); @@ -442,9 +442,9 @@ void testTracedChildSpanWithoutTraceState() { @Test void testNonTracedChildSpanWithoutTraceState() { Map headers = Map.of( - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00" + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-00" ); - TraceContext child = createChildSpanFromHeaders(headers); + TraceContextImpl child = createChildSpanFromHeaders(headers); assertThat(child.isSampled()).isFalse(); assertThat(child.getSampleRate()).isEqualTo(0.0d); @@ -466,12 +466,12 @@ void testNonTracedChildSpanWithoutTraceState() { }) void checkExpectedSampleRate(@Nullable String traceState, double expectedRate, @Nullable String expectedHeader) { Map headers = new HashMap<>(); - headers.put(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); + headers.put(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01"); if (null != traceState) { - headers.put(TraceContext.TRACESTATE_HEADER_NAME, traceState); + headers.put(TraceContextImpl.TRACESTATE_HEADER_NAME, traceState); } - TraceContext child = createChildSpanFromHeaders(headers); + TraceContextImpl child = createChildSpanFromHeaders(headers); assertThat(child.isSampled()).isTrue(); @@ -485,51 +485,51 @@ void checkExpectedSampleRate(@Nullable String traceState, double expectedRate, @ } - private TraceContext createChildSpanFromHeaders(Map inHeaders) { - TraceContext child = TraceContext.with64BitId(tracer); + private TraceContextImpl createChildSpanFromHeaders(Map inHeaders) { + TraceContextImpl child = TraceContextImpl.with64BitId(tracer); assertThat(child.asChildOf(inHeaders, TextHeaderMapAccessor.INSTANCE)).isTrue(); return child; } @Test void testPropagateTransactionIdForUnsampledSpan() { - final TraceContext rootContext = TraceContext.with64BitId(tracer); + final TraceContextImpl rootContext = TraceContextImpl.with64BitId(tracer); rootContext.asRootSpan(ConstantSampler.of(false)); - final TraceContext childContext = TraceContext.with64BitId(tracer); + final TraceContextImpl childContext = TraceContextImpl.with64BitId(tracer); childContext.asChildOf(rootContext); verifyTraceContextContents(childContext.getOutgoingTraceParentTextHeader().toString(), childContext.getTraceId().toString(), rootContext.getId().toString(), "00", "00"); Map binaryHeaderMap = new HashMap<>(); childContext.propagateTraceContext(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE); - verifyTraceContextContents(binaryHeaderMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), + verifyTraceContextContents(binaryHeaderMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), childContext.getTraceId().toString(), rootContext.getId().toString(), "00", "00"); } @Test void testPropagateSpanIdForSampledSpan() { - final TraceContext rootContext = TraceContext.with64BitId(tracer); + final TraceContextImpl rootContext = TraceContextImpl.with64BitId(tracer); rootContext.asRootSpan(ConstantSampler.of(true)); - final TraceContext childContext = TraceContext.with64BitId(tracer); + final TraceContextImpl childContext = TraceContextImpl.with64BitId(tracer); childContext.asChildOf(rootContext); verifyTraceContextContents(childContext.getOutgoingTraceParentTextHeader().toString(), childContext.getTraceId().toString(), childContext.getId().toString(), "00", "01"); Map binaryHeaderMap = new HashMap<>(); childContext.propagateTraceContext(binaryHeaderMap, Utf8HeaderMapAccessor.INSTANCE); - verifyTraceContextContents(binaryHeaderMap.get(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), + verifyTraceContextContents(binaryHeaderMap.get(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME), childContext.getTraceId().toString(), childContext.getId().toString(), "00", "01"); } @Test void testRootContextSampleRateFromSampler() { Sampler sampler = mock(Sampler.class); - doReturn(true).when(sampler).isSampled(any(Id.class)); + doReturn(true).when(sampler).isSampled(any(IdImpl.class)); doReturn(0.42d).when(sampler).getSampleRate(); - final TraceContext rootContext = TraceContext.with64BitId(tracer); + final TraceContextImpl rootContext = TraceContextImpl.with64BitId(tracer); rootContext.asRootSpan(sampler); assertThat(rootContext.isRecorded()).isTrue(); @@ -583,18 +583,18 @@ void testInvalidHeader_invalidTotalLength() { } private void assertInvalid(String s) { - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); assertThat(traceContext.asChildOf(s)).isFalse(); assertThat(traceContext.asChildOf(s.getBytes(StandardCharsets.UTF_8), CharAccessor.forAsciiBytes())).isFalse(); } private void assertValid(String s) { - TraceContext textTraceContext = TraceContext.with64BitId(tracer); + TraceContextImpl textTraceContext = TraceContextImpl.with64BitId(tracer); assertThat(textTraceContext.asChildOf(s)).isTrue(); verifyTraceContextContents(textTraceContext.getOutgoingTraceParentTextHeader().toString(), textTraceContext.getTraceId().toString(), textTraceContext.getId().toString(), "00", s.substring(53, 55)); - TraceContext utf8TraceContext = TraceContext.with64BitId(tracer); + TraceContextImpl utf8TraceContext = TraceContextImpl.with64BitId(tracer); assertThat(utf8TraceContext.asChildOf(s.getBytes(StandardCharsets.UTF_8), CharAccessor.forAsciiBytes())).isTrue(); verifyTraceContextContents(utf8TraceContext.getOutgoingTraceParentTextHeader().toString(), utf8TraceContext.getTraceId().toString(), utf8TraceContext.getId().toString(), "00", s.substring(53, 55)); @@ -603,16 +603,16 @@ private void assertValid(String s) { @Test void testDeserialization() { ElasticApmTracer tracer = MockTracer.create(); - CoreConfiguration configuration = tracer.getConfig(CoreConfiguration.class); + CoreConfigurationImpl configuration = tracer.getConfig(CoreConfigurationImpl.class); doReturn(Integer.MAX_VALUE).when(configuration).getTracestateSizeLimit(); - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.asRootSpan(ConstantSampler.of(true)); - byte[] serializedContext = new byte[TraceContext.SERIALIZED_LENGTH]; + byte[] serializedContext = new byte[TraceContextImpl.SERIALIZED_LENGTH]; traceContext.serialize(serializedContext); - TraceContext deserialized = TraceContext.with64BitId(tracer); + TraceContextImpl deserialized = TraceContextImpl.with64BitId(tracer); deserialized.deserialize(serializedContext, null, null); assertThat(deserialized.traceIdAndIdEquals(serializedContext)).isTrue(); @@ -626,7 +626,7 @@ void testDeserialization() { @Test void testSetServiceInfoWithEmptyServiceName() { - TraceContext traceContext = TraceContext.with64BitId(tracer); + TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.setServiceInfo(null, "My Version"); assertThat(traceContext.getServiceName()).isNull(); @@ -638,7 +638,7 @@ void testSetServiceInfoWithEmptyServiceName() { @Test void testSetServiceInfoWithNonEmptyServiceName() { - TraceContext traceContext = TraceContext.with64BitId(tracer); + TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.setServiceInfo("My Service", null); assertThat(traceContext.getServiceName()).isEqualTo("My Service"); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextW3CTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextW3CTest.java index 914ff65aae..435ed04e2d 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextW3CTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContextW3CTest.java @@ -49,7 +49,7 @@ void testW3CData() { final boolean traceparentValid = testCase.get("is_traceparent_valid").booleanValue(); ElasticApmTracer tracer = MockTracer.create(); - final TraceContext traceContext = TraceContext.with64BitId(tracer); + final TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); softly.assertThat(traceContext.asChildOf(traceParentHeader)) .withFailMessage("Expected '%s' to be %s", traceParentHeader, traceparentValid ? "valid" : "invalid") .isEqualTo(traceparentValid); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContinuationStrategyTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContinuationStrategyTest.java index 5b42855a11..5da2ed629e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContinuationStrategyTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TraceContinuationStrategyTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; @@ -66,37 +66,37 @@ static void setUp() { @Test void continueTraceFromNonElasticSystem() { - traceFromSystem(false, CoreConfiguration.TraceContinuationStrategy.CONTINUE, false); + traceFromSystem(false, CoreConfigurationImpl.TraceContinuationStrategy.CONTINUE, false); } @Test void continueTraceFromElasticSystem() { - traceFromSystem(true, CoreConfiguration.TraceContinuationStrategy.CONTINUE, false); + traceFromSystem(true, CoreConfigurationImpl.TraceContinuationStrategy.CONTINUE, false); } @Test void restartTraceFromNonElasticSystem() { - traceFromSystem(false, CoreConfiguration.TraceContinuationStrategy.RESTART, true); + traceFromSystem(false, CoreConfigurationImpl.TraceContinuationStrategy.RESTART, true); } @Test void restartTraceFromElasticSystem() { - traceFromSystem(true, CoreConfiguration.TraceContinuationStrategy.RESTART, true); + traceFromSystem(true, CoreConfigurationImpl.TraceContinuationStrategy.RESTART, true); } @Test void restartExternalTraceFromNonElasticSystem() { - traceFromSystem(false, CoreConfiguration.TraceContinuationStrategy.RESTART_EXTERNAL, true); + traceFromSystem(false, CoreConfigurationImpl.TraceContinuationStrategy.RESTART_EXTERNAL, true); } @Test void restartExternalTraceFromElasticSystem() { - traceFromSystem(true, CoreConfiguration.TraceContinuationStrategy.RESTART_EXTERNAL, false); + traceFromSystem(true, CoreConfigurationImpl.TraceContinuationStrategy.RESTART_EXTERNAL, false); } @Test void testAssumptions() { - Transaction transaction = new Transaction(tracerImpl); + TransactionImpl transaction = new TransactionImpl(tracerImpl); assertThat(transaction.getTraceContext().getParentId().toString()).isEqualTo("0000000000000000"); assertThat(transaction.getTraceContext().getId().toString()).isEqualTo("0000000000000000"); assertThat(transaction.getTraceContext().getTraceId().toString()).isEqualTo("00000000000000000000000000000000"); @@ -106,17 +106,17 @@ void testAssumptions() { assertThat(transaction.getTraceContext().getTraceId().toString()).isNotEqualTo("00000000000000000000000000000000"); } - void traceFromSystem(boolean fromElastic, CoreConfiguration.TraceContinuationStrategy strategy, boolean restartExpected) { - doReturn(strategy).when(tracerImpl.getConfig(CoreConfiguration.class)).getTraceContinuationStrategy(); + void traceFromSystem(boolean fromElastic, CoreConfigurationImpl.TraceContinuationStrategy strategy, boolean restartExpected) { + doReturn(strategy).when(tracerImpl.getConfig(CoreConfigurationImpl.class)).getTraceContinuationStrategy(); String traceID = "ca6150c33a473fda1f3a7a0b9eb4d143"; String parentSpanID = "abc345d9029d61ff"; final Map headerMap = new HashMap<>(); - headerMap.put(TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-"+traceID+"-"+parentSpanID+"-01"); + headerMap.put(TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-"+traceID+"-"+parentSpanID+"-01"); if (fromElastic) { - headerMap.put(TraceContext.TRACESTATE_HEADER_NAME, "es=s:1"); + headerMap.put(TraceContextImpl.TRACESTATE_HEADER_NAME, "es=s:1"); } - final Transaction transaction = tracerImpl.startChildTransaction(headerMap, TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(false), 0, null); + final TransactionImpl transaction = tracerImpl.startChildTransaction(headerMap, TextHeaderMapAccessor.INSTANCE, ConstantSampler.of(false), 0, null); if (restartExpected) { assertThat(transaction.getTraceContext().getTraceId().toString()).isNotEqualTo(traceID); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TransactionTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TransactionTest.java index 8035ef3a0d..3f69986556 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TransactionTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/transaction/TransactionTest.java @@ -20,12 +20,12 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.TransactionUtils; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.metadata.MetaDataMock; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.report.serialize.SerializationConstants; @@ -49,11 +49,11 @@ public class TransactionTest { @BeforeEach void setUp() { - CoreConfiguration coreConfig = MockTracer.createRealTracer().getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = MockTracer.createRealTracer().getConfig(CoreConfigurationImpl.class); SerializationConstants.init(coreConfig); jsonSerializer = new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), mock(ApmServerClient.class), MetaDataMock.create() ).newWriter(); @@ -61,15 +61,15 @@ void setUp() { @Test void resetState() { - final Transaction transaction = new Transaction(MockTracer.create()); + final TransactionImpl transaction = new TransactionImpl(MockTracer.create()); TransactionUtils.fillTransaction(transaction); transaction.resetState(); - assertThat(jsonSerializer.toJsonString(transaction)).isEqualTo(jsonSerializer.toJsonString(new Transaction(MockTracer.create()))); + assertThat(jsonSerializer.toJsonString(transaction)).isEqualTo(jsonSerializer.toJsonString(new TransactionImpl(MockTracer.create()))); } @Test void getSetOutcome() { - Transaction transaction = new Transaction(MockTracer.create()); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()); assertThat(transaction.getOutcome()) .describedAs("default outcome should be unknown") @@ -105,9 +105,9 @@ void getSetOutcome() { @ParameterizedTest @MethodSource("typeTestArguments") void normalizeType(String type, String expectedType) { - Transaction transaction = new Transaction(MockTracer.createRealTracer()); + TransactionImpl transaction = new TransactionImpl(MockTracer.createRealTracer()); - transaction.startRoot(0, ConstantSampler.of(true), Baggage.EMPTY); + transaction.startRoot(0, ConstantSampler.of(true), BaggageImpl.EMPTY); assertThat(transaction.getType()) .describedAs("transaction type should not be set by default") .isNull(); @@ -132,9 +132,9 @@ void skipChildSpanCreationWhenLimitReached() { int limit = 3; ElasticApmTracer tracer = MockTracer.createRealTracer(); - doReturn(limit).when(tracer.getConfig(CoreConfiguration.class)).getTransactionMaxSpans(); + doReturn(limit).when(tracer.getConfig(CoreConfigurationImpl.class)).getTransactionMaxSpans(); - Transaction transaction = tracer.startRootTransaction(TransactionTest.class.getClassLoader()); + TransactionImpl transaction = tracer.startRootTransaction(TransactionTest.class.getClassLoader()); assertThat(transaction).isNotNull(); transaction.activate(); @@ -172,11 +172,11 @@ void skipChildSpanCreationWhenLimitReached() { } /** - * A utility to enable arbitrary tests to set an existing {@link Transaction} state without making this functionality globally accessible + * A utility to enable arbitrary tests to set an existing {@link TransactionImpl} state without making this functionality globally accessible * @param recorded should the provided trace context be recorded * @param transaction a span of which state is to be set */ - public static void setRecorded(boolean recorded, Transaction transaction) { + public static void setRecorded(boolean recorded, TransactionImpl transaction) { transaction.getTraceContext().setRecorded(recorded); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/ApmServerLogAppenderTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/ApmServerLogAppenderTest.java index 072885b5ed..0a6e35f78b 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/ApmServerLogAppenderTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/ApmServerLogAppenderTest.java @@ -84,7 +84,7 @@ void createAndInit() throws Exception { ApmServerReporter reporter = mock(ApmServerReporter.class); doReturn(reporter).when(tracer).getReporter(); - LoggingConfiguration config = tracer.getConfig(LoggingConfiguration.class); + LoggingConfigurationImpl config = tracer.getConfig(LoggingConfigurationImpl.class); doReturn(true).when(config).getSendLogs(); appender.getInitListener().init(tracer); @@ -117,7 +117,7 @@ void bufferingAndInit(boolean enabled) throws Exception { verifyNoInteractions(reporter); ElasticApmTracer tracer = MockTracer.create(); - LoggingConfiguration config = tracer.getConfig(LoggingConfiguration.class); + LoggingConfigurationImpl config = tracer.getConfig(LoggingConfigurationImpl.class); doReturn(enabled).when(config).getSendLogs(); doReturn(reporter).when(tracer).getReporter(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/LoggingConfigurationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/LoggingConfigurationTest.java index 42fb36b746..0c691ffde7 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/LoggingConfigurationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/logging/LoggingConfigurationTest.java @@ -53,7 +53,7 @@ import java.util.Map; import java.util.Objects; -import static co.elastic.apm.agent.logging.LoggingConfiguration.LOG_LEVEL_KEY; +import static co.elastic.apm.agent.logging.LoggingConfigurationImpl.LOG_LEVEL_KEY; import static org.assertj.core.api.Assertions.assertThat; @SuppressWarnings("NotNullFieldNotInitialized") diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java index 5590fea3cc..b069f1e6f1 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/MetricRegistryTest.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.metrics; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.DoubleSupplier; import co.elastic.apm.agent.tracer.metrics.Labels; import org.junit.jupiter.api.BeforeEach; @@ -40,13 +40,13 @@ class MetricRegistryTest { private MetricRegistry metricRegistry; - private ReporterConfiguration reporterConfiguration; - private MetricsConfiguration metricsConfiguration; + private ReporterConfigurationImpl reporterConfiguration; + private MetricsConfigurationImpl metricsConfiguration; @BeforeEach void setUp() { - reporterConfiguration = mock(ReporterConfiguration.class); - metricsConfiguration = spy(MetricsConfiguration.class); + reporterConfiguration = mock(ReporterConfigurationImpl.class); + metricsConfiguration = spy(MetricsConfigurationImpl.class); metricRegistry = new MetricRegistry(reporterConfiguration, metricsConfiguration); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java index 093782f979..22f3f79746 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentOverheadMetricsTest.java @@ -18,12 +18,12 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricSet; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.util.ExecutorUtils; import com.sun.management.ThreadMXBean; import org.junit.jupiter.api.BeforeEach; @@ -55,15 +55,15 @@ public class AgentOverheadMetricsTest { private MetricRegistry metricRegistry; - private ReporterConfiguration spyReporterConfig; - private MetricsConfiguration spyMetricsConfig; + private ReporterConfigurationImpl spyReporterConfig; + private MetricsConfigurationImpl spyMetricsConfig; private AgentOverheadMetrics overheadMetrics; @BeforeEach public void setUp() { - spyReporterConfig = spy(ReporterConfiguration.class); - spyMetricsConfig = spy(MetricsConfiguration.class); + spyReporterConfig = spy(ReporterConfigurationImpl.class); + spyMetricsConfig = spy(MetricsConfigurationImpl.class); overheadMetrics = new AgentOverheadMetrics(); metricRegistry = new MetricRegistry(spyReporterConfig, spyMetricsConfig); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java index 83527ffe6b..96be6d0918 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/AgentReporterMetricsTest.java @@ -18,12 +18,12 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricSet; -import co.elastic.apm.agent.report.ReporterConfiguration; import co.elastic.apm.agent.report.ReportingEvent; import co.elastic.apm.agent.report.ReportingEventCounter; import org.junit.jupiter.api.BeforeEach; @@ -46,16 +46,16 @@ public class AgentReporterMetricsTest { private MetricRegistry metricRegistry; - private ReporterConfiguration mockReporterConfig; + private ReporterConfigurationImpl mockReporterConfig; - private MetricsConfiguration mockMetricsConfig; + private MetricsConfigurationImpl mockMetricsConfig; private AgentReporterMetrics reporterMetrics; @BeforeEach public void setUp() { - mockReporterConfig = mock(ReporterConfiguration.class); - mockMetricsConfig = spy(MetricsConfiguration.class); + mockReporterConfig = mock(ReporterConfigurationImpl.class); + mockMetricsConfig = spy(MetricsConfigurationImpl.class); metricRegistry = new MetricRegistry(mockReporterConfig, mockMetricsConfig); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java index 5dd24ae174..8f50668d59 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/CGroupMetricsTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; -import co.elastic.apm.agent.report.ReporterConfiguration; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -38,7 +38,7 @@ class CGroupMetricsTest { - private final MetricRegistry metricRegistry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + private final MetricRegistry metricRegistry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); private CGroupMetrics createUnlimitedSystemMetrics() throws URISyntaxException, IOException { File mountInfo = new File(getClass().getResource("/proc/unlimited/memory").toURI()); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java index 3f87b5c70c..4d5de2bfaf 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmFdMetricsTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; -import co.elastic.apm.agent.report.ReporterConfiguration; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; @@ -44,7 +44,7 @@ class JvmFdMetricsTest { }) @DisabledOnOs(OS.WINDOWS) void testMetrics(String metric) { - MetricRegistry registry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + MetricRegistry registry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); jvmFdMetrics.bindTo(registry); assertThat(registry.getGaugeValue(metric, Labels.EMPTY)) @@ -61,7 +61,7 @@ void testMetrics(String metric) { }) @EnabledOnOs(OS.WINDOWS) void testMetricsDisabledOnWindows(String metric) { - MetricRegistry registry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + MetricRegistry registry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); jvmFdMetrics.bindTo(registry); assertThat(registry.getGauge(metric, Labels.EMPTY)).isNull(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java index 413b148d5c..b36a6e3e2a 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/JvmMemoryMetricsTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; -import co.elastic.apm.agent.report.ReporterConfiguration; import org.assertj.core.api.AbstractDoubleAssert; import org.junit.jupiter.api.Test; @@ -42,7 +42,7 @@ class JvmMemoryMetricsTest { @Test void testMetrics() { - final MetricRegistry registry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + final MetricRegistry registry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); jvmMemoryMetrics.bindTo(registry); Stream.of( diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java index 3226241264..692b7affb8 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/SystemMetricsTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; @@ -36,7 +36,7 @@ class SystemMetricsTest { - private MetricRegistry metricRegistry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + private MetricRegistry metricRegistry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); private SystemMetrics systemMetrics = new SystemMetrics(); @Test diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java index 4fec12cf1a..c8afa7c992 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/metrics/builtin/ThreadMetricsTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.metrics.builtin; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricRegistry; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ class ThreadMetricsTest { private static final double NUM_ADDED_THREADS = 12.0; private final ThreadMetrics threadMetrics = new ThreadMetrics(); - private MetricRegistry registry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + private MetricRegistry registry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); @Test void testThreadCount() { diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/ObjectPoolTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/ObjectPoolTest.java index ee96d7841b..23ad800ef9 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/ObjectPoolTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/ObjectPoolTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.SoftAssertions.assertSoftly; -public abstract class ObjectPoolTest> { +public abstract class ObjectPoolTest> { private static final int MAX_SIZE = 16; private T objectPool; diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/TestObjectPoolFactory.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/TestObjectPoolFactory.java index 72a2bfc5b3..ff85357cb1 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/TestObjectPoolFactory.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/TestObjectPoolFactory.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.objectpool; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.impl.BookkeeperObjectPool; import co.elastic.apm.agent.tracer.pooling.Allocator; import co.elastic.apm.agent.tracer.pooling.Recyclable; @@ -36,17 +36,17 @@ /** * Extension of default pool factory that keeps track of all pools and thus allows to query their state while testing */ -public class TestObjectPoolFactory extends ObjectPoolFactory { +public class TestObjectPoolFactory extends ObjectPoolFactoryImpl { private final List> createdPools = new ArrayList>(); - private BookkeeperObjectPool transactionPool; - private BookkeeperObjectPool spanPool; - private BookkeeperObjectPool errorPool; - private BookkeeperObjectPool spanLinksPool; + private BookkeeperObjectPool transactionPool; + private BookkeeperObjectPool spanPool; + private BookkeeperObjectPool errorPool; + private BookkeeperObjectPool spanLinksPool; @Override - public ObjectPool createRecyclableObjectPool(int maxCapacity, Allocator allocator) { - ObjectPool pool = super.createRecyclableObjectPool(maxCapacity, allocator); + public ObservableObjectPool createRecyclableObjectPool(int maxCapacity, Allocator allocator) { + ObservableObjectPool pool = super.createRecyclableObjectPool(maxCapacity, allocator); BookkeeperObjectPool wrappedPool = new BookkeeperObjectPool<>(pool); createdPools.add(wrappedPool); return wrappedPool; @@ -95,42 +95,42 @@ public void reset() { } @Override - public ObjectPool createTransactionPool(int maxCapacity, ElasticApmTracer tracer) { - transactionPool = (BookkeeperObjectPool) super.createTransactionPool(maxCapacity, tracer); + public ObservableObjectPool createTransactionPool(int maxCapacity, ElasticApmTracer tracer) { + transactionPool = (BookkeeperObjectPool) super.createTransactionPool(maxCapacity, tracer); return transactionPool; } @Override - public ObjectPool createSpanPool(int maxCapacity, ElasticApmTracer tracer) { - spanPool = (BookkeeperObjectPool) super.createSpanPool(maxCapacity, tracer); + public ObservableObjectPool createSpanPool(int maxCapacity, ElasticApmTracer tracer) { + spanPool = (BookkeeperObjectPool) super.createSpanPool(maxCapacity, tracer); return spanPool; } @Override - public ObjectPool createErrorPool(int maxCapacity, ElasticApmTracer tracer) { - errorPool = (BookkeeperObjectPool) super.createErrorPool(maxCapacity, tracer); + public ObservableObjectPool createErrorPool(int maxCapacity, ElasticApmTracer tracer) { + errorPool = (BookkeeperObjectPool) super.createErrorPool(maxCapacity, tracer); return errorPool; } @Override - public ObjectPool createSpanLinkPool(int maxCapacity, ElasticApmTracer tracer) { - spanLinksPool = (BookkeeperObjectPool) super.createSpanLinkPool(maxCapacity, tracer); + public ObservableObjectPool createSpanLinkPool(int maxCapacity, ElasticApmTracer tracer) { + spanLinksPool = (BookkeeperObjectPool) super.createSpanLinkPool(maxCapacity, tracer); return spanLinksPool; } - public BookkeeperObjectPool getTransactionPool() { + public BookkeeperObjectPool getTransactionPool() { return transactionPool; } - public BookkeeperObjectPool getSpanPool() { + public BookkeeperObjectPool getSpanPool() { return spanPool; } - public BookkeeperObjectPool getErrorPool() { + public BookkeeperObjectPool getErrorPool() { return errorPool; } - public BookkeeperObjectPool getSpanLinksPool() { + public BookkeeperObjectPool getSpanLinksPool() { return spanLinksPool; } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPool.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPool.java index ac4ce8292f..853eb138a1 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPool.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPool.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.objectpool.impl; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -29,16 +29,16 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * {@link ObjectPool} wrapper implementation that keeps track of all created object instances, and thus allows to check + * {@link ObservableObjectPool} wrapper implementation that keeps track of all created object instances, and thus allows to check * for any pooled object leak. Should only be used for testing as it keeps a reference to all in-flight pooled objects. * * @param pooled object type */ -public class BookkeeperObjectPool implements ObjectPool { +public class BookkeeperObjectPool implements ObservableObjectPool { private static final Logger logger = LoggerFactory.getLogger(BookkeeperObjectPool.class); - private final ObjectPool pool; + private final ObservableObjectPool pool; private final Set toReturn = Collections.synchronizedSet(Collections.newSetFromMap(new IdentityHashMap())); // An ever-increasing counter for how many objects where requested from the pool private AtomicInteger objectCounter = new AtomicInteger(); @@ -46,7 +46,7 @@ public class BookkeeperObjectPool implements ObjectPool { /** * @param pool pool to wrap */ - public BookkeeperObjectPool(ObjectPool pool) { + public BookkeeperObjectPool(ObservableObjectPool pool) { this.pool = pool; } @@ -96,7 +96,7 @@ public Collection getRecyclablesToReturn() { * Returns the number of times an object has been requested from the pool since its creation. * The returned value cannot be used as any indication as to the number of objects actually allocated by the pool. * - * @return number of times {@link ObjectPool#createInstance()} was called on this pool since its creation + * @return number of times {@link ObservableObjectPool#createInstance()} was called on this pool since its creation */ public int getRequestedObjectCount() { return objectCounter.get(); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPoolTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPoolTest.java index 8dbec5ed48..037fa0285e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPoolTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/BookkeeperObjectPoolTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.objectpool.impl; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.ObjectPoolTest; import co.elastic.apm.agent.objectpool.TestRecyclable; import org.jctools.queues.atomic.MpmcAtomicArrayQueue; @@ -31,7 +31,7 @@ class BookkeeperObjectPoolTest extends ObjectPoolTest createObjectPool(int maxSize) { - ObjectPool queuePool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue<>(maxSize), false, TestRecyclable::new); + ObservableObjectPool queuePool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue<>(maxSize), false, TestRecyclable::new); return new BookkeeperObjectPool<>(queuePool); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/QueueBasedObjectPoolTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/QueueBasedObjectPoolTest.java index 4edae48c03..1e24ad2bc3 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/QueueBasedObjectPoolTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/objectpool/impl/QueueBasedObjectPoolTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.objectpool.impl; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.ObjectPoolTest; import co.elastic.apm.agent.objectpool.TestRecyclable; import co.elastic.apm.agent.sdk.internal.util.IOUtils; @@ -47,7 +47,7 @@ void preAllocationShouldCreateObjectsInPool() { // we have to use a power of two as capacity, otherwise actual capacity will differ int capacity = 8; - ObjectPool pool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue<>(capacity), true, TestRecyclable::new); + ObservableObjectPool pool = QueueBasedObjectPool.ofRecyclable(new MpmcAtomicArrayQueue<>(capacity), true, TestRecyclable::new); assertThat(pool.getGarbageCreated()).isEqualTo(0); assertThat(pool.getObjectsInPool()).isEqualTo(capacity); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientProxySupportIT.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientProxySupportIT.java index 645c0020f8..6807952ed2 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientProxySupportIT.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientProxySupportIT.java @@ -226,7 +226,7 @@ private void setSystemProxyCredentialProperties() { private static ApmServerClient createAndStartClient(boolean useProxy) { ConfigurationRegistry spyConfig = SpyConfiguration.createSpyConfig(); - ReporterConfiguration config = spyConfig.getConfig(ReporterConfiguration.class); + ReporterConfigurationImpl config = spyConfig.getConfig(ReporterConfigurationImpl.class); doReturn(Collections.singletonList(useProxy ? proxyUrl : directUrl)).when(config).getServerUrls(); ApmServerClient client = new ApmServerClient(spyConfig); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java index e469235bcc..bb488f4934 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java @@ -20,18 +20,18 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.common.util.Version; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.configuration.source.ConfigSources; 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.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.MetaData; import co.elastic.apm.agent.impl.metadata.MetaDataMock; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.objectpool.impl.BookkeeperObjectPool; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; @@ -87,8 +87,8 @@ public class ApmServerClientTest { private ConfigurationRegistry config; private ElasticApmTracer tracer; private TestObjectPoolFactory objectPoolFactory; - private ReporterConfiguration reporterConfiguration; - private CoreConfiguration coreConfiguration; + private ReporterConfigurationImpl reporterConfiguration; + private CoreConfigurationImpl coreConfiguration; private List urlList; @Before @@ -106,8 +106,8 @@ public void setUp() throws IOException, ExecutionException, InterruptedException apmServer2.stubFor(get(urlEqualTo("/proxy/not-found")).willReturn(notFound())); config = SpyConfiguration.createSpyConfig(); - reporterConfiguration = config.getConfig(ReporterConfiguration.class); - coreConfiguration = config.getConfig(CoreConfiguration.class); + reporterConfiguration = config.getConfig(ReporterConfigurationImpl.class); + coreConfiguration = config.getConfig(CoreConfigurationImpl.class); objectPoolFactory = new TestObjectPoolFactory(); config.save("server_urls", url1 + "," + url2, SpyConfiguration.CONFIG_SOURCE_NAME); urlList = List.of(UrlValueConverter.INSTANCE.convert(url1.toString()), UrlValueConverter.INSTANCE.convert(url2.toString())); @@ -131,7 +131,7 @@ public void setUp() throws IOException, ExecutionException, InterruptedException @Test @SuppressWarnings("unchecked") public void ensureSerializerDoesNotBlockOnAwsLambda() throws Exception { - doReturn(true).when(config.getConfig(ServerlessConfiguration.class)).runsOnAwsLambda(); + doReturn(true).when(config.getConfig(ServerlessConfigurationImpl.class)).runsOnAwsLambda(); ApmServerClient client = new ApmServerClient(config); Future serverVersionFuture = Mockito.mock(Future.class); doReturn(false).when(serverVersionFuture).isDone(); @@ -139,7 +139,7 @@ public void ensureSerializerDoesNotBlockOnAwsLambda() throws Exception { client.start(serverVersionFuture); Future metadata = MetaDataMock.create(); - DslJsonSerializer dslJsonSerializer = new DslJsonSerializer(config.getConfig(StacktraceConfiguration.class), client, metadata); + DslJsonSerializer dslJsonSerializer = new DslJsonSerializer(config.getConfig(StacktraceConfigurationImpl.class), client, metadata); dslJsonSerializer.newWriter().blockUntilReady(); verify(serverVersionFuture, never()).get(); @@ -165,19 +165,19 @@ public void testDroppingAndRecyclingEventsWithEmptyUrls() { // tests setting server_url to an empty string in configuration apmServerClient.start(Lists.emptyList()); - BookkeeperObjectPool transactionPool = objectPoolFactory.getTransactionPool(); + BookkeeperObjectPool transactionPool = objectPoolFactory.getTransactionPool(); int transactionsRequestedBefore = transactionPool.getRequestedObjectCount(); - final Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); + final TransactionImpl transaction = tracer.startRootTransaction(getClass().getClassLoader()); assertThat(transactionPool.getRequestedObjectCount()).isEqualTo(transactionsRequestedBefore + 1); int transactionsInPoolAfterCreation = transactionPool.getObjectsInPool(); - BookkeeperObjectPool spanPool = objectPoolFactory.getSpanPool(); + BookkeeperObjectPool spanPool = objectPoolFactory.getSpanPool(); int spansRequestedBefore = spanPool.getRequestedObjectCount(); - final Span span = Objects.requireNonNull(transaction).createSpan(); + final SpanImpl span = Objects.requireNonNull(transaction).createSpan(); assertThat(transactionPool.getRequestedObjectCount()).isEqualTo(spansRequestedBefore + 1); int spansInPoolAfterCreation = spanPool.getObjectsInPool(); - BookkeeperObjectPool errorPool = objectPoolFactory.getErrorPool(); + BookkeeperObjectPool errorPool = objectPoolFactory.getErrorPool(); int errorsRequestedBefore = errorPool.getRequestedObjectCount(); span.captureException(new Throwable()); assertThat(errorPool.getRequestedObjectCount()).isEqualTo(errorsRequestedBefore + 1); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerReporterIntegrationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerReporterIntegrationTest.java index e7c234fc2a..ff8412dcce 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerReporterIntegrationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerReporterIntegrationTest.java @@ -19,17 +19,17 @@ package co.elastic.apm.agent.report; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.MetaDataMock; import co.elastic.apm.agent.impl.metadata.ProcessInfo; -import co.elastic.apm.agent.impl.metadata.Service; +import co.elastic.apm.agent.impl.metadata.ServiceImpl; import co.elastic.apm.agent.impl.metadata.SystemInfo; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.processor.ProcessorEventHandler; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.report.serialize.SerializationConstants; @@ -83,9 +83,9 @@ class ApmServerReporterIntegrationTest { private final ElasticApmTracer tracer = MockTracer.create(); private volatile int statusCode = HttpStatus.OK_200; private volatile int acceptedEventCount = 0; - private ReporterConfiguration reporterConfiguration; + private ReporterConfigurationImpl reporterConfiguration; - private CoreConfiguration coreConfiguration; + private CoreConfigurationImpl coreConfiguration; private ApmServerReporter reporter; private ReporterMonitor mockMonitor; @@ -141,8 +141,8 @@ void setUp() throws Exception { }); ConfigurationRegistry config = tracer.getConfigurationRegistry(); - reporterConfiguration = config.getConfig(ReporterConfiguration.class); - coreConfiguration = config.getConfig(CoreConfiguration.class); + reporterConfiguration = config.getConfig(ReporterConfigurationImpl.class); + coreConfiguration = config.getConfig(CoreConfigurationImpl.class); SerializationConstants.init(coreConfiguration); // mockito mocking does not seem to reliably work here @@ -154,13 +154,13 @@ void setUp() throws Exception { doReturn(Collections.singletonList(new URL("http://localhost:" + port))).when(reporterConfiguration).getServerUrls(); SystemInfo system = new SystemInfo("x64", "localhost", null, "platform"); - final Service service = new Service(); + final ServiceImpl service = new ServiceImpl(); final ProcessInfo title = new ProcessInfo("title"); final ProcessorEventHandler processorEventHandler = ProcessorEventHandler.loadProcessors(config); ApmServerClient apmServerClient = new ApmServerClient(config); apmServerClient.start(); DslJsonSerializer payloadSerializer = new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create(title, service, system, null, Collections.emptyMap(), null) ); @@ -170,7 +170,7 @@ void setUp() throws Exception { payloadSerializer, apmServerClient); mockMonitor = Mockito.mock(ReporterMonitor.class); - reporter = new ApmServerReporter(false, reporterConfiguration, coreConfiguration, v2handler, mockMonitor, apmServerClient, payloadSerializer, new ObjectPoolFactory()); + reporter = new ApmServerReporter(false, reporterConfiguration, coreConfiguration, v2handler, mockMonitor, apmServerClient, payloadSerializer, new ObjectPoolFactoryImpl()); reporter.start(); } @@ -187,7 +187,7 @@ void tearDown() { @Test void testReportTransaction() { - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); assertThat(reporter.flush(5, TimeUnit.SECONDS, false)).isTrue(); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(1); @@ -206,8 +206,8 @@ void testReportTransaction() { void testContextPropagationOnlyRespected() { doReturn(true).when(coreConfiguration).isContextPropagationOnly(); - reporter.reportPartialTransaction(new Transaction(tracer)); - reporter.report(new Transaction(tracer)); + reporter.reportPartialTransaction(new TransactionImpl(tracer)); + reporter.report(new TransactionImpl(tracer)); assertThat(reporter.flush(5, TimeUnit.SECONDS, false)).isTrue(); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(0); @@ -219,7 +219,7 @@ void testContextPropagationOnlyRespected() { @Test void testReportTransaction_withFlushRequest() { - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); assertThat(receivedEvents.get()).isEqualTo(0); assertThat(reporter.flush(5, TimeUnit.SECONDS, true)).isTrue(); assertThat(reporter.getDropped()).isEqualTo(0); @@ -237,7 +237,7 @@ void testReportTransaction_withFlushRequest() { @Test void testReportSpan() { - reporter.report(new Span(tracer)); + reporter.report(new SpanImpl(tracer)); reporter.flush(); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(1); @@ -252,7 +252,7 @@ void testReportSpan() { @Test void testReportSpan_withFlushRequest() { - reporter.report(new Span(tracer)); + reporter.report(new SpanImpl(tracer)); reporter.flush(5, TimeUnit.SECONDS, true); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(2); @@ -277,7 +277,7 @@ void testSecretToken() { } exchange.setStatusCode(200).endExchange(); }; - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); reporter.flush(); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(1); @@ -285,7 +285,7 @@ void testSecretToken() { @Test void testReportErrorCapture() { - reporter.report(new ErrorCapture(tracer)); + reporter.report(new ErrorCaptureImpl(tracer)); reporter.flush(); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(1); @@ -300,7 +300,7 @@ void testReportErrorCapture() { @Test void testTimeout() { timeout.set(TimeDuration.of("1ms")); - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); await().untilAsserted(() -> assertThat(reporter.getReported()).isEqualTo(1)); assertThat(reporter.getDropped()).isEqualTo(0); assertThat(receivedIntakeApiCalls.get()).isEqualTo(1); @@ -317,13 +317,13 @@ void testTimeout() { void testFailingApmServer() { statusCode = HttpStatus.SERVICE_UNAVAILABLE_503; // try to report a few events to trigger backoff - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); reporter.flush(1, TimeUnit.SECONDS, false); - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); reporter.flush(1, TimeUnit.SECONDS, false); - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); reporter.flush(1, TimeUnit.SECONDS, false); - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); assertThat(v2handler.isHealthy()).isFalse(); assertThat(reporter.flush(1, TimeUnit.SECONDS, false)).isFalse(); @@ -339,7 +339,7 @@ void testErrorResponseParsing() { acceptedEventCount = 2; // try to report a few events to trigger backoff for (int i = 0; i < 5; i++) { - reporter.report(new Transaction(tracer)); + reporter.report(new TransactionImpl(tracer)); } reporter.flush(1, TimeUnit.SECONDS, false); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandlerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandlerTest.java index ba31a13dac..cea5759cb7 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandlerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/IntakeV2ReportingEventHandlerTest.java @@ -20,16 +20,16 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.common.util.Version; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.MetaDataMock; import co.elastic.apm.agent.impl.metadata.ProcessInfo; -import co.elastic.apm.agent.impl.metadata.Service; +import co.elastic.apm.agent.impl.metadata.ServiceImpl; import co.elastic.apm.agent.impl.metadata.SystemInfo; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.processor.ProcessorEventHandler; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import com.dslplatform.json.DslJson; @@ -103,11 +103,11 @@ void setUp() throws Exception { mockApmServer2.start(); final ConfigurationRegistry configurationRegistry = SpyConfiguration.createSpyConfig(); - final ReporterConfiguration reporterConfiguration = configurationRegistry.getConfig(ReporterConfiguration.class); - final CoreConfiguration coreConfiguration = configurationRegistry.getConfig(CoreConfiguration.class); + final ReporterConfigurationImpl reporterConfiguration = configurationRegistry.getConfig(ReporterConfigurationImpl.class); + final CoreConfigurationImpl coreConfiguration = configurationRegistry.getConfig(CoreConfigurationImpl.class); SystemInfo system = new SystemInfo("x64", "localhost", null, "platform"); final ProcessInfo title = new ProcessInfo("title"); - final Service service = new Service(); + final ServiceImpl service = new ServiceImpl(); apmServerClient = new ApmServerClient(configurationRegistry); apmServerClient.start(List.of( new URL(HTTP_LOCALHOST + mockApmServer1.port()), @@ -118,21 +118,21 @@ void setUp() throws Exception { reporterConfiguration, mock(ProcessorEventHandler.class), new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create(title, service, system, null, Collections.emptyMap(), null) ), apmServerClient); final ProcessInfo title1 = new ProcessInfo("title"); - final Service service1 = new Service(); + final ServiceImpl service1 = new ServiceImpl(); ApmServerClient nonConnectedApmServerClient = new ApmServerClient(configurationRegistry); nonConnectedApmServerClient.start(List.of(new URL("http://non.existing:8080"))); nonConnectedReportingEventHandler = new IntakeV2ReportingEventHandler( reporterConfiguration, mock(ProcessorEventHandler.class), new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), nonConnectedApmServerClient, MetaDataMock.create(title1, service1, system, null, Collections.emptyMap(), null) ), @@ -244,21 +244,21 @@ void testRandomJitter() { private void reportTransaction(IntakeV2ReportingEventHandler reportingEventHandler) throws Exception { final ReportingEvent reportingEvent = new ReportingEvent(); - reportingEvent.setTransaction(new Transaction(MockTracer.create())); + reportingEvent.setTransaction(new TransactionImpl(MockTracer.create())); reportingEventHandler.onEvent(reportingEvent, -1, true); } private void reportSpan() throws Exception { final ReportingEvent reportingEvent = new ReportingEvent(); - reportingEvent.setSpan(new Span(MockTracer.create())); + reportingEvent.setSpan(new SpanImpl(MockTracer.create())); reportingEventHandler.onEvent(reportingEvent, -1, true); } private void reportError() throws Exception { final ReportingEvent reportingEvent = new ReportingEvent(); - reportingEvent.setError(new ErrorCapture(MockTracer.create())); + reportingEvent.setError(new ErrorCaptureImpl(MockTracer.create())); reportingEventHandler.onEvent(reportingEvent, -1, true); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/PartialTransactionTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/PartialTransactionTest.java index 1b8a6ec486..1176b4b6c8 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/PartialTransactionTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/PartialTransactionTest.java @@ -20,11 +20,11 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.metadata.MetaDataMock; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import com.github.tomakehurst.wiremock.junit5.WireMockExtension; @@ -79,7 +79,7 @@ public void setup() throws MalformedURLException { ApmServerClient client = new ApmServerClient(spyConfig); client.start(List.of(new URL(apmServer.getRuntimeInfo().getHttpBaseUrl()))); - StacktraceConfiguration stackTraceConfig = spyConfig.getConfig(StacktraceConfiguration.class); + StacktraceConfigurationImpl stackTraceConfig = spyConfig.getConfig(StacktraceConfigurationImpl.class); DslJsonSerializer serializer = new DslJsonSerializer(stackTraceConfig, client, MetaDataMock.create()); PartialTransactionReporter partialTransactionReporter = new PartialTransactionReporter(client, serializer, objectPoolFactory); @@ -96,10 +96,10 @@ public void cleanup() { @Test public void testReportAwsLambdaTransaction() { apmServer.stubFor(post(urlEqualTo("/register/transaction")).willReturn(aResponse().withStatus(200))); - ServerlessConfiguration serverlessConfig = spyConfig.getConfig(ServerlessConfiguration.class); + ServerlessConfigurationImpl serverlessConfig = spyConfig.getConfig(ServerlessConfigurationImpl.class); doReturn(true).when(serverlessConfig).runsOnAwsLambda(); - Transaction tx1 = tracer + TransactionImpl tx1 = tracer .startRootTransaction(null) .withName("faas-transaction"); tx1.getFaas().withExecution("foo-bar-id"); @@ -135,7 +135,7 @@ public void testReportAwsLambdaTransaction() { tx1.deactivate().end(); apmServer.verify(1, postRequestedFor(urlEqualTo("/register/transaction"))); - Transaction tx2 = tracer + TransactionImpl tx2 = tracer .startRootTransaction(null) .withName("second-faas-transaction"); tx2.getFaas().withExecution("baz-id"); @@ -170,10 +170,10 @@ public void testReportAwsLambdaTransaction() { @Test public void testNoMoreReportingAfter4xx() { apmServer.stubFor(post(urlEqualTo("/register/transaction")).willReturn(aResponse().withStatus(404))); - ServerlessConfiguration serverlessConfig = spyConfig.getConfig(ServerlessConfiguration.class); + ServerlessConfigurationImpl serverlessConfig = spyConfig.getConfig(ServerlessConfigurationImpl.class); doReturn(true).when(serverlessConfig).runsOnAwsLambda(); - Transaction tx1 = tracer + TransactionImpl tx1 = tracer .startRootTransaction(null) .withName("faas-transaction"); tx1.getFaas().withExecution("foo-bar-id"); @@ -182,7 +182,7 @@ public void testNoMoreReportingAfter4xx() { tx1.deactivate().end(); - Transaction tx2 = tracer + TransactionImpl tx2 = tracer .startRootTransaction(null) .withName("faas-transaction"); tx2.getFaas().withExecution("foo-bar-id"); @@ -196,10 +196,10 @@ public void testNoMoreReportingAfter4xx() { @Test public void testNonLambdaTransactionNotReported() { apmServer.stubFor(post(urlEqualTo("/register/transaction")).willReturn(aResponse().withStatus(200))); - ServerlessConfiguration serverlessConfig = spyConfig.getConfig(ServerlessConfiguration.class); + ServerlessConfigurationImpl serverlessConfig = spyConfig.getConfig(ServerlessConfigurationImpl.class); doReturn(true).when(serverlessConfig).runsOnAwsLambda(); - Transaction transaction = tracer.startRootTransaction(null).withName("nonfaas-transaction"); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("nonfaas-transaction"); transaction.activate(); apmServer.verify(0, postRequestedFor(urlEqualTo("/register/transaction"))); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ReporterFactoryTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ReporterFactoryTest.java index ed2748dd09..c463f8cb2d 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ReporterFactoryTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ReporterFactoryTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.metadata.MetaDataMock; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.server.HttpConfiguration; @@ -58,7 +58,7 @@ class ReporterFactoryTest { private ReporterFactory reporterFactory = new ReporterFactory(); private ConfigurationRegistry configuration; private AtomicBoolean requestHandled = new AtomicBoolean(false); - private ReporterConfiguration reporterConfiguration; + private ReporterConfigurationImpl reporterConfiguration; @BeforeEach void setUp() throws Exception { @@ -89,7 +89,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques }); server.start(); configuration = SpyConfiguration.createSpyConfig(); - reporterConfiguration = configuration.getConfig(ReporterConfiguration.class); + reporterConfiguration = configuration.getConfig(ReporterConfigurationImpl.class); doReturn(Collections.singletonList(new URL("https://localhost:" + getPort()))).when(reporterConfiguration).getServerUrls(); } @@ -107,12 +107,12 @@ void testNotValidatingSslCertificate() throws Exception { doReturn(false).when(reporterConfiguration).isVerifyServerCert(); ApmServerClient apmServerClient = new ApmServerClient(configuration); apmServerClient.start(); - DslJsonSerializer serializer = new DslJsonSerializer(configuration.getConfig(StacktraceConfiguration.class), apmServerClient, MetaDataMock.create()); - ObjectPoolFactory poolFactory = new ObjectPoolFactory(); + DslJsonSerializer serializer = new DslJsonSerializer(configuration.getConfig(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create()); + ObjectPoolFactoryImpl poolFactory = new ObjectPoolFactoryImpl(); final Reporter reporter = reporterFactory.createReporter(configuration, apmServerClient, serializer, ReporterMonitor.NOOP, poolFactory); reporter.start(); - reporter.report(new Transaction(MockTracer.create())); + reporter.report(new TransactionImpl(MockTracer.create())); reporter.flush(); assertThat(requestHandled) @@ -126,12 +126,12 @@ void testValidatingSslCertificate() throws Exception { doReturn(true).when(reporterConfiguration).isVerifyServerCert(); ApmServerClient apmServerClient = new ApmServerClient(configuration); apmServerClient.start(); - DslJsonSerializer serializer = new DslJsonSerializer(configuration.getConfig(StacktraceConfiguration.class), apmServerClient, MetaDataMock.create()); - ObjectPoolFactory poolFactory = new ObjectPoolFactory(); + DslJsonSerializer serializer = new DslJsonSerializer(configuration.getConfig(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create()); + ObjectPoolFactoryImpl poolFactory = new ObjectPoolFactoryImpl(); final Reporter reporter = reporterFactory.createReporter(configuration, apmServerClient, serializer, ReporterMonitor.NOOP, poolFactory); reporter.start(); - reporter.report(new Transaction(MockTracer.create())); + reporter.report(new TransactionImpl(MockTracer.create())); reporter.flush(); assertThat(requestHandled) diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/TestProcessor.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/TestProcessor.java index 53937e8cbb..9b3ef496e2 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/TestProcessor.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/TestProcessor.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.report; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.processor.Processor; import java.util.concurrent.atomic.AtomicInteger; @@ -30,12 +30,12 @@ public class TestProcessor implements Processor { private static AtomicInteger errorCounter = new AtomicInteger(); @Override - public void processBeforeReport(Transaction transaction) { + public void processBeforeReport(TransactionImpl transaction) { transactionCounter.incrementAndGet(); } @Override - public void processBeforeReport(ErrorCapture error) { + public void processBeforeReport(ErrorCaptureImpl error) { errorCounter.incrementAndGet(); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java index 8f341fd835..34caa3ba05 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java @@ -20,19 +20,18 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.context.AbstractContext; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.context.AbstractContextImpl; +import co.elastic.apm.agent.impl.context.DestinationImpl; import co.elastic.apm.agent.impl.context.Headers; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Url; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.Agent; import co.elastic.apm.agent.impl.metadata.CloudProviderInfo; import co.elastic.apm.agent.impl.metadata.FaaSMetaDataExtension; @@ -42,18 +41,13 @@ import co.elastic.apm.agent.impl.metadata.MetaDataMock; import co.elastic.apm.agent.impl.metadata.NameAndIdField; import co.elastic.apm.agent.impl.metadata.ProcessInfo; -import co.elastic.apm.agent.impl.metadata.Service; +import co.elastic.apm.agent.impl.metadata.ServiceImpl; import co.elastic.apm.agent.impl.metadata.SystemInfo; import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.OTelSpanKind; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.StackFrame; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.*; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.sdk.internal.collections.LongList; import co.elastic.apm.agent.sdk.internal.util.IOUtils; @@ -102,13 +96,13 @@ class DslJsonSerializerTest { @BeforeEach void setUp() throws Exception { - StacktraceConfiguration stacktraceConfiguration = mock(StacktraceConfiguration.class); + StacktraceConfigurationImpl stacktraceConfiguration = mock(StacktraceConfigurationImpl.class); doReturn(15).when(stacktraceConfiguration).getStackTraceLimit(); apmServerClient = mock(ApmServerClient.class); metaData = MetaDataMock.create(); objectMapper = new ObjectMapper(); tracer = MockTracer.createRealTracer(); - SerializationConstants.init(tracer.getConfig(CoreConfiguration.class)); + SerializationConstants.init(tracer.getConfig(CoreConfigurationImpl.class)); DslJsonSerializer serializer = new DslJsonSerializer(stacktraceConfiguration, apmServerClient, metaData); writer = serializer.newWriter(); @@ -149,7 +143,7 @@ void testSerializeUrlPort(boolean useNumericPort) { doReturn(useNumericPort).when(apmServerClient).supportsNumericUrlPort(); - Url url = new Url() + UrlImpl url = new UrlImpl() .withPort(42) .withHostname("hostname") .withProtocol("http") @@ -168,9 +162,9 @@ void testSerializeUrlPort(boolean useNumericPort) { @Test void testErrorSerialization() { - Transaction transaction = new Transaction(tracer); - transaction.startRoot(-1, ConstantSampler.of(true), Baggage.EMPTY); - ErrorCapture error = new ErrorCapture(tracer).asChildOf(transaction).withTimestamp(5000); + TransactionImpl transaction = new TransactionImpl(tracer); + transaction.startRoot(-1, ConstantSampler.of(true), BaggageImpl.EMPTY); + ErrorCaptureImpl error = new ErrorCaptureImpl(tracer).asChildOf(transaction).withTimestamp(5000); error.setTransactionSampled(true); error.setTransactionType("test-type"); error.setTransactionName(new StringBuilder("Test Transaction")); @@ -201,11 +195,11 @@ void testErrorSerialization() { @Test void testErrorSerializationAllFrames() { - StacktraceConfiguration stacktraceConfiguration = mock(StacktraceConfiguration.class); + StacktraceConfigurationImpl stacktraceConfiguration = mock(StacktraceConfigurationImpl.class); doReturn(-1).when(stacktraceConfiguration).getStackTraceLimit(); writer = new DslJsonSerializer(stacktraceConfiguration, apmServerClient, metaData).newWriter(); - ErrorCapture error = new ErrorCapture(tracer).withTimestamp(5000); + ErrorCaptureImpl error = new ErrorCaptureImpl(tracer).withTimestamp(5000); Exception exception = new Exception("test"); error.setException(exception); @@ -216,10 +210,10 @@ void testErrorSerializationAllFrames() { @Test void testErrorSerializationWithEmptyTraceId() { - Transaction transaction = new Transaction(tracer); - transaction.startRoot(-1, ConstantSampler.of(true), Baggage.EMPTY); + TransactionImpl transaction = new TransactionImpl(tracer); + transaction.startRoot(-1, ConstantSampler.of(true), BaggageImpl.EMPTY); transaction.getTraceContext().getTraceId().resetState(); - ErrorCapture error = new ErrorCapture(tracer).asChildOf(transaction).withTimestamp(5000); + ErrorCaptureImpl error = new ErrorCaptureImpl(tracer).asChildOf(transaction).withTimestamp(5000); JsonNode errorTree = readJsonString(writer.toJsonString(error)); @@ -240,7 +234,7 @@ void testErrorSerializationWithEmptyTraceId() { @Test void testErrorSerializationOutsideTrace() { MockReporter reporter = new MockReporter(); - Tracer tracer = MockTracer.createRealTracer(reporter); + ElasticApmTracer tracer = MockTracer.createRealTracer(reporter); tracer.captureAndReportException(new Exception("test"), getClass().getClassLoader()); String errorJson = writer.toJsonString(reporter.getFirstError()); @@ -261,7 +255,7 @@ void testErrorSerializationOutsideTrace() { void testErrorSerializationWithExceptionCause() { // testing outside trace is enough to test exception serialization logic MockReporter reporter = new MockReporter(); - Tracer tracer = MockTracer.createRealTracer(reporter); + ElasticApmTracer tracer = MockTracer.createRealTracer(reporter); Exception cause2 = new IllegalStateException("second cause"); Exception cause1 = new RuntimeException("first cause", cause2); @@ -336,7 +330,7 @@ void testLimitStringValueLength() throws IOException { @Test void testNullTransactionHeaders() { - Transaction transaction = new Transaction(tracer); + TransactionImpl transaction = new TransactionImpl(tracer); transaction.getContext().getRequest().addHeader("foo", (String) null); transaction.getContext().getRequest().addHeader("baz", (Enumeration) null); transaction.getContext().getRequest().getHeaders().add("bar", null); @@ -350,7 +344,7 @@ void testNullTransactionHeaders() { @Test void testMessageHeaders() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getTraceContext().asRootSpan(ConstantSampler.of(true)); span.withType("messaging").withSubtype("kafka"); @@ -380,7 +374,7 @@ void testMessageHeaders() { @Test void testSpanTypeSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getTraceContext().asRootSpan(ConstantSampler.of(true)); span.withType("template.jsf.render.view"); JsonNode spanJson = readJsonString(writer.toJsonString(span)); @@ -395,19 +389,19 @@ void testSpanTypeSerialization() { spanJson = readJsonString(writer.toJsonString(span)); assertThat(spanJson.get("type").textValue()).isEqualTo("template.jsf_lifecycle.render_view"); - span = new Span(tracer); + span = new SpanImpl(tracer); span.getTraceContext().asRootSpan(ConstantSampler.of(true)); span.withType("template").withAction("jsf.render"); spanJson = readJsonString(writer.toJsonString(span)); assertThat(spanJson.get("type").textValue()).isEqualTo("template..jsf_render"); - span = new Span(tracer); + span = new SpanImpl(tracer); span.getTraceContext().asRootSpan(ConstantSampler.of(true)); span.withType("template").withSubtype("jsf.render"); spanJson = readJsonString(writer.toJsonString(span)); assertThat(spanJson.get("type").textValue()).isEqualTo("template.jsf_render"); - span = new Span(tracer); + span = new SpanImpl(tracer); span.getTraceContext().asRootSpan(ConstantSampler.of(true)); span.withSubtype("jsf").withAction("render"); spanJson = readJsonString(writer.toJsonString(span)); @@ -416,7 +410,7 @@ void testSpanTypeSerialization() { @Test void testSpanHttpContextSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getHttp() .withMethod("GET") .withStatusCode(523) @@ -451,8 +445,8 @@ void testSpanDestinationContextSerializationWithCombinations(boolean[] contentCo boolean hasPort = contentCombination[1]; boolean hasServiceTargetContent = contentCombination[2]; boolean hasCloudContent = contentCombination[3]; - Span span = new Span(MockTracer.create()); - Destination dest = span.getContext().getDestination(); + SpanImpl span = new SpanImpl(MockTracer.create()); + DestinationImpl dest = span.getContext().getDestination(); if (hasAddress) { dest.withAddress("whatever.com"); } @@ -509,7 +503,7 @@ void testSpanDestinationContextSerializationWithCombinations(boolean[] contentCo @Test void testTransactionNullFrameworkNameSerialization() { - Transaction transaction = new Transaction(tracer); + TransactionImpl transaction = new TransactionImpl(tracer); transaction.getTraceContext().setServiceInfo("service-name", null); transaction.setUserFrameworkName(null); JsonNode transactionJson = readJsonString(writer.toJsonString(transaction)); @@ -518,7 +512,7 @@ void testTransactionNullFrameworkNameSerialization() { @Test void testTransactionEmptyFrameworkNameSerialization() { - Transaction transaction = new Transaction(tracer); + TransactionImpl transaction = new TransactionImpl(tracer); transaction.getTraceContext().setServiceInfo("service-name", null); transaction.setUserFrameworkName(""); JsonNode transactionJson = readJsonString(writer.toJsonString(transaction)); @@ -527,7 +521,7 @@ void testTransactionEmptyFrameworkNameSerialization() { @Test void testSpanInvalidDestinationSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDestination().withAddress(null).withPort(-1); span.getContext().getServiceTarget().withUserName("").withNameOnlyDestinationResource(); @@ -540,7 +534,7 @@ void testSpanInvalidDestinationSerialization() { @Test void testSpanValidPortSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDestination().withAddress(null).withPort(8090); JsonNode spanJson = readJsonString(writer.toJsonString(span)); @@ -553,7 +547,7 @@ void testSpanValidPortSerialization() { @Test void testSpanValidAddressAndPortSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDestination().withAddress("test").withPort(8090); JsonNode spanJson = readJsonString(writer.toJsonString(span)); @@ -566,7 +560,7 @@ void testSpanValidAddressAndPortSerialization() { @Test void testSpanValidAddressSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDestination().withAddress("test").withPort(0); JsonNode spanJson = readJsonString(writer.toJsonString(span)); @@ -579,7 +573,7 @@ void testSpanValidAddressSerialization() { @Test void testSpanValidServiceResourceSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDestination().withAddress("").withPort(0); span.getContext().getServiceTarget().withType("test").withName("resource"); @@ -598,7 +592,7 @@ void testSpanValidServiceResourceSerialization() { @Test void testSpanValidServiceAndAddressResourceSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDestination().withAddress("test-address").withPort(0); span.getContext().getServiceTarget().withType("test").withName("test-resource").withNameOnlyDestinationResource(); @@ -618,7 +612,7 @@ void testSpanValidServiceAndAddressResourceSerialization() { @Test void testSpanMessageContextSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getMessage() .withRoutingKey("routing-key") .withQueue("test-queue") @@ -651,7 +645,7 @@ void testSpanMessageContextSerialization() { @Test void testSpanMessageContextSerializationWithoutRoutingKey() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getMessage() .withQueue("test-queue") .withBody("test-body") @@ -666,7 +660,7 @@ void testSpanMessageContextSerializationWithoutRoutingKey() { @Test void testSpanMessageContextInvalidTimestamp() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getMessage() .withQueue("test-queue"); @@ -683,7 +677,7 @@ void testSpanMessageContextInvalidTimestamp() { @Test void testSpanDbContextSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getContext().getDb() .withAffectedRowsCount(5) .withInstance("test-instance") @@ -700,11 +694,11 @@ void testSpanDbContextSerialization() { @Test void testSpanChildIdSerialization() { - Id id1 = Id.new64BitId(); + IdImpl id1 = IdImpl.new64BitId(); id1.setToRandomValue(); - Id id2 = Id.new64BitId(); + IdImpl id2 = IdImpl.new64BitId(); id2.setToRandomValue(); - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.withChildIds(LongList.of(id1.getLeastSignificantBits(), id2.getLeastSignificantBits())); JsonNode spanJson = readJsonString(writer.toJsonString(span)); @@ -730,7 +724,7 @@ void testSerializeMetadata() throws Exception { doReturn(kubernetes).when(systemInfo).getKubernetesInfo(); doReturn("9 3/4").when(systemInfo).getPlatform(); // this terrible pun is intentional - Service service = new Service() + ServiceImpl service = new ServiceImpl() .withAgent(new Agent("MyAgent", "1.11.1")) .withFramework(new Framework("Lambda_Java", "1.2.3")) .withName("MyService") @@ -743,7 +737,7 @@ void testSerializeMetadata() throws Exception { CloudProviderInfo cloudProviderInfo = createCloudProviderInfo(); writer = new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create( processInfo, service, systemInfo, cloudProviderInfo, @@ -824,8 +818,8 @@ void testSerializeMetadata() throws Exception { @Test void testConfiguredServiceNodeName() throws Exception { ConfigurationRegistry configRegistry = SpyConfiguration.createSpyConfig(); - doReturn("Custom-Node-Name").when(configRegistry.getConfig(CoreConfiguration.class)).getServiceNodeName(); - writer = new DslJsonSerializer(mock(StacktraceConfiguration.class), apmServerClient, MetaData.create(configRegistry, null)).newWriter(); + doReturn("Custom-Node-Name").when(configRegistry.getConfig(CoreConfigurationImpl.class)).getServiceNodeName(); + writer = new DslJsonSerializer(mock(StacktraceConfigurationImpl.class), apmServerClient, MetaData.create(configRegistry, null)).newWriter(); writer.blockUntilReady(); writer.appendMetaDataNdJsonToStream(); JsonNode metaDataJson = readJsonString(writer.toString()).get("metadata"); @@ -840,7 +834,7 @@ void testConfiguredServiceNodeName() throws Exception { @Test void testTransactionContextSerialization() { - Transaction transaction = new Transaction(tracer); + TransactionImpl transaction = new TransactionImpl(tracer); // test only the most recent server here doReturn(true).when(apmServerClient).supportsMultipleHeaderValues(); @@ -851,7 +845,7 @@ void testTransactionContextSerialization() { .withEmail("user@email.com") .withUsername("bob"); - Request request = transaction.getContext().getRequest(); + RequestImpl request = transaction.getContext().getRequest(); request.withMethod("PUT") .withHttpVersion("5.0") @@ -889,7 +883,7 @@ void testTransactionContextSerialization() { transaction.getContext().getServiceOrigin().withName("origin_service_name").withId("origin_service_id").withVersion("origin_service_version"); transaction.getContext().getCloudOrigin().withRegion("origin_cloud_region").withAccountId("origin_cloud_account_id").withProvider("origin_cloud_provider").withServiceName("origin_cloud_service_name"); - TraceContext ctx = transaction.getTraceContext(); + TraceContextImpl ctx = transaction.getTraceContext(); String serviceName = RandomStringUtils.randomAlphabetic(5); String serviceVersion = RandomStringUtils.randomAlphabetic(5); @@ -985,8 +979,8 @@ void testTransactionContextSerialization() { @Test void testBodyBuffer() throws IOException { - final Transaction transaction = createRootTransaction(); - Request request = transaction.getContext().getRequest(); + final TransactionImpl transaction = createRootTransaction(); + RequestImpl request = transaction.getContext().getRequest(); final CharBuffer bodyBuffer = request.withBodyBuffer(); IOUtils.decodeUtf8Bytes("{f".getBytes(StandardCharsets.UTF_8), bodyBuffer); IOUtils.decodeUtf8Bytes(new byte[]{0, 0, 'o', 'o', 0}, 2, 2, bodyBuffer); @@ -1008,8 +1002,8 @@ void testBodyBuffer() throws IOException { */ @Test void testNonFlippedTransactionBodyBuffer() throws IOException { - final Transaction transaction = createRootTransaction(); - Request request = transaction.getContext().getRequest(); + final TransactionImpl transaction = createRootTransaction(); + RequestImpl request = transaction.getContext().getRequest(); request.withBodyBuffer().append("TEST"); final String content = writer.toJsonString(transaction); System.out.println(content); @@ -1019,13 +1013,13 @@ void testNonFlippedTransactionBodyBuffer() throws IOException { @Test void testBodyBufferCopy() throws IOException { - final Transaction transaction = createRootTransaction(); - Request request = transaction.getContext().getRequest(); + final TransactionImpl transaction = createRootTransaction(); + RequestImpl request = transaction.getContext().getRequest(); final CharBuffer bodyBuffer = request.withBodyBuffer(); IOUtils.decodeUtf8Bytes("{foo}".getBytes(StandardCharsets.UTF_8), bodyBuffer); request.endOfBufferInput(); - Transaction copy = createRootTransaction(); + TransactionImpl copy = createRootTransaction(); copy.getContext().copyFrom(transaction.getContext()); assertThat(objectMapper.readTree(writer.toJsonString(copy)).get("context")) @@ -1034,7 +1028,7 @@ void testBodyBufferCopy() throws IOException { @Test void testCustomContext() throws Exception { - final Transaction transaction = createRootTransaction(); + final TransactionImpl transaction = createRootTransaction(); transaction.addCustomContext("string", "foo"); final String longString = RandomStringUtils.randomAlphanumeric(10001); transaction.addCustomContext("long_string", longString); @@ -1050,7 +1044,7 @@ void testCustomContext() throws Exception { @Test void testJsonSchemaDslJsonEmptyValues() throws IOException { - Transaction transaction = new Transaction(tracer); + TransactionImpl transaction = new TransactionImpl(tracer); final String content = writer.toJsonString(transaction); System.out.println(content); JsonNode transactionNode = objectMapper.readTree(content); @@ -1271,11 +1265,11 @@ void testActivationMethodMetadataUpdate(boolean value1, boolean value2 ) throws // because metadata is serialized only once, we need to ensure it's properly updated whenever needed // in particular when going from 'apm server version unknown' to 'apm server version known' - StacktraceConfiguration stacktraceConfiguration = mock(StacktraceConfiguration.class); + StacktraceConfigurationImpl stacktraceConfiguration = mock(StacktraceConfigurationImpl.class); apmServerClient = mock(ApmServerClient.class); doReturn(value1).when(apmServerClient).supportsActivationMethod(); - Service service = mock(Service.class); + ServiceImpl service = mock(ServiceImpl.class); Agent agent = new Agent("java-test", "1.0.0"); doReturn(agent).when(service).getAgent(); MetaData mockMetada = MetaDataMock.createDefaultMock(); @@ -1316,11 +1310,11 @@ private void checkMetadataActivationMethod(String json, @Nullable String expecte } private MetaData createMetaData() throws Exception { - return createMetaData(SystemInfo.create("hostname", 0, mock(ServerlessConfiguration.class))); + return createMetaData(SystemInfo.create("hostname", 0, mock(ServerlessConfigurationImpl.class))); } private MetaData createMetaData(SystemInfo system) throws Exception { - Service service = new Service().withAgent(new Agent("name", "version")).withName("name"); + ServiceImpl service = new ServiceImpl().withAgent(new Agent("name", "version")).withName("name"); final ProcessInfo processInfo = new ProcessInfo("title"); processInfo.getArgv().add("test"); return MetaDataMock.create(processInfo, service, system, createCloudProviderInfo(), new HashMap<>(0), createFaaSMetaDataExtension()).get(); @@ -1346,22 +1340,22 @@ private FaaSMetaDataExtension createFaaSMetaDataExtension() { ); } - private Transaction createRootTransaction(Sampler sampler) { - Transaction t = new Transaction(tracer); - t.startRoot(0, sampler, Baggage.EMPTY); + private TransactionImpl createRootTransaction(Sampler sampler) { + TransactionImpl t = new TransactionImpl(tracer); + t.startRoot(0, sampler, BaggageImpl.EMPTY); t.withType("type"); t.getContext().getRequest().withMethod("GET"); t.getContext().getRequest().getUrl().withFull("http://localhost:8080/foo/bar"); return t; } - private Transaction createRootTransaction() { + private TransactionImpl createRootTransaction() { return createRootTransaction(ConstantSampler.of(true)); } @Test void testSpanStackFrameSerialization() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.setStackTrace(Arrays.asList(StackFrame.of("foo.Bar", "baz"), StackFrame.of("foo.Bar$Baz", "qux"))); JsonNode spanJson = readJsonString(writer.toJsonString(span)); @@ -1394,10 +1388,10 @@ void testSampledRootTransaction() { private void testRootTransactionSampleRate(boolean sampled, double samplerRate, @Nullable Double expectedRate) { Sampler sampler = mock(Sampler.class); - doReturn(sampled).when(sampler).isSampled(any(Id.class)); + doReturn(sampled).when(sampler).isSampled(any(IdImpl.class)); doReturn(samplerRate).when(sampler).getSampleRate(); - Transaction transaction = createRootTransaction(sampler); + TransactionImpl transaction = createRootTransaction(sampler); JsonNode jsonTransaction = readJsonString(writer.toJsonString(transaction)); @@ -1415,15 +1409,15 @@ private void testRootTransactionSampleRate(boolean sampled, double samplerRate, void testSampledSpan_rateFromParent() { Sampler sampler = mock(Sampler.class); - doReturn(true).when(sampler).isSampled(any(Id.class)); + doReturn(true).when(sampler).isSampled(any(IdImpl.class)); doReturn(0.42d).when(sampler).getSampleRate(); - Transaction transaction = createRootTransaction(sampler); - TraceContext transactionContext = transaction.getTraceContext(); + TransactionImpl transaction = createRootTransaction(sampler); + TraceContextImpl transactionContext = transaction.getTraceContext(); assertThat(transactionContext.isSampled()).isTrue(); assertThat(transactionContext.getSampleRate()).isEqualTo(0.42d); - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getTraceContext().asChildOf(transactionContext); JsonNode jsonSpan = readJsonString(writer.toJsonString(span)); @@ -1434,10 +1428,10 @@ void testSampledSpan_rateFromParent() { @Test void testNonSampledTransaction() { Sampler sampler = mock(Sampler.class); - doReturn(false).when(sampler).isSampled(any(Id.class)); + doReturn(false).when(sampler).isSampled(any(IdImpl.class)); doReturn(0.42d).when(sampler).getSampleRate(); - Transaction transaction = createRootTransaction(sampler); - TraceContext transactionContext = transaction.getTraceContext(); + TransactionImpl transaction = createRootTransaction(sampler); + TraceContextImpl transactionContext = transaction.getTraceContext(); assertThat(transactionContext.isSampled()).isFalse(); assertThat(transactionContext.getSampleRate()).isEqualTo(0.0d); JsonNode transactionSpan = readJsonString(writer.toJsonString(transaction)); @@ -1450,7 +1444,7 @@ void multiValueHeaders(boolean supportsMulti) { // older versions of APM server do not support multi-value headers // thus we should make sure to not break those - Transaction transaction = createRootTransaction(); + TransactionImpl transaction = createRootTransaction(); transaction.getContext().getRequest() .addHeader("user-agent", "user-agent1") @@ -1491,14 +1485,14 @@ void multiValueHeaders(boolean supportsMulti) { @Test void testOTelSpanSerialization() { - Span span = new Span(tracer).withName("otel span"); + SpanImpl span = new SpanImpl(tracer).withName("otel span"); testOTelSpanSerialization(span, s -> readJsonString(writer.toJsonString(s))); - Transaction transaction = new Transaction(MockTracer.create()).withName("otel span"); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()).withName("otel span"); testOTelSpanSerialization(transaction, t -> readJsonString(writer.toJsonString(t))); } - private > void testOTelSpanSerialization(T context, Function toJson) { + private > void testOTelSpanSerialization(T context, Function toJson) { assertThat(context.getOtelKind()) .describedAs("otel span kind should not be set by default") @@ -1537,7 +1531,7 @@ private > void testOTelSpanSerialization(T context, Fu @Test void testNonCompositeSpan() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); JsonNode jsonSpan = readJsonString(writer.toJsonString(span)); assertThat(jsonSpan.get("composite")).isNull(); @@ -1545,7 +1539,7 @@ void testNonCompositeSpan() { @Test void testCompositeSpan() { - Span span = new Span(tracer); + SpanImpl span = new SpanImpl(tracer); span.getComposite().init(1234, "exact_match"); JsonNode jsonSpan = readJsonString(writer.toJsonString(span)); @@ -1560,12 +1554,12 @@ void testCompositeSpan() { @Test void testSpanLinksSerialization() { - Transaction transaction = tracer.startRootTransaction(null); - Span parent1 = Objects.requireNonNull(transaction).createSpan(); + TransactionImpl transaction = tracer.startRootTransaction(null); + SpanImpl parent1 = Objects.requireNonNull(transaction).createSpan(); Map textTraceContextCarrier = new HashMap<>(); parent1.propagateContext(textTraceContextCarrier, TextHeaderMapAccessor.INSTANCE, null); transaction.addSpanLink(TextHeaderMapAccessor.INSTANCE, textTraceContextCarrier); - Span parent2 = transaction.createSpan(); + SpanImpl parent2 = transaction.createSpan(); Map binaryTraceContextCarrier = new HashMap<>(); parent2.propagateContext(binaryTraceContextCarrier, TextHeaderMapAccessor.INSTANCE, null); transaction.addSpanLink(TextHeaderMapAccessor.INSTANCE, binaryTraceContextCarrier); @@ -1584,15 +1578,15 @@ void testSpanLinksSerialization() { assertThat(parent2link.get("span_id").textValue()).isEqualTo(parent2.getTraceContext().getId().toString()); } - private static Id create128BitId(String id) { - Id idObj = Id.new128BitId(); + private static IdImpl create128BitId(String id) { + IdImpl idObj = IdImpl.new128BitId(); idObj.fromHexString(id, 0); return idObj; } @Test void testProfilingStackTraceIdSerialization() { - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); transaction.addProfilerCorrelationStackTrace(create128BitId("a1a2a3a4a5a6a7a8b1b2b3b4b5b6b7b8")); transaction.addProfilerCorrelationStackTrace(create128BitId("c1c2c3c4c5c6c7c8d1d2d3d4d5d6d7d8")); @@ -1696,7 +1690,7 @@ private String toJson(Map map) { } private String serializeTags(Map tags) { - final AbstractContext context = new AbstractContext() { + final AbstractContextImpl context = new AbstractContextImpl() { }; for (Map.Entry entry : tags.entrySet()) { if (entry.getValue() instanceof String) { diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java index 1abc82a114..964ac02e6f 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/MetricSetSerializationTest.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.report.serialize; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.tracer.metrics.Labels; import co.elastic.apm.agent.metrics.MetricCollector; import co.elastic.apm.agent.metrics.MetricRegistry; import co.elastic.apm.agent.metrics.MetricsProvider; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import com.dslplatform.json.JsonWriter; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -44,7 +44,7 @@ class MetricSetSerializationTest { private ObjectMapper objectMapper = new ObjectMapper(); - private MetricRegistry registry = new MetricRegistry(mock(ReporterConfiguration.class), spy(MetricsConfiguration.class)); + private MetricRegistry registry = new MetricRegistry(mock(ReporterConfigurationImpl.class), spy(MetricsConfigurationImpl.class)); private MetricRegistrySerializer metricRegistrySerializer = new MetricRegistrySerializer(); @Test diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/SerializationConstantsTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/SerializationConstantsTest.java index e6dbdd16db..7b3e743325 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/SerializationConstantsTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/SerializationConstantsTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import net.bytebuddy.agent.ByteBuddyAgent; @@ -49,7 +49,7 @@ void getDefaults() { void overrideDefaults() { ConfigurationRegistry config = SpyConfiguration.createSpyConfig(); - CoreConfiguration configuration = config.getConfig(CoreConfiguration.class); + CoreConfigurationImpl configuration = config.getConfig(CoreConfigurationImpl.class); doReturn(42).when(configuration).getLongFieldMaxLength(); MockTracer.MockInstrumentationSetup mockInstrumentationSetup = MockTracer.createMockInstrumentationSetup(config); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/AbstractSpanAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/AbstractSpanAssert.java index fd21a92d17..50398baf1b 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/AbstractSpanAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/AbstractSpanAssert.java @@ -18,14 +18,14 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.tracer.Outcome; import java.util.Objects; import java.util.stream.Collectors; -public class AbstractSpanAssert, ACTUAL extends AbstractSpan> extends ElasticContextAssert { +public class AbstractSpanAssert, ACTUAL extends AbstractSpanImpl> extends ElasticContextAssert { protected AbstractSpanAssert(ACTUAL actual, Class selfType) { super(actual, selfType); @@ -64,9 +64,9 @@ public SELF isNotExit() { return thiz(); } - public SELF hasParent(AbstractSpan expectedParent) { - TraceContext parentCtx = expectedParent.getTraceContext(); - TraceContext actualCtx = actual.getTraceContext(); + public SELF hasParent(AbstractSpanImpl expectedParent) { + TraceContextImpl parentCtx = expectedParent.getTraceContext(); + TraceContextImpl actualCtx = actual.getTraceContext(); checkObject("Expected span to have traceId '%s' but was '%s'", parentCtx.getTraceId(), actualCtx.getTraceId()); checkObject("Expected span to have parent-Id '%s' but was '%s'", parentCtx.getId(), actualCtx.getParentId()); @@ -80,7 +80,7 @@ public SELF hasSpanLinkCount(int expected) { return thiz(); } - public SELF hasSpanLink(AbstractSpan expectedLink) { + public SELF hasSpanLink(AbstractSpanImpl expectedLink) { if (!checkSpanLinksContain(expectedLink.getTraceContext())) { String links = actual.getSpanLinks().stream() .map(ctx -> String.format("%s-%s", ctx.getTraceId(), ctx.getParentId())) @@ -101,7 +101,7 @@ public SELF hasOtelAttribute(String key, Object expectedValue) { return thiz(); } - private boolean checkSpanLinksContain(TraceContext expectedLink) { + private boolean checkSpanLinksContain(TraceContextImpl expectedLink) { return actual.getSpanLinks().stream() .anyMatch(ctx -> Objects.equals(ctx.getParentId(), expectedLink.getId()) && Objects.equals(ctx.getTraceId(), expectedLink.getTraceId()) diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/Assertions.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/Assertions.java index 8a680803cf..c640665c9d 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/Assertions.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/Assertions.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.context.Db; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.context.DbImpl; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.testutils.assertions.metrics.MetricSetsAssert; import java.util.Collection; @@ -34,27 +34,27 @@ public class Assertions extends org.assertj.core.api.Assertions { private Assertions() { } - public static ServiceTargetAssert assertThat(ServiceTarget serviceTarget) { + public static ServiceTargetAssert assertThat(ServiceTargetImpl serviceTarget) { return new ServiceTargetAssert(serviceTarget); } - public static DestinationAssert assertThat(Destination destination) { + public static DestinationAssert assertThat(DestinationImpl destination) { return new DestinationAssert(destination); } - public static SpanAssert assertThat(Span span) { + public static SpanAssert assertThat(SpanImpl span) { return new SpanAssert(span); } - public static DbAssert assertThat(Db db) { + public static DbAssert assertThat(DbImpl db) { return new DbAssert(db); } - public static AbstractSpanAssert assertThat(AbstractSpan span) { + public static AbstractSpanAssert assertThat(AbstractSpanImpl span) { return new AbstractSpanAssert<>(span, AbstractSpanAssert.class); } - public static ElasticContextAssert assertThat(ElasticContext span) { + public static ElasticContextAssert assertThat(TraceStateImpl span) { return new ElasticContextAssert<>(span, ElasticContextAssert.class); } @@ -62,7 +62,7 @@ public static MetricSetsAssert assertThatMetricSets(Collection metricset return new MetricSetsAssert(metricsetsJson); } - public static BaggageAssert assertThat(Baggage baggage) { + public static BaggageAssert assertThat(BaggageImpl baggage) { return new BaggageAssert(baggage); } } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/BaggageAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/BaggageAssert.java index a31cccabc1..0b6f1a9997 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/BaggageAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/BaggageAssert.java @@ -18,14 +18,14 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.baggage.Baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import javax.annotation.Nullable; import java.util.Objects; -public class BaggageAssert extends BaseAssert { +public class BaggageAssert extends BaseAssert { - protected BaggageAssert(Baggage actual) { + protected BaggageAssert(BaggageImpl actual) { super(actual, BaggageAssert.class); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DbAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DbAssert.java index 6a3b5069a3..69825f0018 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DbAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DbAssert.java @@ -18,14 +18,14 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.context.Db; +import co.elastic.apm.agent.impl.context.DbImpl; import javax.annotation.Nullable; import java.nio.CharBuffer; -public class DbAssert extends BaseAssert { +public class DbAssert extends BaseAssert { - protected DbAssert(Db actual) { + protected DbAssert(DbImpl actual) { super(actual, DbAssert.class); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DestinationAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DestinationAssert.java index dde666dcf2..70259210f2 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DestinationAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/DestinationAssert.java @@ -18,11 +18,11 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.context.DestinationImpl; -public class DestinationAssert extends BaseAssert { +public class DestinationAssert extends BaseAssert { - DestinationAssert(Destination actual) { + DestinationAssert(DestinationImpl actual) { super(actual, DestinationAssert.class); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ElasticContextAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ElasticContextAssert.java index 7e140bea1e..76e7611ca6 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ElasticContextAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ElasticContextAssert.java @@ -18,9 +18,9 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.transaction.ElasticContext; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; -public class ElasticContextAssert, ACTUAL extends ElasticContext> extends BaseAssert { +public class ElasticContextAssert, ACTUAL extends TraceStateImpl> extends BaseAssert { protected ElasticContextAssert(ACTUAL actual, Class selfType) { super(actual, selfType); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ServiceTargetAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ServiceTargetAssert.java index 58fad0cec1..49aafc6e67 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ServiceTargetAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/ServiceTargetAssert.java @@ -18,11 +18,11 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.context.ServiceTarget; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; -public class ServiceTargetAssert extends BaseAssert { +public class ServiceTargetAssert extends BaseAssert { - ServiceTargetAssert(ServiceTarget actual) { + ServiceTargetAssert(ServiceTargetImpl actual) { super(actual, ServiceTargetAssert.class); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/SpanAssert.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/SpanAssert.java index dacc4f78cc..2794429dd7 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/SpanAssert.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/testutils/assertions/SpanAssert.java @@ -18,11 +18,11 @@ */ package co.elastic.apm.agent.testutils.assertions; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; -public class SpanAssert extends AbstractSpanAssert { +public class SpanAssert extends AbstractSpanAssert { - protected SpanAssert(Span actual) { + protected SpanAssert(SpanImpl actual) { super(actual, SpanAssert.class); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentationTest.java index 393e2cce56..0be632fabc 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/tracemethods/TraceMethodInstrumentationTest.java @@ -22,11 +22,11 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.matcher.MethodMatcher; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.apm.agent.tracer.configuration.TimeDuration; @@ -53,7 +53,7 @@ class TraceMethodInstrumentationTest { private MockReporter reporter; private TestObjectPoolFactory objectPoolFactory; private ElasticApmTracer tracer; - private CoreConfiguration coreConfiguration; + private CoreConfigurationImpl coreConfiguration; @BeforeEach void setUp(TestInfo testInfo) { @@ -61,7 +61,7 @@ void setUp(TestInfo testInfo) { reporter = mockInstrumentationSetup.getReporter(); objectPoolFactory = mockInstrumentationSetup.getObjectPoolFactory(); ConfigurationRegistry config = mockInstrumentationSetup.getConfig(); - coreConfiguration = config.getConfig(CoreConfiguration.class); + coreConfiguration = config.getConfig(CoreConfigurationImpl.class); doReturn(Arrays.asList( MethodMatcher.of("private co.elastic.apm.agent.tracemethods.TraceMethodInstrumentationTest$TestClass#traceMe*()"), MethodMatcher.of("private co.elastic.apm.agent.tracemethods.TraceMethodInstrumentationTest$TestDiscardableMethods#*"), @@ -230,7 +230,7 @@ void testErrorCapture_TraceAll() { void testErrorCapture_TraceErrorBranch() { new TestErrorCapture().root(); assertThat(reporter.getTransactions()).hasSize(1); - assertThat(reporter.getSpans().stream().map(Span::getNameAsString)).containsExactly("TestErrorCapture#throwException", "TestErrorCapture#catchException"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getNameAsString)).containsExactly("TestErrorCapture#throwException", "TestErrorCapture#catchException"); assertThat(reporter.getErrors()).hasSize(1); } @@ -350,9 +350,9 @@ private void mainMethod(boolean invokeManual) { } private void manuallyTraced() { - AbstractSpan active = tracer.getActive(); + AbstractSpanImpl active = tracer.getActive(); if (active != null) { - Span span = active.createSpan(); + SpanImpl span = active.createSpan(); span.propagateContext(new HashMap<>(), (TextHeaderSetter>) (k, v, m) -> m.put(k, v), null); span.end(); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java index d9ec6cfb36..255b1b876c 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/universalprofiling/UniversalProfilingIntegrationTest.java @@ -20,15 +20,15 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.configuration.UniversalProfilingConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import co.elastic.otel.JvmtiAccessImpl; import org.assertj.core.api.Assertions; @@ -139,9 +139,9 @@ class SharedMemory { public void testNestedActivations() { setupTracer(); - Transaction first = tracer.startRootTransaction(null); - Transaction second = tracer.startRootTransaction(null); - Span third = second.createSpan(); + TransactionImpl first = tracer.startRootTransaction(null); + TransactionImpl second = tracer.startRootTransaction(null); + SpanImpl third = second.createSpan(); checkTlsIs(null); @@ -190,7 +190,7 @@ public void testProcessStoragePopulated(String environment) { UniversalProfilingConfiguration profConfig = conf.getConfig(UniversalProfilingConfiguration.class); doReturn(true).when(profConfig).isEnabled(); doReturn(tempDir.toAbsolutePath().toString()).when(profConfig).getSocketDir(); - CoreConfiguration core = conf.getConfig(CoreConfiguration.class); + CoreConfigurationImpl core = conf.getConfig(CoreConfigurationImpl.class); doReturn("service Ä 1").when(core).getServiceName(); doReturn(environment).when(core).getEnvironment(); }); @@ -212,7 +212,7 @@ private String readUtf8Str(ByteBuffer buffer) { } } - static void checkTlsIs(@Nullable AbstractSpan span) { + static void checkTlsIs(@Nullable AbstractSpanImpl span) { ByteBuffer tls = JvmtiAccessImpl.createThreadProfilingCorrelationBufferAlias(TLS_STORAGE_SIZE); if (tls != null) { tls.order(ByteOrder.nativeOrder()); @@ -256,16 +256,16 @@ void checkCorrelationFunctional() { sendProfilerRegistrationMsg(1, "hostid"); - Transaction tx1 = tracer.startRootTransaction(null); - Transaction tx2 = tracer.startRootTransaction(null); + TransactionImpl tx1 = tracer.startRootTransaction(null); + TransactionImpl tx2 = tracer.startRootTransaction(null); - Id st1 = randomStackTraceId(1); + IdImpl st1 = randomStackTraceId(1); sendSampleMsg(tx1, st1, 1); // Send some garbage which should not affect our processing JvmtiAccessImpl.sendToProfilerReturnChannelSocket0(new byte[]{1, 2, 3}); - Id st2 = randomStackTraceId(2); + IdImpl st2 = randomStackTraceId(2); sendSampleMsg(tx2, st2, 2); // ensure that the messages are processed now @@ -277,7 +277,7 @@ void checkCorrelationFunctional() { // ensure that spans are not sent, their delay has not yet elapsed assertThat(reporter.getTransactions()).isEmpty(); - Id st3 = randomStackTraceId(3); + IdImpl st3 = randomStackTraceId(3); sendSampleMsg(tx2, st2, 1); sendSampleMsg(tx1, st3, 2); sendSampleMsg(tx2, st3, 1); @@ -310,7 +310,7 @@ void unsampledTransactionsNotCorrelated() { sendProfilerRegistrationMsg(1, "hostid"); - Transaction tx = tracer.startRootTransaction(ConstantSampler.of(false), 0L, null); + TransactionImpl tx = tracer.startRootTransaction(ConstantSampler.of(false), 0L, null); assertThat(tx.isSampled()).isFalse(); // Still send a stacktrace to make sure it is actually ignored @@ -326,7 +326,7 @@ void unsampledTransactionsNotCorrelated() { @Test void shutdownFlushesBufferedSpans() { - Id st1 = randomStackTraceId(1); + IdImpl st1 = randomStackTraceId(1); setupTracer(); UniversalProfilingIntegration profilingIntegration = tracer.getProfilingIntegration(); @@ -335,7 +335,7 @@ void shutdownFlushesBufferedSpans() { sendProfilerRegistrationMsg(1, "hostid"); profilingIntegration.periodicTimer(); - Transaction tx = tracer.startRootTransaction(null); + TransactionImpl tx = tracer.startRootTransaction(null); tx.end(); profilingIntegration.periodicTimer(); @@ -362,16 +362,16 @@ void bufferCapacityExceeded() { sendProfilerRegistrationMsg(1, "hostid"); profilingIntegration.periodicTimer(); - Transaction tx1 = tracer.startRootTransaction(null); + TransactionImpl tx1 = tracer.startRootTransaction(null); tx1.end(); - Transaction tx2 = tracer.startRootTransaction(null); + TransactionImpl tx2 = tracer.startRootTransaction(null); tx2.end(); //the actual buffer capacity is 2 + 1 because the peeked transaction is stored outside of the buffer profilingIntegration.periodicTimer(); - Transaction tx3 = tracer.startRootTransaction(null); + TransactionImpl tx3 = tracer.startRootTransaction(null); tx3.end(); // now the buffer should be full, transaction 4 should be sent immediately - Transaction tx4 = tracer.startRootTransaction(null); + TransactionImpl tx4 = tracer.startRootTransaction(null); tx4.end(); Assertions.assertThat(reporter.getTransactions()).containsExactly(tx4); @@ -423,15 +423,15 @@ void socketParentDirCreated() throws Exception { } - private Id randomStackTraceId(int seed) { + private IdImpl randomStackTraceId(int seed) { byte[] id = new byte[16]; new Random(seed).nextBytes(id); - Id idObj = Id.new128BitId(); + IdImpl idObj = IdImpl.new128BitId(); idObj.fromBytes(id, 0); return idObj; } - void sendSampleMsg(Transaction transaction, Id stackTraceId, int count) { + void sendSampleMsg(TransactionImpl transaction, IdImpl stackTraceId, int count) { byte[] traceId = idToBytes(transaction.getTraceContext().getTraceId()); byte[] transactionId = idToBytes(transaction.getTraceContext().getId()); @@ -462,7 +462,7 @@ void sendProfilerRegistrationMsg(int sampleDelayMillis, String hostId) { } } - private static byte[] idToBytes(Id id) { + private static byte[] idToBytes(IdImpl id) { byte[] buff = new byte[32]; int len = id.toBytes(buff, 0); byte[] result = new byte[len]; diff --git a/apm-agent-core/src/test/java/org/example/stacktrace/ErrorCaptureTest.java b/apm-agent-core/src/test/java/org/example/stacktrace/ErrorCaptureTest.java index 580a1eac28..29ed723f95 100644 --- a/apm-agent-core/src/test/java/org/example/stacktrace/ErrorCaptureTest.java +++ b/apm-agent-core/src/test/java/org/example/stacktrace/ErrorCaptureTest.java @@ -20,13 +20,13 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.error.ErrorCapture; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.error.RedactedException; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -38,19 +38,19 @@ class ErrorCaptureTest { private ElasticApmTracer tracer; - private StacktraceConfiguration stacktraceConfiguration; - private CoreConfiguration coreConfiguration; + private StacktraceConfigurationImpl stacktraceConfiguration; + private CoreConfigurationImpl coreConfiguration; @BeforeEach void setUp() { tracer = MockTracer.createRealTracer(); - stacktraceConfiguration = tracer.getConfig(StacktraceConfiguration.class); - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + stacktraceConfiguration = tracer.getConfig(StacktraceConfigurationImpl.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); } @Test void testCulpritApplicationPackagesNotConfigured() { - final ErrorCapture errorCapture = new ErrorCapture(tracer); + final ErrorCaptureImpl errorCapture = new ErrorCaptureImpl(tracer); errorCapture.setException(new Exception()); assertThat(errorCapture.getCulprit()).isEmpty(); } @@ -58,7 +58,7 @@ void testCulpritApplicationPackagesNotConfigured() { @Test void testCulprit() { doReturn(List.of("org.example.stacktrace")).when(stacktraceConfiguration).getApplicationPackages(); - final ErrorCapture errorCapture = new ErrorCapture(tracer); + final ErrorCaptureImpl errorCapture = new ErrorCaptureImpl(tracer); final Exception nestedException = new Exception(); final Exception topLevelException = new Exception(nestedException); errorCapture.setException(topLevelException); @@ -69,7 +69,7 @@ void testCulprit() { @Test void testUnnestNestedException() { final NestedException nestedException = new NestedException(new CustomException()); - ErrorCapture errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); + ErrorCaptureImpl errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); assertThat(errorCapture).isNotNull(); assertThat(errorCapture.getException()).isNotInstanceOf(NestedException.class); assertThat(errorCapture.getException()).isInstanceOf(CustomException.class); @@ -78,7 +78,7 @@ void testUnnestNestedException() { @Test void testUnnestDoublyNestedException() { final NestedException nestedException = new NestedException(new NestedException(new CustomException())); - ErrorCapture errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); + ErrorCaptureImpl errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); assertThat(errorCapture).isNotNull(); assertThat(errorCapture.getException()).isNotInstanceOf(NestedException.class); assertThat(errorCapture.getException()).isInstanceOf(CustomException.class); @@ -88,14 +88,14 @@ void testUnnestDoublyNestedException() { void testIgnoredNestedException() { doReturn(List.of(WildcardMatcher.valueOf("*CustomException"))).when(coreConfiguration).getIgnoreExceptions(); final NestedException nestedException = new NestedException(new CustomException()); - ErrorCapture errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); + ErrorCaptureImpl errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); assertThat(errorCapture).isNull(); } @Test void testNonConfiguredNestingException() { final WrapperException wrapperException = new WrapperException(new CustomException()); - ErrorCapture errorCapture = tracer.captureException(wrapperException, tracer.currentContext(), null); + ErrorCaptureImpl errorCapture = tracer.captureException(wrapperException, tracer.currentContext(), null); assertThat(errorCapture).isNotNull(); assertThat(errorCapture.getException()).isInstanceOf(WrapperException.class); } @@ -103,7 +103,7 @@ void testNonConfiguredNestingException() { @Test void testNonConfiguredWrappingConfigured() { final NestedException nestedException = new NestedException(new WrapperException(new NestedException(new Exception()))); - ErrorCapture errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); + ErrorCaptureImpl errorCapture = tracer.captureException(nestedException, tracer.currentContext(), null); assertThat(errorCapture).isNotNull(); assertThat(errorCapture.getException()).isInstanceOf(WrapperException.class); } @@ -120,11 +120,11 @@ void testExceptionRedaction() { // double redaction means no instanceof check assertThat(tracer.redactExceptionIfRequired(redacted)).isNotSameAs(redacted); - ErrorCapture errorCapture = tracer.captureException(exception, tracer.currentContext(), null); + ErrorCaptureImpl errorCapture = tracer.captureException(exception, tracer.currentContext(), null); assertThat(errorCapture).isNotNull(); assertThat(errorCapture.getException()).isInstanceOf(RedactedException.class); - ErrorCapture alreadyRedacted = tracer.captureException(redacted, tracer.currentContext(), null); + ErrorCaptureImpl alreadyRedacted = tracer.captureException(redacted, tracer.currentContext(), null); assertThat(alreadyRedacted).isNotNull(); assertThat(alreadyRedacted.getException()).isNotSameAs(redacted); } @@ -146,14 +146,14 @@ private static class CustomException extends Exception {} @Test void testTransactionContextTransfer() { - final Transaction transaction = new Transaction(tracer); - Request transactionRequest = transaction.getContext().getRequest() + final TransactionImpl transaction = new TransactionImpl(tracer); + RequestImpl transactionRequest = transaction.getContext().getRequest() .withMethod("GET") .addHeader("key", "value"); transactionRequest.withBodyBuffer().append("TEST"); transactionRequest.endOfBufferInput(); - final ErrorCapture errorCapture = new ErrorCapture(tracer).asChildOf(transaction); - Request errorRequest = errorCapture.getContext().getRequest(); + final ErrorCaptureImpl errorCapture = new ErrorCaptureImpl(tracer).asChildOf(transaction); + RequestImpl errorRequest = errorCapture.getContext().getRequest(); assertThat(errorRequest.getMethod()).isEqualTo("GET"); assertThat(errorRequest.getHeaders().get("key")).isEqualTo("value"); assertThat(errorRequest.getBodyBufferForSerialization()).isNotNull(); @@ -162,13 +162,13 @@ void testTransactionContextTransfer() { @Test void testTransactionContextTransferNonFinishedBody() { - final Transaction transaction = new Transaction(tracer); - Request transactionRequest = transaction.getContext().getRequest() + final TransactionImpl transaction = new TransactionImpl(tracer); + RequestImpl transactionRequest = transaction.getContext().getRequest() .withMethod("GET") .addHeader("key", "value"); transactionRequest.withBodyBuffer().append("TEST"); - final ErrorCapture errorCapture = new ErrorCapture(tracer).asChildOf(transaction); - Request errorRequest = errorCapture.getContext().getRequest(); + final ErrorCaptureImpl errorCapture = new ErrorCaptureImpl(tracer).asChildOf(transaction); + RequestImpl errorRequest = errorCapture.getContext().getRequest(); assertThat(errorRequest.getMethod()).isEqualTo("GET"); assertThat(errorRequest.getHeaders().get("key")).isEqualTo("value"); assertThat(errorRequest.getBodyBufferForSerialization()) @@ -178,11 +178,11 @@ void testTransactionContextTransferNonFinishedBody() { @Test void testActiveError() { - assertThat(ErrorCapture.getActive()).isNull(); - ErrorCapture errorCapture = new ErrorCapture(tracer).activate(); - assertThat(ErrorCapture.getActive()).isNotNull(); + assertThat(ErrorCaptureImpl.getActive()).isNull(); + ErrorCaptureImpl errorCapture = new ErrorCaptureImpl(tracer).activate(); + assertThat(ErrorCaptureImpl.getActive()).isNotNull(); errorCapture.deactivate().end(); - assertThat(ErrorCapture.getActive()).isNull(); + assertThat(ErrorCaptureImpl.getActive()).isNull(); } diff --git a/apm-agent-core/src/test/java/org/example/stacktrace/StacktraceSerializationTest.java b/apm-agent-core/src/test/java/org/example/stacktrace/StacktraceSerializationTest.java index 4b4981d6ba..38be48f6c3 100644 --- a/apm-agent-core/src/test/java/org/example/stacktrace/StacktraceSerializationTest.java +++ b/apm-agent-core/src/test/java/org/example/stacktrace/StacktraceSerializationTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import com.fasterxml.jackson.databind.JsonNode; @@ -48,7 +48,7 @@ class StacktraceSerializationTest { private List stacktrace; - private StacktraceConfiguration stacktraceConfiguration; + private StacktraceConfigurationImpl stacktraceConfiguration; private DslJsonSerializer.Writer serializer; private ObjectMapper objectMapper; private ElasticApmTracer tracer; @@ -56,7 +56,7 @@ class StacktraceSerializationTest { @BeforeEach void setUp() throws IOException { tracer = MockTracer.createRealTracer(); - stacktraceConfiguration = tracer.getConfig(StacktraceConfiguration.class); + stacktraceConfiguration = tracer.getConfig(StacktraceConfigurationImpl.class); // always enable doReturn(0L).when(stacktraceConfiguration).getSpanStackTraceMinDurationMs(); serializer = new DslJsonSerializer(stacktraceConfiguration, mock(ApmServerClient.class), tracer.getMetaDataFuture()) @@ -143,8 +143,8 @@ void testStackTraceElementSerialization() throws IOException { private List getStackTrace() throws IOException { - final Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); - final Span span = transaction.createSpan(); + final TransactionImpl transaction = tracer.startRootTransaction(getClass().getClassLoader()); + final SpanImpl span = transaction.createSpan(); span.end(); transaction.end(); return StreamSupport.stream(objectMapper diff --git a/apm-agent-core/src/test/java/specs/OutcomeStepsDefinitions.java b/apm-agent-core/src/test/java/specs/OutcomeStepsDefinitions.java index 7ba00b5f35..72f1460873 100644 --- a/apm-agent-core/src/test/java/specs/OutcomeStepsDefinitions.java +++ b/apm-agent-core/src/test/java/specs/OutcomeStepsDefinitions.java @@ -18,11 +18,11 @@ */ package specs; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.util.ResultUtil; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; @@ -62,31 +62,31 @@ public void thenOutcomeIs(String context, String outcome) { @Given("a HTTP call is made that returns {int}") public void httpSpanWithStatus(int code) { - Span span = state.getSpan(); + SpanImpl span = state.getSpan(); span.withName(String.format("HTTP span status = %d", code)); span.withOutcome(ResultUtil.getOutcomeByHttpClientStatus(code)); } @Given("a HTTP call is received that returns {int}") public void httpTransactionWithStatus(int code) { - Transaction transaction = state.getTransaction(); + TransactionImpl transaction = state.getTransaction(); transaction.withName(String.format("HTTP transaction status = %d", code)); transaction.withOutcome(ResultUtil.getOutcomeByHttpServerStatus(code)); } // utilities - static void setUserOutcome(AbstractSpan context, Outcome outcome) { + static void setUserOutcome(AbstractSpanImpl context, Outcome outcome) { assertThat(context).isNotNull(); context.withUserOutcome(outcome); } - static void setInternalOutcome(AbstractSpan context, Outcome outcome) { + static void setInternalOutcome(AbstractSpanImpl context, Outcome outcome) { assertThat(context).isNotNull(); context.withOutcome(outcome); } - static void checkOutcome(AbstractSpan context, Outcome outcome) { + static void checkOutcome(AbstractSpanImpl context, Outcome outcome) { assertThat(context).isNotNull(); assertThat(context.getOutcome()) .describedAs("expected outcome = %s for context = %s", outcome, context) diff --git a/apm-agent-core/src/test/java/specs/ScenarioState.java b/apm-agent-core/src/test/java/specs/ScenarioState.java index 03ed2ea55e..d88b1a0651 100644 --- a/apm-agent-core/src/test/java/specs/ScenarioState.java +++ b/apm-agent-core/src/test/java/specs/ScenarioState.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.Reporter; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.ConfigurationOptionProvider; @@ -53,8 +53,8 @@ public class ScenarioState { @Nullable private JsonNode apmServerResponse; - private Transaction transaction; - private Span span; + private TransactionImpl transaction; + private SpanImpl span; public ElasticApmTracer getTracer() { return Objects.requireNonNull(tracer); @@ -112,7 +112,7 @@ public void startRootTransactionIfRequired() { } } - public Transaction startTransaction() { + public TransactionImpl startTransaction() { if (transaction != null) { transaction.end(); } @@ -121,7 +121,7 @@ public Transaction startTransaction() { return transaction; } - public Span startSpan() { + public SpanImpl startSpan() { if (span != null) { span.end(); } @@ -134,11 +134,11 @@ public Span startSpan() { return span; } - public Transaction getTransaction() { + public TransactionImpl getTransaction() { return transaction; } - public Span getSpan() { + public SpanImpl getSpan() { return span; } @@ -147,7 +147,7 @@ public Span getSpan() { * @param contextType type name of the required context * @return the current span or transaction, based on the provided type name */ - public AbstractSpan getContext(String contextType) { + public AbstractSpanImpl getContext(String contextType) { return contextType.equals("span") ? getSpan() : getTransaction(); } } diff --git a/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/MethodHierarchyMatcher.java b/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/MethodHierarchyMatcher.java index 84ec59657c..3d8a228afa 100644 --- a/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/MethodHierarchyMatcher.java +++ b/apm-agent-plugin-sdk/src/main/java/co/elastic/apm/agent/sdk/bytebuddy/MethodHierarchyMatcher.java @@ -48,7 +48,7 @@ public class MethodHierarchyMatcher extends ElementMatcher.Junction.AbstractBase private final ElementMatcher hierarchyMatcher; MethodHierarchyMatcher(ElementMatcher extraMethodMatcher) { - this(extraMethodMatcher, not(is(TypeDescription.ForLoadedType.OBJECT)), any()); + this(extraMethodMatcher, not(is(TypeDescription.ForLoadedType.of(Object.class))), any()); } private MethodHierarchyMatcher(ElementMatcher extraMethodMatcher, ElementMatcher superClassMatcher, ElementMatcher hierachyMatcher) { diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java index aa6c60f04d..3a866b8aa9 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -39,10 +39,10 @@ TextHeaderGetter> Object startSpan(final Tracer tracer, final WRAPPER request, @Nullable final HTTPHOST httpHost, final HeaderAccessor headerAccessor) throws URISyntaxException { - ElasticContext elasticContext = tracer.currentContext(); + TraceState traceState = tracer.currentContext(); Span span = null; - if (elasticContext.getSpan() != null) { - span = HttpClientHelper.startHttpClientSpan(elasticContext, adapter.getMethod(request), adapter.getUri(request), adapter.getHostName(httpHost, request)); + if (traceState.getSpan() != null) { + span = HttpClientHelper.startHttpClientSpan(traceState, adapter.getMethod(request), adapter.getUri(request), adapter.getHostName(httpHost, request)); if (span != null) { span.activate(); } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java index 08aab1d912..f3b0f234f8 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -30,14 +30,14 @@ public static asyncHelper, PRODUCER asyncRequestProducer, CONTEXT context, CALLBACK futureCallback) { - ElasticContext parentContext = tracer.currentContext(); + TraceState parentContext = tracer.currentContext(); if (parentContext.isEmpty()) { // performance optimization, no need to wrap if we have nothing to propagate // empty context means also we will not create an exit span return null; } CALLBACK wrappedFutureCallback = futureCallback; - ElasticContext activeContext = tracer.currentContext(); + TraceState activeContext = tracer.currentContext(); Span span = activeContext.createExitSpan(); if (span != null) { span.withType(HttpClientHelper.EXTERNAL_TYPE) diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/ApacheHttpClientAsyncHelper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/ApacheHttpClientAsyncHelper.java index 7f213dcc84..b7510f2901 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/ApacheHttpClientAsyncHelper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/ApacheHttpClientAsyncHelper.java @@ -19,12 +19,12 @@ package co.elastic.apm.agent.httpclient.common; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; public interface ApacheHttpClientAsyncHelper { - AsyncProducerWrapper wrapRequestProducer(AsyncProducer asyncRequestProducer, Span span, ElasticContext toPropagate); + AsyncProducerWrapper wrapRequestProducer(AsyncProducer asyncRequestProducer, Span span, TraceState toPropagate); FutureCallbackWrapper wrapFutureCallback(FutureCallback futureCallback, HttpContext httpContext, Span span); diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/src/main/java/co/elastic/apm/agent/httpclient/v3/HttpClient3Instrumentation.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/src/main/java/co/elastic/apm/agent/httpclient/v3/HttpClient3Instrumentation.java index 4f178a6df1..870045df09 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/src/main/java/co/elastic/apm/agent/httpclient/v3/HttpClient3Instrumentation.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/src/main/java/co/elastic/apm/agent/httpclient/v3/HttpClient3Instrumentation.java @@ -23,7 +23,7 @@ import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -96,7 +96,7 @@ public static Object onEnter(@Advice.Argument(0) HttpMethod httpMethod, @Nullable private static Span startClientSpan(HttpMethod httpMethod, HostConfiguration hostConfiguration) { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); if (activeContext.getSpan() == null) { return null; } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java index 5125477133..8097b84d1c 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.httpclient.v4.helper.RequestHeaderAccessor; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.configuration.CoreConfiguration; @@ -80,7 +80,7 @@ public static class LegacyApacheHttpClientAdvice { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static Object onBeforeExecute(@Advice.Argument(0) @Nullable HttpHost host, @Advice.Argument(1) HttpRequest request) { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); Span span = null; if (activeContext.getSpan() != null) { String hostName = (host != null) ? host.getHostName() : null; diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/ApacheHttpClient4AsyncHelper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/ApacheHttpClient4AsyncHelper.java index ed4ef3c8cb..1f638cd3b4 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/ApacheHttpClient4AsyncHelper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/ApacheHttpClient4AsyncHelper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.httpclient.v4.helper; import co.elastic.apm.agent.httpclient.common.ApacheHttpClientAsyncHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -66,7 +66,7 @@ public FutureCallbackWrapper createInstance() { } public HttpAsyncRequestProducerWrapper wrapRequestProducer(HttpAsyncRequestProducer requestProducer, @Nullable Span span, - ElasticContext toPropagate) { + TraceState toPropagate) { return requestProducerWrapperObjectPool.createInstance().with(requestProducer, span, toPropagate); } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java index 4d749ffce7..6d874c13fc 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.httpclient.v4.helper; import co.elastic.apm.agent.httpclient.HttpClientHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.pooling.Recyclable; import org.apache.http.HttpException; @@ -39,7 +39,7 @@ public class HttpAsyncRequestProducerWrapper implements HttpAsyncRequestProducer private volatile HttpAsyncRequestProducer delegate; @Nullable - private ElasticContext toPropagate; + private TraceState toPropagate; @Nullable private Span span; @@ -59,7 +59,7 @@ public class HttpAsyncRequestProducerWrapper implements HttpAsyncRequestProducer * @return the {@link HttpAsyncRequestProducer} wrapper */ public HttpAsyncRequestProducerWrapper with(HttpAsyncRequestProducer delegate, @Nullable Span span, - ElasticContext toPropagate) { + TraceState toPropagate) { // Order is important due to visibility - write to delegate last on this (initiating) thread this.span = span; toPropagate.incrementReferences(); diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java index 9a62a4bd9c..20543c1073 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.httpclient.v4; import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; import org.apache.http.HttpResponse; import org.apache.http.client.config.RequestConfig; @@ -119,7 +119,7 @@ public void testSpanWithIllegalProtocol() throws Exception { setUp(); reporter.resetChecks(); } - Span firstSpan = reporter.getFirstSpan(500); + SpanImpl firstSpan = reporter.getFirstSpan(500); assertThat(firstSpan).isNotNull(); assertThat(firstSpan.getOutcome()).isEqualTo(Outcome.FAILURE); Assertions.assertThat(reporter.getSpans()).hasSize(1); diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/ApacheHttpClient5AsyncHelper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/ApacheHttpClient5AsyncHelper.java index 9c2a4462f5..3fe2166dfb 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/ApacheHttpClient5AsyncHelper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/ApacheHttpClient5AsyncHelper.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.httpclient.common.ApacheHttpClientAsyncHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -73,7 +73,7 @@ public RequestChannelWrapper createInstance() { } public AsyncRequestProducerWrapper wrapRequestProducer(AsyncRequestProducer requestProducer, @Nullable Span span, - @Nullable ElasticContext toPropagate) { + @Nullable TraceState toPropagate) { return requestProducerWrapperObjectPool.createInstance().with(requestProducer, span, toPropagate); } @@ -87,7 +87,7 @@ public void failedBeforeRequestStarted(FutureCallbackWrapper cb, Throwable t) cb.failedWithoutExecution(t); } - public RequestChannelWrapper wrapRequestChannel(RequestChannel requestChannel, @Nullable Span span, @Nullable ElasticContext toPropagate) { + public RequestChannelWrapper wrapRequestChannel(RequestChannel requestChannel, @Nullable Span span, @Nullable TraceState toPropagate) { return requestChannelWrapperObjectPool.createInstance().with(requestChannel, span, toPropagate); } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/AsyncRequestProducerWrapper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/AsyncRequestProducerWrapper.java index 9000796fda..a475ecbd4f 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/AsyncRequestProducerWrapper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/AsyncRequestProducerWrapper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.httpclient.v5.helper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.pooling.Recyclable; import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; @@ -38,7 +38,7 @@ public class AsyncRequestProducerWrapper implements AsyncRequestProducer, Recycl private volatile AsyncRequestProducer delegate; @Nullable - private ElasticContext toPropagate; + private TraceState toPropagate; @Nullable private Span span; @@ -48,7 +48,7 @@ public class AsyncRequestProducerWrapper implements AsyncRequestProducer, Recycl } public AsyncRequestProducerWrapper with(AsyncRequestProducer delegate, @Nullable Span span, - ElasticContext toPropagate) { + TraceState toPropagate) { this.span = span; toPropagate.incrementReferences(); this.toPropagate = toPropagate; diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/RequestChannelWrapper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/RequestChannelWrapper.java index 9b9844f37a..0edd80e85e 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/RequestChannelWrapper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/main/java/co/elastic/apm/agent/httpclient/v5/helper/RequestChannelWrapper.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.pooling.Recyclable; import org.apache.hc.core5.http.EntityDetails; @@ -41,7 +41,7 @@ public class RequestChannelWrapper implements RequestChannel, Recyclable { private volatile RequestChannel delegate; @Nullable - private ElasticContext toPropagate; + private TraceState toPropagate; @Nullable private Span span; @@ -51,7 +51,7 @@ public RequestChannelWrapper() { public RequestChannelWrapper with(RequestChannel delegate, @Nullable Span span, - ElasticContext toPropagate) { + TraceState toPropagate) { this.span = span; toPropagate.incrementReferences(); this.toPropagate = toPropagate; diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/test/java/co/elastic/apm/agent/httpclient/v5/ApacheHttpAsyncClientInstrumentationTest.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/test/java/co/elastic/apm/agent/httpclient/v5/ApacheHttpAsyncClientInstrumentationTest.java index 4b0ccc72eb..ed117da025 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/test/java/co/elastic/apm/agent/httpclient/v5/ApacheHttpAsyncClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/src/test/java/co/elastic/apm/agent/httpclient/v5/ApacheHttpAsyncClientInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.httpclient.v5; import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; import org.apache.hc.client5.http.async.methods.SimpleHttpRequest; import org.apache.hc.client5.http.async.methods.SimpleHttpResponse; @@ -112,7 +112,7 @@ public void testSpanFinishWithIllegalProtocol() throws Exception { String url = getBaseUrl().replaceAll("http", "ottp") + "/"; performGet(url); - Span firstSpan = reporter.getFirstSpan(500); + SpanImpl firstSpan = reporter.getFirstSpan(500); assertThat(firstSpan).isNotNull(); assertThat(firstSpan.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(firstSpan.getNameAsString()).isEqualTo("GET localhost"); @@ -133,7 +133,7 @@ public void testSpanFinishWithIllegalUrl() throws Exception { reporter.resetChecks(); } - Span firstSpan = reporter.getFirstSpan(500); + SpanImpl firstSpan = reporter.getFirstSpan(500); assertThat(firstSpan).isNotNull(); assertThat(firstSpan.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(firstSpan.getNameAsString()).isEqualTo("GET "); diff --git a/apm-agent-plugins/apm-api-plugin/pom.xml b/apm-agent-plugins/apm-api-plugin/pom.xml index 4cad7c8ec1..1df6e23ac5 100644 --- a/apm-agent-plugins/apm-api-plugin/pom.xml +++ b/apm-agent-plugins/apm-api-plugin/pom.xml @@ -16,7 +16,6 @@ ${project.groupId}:${project.artifactId} - ${project.groupId} apm-agent-core diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/AbstractSpanInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/AbstractSpanInstrumentation.java index 7c71246e7c..a99e8e3e04 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/AbstractSpanInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/AbstractSpanInstrumentation.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.pluginapi; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -71,8 +71,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setName(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) String name) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).withName(name, PRIORITY_USER_SUPPLIED); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).withName(name, PRIORITY_USER_SUPPLIED); } } } @@ -87,10 +87,10 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setType(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) String type) { - if (context instanceof Transaction) { - ((Transaction) context).withType(type); - } else if (context instanceof Span) { - ((Span) context).setType(type, null, null); + if (context instanceof TransactionImpl) { + ((TransactionImpl) context).withType(type); + } else if (context instanceof SpanImpl) { + ((SpanImpl) context).setType(type, null, null); } } } @@ -107,8 +107,8 @@ public static void setType(@Advice.Argument(0) Object span, @Advice.Argument(1) @Nullable String type, @Advice.Argument(2) @Nullable String subtype, @Advice.Argument(3) @Nullable String action) { - if (span instanceof Span) { - ((Span) span).setType(type, subtype, action); + if (span instanceof SpanImpl) { + ((SpanImpl) span).setType(type, subtype, action); } } } @@ -125,8 +125,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static Object doCreateSpan(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Return @Nullable Object returnValue) { - if (context instanceof AbstractSpan) { - return ((AbstractSpan) context).createSpan(); + if (context instanceof AbstractSpanImpl) { + return ((AbstractSpanImpl) context).createSpan(); } else { return returnValue; } @@ -145,8 +145,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static Object doCreateExitSpan(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Return @Nullable Object returnValue) { - if (context instanceof AbstractSpan) { - return ((AbstractSpan) context).createExitSpan(); + if (context instanceof AbstractSpanImpl) { + return ((AbstractSpanImpl) context).createExitSpan(); } else { return returnValue; } @@ -162,7 +162,7 @@ public InitializeInstrumentation() { public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void incrementReferences(@Advice.Argument(0) Object span) { - ((AbstractSpan) span).incrementReferences(); + ((AbstractSpanImpl) span).incrementReferences(); } } } @@ -176,8 +176,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setStartTimestamp(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(value = 0) long epochMicros) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).setStartTimestamp(epochMicros); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).setStartTimestamp(epochMicros); } } } @@ -198,14 +198,14 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setOutcome(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(value = 0) @Nullable Enum apiOutcome) { - if (context instanceof AbstractSpan) { + if (context instanceof AbstractSpanImpl) { Outcome outcome = Outcome.UNKNOWN; if (apiOutcome != null) { // valueOf conversion is fast as Enum implementation is using a lookup map internally // thus we don't need to do this ourselves outcome = Outcome.valueOf(apiOutcome.name()); } - ((AbstractSpan) context).withUserOutcome(outcome); + ((AbstractSpanImpl) context).withUserOutcome(outcome); } } } @@ -219,8 +219,8 @@ public EndInstrumentation() { public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void end(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).end(); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).end(); } } } @@ -235,8 +235,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void end(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(value = 0) long epochMicros) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).end(epochMicros); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).end(epochMicros); } } } @@ -259,8 +259,8 @@ public static class AdviceClass { public static String captureException(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) Throwable t, @Advice.Return @Nullable String returnValue) { - if (context instanceof AbstractSpan) { - return ((AbstractSpan) context).captureExceptionAndGetErrorId(t); + if (context instanceof AbstractSpanImpl) { + return ((AbstractSpanImpl) context).captureExceptionAndGetErrorId(t); } else { return returnValue; } @@ -283,8 +283,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void captureException(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) Throwable t) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).captureException(t); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).captureException(t); } } } @@ -301,8 +301,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String getId(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Return @Nullable String returnValue) { - if (context instanceof AbstractSpan) { - return ((AbstractSpan) context).getTraceContext().getId().toString(); + if (context instanceof AbstractSpanImpl) { + return ((AbstractSpanImpl) context).getTraceContext().getId().toString(); } else { return returnValue; } @@ -321,8 +321,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String getTraceId(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Return @Nullable String returnValue) { - if (context instanceof AbstractSpan) { - return ((AbstractSpan) context).getTraceContext().getTraceId().toString(); + if (context instanceof AbstractSpanImpl) { + return ((AbstractSpanImpl) context).getTraceContext().getTraceId().toString(); } else { return returnValue; } @@ -340,8 +340,8 @@ public static class AdviceClass { public static void addLabel(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) String key, @Advice.Argument(1) @Nullable String value) { - if (value != null && context instanceof AbstractSpan) { - ((AbstractSpan) context).addLabel(key, value); + if (value != null && context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).addLabel(key, value); } } } @@ -357,8 +357,8 @@ public static class AdviceClass { public static void addLabel(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) String key, @Advice.Argument(1) @Nullable Number value) { - if (value != null && context instanceof AbstractSpan) { - ((AbstractSpan) context).addLabel(key, value); + if (value != null && context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).addLabel(key, value); } } } @@ -374,8 +374,8 @@ public static class AdviceClass { public static void addLabel(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) String key, @Advice.Argument(1) @Nullable Boolean value) { - if (value != null && context instanceof AbstractSpan) { - ((AbstractSpan) context).addLabel(key, value); + if (value != null && context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).addLabel(key, value); } } } @@ -389,8 +389,8 @@ public ActivateInstrumentation() { public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void activate(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).activate(); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).activate(); } } } @@ -406,8 +406,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static boolean isSampled(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Return boolean returnValue) { - if (context instanceof AbstractSpan) { - return ((AbstractSpan) context).isSampled(); + if (context instanceof AbstractSpanImpl) { + return ((AbstractSpanImpl) context).isSampled(); } else { return returnValue; } @@ -426,8 +426,8 @@ public static class AdviceClass { public static void injectTraceHeaders(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) MethodHandle addHeaderMethodHandle, @Advice.Argument(1) @Nullable Object headerInjector) { - if (headerInjector != null && context instanceof AbstractSpan) { - ((AbstractSpan) context).propagateContext(headerInjector, HeaderInjectorBridge.get(addHeaderMethodHandle), null); + if (headerInjector != null && context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).propagateContext(headerInjector, HeaderInjectorBridge.get(addHeaderMethodHandle), null); } } } @@ -444,8 +444,8 @@ public static class AdviceClass { public static void setDestinationAddress(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) @Nullable String address, @Advice.Argument(1) int port) { - if (context instanceof Span) { - ((Span) context).getContext().getDestination() + if (context instanceof SpanImpl) { + ((SpanImpl) context).getContext().getDestination() .withUserAddress(address) .withUserPort(port); } @@ -463,8 +463,8 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void setDestinationService(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) @Nullable String resource) { - if (context instanceof Span) { - ServiceTarget serviceTarget = ((Span) context).getContext().getServiceTarget(); + if (context instanceof SpanImpl) { + ServiceTargetImpl serviceTarget = ((SpanImpl) context).getContext().getServiceTarget(); if (resource == null || resource.isEmpty()) { serviceTarget.withUserType(null).withUserName(null); } else { @@ -491,8 +491,8 @@ public static class AdviceClass { public static void setServiceTarget(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context, @Advice.Argument(0) @Nullable String type, @Advice.Argument(1) @Nullable String name) { - if (context instanceof Span) { - ((Span) context).getContext().getServiceTarget() + if (context instanceof SpanImpl) { + ((SpanImpl) context).getContext().getServiceTarget() .withUserType(type) .withUserName(name); } @@ -509,8 +509,8 @@ public SetNonDiscardableInstrumentation() { public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void setNonDiscardable(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).setNonDiscardable(); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).setNonDiscardable(); } } } diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ApiScopeInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ApiScopeInstrumentation.java index 1a3c167bf9..94ef2dca68 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ApiScopeInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ApiScopeInstrumentation.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.pluginapi; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -32,8 +32,8 @@ public class ApiScopeInstrumentation extends ApiInstrumentation { public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void close(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object context) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).deactivate(); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).deactivate(); } } } diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureSpanInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureSpanInstrumentation.java index d4b464d280..507d09b996 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureSpanInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureSpanInstrumentation.java @@ -18,15 +18,16 @@ */ package co.elastic.apm.agent.pluginapi; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -59,11 +60,11 @@ public class CaptureSpanInstrumentation extends ElasticApmInstrumentation { protected static final Tracer tracer = GlobalTracer.get(); private final CoreConfiguration coreConfig; - private final StacktraceConfiguration stacktraceConfig; + private final StacktraceConfigurationImpl stacktraceConfig; public CaptureSpanInstrumentation(ElasticApmTracer tracer) { coreConfig = tracer.getConfig(CoreConfiguration.class); - stacktraceConfig = tracer.getConfig(StacktraceConfiguration.class); + stacktraceConfig = tracer.getConfig(StacktraceConfigurationImpl.class); } public static class AdviceClass { @@ -86,7 +87,7 @@ public static Object onMethodEnter( defaultValueProvider = AnnotationValueOffsetMappingFactory.TrueDefaultValueProvider.class ) boolean discardable ) { - ElasticContext activeContext = tracer.currentContext(); + TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan == null) { logger.debug("Not creating span for {} because there is no currently active span.", signature); @@ -107,7 +108,7 @@ public static Object onMethodEnter( .activate(); // using deprecated API to keep compatibility with existing behavior - ((co.elastic.apm.agent.impl.transaction.Span) span).setType(type, subtype, action); + ((SpanImpl) span).setType(type, subtype, action); if (!discardable) { span.setNonDiscardable(); diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureTransactionInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureTransactionInstrumentation.java index 4c1edd87f0..5a2461c873 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureTransactionInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/CaptureTransactionInstrumentation.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory.AnnotationValueExtractor; import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory.SimpleMethodSignature; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; @@ -62,11 +62,11 @@ public class CaptureTransactionInstrumentation extends ElasticApmInstrumentation public static final Logger logger = LoggerFactory.getLogger(CaptureTransactionInstrumentation.class); private final CoreConfiguration coreConfig; - private final StacktraceConfiguration stacktraceConfig; + private final StacktraceConfigurationImpl stacktraceConfig; public CaptureTransactionInstrumentation(ElasticApmTracer tracer) { coreConfig = tracer.getConfig(CoreConfiguration.class); - stacktraceConfig = tracer.getConfig(StacktraceConfiguration.class); + stacktraceConfig = tracer.getConfig(StacktraceConfigurationImpl.class); } public static class AdviceClass { diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ElasticApmApiInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ElasticApmApiInstrumentation.java index 7723217d1c..dc1e75184f 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ElasticApmApiInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/ElasticApmApiInstrumentation.java @@ -18,14 +18,12 @@ */ package co.elastic.apm.agent.pluginapi; -import co.elastic.apm.agent.tracer.service.ServiceAwareTracer; -import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.tracer.ErrorCapture; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Transaction; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; +import co.elastic.apm.agent.tracer.service.ServiceInfo; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -167,7 +165,7 @@ public SetServiceInfoForClassLoaderInstrumentation() { public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void setServiceInfoForClassLoader(@Advice.Argument(0) @Nullable ClassLoader classLoader, @Advice.Argument(1) String serviceName, @Advice.Argument(2) @Nullable String serviceVersion) { - tracer.require(ServiceAwareTracer.class).setServiceInfoForClassLoader(classLoader, ServiceInfo.of(serviceName, serviceVersion)); + tracer.setServiceInfoForClassLoader(classLoader, ServiceInfo.of(serviceName, serviceVersion)); } } } diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/LegacySpanInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/LegacySpanInstrumentation.java index 7b6a79059a..0225f9e9a0 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/LegacySpanInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/LegacySpanInstrumentation.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.pluginapi; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Span; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -86,8 +87,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(inline = false) public static void setType(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object span, @Advice.Argument(0) String type) { - if (span instanceof co.elastic.apm.agent.impl.transaction.Span) { - ((co.elastic.apm.agent.impl.transaction.Span) span).setType(type, null, null); + if (span instanceof SpanImpl) { + ((SpanImpl) span).setType(type, null, null); } } } @@ -201,8 +202,8 @@ public static class AdviceClass { public static void addTag(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object span, @Advice.Argument(0) String key, @Advice.Argument(1) String value) { - if (span instanceof co.elastic.apm.agent.impl.transaction.Span) { - ((co.elastic.apm.agent.impl.transaction.Span) span).addLabel(key, value); + if (span instanceof SpanImpl) { + ((SpanImpl) span).addLabel(key, value); } } } diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TracedInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TracedInstrumentation.java index 61eb1d2d68..4d1a587c45 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TracedInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TracedInstrumentation.java @@ -21,12 +21,12 @@ import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -65,11 +65,11 @@ public class TracedInstrumentation extends ElasticApmInstrumentation { public static final Logger logger = LoggerFactory.getLogger(TracedInstrumentation.class); private final CoreConfiguration coreConfig; - private final StacktraceConfiguration stacktraceConfig; + private final StacktraceConfigurationImpl stacktraceConfig; public TracedInstrumentation(ElasticApmTracer tracer) { coreConfig = tracer.getConfig(CoreConfiguration.class); - stacktraceConfig = tracer.getConfig(StacktraceConfiguration.class); + stacktraceConfig = tracer.getConfig(StacktraceConfigurationImpl.class); } public static class AdviceClass { @@ -93,7 +93,7 @@ public static Object onMethodEnter( defaultValueProvider = AnnotationValueOffsetMappingFactory.TrueDefaultValueProvider.class ) boolean discardable) { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan != null) { if (activeContext.shouldSkipChildSpanCreation()) { diff --git a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TransactionInstrumentation.java b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TransactionInstrumentation.java index e6ce5c97a8..6d6015fdc1 100644 --- a/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TransactionInstrumentation.java +++ b/apm-agent-plugins/apm-api-plugin/src/main/java/co/elastic/apm/agent/pluginapi/TransactionInstrumentation.java @@ -18,12 +18,10 @@ */ package co.elastic.apm.agent.pluginapi; -import co.elastic.apm.agent.tracer.service.ServiceAwareTracer; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.service.ServiceInfo; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -64,8 +62,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setFrameworkName(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transaction, @Advice.Argument(0) String frameworkName) { - if (transaction instanceof Transaction) { - ((Transaction) transaction).setUserFrameworkName(frameworkName); + if (transaction instanceof TransactionImpl) { + ((TransactionImpl) transaction).setUserFrameworkName(frameworkName); } } } @@ -80,8 +78,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setUser(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transaction, @Advice.Argument(0) String id, @Advice.Argument(1) String email, @Advice.Argument(2) String username, @Advice.Argument(value = 3, optional = true) String domain) { - if (transaction instanceof Transaction) { - ((Transaction) transaction).setUser(id, email, username, domain); + if (transaction instanceof TransactionImpl) { + ((TransactionImpl) transaction).setUser(id, email, username, domain); } } } @@ -98,9 +96,9 @@ public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String ensureParentId(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transaction, @Advice.Return @Nullable String returnValue) { - if (transaction instanceof Transaction) { - final TraceContext traceContext = ((Transaction) transaction).getTraceContext(); - Id parentId = traceContext.getParentId(); + if (transaction instanceof TransactionImpl) { + final TraceContextImpl traceContext = ((TransactionImpl) transaction).getTraceContext(); + IdImpl parentId = traceContext.getParentId(); if (parentId.isEmpty()) { parentId.setToRandomValue(); } @@ -120,8 +118,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setResult(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transaction, @Advice.Argument(0) String result) { - if (transaction instanceof Transaction) { - ((Transaction) transaction).withResult(result); + if (transaction instanceof TransactionImpl) { + ((TransactionImpl) transaction).withResult(result); } } } @@ -137,8 +135,8 @@ public static class AdviceClass { public static void addCustomContext(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transactionObj, @Advice.Argument(0) String key, @Advice.Argument(1) @Nullable Object value) { - if (value != null && transactionObj instanceof Transaction) { - Transaction transaction = (Transaction) transactionObj; + if (value != null && transactionObj instanceof TransactionImpl) { + TransactionImpl transaction = (TransactionImpl) transactionObj; if (value instanceof String) { transaction.addCustomContext(key, (String) value); } else if (value instanceof Number) { @@ -160,8 +158,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setServiceInfo(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transaction, @Advice.Argument(0) String serviceName, @Advice.Argument(1) String serviceVersion) { - if (transaction instanceof Transaction) { - ((Transaction) transaction).getTraceContext().setServiceInfo(serviceName, serviceVersion); + if (transaction instanceof TransactionImpl) { + ((TransactionImpl) transaction).getTraceContext().setServiceInfo(serviceName, serviceVersion); } } } @@ -176,10 +174,10 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void useServiceInfoForClassLoader(@Advice.FieldValue(value = "span", typing = Assigner.Typing.DYNAMIC) Object transaction, @Advice.Argument(0) ClassLoader classLoader) { - if (transaction instanceof Transaction) { - ServiceInfo serviceInfo = tracer.require(ServiceAwareTracer.class).getServiceInfoForClassLoader(classLoader); + if (transaction instanceof TransactionImpl) { + ServiceInfo serviceInfo = tracer.getServiceInfoForClassLoader(classLoader); if (serviceInfo != null) { - ((Transaction) transaction).getTraceContext().setServiceInfo(serviceInfo.getServiceName(), serviceInfo.getServiceVersion()); + ((TransactionImpl) transaction).getTraceContext().setServiceInfo(serviceInfo.getServiceName(), serviceInfo.getServiceVersion()); } } } diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/ConfigInstrumentationTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/ConfigInstrumentationTest.java index 8af213b978..a038796647 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/ConfigInstrumentationTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/ConfigInstrumentationTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.api.ElasticApm; @@ -42,7 +42,6 @@ import static net.bytebuddy.matcher.ElementMatchers.named; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatException; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; class ConfigInstrumentationTest { @@ -51,13 +50,13 @@ class ConfigInstrumentationTest { private ElasticApmTracer tracer; private ConfigurationRegistry configurationRegistry; - private CoreConfiguration coreConfig; + private CoreConfigurationImpl coreConfig; @BeforeEach void setup() { tracer = MockTracer.createRealTracer(); configurationRegistry = tracer.getConfigurationRegistry(); - coreConfig = configurationRegistry.getConfig(CoreConfiguration.class); + coreConfig = configurationRegistry.getConfig(CoreConfigurationImpl.class); } @AfterEach diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/SpanInstrumentationTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/SpanInstrumentationTest.java index c08ad9089f..0b24193169 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/SpanInstrumentationTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/agent/pluginapi/SpanInstrumentationTest.java @@ -20,7 +20,9 @@ import co.elastic.apm.AbstractApiTest; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.impl.BookkeeperObjectPool; import co.elastic.apm.api.ElasticApm; import co.elastic.apm.api.Scope; @@ -71,7 +73,7 @@ void testLegacyAPIs() { Span span = transaction.createSpan(); span.setType("foo.bar.baz"); endSpan(span); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getType()).isEqualTo("foo"); assertThat(internalSpan.getSubtype()).isEqualTo("bar"); assertThat(internalSpan.getAction()).isEqualTo("baz"); @@ -83,7 +85,7 @@ void testTypes() { Span span = transaction.startSpan("foo", "bar", "baz"); endSpan(span); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getType()).isEqualTo("foo"); assertThat(internalSpan.getSubtype()).isEqualTo("bar"); assertThat(internalSpan.getAction()).isEqualTo("baz"); @@ -96,7 +98,7 @@ void testExitSpanFromTransaction() { Span span = transaction.startExitSpan("foo", "bar", "baz"); endSpan(span); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); // relying on auto-inference of context.destination.service.resource assertThat(internalSpan.getContext().getServiceTarget()).hasDestinationResource("bar"); } @@ -109,7 +111,7 @@ void testExitSpanFromNonExitSpan() { Span parent = transaction.startSpan("foo", "bar", "baz"); Span span = parent.startExitSpan("foo", "bar", "baz"); endSpan(span); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); // relying on auto-inference of context.destination.service.resource assertThat(internalSpan.getContext().getServiceTarget()).hasDestinationResource("bar"); } @@ -128,7 +130,7 @@ void testExitSpanFromExitSpan() { assertThat(reporter.getSpans()).isEmpty(); endSpan(parent); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); // relying on auto-inference of context.destination.service.resource assertThat(internalSpan.getContext().getServiceTarget()).hasDestinationResource("bar"); } @@ -206,12 +208,12 @@ void testReferenceCounting() { span.end(); transaction.end(); - BookkeeperObjectPool spanPool = objectPoolFactory.getSpanPool(); + BookkeeperObjectPool spanPool = objectPoolFactory.getSpanPool(); assertThat( spanPool.getRecyclablesToReturn().stream().filter(span1 -> span1.getReferenceCount() > 1).collect(Collectors.toList())) .hasSize(spanPool.getRequestedObjectCount()); - BookkeeperObjectPool transactionPool = objectPoolFactory.getTransactionPool(); + BookkeeperObjectPool transactionPool = objectPoolFactory.getTransactionPool(); assertThat( transactionPool.getRecyclablesToReturn().stream().filter(transaction1 -> transaction1.getReferenceCount() > 1).collect(Collectors.toList())) .hasSize(transactionPool.getRequestedObjectCount()); @@ -245,7 +247,7 @@ private void assertContainsTracingHeaders(Span span) { final Map tracingHeaders = new HashMap<>(); span.injectTraceHeaders(tracingHeaders::put); span.injectTraceHeaders(null); - assertThat(TraceContext.containsTraceContextTextHeaders(tracingHeaders, TextHeaderMapAccessor.INSTANCE)).isTrue(); + assertThat(TraceContextImpl.containsTraceContextTextHeaders(tracingHeaders, TextHeaderMapAccessor.INSTANCE)).isTrue(); } } } diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AbstractSpanImplAccessor.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AbstractSpanImplAccessor.java index ada066ad77..1d46e474da 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AbstractSpanImplAccessor.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AbstractSpanImplAccessor.java @@ -20,7 +20,7 @@ public class AbstractSpanImplAccessor { - public static co.elastic.apm.agent.impl.transaction.Transaction accessTransaction(Transaction t) { - return (co.elastic.apm.agent.impl.transaction.Transaction) ((TransactionImpl) t).span; + public static co.elastic.apm.agent.impl.transaction.TransactionImpl accessTransaction(Transaction t) { + return (co.elastic.apm.agent.impl.transaction.TransactionImpl) ((TransactionImpl) t).span; } } diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationApiTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationApiTest.java index 46b173f8b0..ef681737fb 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationApiTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationApiTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.AbstractApiTest; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -87,7 +87,7 @@ private void testTransactionAndSpanTypes(boolean useLegacyTyping) { assertThat(reporter.getFirstTransaction().getFrameworkName()).isEqualTo("API"); assertThat(reporter.getSpans()).hasSize(1); - Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getNameAsString()).isEqualTo("spanWithType"); assertThat(internalSpan.getType()).isEqualTo("external"); assertThat(internalSpan.getSubtype()).isEqualTo("http"); @@ -100,7 +100,7 @@ void testMissingSubtype() { AnnotationTestClass.transactionForMissingSpanSubtype(); assertThat(reporter.getSpans()).hasSize(1); - Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getNameAsString()).isEqualTo("spanWithMissingSubtype"); assertThat(internalSpan.getType()).isEqualTo("external.http"); assertThat(internalSpan.getSubtype()).isNull(); diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java index 3ad2468ab7..5cd32bbc48 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/AnnotationInheritanceTest.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import net.bytebuddy.agent.ByteBuddyAgent; @@ -57,7 +57,7 @@ void cleanup() { private void init(boolean annotationInheritanceEnabled) { MockTracer.MockInstrumentationSetup mockInstrumentationSetup = MockTracer.createMockInstrumentationSetup(SpyConfiguration.createSpyConfig(), false); tracer = mockInstrumentationSetup.getTracer(); - doReturn(annotationInheritanceEnabled).when(tracer.getConfig(CoreConfiguration.class)).isEnablePublicApiAnnotationInheritance(); + doReturn(annotationInheritanceEnabled).when(tracer.getConfig(CoreConfigurationImpl.class)).isEnablePublicApiAnnotationInheritance(); reporter = mockInstrumentationSetup.getReporter(); ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install()); } diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/BlockingQueueContextPropagationTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/BlockingQueueContextPropagationTest.java index 9dd14d928f..e23bcd262d 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/BlockingQueueContextPropagationTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/BlockingQueueContextPropagationTest.java @@ -19,6 +19,8 @@ package co.elastic.apm.api; import co.elastic.apm.AbstractApiTest; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -87,7 +89,7 @@ public void testAsyncTransactionDelegation() throws ExecutionException, Interrup // important for waiting on the queue reader thread to finish the span assertThat(result.get()).isEqualTo(transaction.getId()); - co.elastic.apm.agent.impl.transaction.Transaction reportedTransaction = reporter.getFirstTransaction(); + TransactionImpl reportedTransaction = reporter.getFirstTransaction(); assertThat(reportedTransaction).isNotNull(); assertThat(reportedTransaction.getTraceContext().getId().toString()).isEqualTo(transaction.getId()); assertThat(reportedTransaction.getTimestamp()).isEqualTo(startTime); @@ -120,7 +122,7 @@ public void testAsyncSpanDelegation() throws ExecutionException, InterruptedExce // important for waiting on the queue reader thread to finish the span assertThat(result.get()).isEqualTo(asyncSpanId); - co.elastic.apm.agent.impl.transaction.Transaction reportedTransaction = reporter.getFirstTransaction(); + TransactionImpl reportedTransaction = reporter.getFirstTransaction(); assertThat(reportedTransaction).isNotNull(); long transactionTimestamp = reportedTransaction.getTimestamp(); assertThat(transactionTimestamp).isEqualTo(startTime); @@ -129,7 +131,7 @@ public void testAsyncSpanDelegation() throws ExecutionException, InterruptedExce TimeUnit.MILLISECONDS.toMicros(70) ); - co.elastic.apm.agent.impl.transaction.Span reportedSpan = reporter.getFirstSpan(); + SpanImpl reportedSpan = reporter.getFirstSpan(); assertThat(reportedSpan.getTraceContext().getTraceId()).isEqualTo(reportedTransaction.getTraceContext().getTraceId()); assertThat(reportedSpan).isNotNull(); assertThat(reportedSpan.getType()).isEqualTo("async"); diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/ElasticApmApiInstrumentationTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/ElasticApmApiInstrumentationTest.java index b5a728eca6..1aa1e4acb9 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/ElasticApmApiInstrumentationTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/ElasticApmApiInstrumentationTest.java @@ -19,11 +19,13 @@ package co.elastic.apm.api; import co.elastic.apm.AbstractApiTest; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import org.junit.jupiter.api.Test; import java.util.Collections; @@ -99,14 +101,14 @@ void testTransactionWithError() { @Test void testCreateChildSpanOfCurrentTransaction() { - final co.elastic.apm.agent.impl.transaction.Transaction transaction = startTestRootTransaction(); + final TransactionImpl transaction = startTestRootTransaction(); final Span span = ElasticApm.currentSpan().startSpan("db", "mysql", "query"); span.setName("span"); span.end(); transaction.deactivate().end(); assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getSpans()).hasSize(1); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getTraceContext().getParentId()).isEqualTo(reporter.getFirstTransaction().getTraceContext().getId()); assertThat(internalSpan.getType()).isEqualTo("db"); assertThat(internalSpan.getSubtype()).isEqualTo("mysql"); @@ -115,7 +117,7 @@ void testCreateChildSpanOfCurrentTransaction() { @Test void testLegacySpanCreationAndTyping() { - final co.elastic.apm.agent.impl.transaction.Transaction transaction = startTestRootTransaction(); + final TransactionImpl transaction = startTestRootTransaction(); final Span span = ElasticApm.currentSpan().createSpan(); span.setName("span"); span.setType("db.mysql.query.etc"); @@ -123,7 +125,7 @@ void testLegacySpanCreationAndTyping() { transaction.deactivate().end(); assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getSpans()).hasSize(1); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getTraceContext().getParentId()).isEqualTo(reporter.getFirstTransaction().getTraceContext().getId()); assertThat(internalSpan.getType()).isEqualTo("db"); assertThat(internalSpan.getSubtype()).isEqualTo("mysql"); @@ -134,7 +136,7 @@ void testLegacySpanCreationAndTyping() { @Test void testAutomaticAndManualTransactions() { - final co.elastic.apm.agent.impl.transaction.Transaction transaction = startTestRootTransaction(); + final TransactionImpl transaction = startTestRootTransaction(); final Transaction manualTransaction = ElasticApm.startTransaction(); manualTransaction.setName("manual transaction"); manualTransaction.setType("request"); @@ -146,13 +148,13 @@ void testAutomaticAndManualTransactions() { @Test void testGetId_distributedTracingEnabled() { - co.elastic.apm.agent.impl.transaction.Transaction transaction = tracer.startRootTransaction(null).withType(Transaction.TYPE_REQUEST); + TransactionImpl transaction = tracer.startRootTransaction(null).withType(Transaction.TYPE_REQUEST); try (co.elastic.apm.agent.tracer.Scope scope = transaction.activateInScope()) { assertThat(ElasticApm.currentTransaction().getId()).isEqualTo(transaction.getTraceContext().getId().toString()); assertThat(ElasticApm.currentTransaction().getTraceId()).isEqualTo(transaction.getTraceContext().getTraceId().toString()); assertThat(ElasticApm.currentSpan().getId()).isEqualTo(transaction.getTraceContext().getId().toString()); assertThat(ElasticApm.currentSpan().getTraceId()).isEqualTo(transaction.getTraceContext().getTraceId().toString()); - co.elastic.apm.agent.impl.transaction.Span span = transaction.createSpan().withType("db").withSubtype("mysql").withName("SELECT"); + SpanImpl span = transaction.createSpan().withType("db").withSubtype("mysql").withName("SELECT"); try (co.elastic.apm.agent.tracer.Scope spanScope = span.activateInScope()) { assertThat(ElasticApm.currentSpan().getId()).isEqualTo(span.getTraceContext().getId().toString()); assertThat(ElasticApm.currentSpan().getTraceId()).isEqualTo(span.getTraceContext().getTraceId().toString()); @@ -262,7 +264,7 @@ void testEnsureParentId() { @Test void testTransactionWithRemoteParentFunction() { - AbstractSpan parent = tracer.startRootTransaction(null); + AbstractSpanImpl parent = tracer.startRootTransaction(null); assertThat(parent).isNotNull(); Map headerMap = new HashMap<>(); parent.propagateContext(headerMap, TextHeaderMapAccessor.INSTANCE, null); @@ -273,7 +275,7 @@ void testTransactionWithRemoteParentFunction() { @Test void testTransactionWithRemoteParentFunctions() { - AbstractSpan parent = tracer.startRootTransaction(null); + AbstractSpanImpl parent = tracer.startRootTransaction(null); assertThat(parent).isNotNull(); Map headerMap = new HashMap<>(); parent.propagateContext(headerMap, TextHeaderMapAccessor.INSTANCE, null); @@ -284,7 +286,7 @@ void testTransactionWithRemoteParentFunctions() { @Test void testTransactionWithRemoteParentHeaders() { - AbstractSpan parent = tracer.startRootTransaction(null); + AbstractSpanImpl parent = tracer.startRootTransaction(null); assertThat(parent).isNotNull(); Map headerMap = new HashMap<>(); parent.propagateContext(headerMap, TextHeaderMapAccessor.INSTANCE, null); @@ -359,7 +361,7 @@ void testOverrideServiceVersionForClassLoaderWithRemoteParent() { } private void checkTransactionServiceInfo(ServiceInfo expected){ - TraceContext traceContext = reporter.getFirstTransaction().getTraceContext(); + TraceContextImpl traceContext = reporter.getFirstTransaction().getTraceContext(); assertThat(traceContext.getServiceName()).isEqualTo(expected.getServiceName()); assertThat(traceContext.getServiceVersion()).isEqualTo(expected.getServiceVersion()); } diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDestinationApiTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDestinationApiTest.java index 633bb2b297..f13b4b9ea7 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDestinationApiTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDestinationApiTest.java @@ -19,7 +19,8 @@ package co.elastic.apm.api; import co.elastic.apm.AbstractApiTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,8 +35,8 @@ class SpanDestinationApiTest extends AbstractApiTest { public static final int INTERNAL_PORT = 9001; public static final String INTERNAL_RESOURCE = "internal-resource"; - private co.elastic.apm.agent.impl.transaction.Transaction internalTransaction; - private co.elastic.apm.agent.impl.transaction.Span internalSpan; + private TransactionImpl internalTransaction; + private SpanImpl internalSpan; @BeforeEach void setUp() { @@ -201,7 +202,7 @@ void testSetServiceTargetTypeNameAndServiceResource() { .hasDestinationResource("my-resource"); } - private Span getSpan() { + private SpanImpl getSpan() { internalSpan.deactivate().end(); return reporter.getFirstSpan(); } diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDiscardingTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDiscardingTest.java index 9eaa784d39..f3bf0bb2a3 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDiscardingTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanDiscardingTest.java @@ -19,7 +19,8 @@ package co.elastic.apm.api; import co.elastic.apm.AbstractApiTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import org.junit.jupiter.api.Test; @@ -62,12 +63,12 @@ void testNonDiscarding_tracedAnnotation() { } private void doTest(Scenario scenario) { - doReturn(TimeDuration.of("100ms")).when(config.getConfig(CoreConfiguration.class)).getSpanMinDuration(); + doReturn(TimeDuration.of("100ms")).when(config.getConfig(CoreConfigurationImpl.class)).getSpanMinDuration(); Transaction transaction = ElasticApm.startTransaction(); try (Scope activate = transaction.activate()) { parentSpan(scenario); } - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); switch (scenario) { case DISCARD: case DISCARD_TRACED_ANNOTATION: diff --git a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanExitTest.java b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanExitTest.java index d99cef3e24..39ed9596a4 100644 --- a/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanExitTest.java +++ b/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/SpanExitTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.api; import co.elastic.apm.AbstractApiTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -41,7 +41,7 @@ void before() { @Test void captureSpan() { - Span span = scenario(this::doCaptureSpan); + SpanImpl span = scenario(this::doCaptureSpan); assertThat(span) .hasName("SpanExitTest#doCaptureSpan") .hasType("app") @@ -55,7 +55,7 @@ void doCaptureSpan() { @Test void captureSpanExit1() { - Span span = scenario(this::doCaptureSpanExit1); + SpanImpl span = scenario(this::doCaptureSpanExit1); assertThat(span) .hasName("SpanExitTest#doCaptureSpanExit1") .hasType("app") @@ -69,7 +69,7 @@ void doCaptureSpanExit1() { @Test void captureSpanExit2() { - Span span = scenario(this::doCaptureSpanExit2); + SpanImpl span = scenario(this::doCaptureSpanExit2); assertThat(span) .hasName("SpanExitTest#doCaptureSpanExit2") .hasType("app") @@ -84,7 +84,7 @@ void doCaptureSpanExit2() { @Test void captureSpanExit3() { - Span span = scenario(this::doCaptureSpanExit3); + SpanImpl span = scenario(this::doCaptureSpanExit3); assertThat(span) .hasName("SpanExitTest#doCaptureSpanExit3") .hasType("app") @@ -102,7 +102,7 @@ void doCaptureSpanExit3() { @Test void traced() { - Span span = scenario(this::doTraced); + SpanImpl span = scenario(this::doTraced); assertThat(span) .hasName("SpanExitTest#doTraced") .hasType("app") @@ -115,7 +115,7 @@ void doTraced() { @Test void tracedExit1() { - Span span = scenario(this::doTracedExit1); + SpanImpl span = scenario(this::doTracedExit1); assertThat(span) .hasName("SpanExitTest#doTracedExit1") .hasType("app") @@ -129,7 +129,7 @@ void doTracedExit1() { @Test void tracedExit2() { - Span span = scenario(this::doTracedExit2); + SpanImpl span = scenario(this::doTracedExit2); assertThat(span) .hasName("SpanExitTest#doTracedExit2") .hasType("other") @@ -144,7 +144,7 @@ void doTracedExit2() { @Test void tracedExit3() { - Span span = scenario(this::doTracedExit3); + SpanImpl span = scenario(this::doTracedExit3); assertThat(span) .hasName("SpanExitTest#doTracedExit3") .hasType("app") @@ -160,13 +160,13 @@ void doTracedExit3() { // common - private Span scenario(Runnable task) { + private SpanImpl scenario(Runnable task) { Transaction transaction = ElasticApm.startTransaction(); try (Scope activate = transaction.activate()) { task.run(); } transaction.end(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans) .describedAs("only a single span is expected to be created") .hasSize(1); diff --git a/apm-agent-plugins/apm-asynchttpclient-plugin/src/main/java/co/elastic/apm/agent/asynchttpclient/AbstractAsyncHttpClientInstrumentation.java b/apm-agent-plugins/apm-asynchttpclient-plugin/src/main/java/co/elastic/apm/agent/asynchttpclient/AbstractAsyncHttpClientInstrumentation.java index e8fe41e590..e2cbfa840a 100644 --- a/apm-agent-plugins/apm-asynchttpclient-plugin/src/main/java/co/elastic/apm/agent/asynchttpclient/AbstractAsyncHttpClientInstrumentation.java +++ b/apm-agent-plugins/apm-asynchttpclient-plugin/src/main/java/co/elastic/apm/agent/asynchttpclient/AbstractAsyncHttpClientInstrumentation.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -103,7 +103,7 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static Object onBeforeExecute(@Advice.Argument(value = 0) Request request, @Advice.Argument(value = 1) AsyncHandler asyncHandler) { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = tracer.getActive(); Span span = null; if (parentSpan != null) { diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/main/java/co/elastic/apm/agent/awssdk/v1/helper/SQSHelper.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/main/java/co/elastic/apm/agent/awssdk/v1/helper/SQSHelper.java index d5b07530a2..05eeb59428 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/main/java/co/elastic/apm/agent/awssdk/v1/helper/SQSHelper.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/main/java/co/elastic/apm/agent/awssdk/v1/helper/SQSHelper.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.awssdk.v1.helper.sqs.wrapper.ReceiveMessageResultWrapper; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -58,7 +58,7 @@ protected SQSHelper(Tracer tracer) { } - public void propagateContext(ElasticContext toPropagate, AmazonWebServiceRequest request) { + public void propagateContext(TraceState toPropagate, AmazonWebServiceRequest request) { if (request instanceof SendMessageRequest) { SendMessageRequest sendMessageRequest = (SendMessageRequest) request; toPropagate.propagateContext(sendMessageRequest.getMessageAttributes(), this, null); diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/DynamoDbClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/DynamoDbClientIT.java index 1ebe829184..8185ef2e3e 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/DynamoDbClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/DynamoDbClientIT.java @@ -18,9 +18,8 @@ */ package co.elastic.apm.agent.awssdk.v1; -import co.elastic.apm.agent.awssdk.common.AbstractAwsClientIT; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; @@ -55,7 +54,7 @@ public class DynamoDbClientIT extends AbstractAws1ClientIT { private AmazonDynamoDB dynamoDB; private AmazonDynamoDBAsync dynamoDBAsync; - private final Consumer dbAssert = span -> assertThat(span.getContext().getDb().getInstance()).isEqualTo(localstack.getRegion()); + private final Consumer dbAssert = span -> assertThat(span.getContext().getDb().getInstance()).isEqualTo(localstack.getRegion()); @BeforeEach @@ -72,7 +71,7 @@ public void setupClient() { @Test public void testDynamoDbClient() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> dynamoDB.createTable(new CreateTableRequest().withTableName(TABLE_NAME) .withAttributeDefinitions(List.of( @@ -142,7 +141,7 @@ public void testDynamoDbClient() { @Test public void testDynamoDbClientAsync() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> dynamoDBAsync.createTableAsync(new CreateTableRequest().withTableName(TABLE_NAME) .withAttributeDefinitions(List.of( diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/S3ClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/S3ClientIT.java index 05a6f1e282..d811f05fb0 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/S3ClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/S3ClientIT.java @@ -18,8 +18,7 @@ */ package co.elastic.apm.agent.awssdk.v1; -import co.elastic.apm.agent.awssdk.common.AbstractAwsClientIT; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; @@ -50,7 +49,7 @@ public void setupClient() { @Test public void testS3Client() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> s3.createBucket(BUCKET_NAME)) .operationName("CreateBucket") diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSClientIT.java index 7efb851088..af625db21f 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSClientIT.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.awssdk.v1; import co.elastic.apm.agent.awssdk.common.AbstractSQSClientIT; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; @@ -52,9 +52,9 @@ public class SQSClientIT extends AbstractSQSClientIT { private AmazonSQS sqs; private AmazonSQSAsync sqsAsync; - private final Consumer messagingAssert = span -> assertThat(span.getContext().getMessage().getQueueName()).isEqualTo(SQS_QUEUE_NAME); + private final Consumer messagingAssert = span -> assertThat(span.getContext().getMessage().getQueueName()).isEqualTo(SQS_QUEUE_NAME); - CoreConfiguration coreConfiguration; + CoreConfigurationImpl coreConfiguration; MessagingConfiguration messagingConfiguration; public SQSClientIT() { @@ -63,7 +63,7 @@ public SQSClientIT() { @BeforeEach public void setupClient() { - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); messagingConfiguration = tracer.getConfig(MessagingConfiguration.class); sqs = AmazonSQSClient.builder() @@ -79,7 +79,7 @@ public void setupClient() { @Test public void testSQSClient() { - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); newTest(() -> sqs.createQueue(SQS_QUEUE_NAME)) .operationName("CreateQueue") @@ -158,7 +158,7 @@ public void testSQSClient() { @Test public void testAsyncSQSClient() { - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); newTest(() -> sqsAsync.createQueueAsync(SQS_QUEUE_NAME)) .operationName("CreateQueue") diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSJmsClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSJmsClientIT.java index f8a2ebe393..ed5f1aa57b 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSJmsClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/SQSJmsClientIT.java @@ -18,15 +18,13 @@ */ package co.elastic.apm.agent.awssdk.v1; -import co.elastic.apm.agent.awssdk.common.AbstractAwsClientIT; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.tracer.Scope; import com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper; import com.amazon.sqs.javamessaging.ProviderConfiguration; @@ -61,12 +59,12 @@ public class SQSJmsClientIT extends AbstractAws1ClientIT { SQSConnection connection; SQSConnection receivingConnection; AmazonSQS sqs; - CoreConfiguration coreConfiguration; + CoreConfigurationImpl coreConfiguration; MessagingConfiguration messagingConfiguration; @BeforeEach public void setupClient() throws JMSException { - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); messagingConfiguration = tracer.getConfig(MessagingConfiguration.class); sqs = AmazonSQSClient.builder() @@ -92,7 +90,7 @@ public void tearDown() throws JMSException { public void testSend() throws JMSException { client.createQueue(SQS_QUEUE_NAME); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -114,7 +112,7 @@ public void testReceiveWithinTransaction() throws JMSException { client.createQueue(SQS_QUEUE_NAME); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -133,7 +131,7 @@ public void testReceiveWithinTransaction() throws JMSException { receivingConnection.start(); - Transaction receiveTransaction = startTestRootTransaction("sqs-test-receive"); + TransactionImpl receiveTransaction = startTestRootTransaction("sqs-test-receive"); Message receivedMessage = consumer.receive(2000); assertThat(receivedMessage.getStringProperty("traceparent")).isNotNull(); @@ -147,7 +145,7 @@ public void testReceiveWithinTransaction() throws JMSException { assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); assertThat(reporter.getNumReportedSpans()).isEqualTo(4); - Span jmsReceiveSpan = reporter.getSpanByName("JMS RECEIVE from queue " + SQS_QUEUE_NAME); + SpanImpl jmsReceiveSpan = reporter.getSpanByName("JMS RECEIVE from queue " + SQS_QUEUE_NAME); assertThat(reporter.getSpanByName("SQS DELETE from " + SQS_QUEUE_NAME).isChildOf(jmsReceiveSpan)).isTrue(); assertThat(jmsReceiveSpan.isChildOf(receiveTransaction)).isTrue(); assertThat(reporter.getSpans()).allSatisfy(span -> assertThat(span).isSync()); @@ -159,7 +157,7 @@ public void testReceiveOutsideTransaction() throws JMSException { client.createQueue(SQS_QUEUE_NAME); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -206,7 +204,7 @@ public void testOnMessage() throws JMSException { receivingConnection.start(); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -222,9 +220,9 @@ public void testOnMessage() throws JMSException { receivingSession.close(); assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); - Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); + Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); assertThat(optTransaction.isPresent()).isTrue(); - Transaction receivingTransaction = optTransaction.get(); + TransactionImpl receivingTransaction = optTransaction.get(); assertThat(reporter.getNumReportedSpans()).isEqualTo(3); assertThat(reporter.getSpanByName("on-message-child").isChildOf(receivingTransaction)).isTrue(); @@ -245,7 +243,7 @@ public void testOnMessageWithNonJmssender() throws JMSException { receivingConnection.start(); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); sqs.sendMessage(queueUrl, MESSAGE_BODY); @@ -256,9 +254,9 @@ public void testOnMessageWithNonJmssender() throws JMSException { receivingSession.close(); assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); - Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); + Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); assertThat(optTransaction.isPresent()).isTrue(); - Transaction receivingTransaction = optTransaction.get(); + TransactionImpl receivingTransaction = optTransaction.get(); assertThat(reporter.getNumReportedSpans()).isEqualTo(2); assertThat(reporter.getSpanByName("on-message-child").isChildOf(receivingTransaction)).isTrue(); @@ -297,11 +295,11 @@ static class SQSListener implements MessageListener { @Override public void onMessage(Message message) { try { - Tracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); + ElasticApmTracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); assertThat(tracer).isNotNull(); - AbstractSpan parent = tracer.getActive(); + AbstractSpanImpl parent = tracer.getActive(); assertThat(parent).isNotNull(); - Span child = parent.createSpan(); + SpanImpl child = parent.createSpan(); assertThat(child).isNotNull(); child.withName("on-message-child"); try (Scope ignored = child.activateInScope()) { diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/main/java/co/elastic/apm/agent/awssdk/v2/helper/SQSHelper.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/main/java/co/elastic/apm/agent/awssdk/v2/helper/SQSHelper.java index 52652e47d7..58373b0045 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/main/java/co/elastic/apm/agent/awssdk/v2/helper/SQSHelper.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/main/java/co/elastic/apm/agent/awssdk/v2/helper/SQSHelper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.awssdk.v2.helper; import co.elastic.apm.agent.awssdk.common.AbstractSQSInstrumentationHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -57,7 +57,7 @@ public SQSHelper(Tracer tracer) { super(tracer, SdkV2DataSource.getInstance()); } - private SdkRequest propagateContext(ElasticContext toPropagate, SdkRequest sdkRequest) { + private SdkRequest propagateContext(TraceState toPropagate, SdkRequest sdkRequest) { if (sdkRequest instanceof SendMessageRequest) { SendMessageRequest sendMessageRequest = (SendMessageRequest) sdkRequest; Map attributesMap = new HashMap<>(sendMessageRequest.messageAttributes()); @@ -119,7 +119,7 @@ protected boolean isReceiveMessageRequest(SdkRequest request) { return request instanceof ReceiveMessageRequest; } - public void modifyRequestObject(ElasticContext toPropagate, ClientExecutionParams clientExecutionParams, ExecutionContext executionContext) { + public void modifyRequestObject(TraceState toPropagate, ClientExecutionParams clientExecutionParams, ExecutionContext executionContext) { SdkRequest sdkRequest = clientExecutionParams.getInput(); SdkRequest newRequestObj = null; if (!toPropagate.isEmpty() && clientExecutionParams.getOperationName().startsWith("SendMessage")) { diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/BaseSyncClientHandlerInstrumentationTest.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/BaseSyncClientHandlerInstrumentationTest.java index e6d0bf528e..cdbdc9052d 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/BaseSyncClientHandlerInstrumentationTest.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/BaseSyncClientHandlerInstrumentationTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.common.JvmRuntimeInfo; import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import software.amazon.awssdk.auth.signer.AwsSignerExecutionAttribute; @@ -82,7 +82,7 @@ public Outcome exerciseRedactedException(Exception canBeNull) { MockTracer.MockInstrumentationSetup mockInstrumentationSetup = MockTracer.createMockInstrumentationSetup(); ElasticApmTracer tracer = mockInstrumentationSetup.getTracer(); - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); assertThat(transaction).isNotNull(); transaction .withName("exception-test") @@ -91,7 +91,7 @@ public Outcome exerciseRedactedException(Exception canBeNull) { .withOutcome(Outcome.SUCCESS) .activate(); - Span span = tracer.createExitChildSpan(); + SpanImpl span = tracer.createExitChildSpan(); span.withType("storage") .withSubtype("s3") .withAction("operationName"); diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/DynamoDbClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/DynamoDbClientIT.java index 6e9c6b7f29..d753bd91d4 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/DynamoDbClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/DynamoDbClientIT.java @@ -18,9 +18,8 @@ */ package co.elastic.apm.agent.awssdk.v2; -import co.elastic.apm.agent.awssdk.common.AbstractAwsClientIT; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.testcontainers.containers.localstack.LocalStackContainer; @@ -59,7 +58,7 @@ public class DynamoDbClientIT extends AbstractAws2ClientIT { private DynamoDbClient dynamoDB; private DynamoDbAsyncClient dynamoDBAsync; - private final Consumer dbAssert = span -> assertThat(span.getContext().getDb().getInstance()).isEqualTo(localstack.getRegion()); + private final Consumer dbAssert = span -> assertThat(span.getContext().getDb().getInstance()).isEqualTo(localstack.getRegion()); private static final Map ITEM = Stream.of( new AbstractMap.SimpleEntry<>("attributeOne", AttributeValue.builder().s("valueOne").build()), @@ -85,7 +84,7 @@ public void setupClient() { @Test public void testDynamoDbClient() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> dynamoDB.createTable(CreateTableRequest.builder() .tableName(TABLE_NAME) @@ -159,7 +158,7 @@ public void testDynamoDbClient() { @Test public void testDynamoDbClientAsync() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> dynamoDBAsync.createTable(CreateTableRequest.builder() .tableName(TABLE_NAME) @@ -209,7 +208,7 @@ public void testDynamoDbClientAsync() { .async() .execute(); - Span span = reporter.getSpanByName("DynamoDB Query " + TABLE_NAME); + SpanImpl span = reporter.getSpanByName("DynamoDB Query " + TABLE_NAME); assertThat(span.getContext().getDb()).hasStatement(KEY_CONDITION_EXPRESSION); newTest(() -> dynamoDBAsync.deleteTable(DeleteTableRequest.builder().tableName(TABLE_NAME).build())) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/S3ClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/S3ClientIT.java index 5b369a396d..57ac737639 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/S3ClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/S3ClientIT.java @@ -18,8 +18,7 @@ */ package co.elastic.apm.agent.awssdk.v2; -import co.elastic.apm.agent.awssdk.common.AbstractAwsClientIT; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.testcontainers.containers.localstack.LocalStackContainer; @@ -65,7 +64,7 @@ public void setupClient() { @Test public void testS3Client() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> s3.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build())) .operationName("CreateBucket") .entityName(BUCKET_NAME) @@ -133,7 +132,7 @@ public void testS3Client() { @Test public void testAsyncS3Client() { - Transaction transaction = startTestRootTransaction("s3-test"); + TransactionImpl transaction = startTestRootTransaction("s3-test"); newTest(() -> s3Async.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build())) .operationName("CreateBucket") diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSClientIT.java index da977bb9aa..10f955995c 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSClientIT.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.awssdk.v2; import co.elastic.apm.agent.awssdk.common.AbstractSQSClientIT; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -55,9 +55,9 @@ public class SQSClientIT extends AbstractSQSClientIT { private SqsClient sqs; private SqsAsyncClient sqsAsync; - private final Consumer messagingAssert = span -> assertThat(span.getContext().getMessage().getQueueName()).isEqualTo(SQS_QUEUE_NAME); + private final Consumer messagingAssert = span -> assertThat(span.getContext().getMessage().getQueueName()).isEqualTo(SQS_QUEUE_NAME); - CoreConfiguration coreConfiguration; + CoreConfigurationImpl coreConfiguration; MessagingConfiguration messagingConfiguration; public SQSClientIT() { @@ -66,7 +66,7 @@ public SQSClientIT() { @BeforeEach public void setupClient() { - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); messagingConfiguration = tracer.getConfig(MessagingConfiguration.class); sqs = SqsClient.builder().endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.SQS)) @@ -84,7 +84,7 @@ public void setupClient() { @Test public void testSQSClient() { - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); newTest(() -> sqs.createQueue(CreateQueueRequest.builder().queueName(SQS_QUEUE_NAME).build())) .operationName("CreateQueue") @@ -163,7 +163,7 @@ public void testSQSClient() { @Test public void testAsyncSQSClient() { - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); newTest(() -> sqsAsync.createQueue(CreateQueueRequest.builder().queueName(SQS_QUEUE_NAME).build())) .operationName("CreateQueue") @@ -253,7 +253,7 @@ public void testNonReceiveMessageWithinMessagingTransaction() { final StringBuilder queueUrl = new StringBuilder(); queueUrl.append(sqs.getQueueUrl(GetQueueUrlRequest.builder().queueName(SQS_QUEUE_NAME).build()).queueUrl()); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); transaction.withType("messaging"); sqs.sendMessage(SendMessageRequest.builder() @@ -276,7 +276,7 @@ public void testAsnycNonReceiveMessageWithinMessagingTransaction() { final StringBuilder queueUrl = new StringBuilder(); queueUrl.append(sqsAsync.getQueueUrl(GetQueueUrlRequest.builder().queueName(SQS_QUEUE_NAME).build()).join().queueUrl()); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); transaction.withType("messaging"); sqsAsync.sendMessage(SendMessageRequest.builder() @@ -300,7 +300,7 @@ public void testReceiveMessageWithinMessagingTransaction() { final StringBuilder queueUrl = new StringBuilder(); queueUrl.append(sqs.getQueueUrl(GetQueueUrlRequest.builder().queueName(SQS_QUEUE_NAME).build()).queueUrl()); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); transaction.withType("messaging"); sqs.receiveMessage(ReceiveMessageRequest.builder().queueUrl(queueUrl.toString()).build()); diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSJmsClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSJmsClientIT.java index 3286c10644..475e6f5dd1 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSJmsClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/test/java/co/elastic/apm/agent/awssdk/v2/SQSJmsClientIT.java @@ -18,15 +18,13 @@ */ package co.elastic.apm.agent.awssdk.v2; -import co.elastic.apm.agent.awssdk.common.AbstractAwsClientIT; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.tracer.Scope; import com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper; import com.amazon.sqs.javamessaging.ProviderConfiguration; @@ -62,12 +60,12 @@ public class SQSJmsClientIT extends AbstractAws2ClientIT { SQSConnection connection; SQSConnection receivingConnection; SqsClient sqs; - CoreConfiguration coreConfiguration; + CoreConfigurationImpl coreConfiguration; MessagingConfiguration messagingConfiguration; @BeforeEach public void setupClient() throws JMSException { - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); messagingConfiguration = tracer.getConfig(MessagingConfiguration.class); sqs = SqsClient.builder().endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.SQS)) @@ -94,7 +92,7 @@ public void tearDown() throws JMSException { public void testSend() throws JMSException { client.createQueue(SQS_QUEUE_NAME); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -116,7 +114,7 @@ public void testReceiveWithinTransaction() throws JMSException { client.createQueue(SQS_QUEUE_NAME); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -135,7 +133,7 @@ public void testReceiveWithinTransaction() throws JMSException { receivingConnection.start(); - Transaction receiveTransaction = startTestRootTransaction("sqs-test-receive"); + TransactionImpl receiveTransaction = startTestRootTransaction("sqs-test-receive"); Message receivedMessage = consumer.receive(2000); assertThat(receivedMessage.getStringProperty("traceparent")).isNotNull(); @@ -149,7 +147,7 @@ public void testReceiveWithinTransaction() throws JMSException { assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); assertThat(reporter.getNumReportedSpans()).isEqualTo(4); - Span jmsReceiveSpan = reporter.getSpanByName("JMS RECEIVE from queue " + SQS_QUEUE_NAME); + SpanImpl jmsReceiveSpan = reporter.getSpanByName("JMS RECEIVE from queue " + SQS_QUEUE_NAME); assertThat(reporter.getSpanByName("SQS DELETE from " + SQS_QUEUE_NAME).isChildOf(jmsReceiveSpan)).isTrue(); assertThat(jmsReceiveSpan.isChildOf(receiveTransaction)).isTrue(); assertThat(reporter.getSpans()).allSatisfy(span -> assertThat(span).isSync()); @@ -161,7 +159,7 @@ public void testReceiveOutsideTransaction() throws JMSException { client.createQueue(SQS_QUEUE_NAME); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -207,7 +205,7 @@ public void testOnMessage() throws JMSException { receivingConnection.start(); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(SQS_QUEUE_NAME); @@ -223,9 +221,9 @@ public void testOnMessage() throws JMSException { receivingSession.close(); assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); - Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); + Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); assertThat(optTransaction.isPresent()).isTrue(); - Transaction receivingTransaction = optTransaction.get(); + TransactionImpl receivingTransaction = optTransaction.get(); assertThat(reporter.getNumReportedSpans()).isEqualTo(3); assertThat(reporter.getSpanByName("on-message-child").isChildOf(receivingTransaction)).isTrue(); @@ -246,7 +244,7 @@ public void testOnMessageWithNonJmssender() throws JMSException { receivingConnection.start(); // SEND message - Transaction sendTransaction = startTestRootTransaction("sqs-test-send"); + TransactionImpl sendTransaction = startTestRootTransaction("sqs-test-send"); sqs.sendMessage(software.amazon.awssdk.services.sqs.model.SendMessageRequest.builder() .queueUrl(queueUrl) @@ -261,9 +259,9 @@ public void testOnMessageWithNonJmssender() throws JMSException { receivingSession.close(); assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); - Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); + Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("JMS RECEIVE")).findAny(); assertThat(optTransaction.isPresent()).isTrue(); - Transaction receivingTransaction = optTransaction.get(); + TransactionImpl receivingTransaction = optTransaction.get(); assertThat(reporter.getNumReportedSpans()).isEqualTo(2); assertThat(reporter.getSpanByName("on-message-child").isChildOf(receivingTransaction)).isTrue(); @@ -302,11 +300,11 @@ static class SQSListener implements MessageListener { @Override public void onMessage(Message message) { try { - Tracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); + ElasticApmTracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); assertThat(tracer).isNotNull(); - AbstractSpan parent = tracer.getActive(); + AbstractSpanImpl parent = tracer.getActive(); assertThat(parent).isNotNull(); - Span child = parent.createSpan(); + SpanImpl child = parent.createSpan(); assertThat(child).isNotNull(); child.withName("on-message-child"); try (Scope ignored = child.activateInScope()) { diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java index 622d56be20..91f632f562 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.awssdk.common; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; import org.testcontainers.containers.localstack.LocalStackContainer; import org.testcontainers.junit.jupiter.Container; @@ -86,7 +86,7 @@ public class TestBuilder { private final Map otelAttributes; @Nullable - private Consumer spanAssertions; + private Consumer spanAssertions; private boolean asyncSpans; private TestBuilder(Supplier test) { @@ -119,7 +119,7 @@ public TestBuilder async() { return this; } - public TestBuilder withSpanAssertions(Consumer assertions) { + public TestBuilder withSpanAssertions(Consumer assertions) { this.spanAssertions = assertions; return this; } @@ -127,7 +127,7 @@ public TestBuilder withSpanAssertions(Consumer assertions) { public void execute() { doExecute(); - Span span = getSpan(); + SpanImpl span = getSpan(); commonSpanAssertions(span); assertThat(span).hasOutcome(Outcome.SUCCESS); @@ -137,7 +137,7 @@ public void executeWithException(Class exceptionType) { assertThatExceptionOfType(exceptionType) .isThrownBy(this::doExecute); - Span span = getSpan(); + SpanImpl span = getSpan(); commonSpanAssertions(span); assertThat(span).hasOutcome(Outcome.FAILURE); @@ -157,10 +157,10 @@ private void doExecute() { } } - private Span getSpan() { + private SpanImpl getSpan() { String spanName = awsService() + " " + operationName + (entityName != null ? " " + entityName : ""); - Span span = reporter.getSpanByName(spanName); + SpanImpl span = reporter.getSpanByName(spanName); assertThat(span) .describedAs("span with name '%s' is expected", spanName) .isNotNull(); @@ -168,7 +168,7 @@ private Span getSpan() { return span; } - private void commonSpanAssertions(Span span) { + private void commonSpanAssertions(SpanImpl span) { assertThat(span) .isExit() @@ -179,7 +179,7 @@ private void commonSpanAssertions(Span span) { assertThat(span).hasAction(action); } - ServiceTarget serviceTarget = span.getContext().getServiceTarget(); + ServiceTargetImpl serviceTarget = span.getContext().getServiceTarget(); String targetName = expectedTargetName(entityName); diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractSQSClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractSQSClientIT.java index dd8368ed51..1796e36ab5 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractSQSClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractSQSClientIT.java @@ -18,11 +18,11 @@ */ package co.elastic.apm.agent.awssdk.common; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.params.ParameterizedTest; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.doReturn; public abstract class AbstractSQSClientIT extends AbstractAwsClientIT { - protected CoreConfiguration coreConfiguration; + protected CoreConfigurationImpl coreConfiguration; protected MessagingConfiguration messagingConfiguration; public AbstractSQSClientIT(String localstackVersion) { @@ -44,18 +44,18 @@ public AbstractSQSClientIT(String localstackVersion) { @BeforeEach public void setupConfig() { - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); messagingConfiguration = tracer.getConfig(MessagingConfiguration.class); } @ParameterizedTest @ValueSource(strings = {"sync", "async"}) public void testReceiveOneMessageWithinTransaction(String clientType) { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); String queueUrl = setupQueue(); - Transaction parentTransaction = startTestRootTransaction("parent-transaction"); + TransactionImpl parentTransaction = startTestRootTransaction("parent-transaction"); sendMessage(queueUrl); parentTransaction.deactivate().end(); @@ -66,7 +66,7 @@ public void testReceiveOneMessageWithinTransaction(String clientType) { e.printStackTrace(); } - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); if (clientType.equals("async")) { receiveMessagesAsync(queueUrl); @@ -79,11 +79,11 @@ public void testReceiveOneMessageWithinTransaction(String clientType) { assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); assertThat(reporter.getNumReportedSpans()).isEqualTo(3); - Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().equals("sqs-test")).findFirst(); + Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().equals("sqs-test")).findFirst(); assertThat(optTransaction.isPresent()).isTrue(); - Transaction sqsTransaction = optTransaction.get(); + TransactionImpl sqsTransaction = optTransaction.get(); - Span receivingSpan = reporter.getSpanByName("SQS POLL from " + SQS_QUEUE_NAME); + SpanImpl receivingSpan = reporter.getSpanByName("SQS POLL from " + SQS_QUEUE_NAME); assertThat(receivingSpan.getContext().getMessage().getQueueName()).isEqualTo(SQS_QUEUE_NAME); assertThat(receivingSpan.getContext().getMessage().getAge()).isGreaterThan(0); assertThat(receivingSpan.getContext().getMessage().getBodyForRead()).isNotNull(); @@ -98,11 +98,11 @@ public void testReceiveOneMessageWithinTransaction(String clientType) { @ParameterizedTest @ValueSource(strings = {"sync", "async"}) public void testReceiveOneMessageOutsideATransaction(String clientType) { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); String queueUrl = setupQueue(); - Transaction parentTransaction = startTestRootTransaction("parent-transaction"); + TransactionImpl parentTransaction = startTestRootTransaction("parent-transaction"); sendMessage(queueUrl); parentTransaction.deactivate().end(); @@ -122,15 +122,15 @@ public void testReceiveOneMessageOutsideATransaction(String clientType) { assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); assertThat(reporter.getNumReportedSpans()).isEqualTo(2); - Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("SQS RECEIVE from")).findFirst(); + Optional optTransaction = reporter.getTransactions().stream().filter(t -> t.getNameAsString().startsWith("SQS RECEIVE from")).findFirst(); assertThat(optTransaction.isPresent()).isTrue(); - Transaction sqsTransaction = optTransaction.get(); + TransactionImpl sqsTransaction = optTransaction.get(); assertThat(sqsTransaction.getSpanLinks()).isEmpty(); - Span childSpan = reporter.getSpanByName("custom-child-span"); + SpanImpl childSpan = reporter.getSpanByName("custom-child-span"); assertThat(childSpan.isChildOf(sqsTransaction)).isTrue(); - Span sendingSpan = reporter.getSpanByName("SQS SEND to " + SQS_QUEUE_NAME); + SpanImpl sendingSpan = reporter.getSpanByName("SQS SEND to " + SQS_QUEUE_NAME); assertThat(sqsTransaction.getContext().getMessage().getQueueName()).isEqualTo(SQS_QUEUE_NAME); assertThat(sqsTransaction.getContext().getMessage().getAge()).isGreaterThan(0); @@ -142,11 +142,11 @@ public void testReceiveOneMessageOutsideATransaction(String clientType) { @ParameterizedTest @ValueSource(strings = {"sync", "async"}) public void testReceiveMultipleMessagesOutsideATransaction(String clientType) { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); String queueUrl = setupQueue(); - Transaction parentTransaction = startTestRootTransaction("parent-transaction"); + TransactionImpl parentTransaction = startTestRootTransaction("parent-transaction"); sendMessage(queueUrl); sendMessage(queueUrl); sendMessage(queueUrl); @@ -184,11 +184,11 @@ public void testReceiveMultipleMessagesOutsideATransaction(String clientType) { @ParameterizedTest @ValueSource(strings = {"sync", "async"}) public void testReceiveMultipleMessagesWithinATransaction(String clientType) { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); String queueUrl = setupQueue(); - Transaction parentTransaction = startTestRootTransaction("parent-transaction"); + TransactionImpl parentTransaction = startTestRootTransaction("parent-transaction"); sendMessage(queueUrl); sendMessage(queueUrl); sendMessage(queueUrl); @@ -201,7 +201,7 @@ public void testReceiveMultipleMessagesWithinATransaction(String clientType) { e.printStackTrace(); } - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); if (clientType.equals("async")) { receiveMessagesAsync(queueUrl, 3); @@ -213,7 +213,7 @@ public void testReceiveMultipleMessagesWithinATransaction(String clientType) { assertThat(reporter.getNumReportedTransactions()).isEqualTo(2); assertThat(reporter.getNumReportedSpans()).isEqualTo(7); - Span receivingSpan = reporter.getSpanByName("SQS POLL from some-test-sqs-queue"); + SpanImpl receivingSpan = reporter.getSpanByName("SQS POLL from some-test-sqs-queue"); assertThat(receivingSpan.getSpanLinks()).isNotNull(); assertThat(receivingSpan.getSpanLinks()).hasSize(3); long numCustomSpans = reporter.getSpans().stream().filter(t -> t.getNameAsString().startsWith("custom")).count(); @@ -232,7 +232,7 @@ public void testQueueExclusion(String clientType) { String queueUrl = setupQueue(); String ignoredQueueUrl = setupIgnoreQueue(); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); if (clientType.equals("async")) { executeAsyncQueueExclusion(queueUrl, ignoredQueueUrl); @@ -253,7 +253,7 @@ public void testEmptyReceiveWithinTransaction(String clientType) { String queueUrl = setupQueue(); - Transaction transaction = startTestRootTransaction("sqs-test"); + TransactionImpl transaction = startTestRootTransaction("sqs-test"); if (clientType.equals("async")) { receiveMessagesAsync(queueUrl); @@ -283,9 +283,9 @@ public void testEmptyReceiveOutsideTransaction(String clientType) { } protected void executeChildSpan() { - AbstractSpan active = tracer.getActive(); + AbstractSpanImpl active = tracer.getActive(); assertThat(active).isNotNull(); - Span childSpan = active.createSpan(); + SpanImpl childSpan = active.createSpan(); assertThat(childSpan).isNotNull(); childSpan.withName("custom-child-span"); childSpan.activate(); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java index 9722136ae1..58cff35723 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java @@ -23,14 +23,13 @@ import co.elastic.apm.agent.awslambda.lambdas.AbstractFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.ServerlessConfiguration; +import co.elastic.apm.agent.configuration.ServerlessConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.metadata.MetaDataMock; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.impl.transaction.TraceState; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import co.elastic.apm.agent.tracer.Outcome; @@ -85,8 +84,8 @@ public abstract class AbstractLambdaTest extends AbstractInstrumenta HEADER_2_KEY, HEADER_2_VALUE, CONTENT_TYPE_HEADER, TEXT_CONTENT_TYPE, "Host", API_GATEWAY_HOST, - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, TRACEPARENT_EXAMPLE, - TraceContext.TRACESTATE_HEADER_NAME, TRACESTATE_EXAMPLE + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, TRACEPARENT_EXAMPLE, + TraceContextImpl.TRACESTATE_HEADER_NAME, TRACESTATE_EXAMPLE ); protected static final String PATH = "/some/url/path"; @@ -117,7 +116,7 @@ public abstract class AbstractLambdaTest extends AbstractInstrumenta protected static final String S3_BUCKET_ARN = "arn:aws:s3:::" + S3_BUCKET_NAME; @Nullable - static ServerlessConfiguration serverlessConfiguration; + static ServerlessConfigurationImpl serverlessConfiguration; @Nullable protected TestContext context; @@ -131,7 +130,7 @@ public abstract class AbstractLambdaTest extends AbstractInstrumenta public AbstractLambdaTest() { jsonSerializer = new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), mock(ApmServerClient.class), MetaDataMock.create() ).newWriter(); @@ -153,7 +152,7 @@ protected boolean supportsContextPropagation() { static synchronized void initAllButInstrumentation() { config = SpyConfiguration.createSpyConfig(); - serverlessConfiguration = config.getConfig(ServerlessConfiguration.class); + serverlessConfiguration = config.getConfig(ServerlessConfigurationImpl.class); doReturn(true).when(serverlessConfiguration).runsOnAwsLambda(); MockTracer.MockInstrumentationSetup mockInstrumentationSetup = MockTracer.createMockInstrumentationSetup(config); tracer = mockInstrumentationSetup.getTracer(); @@ -184,7 +183,7 @@ protected void verifyFailure() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(transaction.getResult()).isEqualTo("failure"); assertThat(reporter.getPartialTransactions()).containsExactly(transaction); @@ -197,18 +196,18 @@ public void testTraceContext() { return; } getFunction().handleRequest(input, context); - Transaction transaction = reporter.getFirstTransaction(); - TraceContext traceContext = transaction.getTraceContext(); + TransactionImpl transaction = reporter.getFirstTransaction(); + TraceContextImpl traceContext = transaction.getTraceContext(); verifyDistributedTracing(traceContext); } - protected void verifyDistributedTracing(TraceContext traceContext) { + protected void verifyDistributedTracing(TraceContextImpl traceContext) { assertThat(traceContext.getTraceId().toString()).isEqualTo(TRACE_ID_EXAMPLE); assertThat(traceContext.getParentId().toString()).isEqualTo(PARENT_ID_EXAMPLE); assertThat(traceContext.getTraceState().getSampleRate()).isEqualTo(0.77d); } - protected void printTransactionJson(Transaction transaction) { + protected void printTransactionJson(TransactionImpl transaction) { String transactionJson = jsonSerializer.toJsonString(transaction); try { System.out.println(objectMapper.readTree(transactionJson).toPrettyString()); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractPlainLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractPlainLambdaTest.java index 8eae63d31a..0e02f02375 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractPlainLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractPlainLambdaTest.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.awslambda.lambdas.TestContext; import co.elastic.apm.agent.impl.metadata.MetaData; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.sdk.internal.util.VersionUtils; import com.amazonaws.services.lambda.runtime.RequestHandler; @@ -58,7 +58,7 @@ protected void verifyTransactionDetails() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); @@ -73,7 +73,7 @@ protected void verifyTransactionDetails() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getName()).isEqualTo(TestContext.FUNCTION_NAME); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractStreamHandlerLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractStreamHandlerLambdaTest.java index ab1f533b4e..1265480d9c 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractStreamHandlerLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractStreamHandlerLambdaTest.java @@ -21,8 +21,8 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.awslambda.lambdas.TestContext; import co.elastic.apm.agent.impl.metadata.MetaData; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.sdk.internal.util.VersionUtils; import com.amazonaws.services.lambda.runtime.Context; @@ -70,7 +70,7 @@ public void testBasicCall() throws Throwable { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); @@ -85,7 +85,7 @@ public void testBasicCall() throws Throwable { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("other"); @@ -101,7 +101,7 @@ public void testCallWithHandlerError() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(transaction.getResult()).isEqualTo("failure"); } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java index 6006e85979..a684b33f13 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV1LambdaTest.java @@ -21,13 +21,13 @@ import co.elastic.apm.agent.awslambda.lambdas.AbstractFunction; import co.elastic.apm.agent.awslambda.lambdas.ApiGatewayV1LambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.Url; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; @@ -90,25 +90,25 @@ private APIGatewayProxyRequestEvent createRequestEvent(String httpMethod, @Nulla @Test public void testBasicCall() { - doReturn(CoreConfiguration.EventType.ALL).when(config.getConfig(CoreConfiguration.class)).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(config.getConfig(CoreConfigurationImpl.class)).getCaptureBody(); getFunction().handleRequest(createInput(), context); reporter.awaitTransactionCount(1); reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(HTTP_METHOD + " /" + API_GATEWAY_STAGE + API_GATEWAY_RESOURCE_PATH); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); assertThat(reporter.getPartialTransactions()).containsExactly(transaction); - Request request = transaction.getContext().getRequest(); + RequestImpl request = transaction.getContext().getRequest(); assertThat(request.getMethod()).isEqualTo(HTTP_METHOD); assertThat(String.valueOf(request.getBody())).isEqualTo(BODY); assertThat(request.getHttpVersion()).isNull(); - Url url = request.getUrl(); + UrlImpl url = request.getUrl(); assertThat(url.getHostname()).isEqualTo(API_GATEWAY_HOST); assertThat(url.getPort()).isEqualTo(443); assertThat(url.getPathname()).isEqualTo(PATH); @@ -121,7 +121,7 @@ public void testBasicCall() { assertThat(headers.get(HEADER_1_KEY)).isEqualTo(HEADER_1_VALUE); assertThat(headers.get(HEADER_2_KEY)).isEqualTo(HEADER_2_VALUE); - Response response = transaction.getContext().getResponse(); + ResponseImpl response = transaction.getContext().getResponse(); assertThat(response.getStatusCode()).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_STATUS_CODE); assertThat(response.getHeaders()).isNotNull(); assertThat(response.getHeaders().get(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_KEY)).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_VALUE); @@ -137,7 +137,7 @@ public void testBasicCall() { assertThat(transaction.getContext().getServiceOrigin().getId()).isEqualTo(API_ID); assertThat(transaction.getContext().getServiceOrigin().getVersion()).isEqualTo("1.0"); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("http"); @@ -155,7 +155,7 @@ public void testCallWithNullRequestContext(boolean isObjectNull) { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); @@ -171,7 +171,7 @@ public void testCallWithNullRequestContext(boolean isObjectNull) { assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isNull(); assertThat(transaction.getContext().getServiceOrigin().hasContent()).isEqualTo(!isObjectNull); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); if (isObjectNull) { @@ -222,7 +222,7 @@ public void testServiceNameAsLambdaUrl() { getFunction().handleRequest(event, context); reporter.awaitTransactionCount(1); reporter.awaitSpanCount(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isEqualTo("lambda url"); } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java index 4315ca4d3f..34099ce792 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApiGatewayV2LambdaTest.java @@ -22,16 +22,14 @@ import co.elastic.apm.agent.awslambda.lambdas.ApiGatewayV1LambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.ApiGatewayV2LambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.Url; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.tracer.Outcome; +import co.elastic.apm.agent.impl.transaction.FaasImpl; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; -import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse; import org.junit.BeforeClass; @@ -97,25 +95,25 @@ private APIGatewayV2HTTPEvent createRequestEvent(@Nullable APIGatewayV2HTTPEvent @Test public void testBasicCall() { - doReturn(CoreConfiguration.EventType.ALL).when(config.getConfig(CoreConfiguration.class)).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(config.getConfig(CoreConfigurationImpl.class)).getCaptureBody(); getFunction().handleRequest(createInput(), context); reporter.awaitTransactionCount(1); reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(HTTP_METHOD + " /" + API_GATEWAY_STAGE + API_GATEWAY_RESOURCE_PATH); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); assertThat(reporter.getPartialTransactions()).containsExactly(transaction); - Request request = transaction.getContext().getRequest(); + RequestImpl request = transaction.getContext().getRequest(); assertThat(request.getMethod()).isEqualTo(HTTP_METHOD); assertThat(String.valueOf(request.getBody())).isEqualTo(BODY); assertThat(request.getHttpVersion()).isEqualTo("1.1"); - Url url = request.getUrl(); + UrlImpl url = request.getUrl(); assertThat(url.getHostname()).isEqualTo(API_GATEWAY_HOST); assertThat(url.getPort()).isEqualTo(443); assertThat(url.getPathname()).isEqualTo(PATH); @@ -128,7 +126,7 @@ public void testBasicCall() { assertThat(headers.get(HEADER_1_KEY)).isEqualTo(HEADER_1_VALUE); assertThat(headers.get(HEADER_2_KEY)).isEqualTo(HEADER_2_VALUE); - Response response = transaction.getContext().getResponse(); + ResponseImpl response = transaction.getContext().getResponse(); assertThat(response.getStatusCode()).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_STATUS_CODE); assertThat(response.getHeaders()).isNotNull(); assertThat(response.getHeaders().get(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_KEY)).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_VALUE); @@ -144,7 +142,7 @@ public void testBasicCall() { assertThat(transaction.getContext().getServiceOrigin().getId()).isEqualTo(API_ID); assertThat(transaction.getContext().getServiceOrigin().getVersion()).isEqualTo("2.0"); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("http"); @@ -162,7 +160,7 @@ public void testCallWithNullRequestContext(boolean isObjectNull) { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); @@ -177,7 +175,7 @@ public void testCallWithNullRequestContext(boolean isObjectNull) { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("other"); @@ -216,7 +214,7 @@ public void testServiceNameAsLambdaUrl() { getFunction().handleRequest(event, context); reporter.awaitTransactionCount(1); reporter.awaitSpanCount(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getContext().getCloudOrigin().getServiceName()).isEqualTo("lambda url"); } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java index 5583ba1834..a84bb69f0b 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/ApplicationLoadBalancerRequestEventLambdaTest.java @@ -22,24 +22,20 @@ import co.elastic.apm.agent.awslambda.lambdas.ApiGatewayV1LambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.ApplicationLoadBalancerRequestLambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.Url; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; -import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent; import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerRequestEvent; import com.amazonaws.services.lambda.runtime.events.ApplicationLoadBalancerResponseEvent; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Map; import java.util.Objects; @@ -94,25 +90,25 @@ protected boolean supportsContextPropagation() { @Test public void testBasicCall() { - doReturn(CoreConfiguration.EventType.ALL).when(config.getConfig(CoreConfiguration.class)).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(config.getConfig(CoreConfigurationImpl.class)).getCaptureBody(); getFunction().handleRequest(createInput(), context); reporter.awaitTransactionCount(1); reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo("FUNCTION_NAME"); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); assertThat(reporter.getPartialTransactions()).containsExactly(transaction); - Request request = transaction.getContext().getRequest(); + RequestImpl request = transaction.getContext().getRequest(); assertThat(request.getMethod()).isEqualTo(HTTP_METHOD); assertThat(request.getBody()).isNull(); assertThat(request.getHttpVersion()).isNull(); - Url url = request.getUrl(); + UrlImpl url = request.getUrl(); assertThat(url.getHostname()).isEqualTo("blabla.com"); assertThat(url.getPort()).isEqualTo(443); assertThat(url.getPathname()).isEqualTo("/toolz/api/v2.0/downloadPDF/PDF_2020-09-11_11-06-01.pdf"); @@ -128,7 +124,7 @@ public void testBasicCall() { assertThat(headers.get("connection")).isEqualTo("Keep-Alive"); assertThat(headers.get("accept-encoding")).isEqualTo("gzip,deflate"); - Response response = transaction.getContext().getResponse(); + ResponseImpl response = transaction.getContext().getResponse(); assertThat(response.getStatusCode()).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_STATUS_CODE); assertThat(response.getHeaders()).isNotNull(); assertThat(response.getHeaders().get(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_KEY)).isEqualTo(ApiGatewayV1LambdaFunction.EXPECTED_RESPONSE_HEADER_1_VALUE); @@ -145,7 +141,7 @@ public void testBasicCall() { assertThat(transaction.getContext().getServiceOrigin().getId()).isEqualTo("arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/lambda-279XGJDqGZ5rsrHC2Fjr/49e9d65c45c6791a"); assertThat(transaction.getContext().getServiceOrigin().getVersion()).isNull(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("http"); @@ -163,7 +159,7 @@ public void testCallWithNullRequestContext() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); @@ -178,7 +174,7 @@ public void testCallWithNullRequestContext() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("http"); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java index 22394fb6d6..7493babe05 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/BaseGatewayLambdaTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.awslambda; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import org.junit.jupiter.api.Test; @@ -38,7 +38,7 @@ public void testCallWithNullInput() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("HTTP 2xx"); @@ -51,7 +51,7 @@ public void testCallWithNullInput() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("other"); @@ -67,7 +67,7 @@ public void testCallWithErrorStatusCode() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getResult()).isEqualTo("HTTP 5xx"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); } diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/S3EventLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/S3EventLambdaTest.java index 82c737523c..045d375f88 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/S3EventLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/S3EventLambdaTest.java @@ -21,8 +21,8 @@ import co.elastic.apm.agent.awslambda.lambdas.AbstractFunction; import co.elastic.apm.agent.awslambda.lambdas.S3EventLambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import com.amazonaws.services.lambda.runtime.events.S3Event; import com.amazonaws.services.lambda.runtime.events.models.s3.S3EventNotification; @@ -80,7 +80,7 @@ public void testBasicCall() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(S3_EVENT_NAME + " " + S3_BUCKET_NAME); assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -98,7 +98,7 @@ public void testBasicCall() { assertThat(transaction.getContext().getCloudOrigin().getRegion()).isEqualTo(EVENT_SOURCE_REGION); assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isNull(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("datasource"); @@ -115,7 +115,7 @@ public void testCallWithNullInput() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -129,7 +129,7 @@ public void testCallWithNullInput() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("other"); @@ -157,7 +157,7 @@ private void validateResultsForUnspecifiedRecord() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -171,14 +171,14 @@ private void validateResultsForUnspecifiedRecord() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("datasource"); assertThat(faas.getTrigger().getRequestId()).isNull(); } - private void verifyOtelAttributes(Transaction transaction) { + private void verifyOtelAttributes(TransactionImpl transaction) { Object s3keyAttribute = transaction.getOtelAttributes().get("aws.s3.key"); assertThat(s3keyAttribute).isInstanceOf(String.class).isEqualTo("b21b84d653bb07b05b1e6b33684dc11b"); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SNSEventLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SNSEventLambdaTest.java index f85e58c5fa..c6fb10632a 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SNSEventLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SNSEventLambdaTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.awslambda.lambdas.AbstractFunction; import co.elastic.apm.agent.awslambda.lambdas.SNSEventLambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import com.amazonaws.services.lambda.runtime.events.SNSEvent; import org.joda.time.DateTime; @@ -80,8 +80,8 @@ private SNSEvent.SNSRecord createSnsRecord(boolean useDefaultTraceparent) { sns.setMessageAttributes(Map.of( HEADER_1_KEY,header_1_Attribute, HEADER_2_KEY, header_2_Attribute, - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, traceparent_Attribute, - TraceContext.TRACESTATE_HEADER_NAME, tracestate_Attribute + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, traceparent_Attribute, + TraceContextImpl.TRACESTATE_HEADER_NAME, tracestate_Attribute )); SNSEvent.SNSRecord record = new SNSEvent.SNSRecord(); @@ -93,7 +93,7 @@ private SNSEvent.SNSRecord createSnsRecord(boolean useDefaultTraceparent) { } @Override - protected void verifyDistributedTracing(TraceContext traceContext) { + protected void verifyDistributedTracing(TraceContextImpl traceContext) { // batch processing root transaction, distributed tracing is supported through span links assertThat(traceContext.getParentId().isEmpty()).isTrue(); assertThat(traceContext.getTraceState().getSampleRate()).isEqualTo(1d); @@ -107,9 +107,9 @@ public void testBasicCall() { } private void verifySpanLink(String traceId, String parentId) { - Transaction transaction = reporter.getFirstTransaction(); - List spanLinks = transaction.getSpanLinks(); - List matchedSpanLinks = spanLinks.stream().filter(spanLink -> spanLink.getParentId().toString().equals(parentId)).collect(Collectors.toList()); + TransactionImpl transaction = reporter.getFirstTransaction(); + List spanLinks = transaction.getSpanLinks(); + List matchedSpanLinks = spanLinks.stream().filter(spanLink -> spanLink.getParentId().toString().equals(parentId)).collect(Collectors.toList()); assertThat(matchedSpanLinks).hasSize(1); assertThat(matchedSpanLinks.get(0).getTraceId().toString()).isEqualTo(traceId); } @@ -119,7 +119,7 @@ private void verifyTransactionDetails() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(reporter.getPartialTransactions()).containsExactly(transaction); printTransactionJson(transaction); @@ -141,7 +141,7 @@ private void verifyTransactionDetails() { assertThat(transaction.getContext().getCloudOrigin().getRegion()).isEqualTo(EVENT_SOURCE_REGION); assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isEqualTo(EVENT_SOURCE_ACCOUNT_ID); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("pubsub"); @@ -155,7 +155,7 @@ public void testCallWithNullInput() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -169,7 +169,7 @@ public void testCallWithNullInput() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("other"); @@ -209,7 +209,7 @@ private void validateResultsForUnspecifiedRecord() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -223,7 +223,7 @@ private void validateResultsForUnspecifiedRecord() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("pubsub"); diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SQSEventLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SQSEventLambdaTest.java index 89f01618b3..36c448d808 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SQSEventLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/SQSEventLambdaTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.awslambda.lambdas.AbstractFunction; import co.elastic.apm.agent.awslambda.lambdas.SQSEventLambdaFunction; import co.elastic.apm.agent.awslambda.lambdas.TestContext; -import co.elastic.apm.agent.impl.transaction.Faas; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import com.amazonaws.services.lambda.runtime.events.SQSEvent; import org.junit.jupiter.api.BeforeAll; @@ -78,8 +78,8 @@ private SQSEvent.SQSMessage createSqsMessage(boolean useDefaultTraceparent) { sqsMessage.setMessageAttributes(Map.of( "SentTimestamp", sentTimestampAttribute, HEADER_1_KEY, header_1_Attribute, - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, traceparent_Attribute, - TraceContext.TRACESTATE_HEADER_NAME, tracestate_Attribute + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, traceparent_Attribute, + TraceContextImpl.TRACESTATE_HEADER_NAME, tracestate_Attribute )); sqsMessage.setBody(MESSAGE_BODY); return sqsMessage; @@ -92,7 +92,7 @@ private SQSEvent createSQSEventWithNulls() { } @Override - protected void verifyDistributedTracing(TraceContext traceContext) { + protected void verifyDistributedTracing(TraceContextImpl traceContext) { // batch processing root transaction, distributed tracing is supported through span links assertThat(traceContext.getParentId().isEmpty()).isTrue(); assertThat(traceContext.getTraceState().getSampleRate()).isEqualTo(1d); @@ -106,9 +106,9 @@ public void testBasicCall() { } private void verifySpanLink(String traceId, String parentId) { - Transaction transaction = reporter.getFirstTransaction(); - List spanLinks = transaction.getSpanLinks(); - List matchedSpanLinks = spanLinks.stream().filter(spanLink -> spanLink.getParentId().toString().equals(parentId)).collect(Collectors.toList()); + TransactionImpl transaction = reporter.getFirstTransaction(); + List spanLinks = transaction.getSpanLinks(); + List matchedSpanLinks = spanLinks.stream().filter(spanLink -> spanLink.getParentId().toString().equals(parentId)).collect(Collectors.toList()); assertThat(matchedSpanLinks).hasSize(1); assertThat(matchedSpanLinks.get(0).getTraceId().toString()).isEqualTo(traceId); } @@ -118,7 +118,7 @@ private void verifyTransactionDetails() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(reporter.getPartialTransactions()).containsExactly(transaction); printTransactionJson(transaction); @@ -140,7 +140,7 @@ private void verifyTransactionDetails() { assertThat(transaction.getContext().getCloudOrigin().getRegion()).isEqualTo(EVENT_SOURCE_REGION); assertThat(transaction.getContext().getCloudOrigin().getAccountId()).isEqualTo(EVENT_SOURCE_ACCOUNT_ID); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getId()).isEqualTo(TestContext.FUNCTION_ARN); assertThat(faas.getTrigger().getType()).isEqualTo("pubsub"); @@ -154,7 +154,7 @@ public void testCallWithNullInput() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -168,7 +168,7 @@ public void testCallWithNullInput() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("other"); @@ -196,7 +196,7 @@ private void validateResultsForUnspecifiedMessage() { reporter.awaitSpanCount(1); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("child-span"); assertThat(reporter.getFirstSpan().getTransaction()).isEqualTo(reporter.getFirstTransaction()); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo(TestContext.FUNCTION_NAME); assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getResult()).isEqualTo("success"); @@ -210,7 +210,7 @@ private void validateResultsForUnspecifiedMessage() { assertThat(transaction.getContext().getServiceOrigin().hasContent()).isFalse(); - Faas faas = transaction.getFaas(); + FaasImpl faas = transaction.getFaas(); assertThat(faas.getExecution()).isEqualTo(TestContext.AWS_REQUEST_ID); assertThat(faas.getTrigger().getType()).isEqualTo("pubsub"); diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra3InstrumentationIT.java b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra3InstrumentationIT.java index 5f87afb60c..b78ea2dc43 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra3InstrumentationIT.java +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra3InstrumentationIT.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.cassandra; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.TestContainersUtils; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; @@ -56,7 +56,7 @@ class Cassandra3InstrumentationIT extends AbstractInstrumentationTest { .withEnv("JAVA_TOOL_OPTIONS", "-Dcassandra.skip_wait_for_gossip_to_settle=0"); private static Session session; private static Cluster cluster; - private Transaction transaction; + private TransactionImpl transaction; @BeforeAll @@ -93,19 +93,19 @@ void test() throws Exception { reporter.awaitSpanCount(3); - Span createSpan = reporter.getSpanByName("CREATE"); + SpanImpl createSpan = reporter.getSpanByName("CREATE"); assertThat(createSpan).isSync(); assertThat(createSpan.getContext().getDb()) .hasStatement("CREATE TABLE users (id UUID, name text, PRIMARY KEY(name, id))") .hasInstance(KEYSPACE); - Span insertSpan = reporter.getSpanByName("INSERT INTO users"); + SpanImpl insertSpan = reporter.getSpanByName("INSERT INTO users"); assertThat(insertSpan).isSync(); assertThat(insertSpan.getContext().getDb()) .hasStatement("INSERT INTO users (id, name) values (?, ?)") .hasInstance(KEYSPACE); - Span selectSpan = reporter.getSpanByName("SELECT FROM users"); + SpanImpl selectSpan = reporter.getSpanByName("SELECT FROM users"); assertThat(selectSpan).isAsync(); assertThat(selectSpan.getContext().getDb()) .hasStatement("SELECT * FROM users where name = 'alice' ALLOW FILTERING") diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra4InstrumentationIT.java b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra4InstrumentationIT.java index 398d6cfdad..4785ec6513 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra4InstrumentationIT.java +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/src/test/java/co/elastic/apm/agent/cassandra/Cassandra4InstrumentationIT.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.cassandra; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.TestContainersUtils; import com.datastax.oss.driver.api.core.CqlSession; import com.datastax.oss.driver.api.core.config.DefaultDriverOption; @@ -59,7 +59,7 @@ class Cassandra4InstrumentationIT extends AbstractInstrumentationTest { .withEnv("JAVA_TOOL_OPTIONS", "-Dcassandra.skip_wait_for_gossip_to_settle=0"); private static CqlSession session; private static int cassandraPort; - private Transaction transaction; + private TransactionImpl transaction; @BeforeAll @@ -103,19 +103,19 @@ void test() throws Exception { reporter.awaitSpanCount(3); - Span createSpan = reporter.getSpanByName("CREATE"); + SpanImpl createSpan = reporter.getSpanByName("CREATE"); assertThat(createSpan).isSync(); assertThat(createSpan.getContext().getDb()) .hasStatement("CREATE TABLE users (id UUID PRIMARY KEY, name text)") .hasInstance(KEYSPACE); - Span insertSpan = reporter.getSpanByName("INSERT INTO users"); + SpanImpl insertSpan = reporter.getSpanByName("INSERT INTO users"); assertThat(insertSpan).isSync(); assertThat(insertSpan.getContext().getDb()) .hasStatement("INSERT INTO users (id, name) values (?, ?)") .hasInstance(KEYSPACE); - Span selectSpan = reporter.getSpanByName("SELECT FROM users"); + SpanImpl selectSpan = reporter.getSpanByName("SELECT FROM users"); assertThat(selectSpan).isAsync(); assertThat(selectSpan.getContext().getDb()) .hasStatement("SELECT * FROM users where name = 'alice' ALLOW FILTERING") diff --git a/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AbstractDubboInstrumentationTest.java b/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AbstractDubboInstrumentationTest.java index 68a240955f..75c5778d8e 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AbstractDubboInstrumentationTest.java +++ b/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AbstractDubboInstrumentationTest.java @@ -19,13 +19,13 @@ package co.elastic.apm.agent.dubbo; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.dubbo.api.DubboTestApi; import co.elastic.apm.agent.dubbo.api.exception.BizException; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.test.TestPort; import co.elastic.apm.agent.tracer.Outcome; import org.junit.jupiter.api.AfterAll; @@ -45,7 +45,7 @@ public abstract class AbstractDubboInstrumentationTest extends AbstractInstrumentationTest { - private static CoreConfiguration coreConfig; + private static CoreConfigurationImpl coreConfig; @Nullable private static DubboTestApi dubboTestApi; @@ -54,7 +54,7 @@ public abstract class AbstractDubboInstrumentationTest extends AbstractInstrumen @BeforeAll static void initInstrumentation() { - coreConfig = tracer.getConfig(CoreConfiguration.class); + coreConfig = tracer.getConfig(CoreConfigurationImpl.class); } @BeforeEach @@ -71,14 +71,14 @@ void beforeEach() { dubboTestApi = buildDubboTestApi(port, backendPort); } - doReturn(CoreConfiguration.EventType.OFF).when(coreConfig).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.OFF).when(coreConfig).getCaptureBody(); startTestRootTransaction("dubbo test"); } @AfterEach void afterEach() { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); if (transaction != null) { transaction.deactivate().end(); } @@ -125,15 +125,15 @@ public void testNormalReturn() { // transaction on the receiving side reporter.awaitTransactionCount(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); validateDubboTransaction(transaction, "normalReturn"); // span on the emitting side (outgoing from this method) reporter.awaitSpanCount(1); - Span span = validateDubboSpan(reporter.getFirstSpan(), "normalReturn"); + SpanImpl span = validateDubboSpan(reporter.getFirstSpan(), "normalReturn"); assertThat(span).isSync(); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors.size()).isEqualTo(0); } @@ -147,9 +147,9 @@ public void testBizException() { assertThat(e).isInstanceOf(BizException.class); } - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors).hasSize(2); - for (ErrorCapture error : errors) { + for (ErrorCaptureImpl error : errors) { assertThat(error.getException()).isInstanceOf(BizException.class); } @@ -179,20 +179,20 @@ public void testAsyncNoReturnException() throws Exception { assertThat(reporter.getFirstSpan(5000)).isNotNull(); assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getSpans()).hasSize(2); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors).hasSize(1); assertThat(errors.get(0).getException()).isInstanceOf(BizException.class); assertThat(reporter.getSpanByName("DubboTestApi#asyncNoReturn")).isAsync(); } - public void validateDubboTransaction(Transaction transaction, String methodName) { + public void validateDubboTransaction(TransactionImpl transaction, String methodName) { assertThat(transaction) .hasType("request") .hasName("DubboTestApi#" + methodName); } - public static Span validateDubboSpan(Span span, String methodName) { + public static SpanImpl validateDubboSpan(SpanImpl span, String methodName) { assertThat(span) .hasName("DubboTestApi#" + methodName) .hasType("external") @@ -225,8 +225,8 @@ public void testBothProviderAndConsumer() { assertThat(reporter.getTransactions()).hasSize(2); assertThat(reporter.getSpans()).hasSize(2); - Map transactionMap = buildMap(reporter.getTransactions()); - Map spanMap = buildMap(reporter.getSpans()); + Map transactionMap = buildMap(reporter.getTransactions()); + Map spanMap = buildMap(reporter.getSpans()); String testApiName = "DubboTestApi#willInvokeAnotherApi"; String anotherApiName = "AnotherApi#echo"; @@ -241,7 +241,7 @@ public void testBothProviderAndConsumer() { .isEqualTo(transactionMap.get(anotherApiName).getTraceContext().getParentId().toString()); } - public > Map buildMap(List list) { + public > Map buildMap(List list) { Map map = new HashMap<>(); for (T t : list) { map.put(t.getNameAsString(), t); diff --git a/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AlibabaDubboInstrumentationTest.java b/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AlibabaDubboInstrumentationTest.java index f48be7115d..be3dfb0a5e 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AlibabaDubboInstrumentationTest.java +++ b/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/AlibabaDubboInstrumentationTest.java @@ -23,9 +23,9 @@ import co.elastic.apm.agent.dubbo.api.exception.BizException; import co.elastic.apm.agent.dubbo.api.impl.AnotherApiImpl; import co.elastic.apm.agent.dubbo.api.impl.DubboTestApiImpl; -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.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.alibaba.dubbo.config.ApplicationConfig; import com.alibaba.dubbo.config.MethodConfig; import com.alibaba.dubbo.config.ProtocolConfig; @@ -143,14 +143,14 @@ public void testAsync() throws Exception { ret = (String) future.get(); assertThat(ret).isEqualTo(arg); - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); validateDubboTransaction(transaction, "async"); assertThat(reporter.getFirstSpan(500)).isNotNull(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span span = validateDubboSpan(spans.get(0), "async"); + SpanImpl span = validateDubboSpan(spans.get(0), "async"); assertThat(span).isAsync(); } @@ -167,16 +167,16 @@ public void testAsyncException() throws Exception { } catch (Exception e) { // exception from Future will be wrapped as RpcException by dubbo implementation assertThat(e.getCause()).isInstanceOf(BizException.class); - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); assertThat(transaction).isNotNull(); assertThat(reporter.getFirstSpan(500)).isNotNull(); assertThat(reporter.getSpans()).hasSize(1); assertThat(reporter.getFirstSpan()).isAsync(); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors.size()).isEqualTo(2); - for (ErrorCapture error : errors) { + for (ErrorCaptureImpl error : errors) { assertThat(error.getException()).isInstanceOf(BizException.class); } } diff --git a/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/ApacheDubboInstrumentationTest.java b/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/ApacheDubboInstrumentationTest.java index 42787b1d4b..8747d6ffa4 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/ApacheDubboInstrumentationTest.java +++ b/apm-agent-plugins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/ApacheDubboInstrumentationTest.java @@ -23,9 +23,9 @@ import co.elastic.apm.agent.dubbo.api.exception.BizException; import co.elastic.apm.agent.dubbo.api.impl.AnotherApiImpl; import co.elastic.apm.agent.dubbo.api.impl.DubboTestApiImpl; -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.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.MethodConfig; import org.apache.dubbo.config.ProtocolConfig; @@ -146,7 +146,7 @@ public void testAsync() throws Exception { ret = (String) future.get(); assertThat(ret).isEqualTo(arg); - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); validateDubboTransaction(transaction, "async"); assertThat(reporter.getFirstSpan(500)) @@ -168,14 +168,14 @@ public void testAsyncException() throws Exception { } catch (Exception e) { // exception from Future will be wrapped as RpcException by dubbo implementation assertThat(e.getCause()).isInstanceOf(BizException.class); - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); assertThat(reporter.getFirstSpan(500)).isNotNull(); assertThat(reporter.getSpans()).hasSize(1); assertThat(reporter.getSpanByName("DubboTestApi#async")).isAsync(); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors.size()).isEqualTo(2); - for (ErrorCapture error : errors) { + for (ErrorCaptureImpl error : errors) { assertThat(error.getException()).isInstanceOf(BizException.class); } } @@ -189,7 +189,7 @@ public void testAsyncByFuture() throws Exception { assertThat(future).isNotNull(); assertThat(future.get()).isEqualTo(arg); - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); validateDubboTransaction(transaction, "asyncByFuture"); assertThat(reporter.getFirstSpan(500)).isNotNull(); @@ -208,7 +208,7 @@ public void testAsyncByFutureException() { future.get(); fail("not ok"); } catch (Exception e) { - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); validateDubboTransaction(transaction, "asyncByFuture"); assertThat(reporter.getFirstSpan(500)).isNotNull(); @@ -217,9 +217,9 @@ public void testAsyncByFutureException() { assertThat(reporter.getSpanByName("DubboTestApi#asyncByFuture")) .isAsync(); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors).hasSize(2); - for (ErrorCapture error : errors) { + for (ErrorCaptureImpl error : errors) { assertThat(error.getException()).isInstanceOf(BizException.class); } } @@ -232,11 +232,11 @@ public void testAsyncByAsyncContext() throws Exception { String ret = dubboTestApi.asyncByAsyncContext(arg); assertThat(ret).isEqualTo(arg); - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); validateDubboTransaction(transaction, "asyncByAsyncContext"); assertThat(reporter.getFirstSpan(500)).isNotNull(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans.size()).isEqualTo(2); assertThat(reporter.getSpanByName("DubboTestApi#asyncByAsyncContext")).isNotNull(); @@ -249,18 +249,18 @@ public void testAsyncByAsyncContextException() throws Exception { dubboTestApi.asyncByAsyncContext("error"); fail("not ok"); } catch (BizException e) { - Transaction transaction = reporter.getFirstTransaction(1000); + TransactionImpl transaction = reporter.getFirstTransaction(1000); validateDubboTransaction(transaction, "asyncByAsyncContext"); assertThat(reporter.getFirstSpan(5000)).isNotNull(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans.size()).isEqualTo(2); assertThat(reporter.getSpanByName("DubboTestApi#asyncByAsyncContext")).isNotNull(); - List errors = reporter.getErrors(); + List errors = reporter.getErrors(); assertThat(errors).hasSize(2); - for (ErrorCapture error : errors) { + for (ErrorCaptureImpl error : errors) { assertThat(error.getException()).isInstanceOf(BizException.class); } } diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/src/main/java/co/elastic/apm/agent/ecs_logging/EcsLoggingUtils.java b/apm-agent-plugins/apm-ecs-logging-plugin/src/main/java/co/elastic/apm/agent/ecs_logging/EcsLoggingUtils.java index bfae79d419..d2116bd018 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/src/main/java/co/elastic/apm/agent/ecs_logging/EcsLoggingUtils.java +++ b/apm-agent-plugins/apm-ecs-logging-plugin/src/main/java/co/elastic/apm/agent/ecs_logging/EcsLoggingUtils.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.ecs_logging; -import co.elastic.apm.agent.tracer.service.ServiceAwareTracer; +import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -38,7 +38,7 @@ public class EcsLoggingUtils { private static final WeakSet versionChecked = WeakConcurrent.buildSet(); private static final WeakSet environmentChecked = WeakConcurrent.buildSet(); - private static final ServiceAwareTracer tracer = GlobalTracer.get().require(ServiceAwareTracer.class); + private static final Tracer tracer = GlobalTracer.get(); @Nullable public static String getServiceName() { diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceEnvironmentTest.java b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceEnvironmentTest.java index 915975ebac..77065b3a57 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceEnvironmentTest.java +++ b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceEnvironmentTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.ecs_logging; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,7 +29,7 @@ public abstract class EcsServiceEnvironmentTest extends EcsLoggingTest { @BeforeEach public void setUp() { - doReturn("test").when(tracer.getConfig(CoreConfiguration.class)).getEnvironment(); + doReturn("test").when(tracer.getConfig(CoreConfigurationImpl.class)).getEnvironment(); } @Test diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceNameTest.java b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceNameTest.java index 5684ef159f..8b1e825156 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceNameTest.java +++ b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceNameTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.ecs_logging; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,7 +29,7 @@ public abstract class EcsServiceNameTest extends EcsLoggingTest { @BeforeEach public void setUp() { - doReturn("foo").when(tracer.getConfig(CoreConfiguration.class)).getServiceName(); + doReturn("foo").when(tracer.getConfig(CoreConfigurationImpl.class)).getServiceName(); } @Test diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceVersionTest.java b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceVersionTest.java index a2864c5e8c..e86393d442 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceVersionTest.java +++ b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/EcsServiceVersionTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.ecs_logging; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,7 +29,7 @@ public abstract class EcsServiceVersionTest extends EcsLoggingTest { @BeforeEach public void setUp() { - doReturn("1.0").when(tracer.getConfig(CoreConfiguration.class)).getServiceVersion(); + doReturn("1.0").when(tracer.getConfig(CoreConfigurationImpl.class)).getServiceVersion(); } @Test diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/jul/JulEcsMdcInstrumentationTest.java b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/jul/JulEcsMdcInstrumentationTest.java index 3fc362644b..73d3ce9e4e 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/jul/JulEcsMdcInstrumentationTest.java +++ b/apm-agent-plugins/apm-ecs-logging-plugin/src/test/java/co/elastic/apm/agent/ecs_logging/jul/JulEcsMdcInstrumentationTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.ecs_logging.jul; import co.elastic.apm.agent.ecs_logging.EcsLoggingTest; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.logging.jul.EcsFormatter; import org.junit.jupiter.api.Test; @@ -42,7 +42,7 @@ void testNoCorrelation() { @Test void testActiveTransaction() { - Transaction transaction = startTestRootTransaction("log"); + TransactionImpl transaction = startTestRootTransaction("log"); try { String json = createLogMsg(); assertThat(getJson(json, "transaction.id")).isEqualTo(transaction.getTraceContext().getTransactionId().toString()); @@ -54,7 +54,7 @@ void testActiveTransaction() { @Test void testActiveError() { - ErrorCapture error = new ErrorCapture(tracer); + ErrorCaptureImpl error = new ErrorCaptureImpl(tracer); error.activate(); try { diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/src/test/java/co/elastic/apm/agent/esrestclient/v5_6/ElasticsearchRestClientInstrumentationIT.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/src/test/java/co/elastic/apm/agent/esrestclient/v5_6/ElasticsearchRestClientInstrumentationIT.java index 76916bf9c6..b3da07daf2 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/src/test/java/co/elastic/apm/agent/esrestclient/v5_6/ElasticsearchRestClientInstrumentationIT.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/src/test/java/co/elastic/apm/agent/esrestclient/v5_6/ElasticsearchRestClientInstrumentationIT.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.esrestclient.v5_6; import co.elastic.apm.agent.esrestclient.AbstractEsClientInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; @@ -185,10 +185,10 @@ public void testDocumentScenario() throws IOException, ExecutionException, Inter assertThat(sr.getHits().getAt(0).getSourceAsMap().get(FOO)).isEqualTo(BAZ); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(2); boolean updateSpanFound = false; - for (Span span : spans) { + for (SpanImpl span : spans) { if (span.getNameAsString().contains("_update")) { updateSpanFound = true; break; diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/AbstractEs6_4ClientInstrumentationTest.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/AbstractEs6_4ClientInstrumentationTest.java index e3e0aa498d..83200e69d0 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/AbstractEs6_4ClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/AbstractEs6_4ClientInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.esrestclient.v6_4; import co.elastic.apm.agent.esrestclient.AbstractEsClientInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; @@ -139,10 +139,10 @@ public void testDocumentScenario() throws Exception { SearchResponse sr = doSearch(new SearchRequest(INDEX)); assertThat(sr.getHits().getAt(0).getSourceAsMap().get(FOO)).isEqualTo(BAZ); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(2); boolean updateSpanFound = false; - for (Span span : spans) { + for (SpanImpl span : spans) { if (span.getNameAsString().contains("_update")) { updateSpanFound = true; break; diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/ElasticsearchRestClientInstrumentationIT_RealReporter.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/ElasticsearchRestClientInstrumentationIT_RealReporter.java index 01c17eed8a..675828e842 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/ElasticsearchRestClientInstrumentationIT_RealReporter.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/esrestclient/v6_4/ElasticsearchRestClientInstrumentationIT_RealReporter.java @@ -19,24 +19,20 @@ package co.elastic.apm.agent.esrestclient.v6_4; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; import co.elastic.apm.agent.impl.metadata.Agent; import co.elastic.apm.agent.impl.metadata.MetaDataMock; import co.elastic.apm.agent.impl.metadata.ProcessInfo; -import co.elastic.apm.agent.impl.metadata.Service; +import co.elastic.apm.agent.impl.metadata.ServiceImpl; import co.elastic.apm.agent.impl.metadata.SystemInfo; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; -import co.elastic.apm.agent.report.ApmServerClient; -import co.elastic.apm.agent.report.ApmServerReporter; -import co.elastic.apm.agent.report.IntakeV2ReportingEventHandler; -import co.elastic.apm.agent.report.Reporter; -import co.elastic.apm.agent.report.ReporterConfiguration; -import co.elastic.apm.agent.report.ReporterMonitor; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; +import co.elastic.apm.agent.report.*; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.report.processor.ProcessorEventHandler; import co.elastic.apm.agent.report.serialize.DslJsonSerializer; import net.bytebuddy.agent.ByteBuddyAgent; @@ -126,19 +122,19 @@ public static void startElasticsearchContainerAndClient() throws IOException { client.indices().create(new CreateIndexRequest(INDEX), RequestOptions.DEFAULT); final ConfigurationRegistry configurationRegistry = SpyConfiguration.createSpyConfig(); - ReporterConfiguration reporterConfiguration = configurationRegistry.getConfig(ReporterConfiguration.class); - CoreConfiguration coreConfiguration = configurationRegistry.getConfig(CoreConfiguration.class); + ReporterConfigurationImpl reporterConfiguration = configurationRegistry.getConfig(ReporterConfigurationImpl.class); + CoreConfigurationImpl coreConfiguration = configurationRegistry.getConfig(CoreConfigurationImpl.class); doReturn(0).when(reporterConfiguration).getMaxQueueSize(); - StacktraceConfiguration stacktraceConfiguration = configurationRegistry.getConfig(StacktraceConfiguration.class); + StacktraceConfigurationImpl stacktraceConfiguration = configurationRegistry.getConfig(StacktraceConfigurationImpl.class); doReturn(30).when(stacktraceConfiguration).getStackTraceLimit(); SystemInfo system = new SystemInfo("x64", "localhost", null, "platform"); - final Service service = new Service().withName("Eyal-ES-client-test").withAgent(new Agent("java", "Test")); + final ServiceImpl service = new ServiceImpl().withName("Eyal-ES-client-test").withAgent(new Agent("java", "Test")); final ProcessInfo title = new ProcessInfo("title"); final ProcessorEventHandler processorEventHandler = ProcessorEventHandler.loadProcessors(configurationRegistry); ApmServerClient apmServerClient = new ApmServerClient(configurationRegistry); apmServerClient.start(); DslJsonSerializer payloadSerializer = new DslJsonSerializer( - mock(StacktraceConfiguration.class), + mock(StacktraceConfigurationImpl.class), apmServerClient, MetaDataMock.create(title, service, system, null, Collections.emptyMap(), null) ); @@ -147,7 +143,7 @@ public static void startElasticsearchContainerAndClient() throws IOException { processorEventHandler, payloadSerializer, apmServerClient); - realReporter = new ApmServerReporter(true, reporterConfiguration, coreConfiguration, v2handler, ReporterMonitor.NOOP, apmServerClient, payloadSerializer, new ObjectPoolFactory()); + realReporter = new ApmServerReporter(true, reporterConfiguration, coreConfiguration, v2handler, ReporterMonitor.NOOP, apmServerClient, payloadSerializer, new ObjectPoolFactoryImpl()); realReporter.start(); tracer = new ElasticApmTracerBuilder() @@ -177,7 +173,7 @@ public void startTransaction() { @After public void endTransaction() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.end(); } diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/src/test/java/co/elastic/apm/agent/esrestclient/v7_x/ElasticsearchRestClientInstrumentationIT.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/src/test/java/co/elastic/apm/agent/esrestclient/v7_x/ElasticsearchRestClientInstrumentationIT.java index cafbb85d1a..6a54a7b879 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/src/test/java/co/elastic/apm/agent/esrestclient/v7_x/ElasticsearchRestClientInstrumentationIT.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/src/test/java/co/elastic/apm/agent/esrestclient/v7_x/ElasticsearchRestClientInstrumentationIT.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.esrestclient.v7_x; import co.elastic.apm.agent.esrestclient.v6_4.AbstractEs6_4ClientInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; @@ -137,7 +137,7 @@ public void onFailure(Exception e) { // This ends the span synchronously cancellable.cancel(); - Span searchSpan = reporter.getFirstSpan(500); + SpanImpl searchSpan = reporter.getFirstSpan(500); validateSpan(searchSpan) .method("POST").pathName("/%s/_search", INDEX) .statusCode(-1) @@ -160,12 +160,12 @@ public void testRestClientAsyncContextPropagation() throws InterruptedException, return; } - AbstractSpan active = tracer.getActive(); - assertThat(active).isInstanceOf(Transaction.class); + AbstractSpanImpl active = tracer.getActive(); + assertThat(active).isInstanceOf(TransactionImpl.class); reporter.reset(); - AtomicReference> observedActive = new AtomicReference<>(); + AtomicReference> observedActive = new AtomicReference<>(); CountDownLatch endLatch = new CountDownLatch(1); RestClient restClient = clientBuilder.build(); diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/src/test/java/co/elastic/apm/agent/esrestclient/v8_x/Elasticsearch8JavaIT.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/src/test/java/co/elastic/apm/agent/esrestclient/v8_x/Elasticsearch8JavaIT.java index 0381d5eb6a..7827ed87b3 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/src/test/java/co/elastic/apm/agent/esrestclient/v8_x/Elasticsearch8JavaIT.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/src/test/java/co/elastic/apm/agent/esrestclient/v8_x/Elasticsearch8JavaIT.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.esrestclient.v8_x; import co.elastic.apm.agent.esrestclient.AbstractEsClientInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.clients.elasticsearch.ElasticsearchAsyncClient; import co.elastic.clients.elasticsearch.ElasticsearchClient; @@ -187,7 +187,7 @@ public void testTryToDeleteNonExistingIndex() { // todo: investigate this - no errors captured, because in this case ResponseListener#onSuccess is invoked instead of onFailure // assertThatErrorsExistWhenDeleteNonExistingIndex(); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getOutcome()).isEqualTo(Outcome.FAILURE); validateSpan(span) .method("DELETE") @@ -201,7 +201,7 @@ public void testTryToDeleteNonExistingIndex() { public void testDocumentScenario() throws Exception { // 1. Index a document and validate span content prepareDefaultDocumentAndIndex(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); try { assertThat(spans).hasSize(1); validateSpan(spans.get(0)) @@ -223,7 +223,7 @@ public void testDocumentScenario() throws Exception { verifyTotalHits(response.hits()); spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span searchSpan = spans.get(0); + SpanImpl searchSpan = spans.get(0); validateSpan(searchSpan) .method("POST") @@ -248,7 +248,7 @@ public void testDocumentScenario() throws Exception { spans = reporter.getSpans(); assertThat(spans).hasSize(2); - Span updateSpan = spans.get(0); + SpanImpl updateSpan = spans.get(0); validateSpan(updateSpan) .method("POST") .endpointName("update") @@ -436,9 +436,9 @@ public void testMultisearchTemplateRequest_validateSpanContentAndDbContext() thr assertThat(items.size()).isEqualTo(1); MultiSearchItem multiSearchItem = (MultiSearchItem) items.get(0)._get(); verifyTotalHits(multiSearchItem.hits()); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span span = spans.get(0); + SpanImpl span = spans.get(0); validateSpan(span) .method("POST") diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/AbstractEsClientInstrumentationTest.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/AbstractEsClientInstrumentationTest.java index 0c967a1a44..2220df1bf9 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/AbstractEsClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/AbstractEsClientInstrumentationTest.java @@ -19,12 +19,12 @@ package co.elastic.apm.agent.esrestclient; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Db; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.context.Http; -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.impl.context.DbImpl; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.TestContainersUtils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; @@ -87,25 +87,25 @@ public void startTransaction() { @After public void endTransaction() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.deactivate().end(); } } public void assertThatErrorsExistWhenDeleteNonExistingIndex() { - List errorCaptures = reporter.getErrors(); + List errorCaptures = reporter.getErrors(); assertThat(errorCaptures).hasSize(1); - ErrorCapture errorCapture = errorCaptures.get(0); + ErrorCaptureImpl errorCapture = errorCaptures.get(0); assertThat(errorCapture.getException()).isNotNull(); } - protected EsSpanValidationBuilder validateSpan(Span spanToValidate) { + protected EsSpanValidationBuilder validateSpan(SpanImpl spanToValidate) { return new EsSpanValidationBuilder(spanToValidate, async); } protected EsSpanValidationBuilder validateSpan() { - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); return validateSpan(spans.get(0)); } @@ -114,7 +114,7 @@ protected static class EsSpanValidationBuilder { private static final ObjectMapper jackson = new ObjectMapper(); - private final Span span; + private final SpanImpl span; private boolean statementExpectedNonNull = false; @@ -140,7 +140,7 @@ protected static class EsSpanValidationBuilder { private boolean isAsyncRequest; - public EsSpanValidationBuilder(Span spanToValidate, boolean isAsyncRequest) { + public EsSpanValidationBuilder(SpanImpl spanToValidate, boolean isAsyncRequest) { this.span = spanToValidate; this.isAsyncRequest = isAsyncRequest; } @@ -238,7 +238,7 @@ public void check() { private void checkHttpContext() { - Http http = span.getContext().getHttp(); + HttpImpl http = span.getContext().getHttp(); assertThat(http).isNotNull(); if (expectedHttpMethod != null) { assertThat(http.getMethod()).isEqualTo(expectedHttpMethod); @@ -250,7 +250,7 @@ private void checkHttpContext() { } private void checkDbContext() { - Db db = span.getContext().getDb(); + DbImpl db = span.getContext().getDb(); assertThat(db.getType()).isEqualTo(ELASTICSEARCH); CharSequence statement = db.getStatementBuffer(); if (statementExpectedNonNull) { @@ -284,7 +284,7 @@ private void checkPathPartAttributes() { } private void checkDestinationContext() { - Destination destination = span.getContext().getDestination(); + DestinationImpl destination = span.getContext().getDestination(); assertThat(destination).isNotNull(); if (reporter.checkDestinationAddress()) { assertThat(destination.getAddress().toString()).isEqualTo(container.getContainerIpAddress()); diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/ElasticsearchRestClientInstrumentationHelperTest.java b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/ElasticsearchRestClientInstrumentationHelperTest.java index 5fbce1c02e..e4420f0d33 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/ElasticsearchRestClientInstrumentationHelperTest.java +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/src/test/java/co/elastic/apm/agent/esrestclient/ElasticsearchRestClientInstrumentationHelperTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.impl.context.Db; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.DbImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.impl.transaction.TransactionTest; import co.elastic.apm.agent.testutils.assertions.SpanAssert; import org.apache.http.HttpHost; @@ -37,9 +37,7 @@ import java.util.List; import java.util.Map; -import java.util.function.Consumer; import java.util.function.Function; -import java.util.function.Supplier; import static co.elastic.apm.agent.esrestclient.ElasticsearchRestClientInstrumentationHelper.ELASTICSEARCH; import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; @@ -52,7 +50,7 @@ class ElasticsearchRestClientInstrumentationHelperTest extends AbstractInstrumen private final ElasticsearchRestClientInstrumentationHelper helper = ElasticsearchRestClientInstrumentationHelper.get(); - private Transaction transaction; + private TransactionImpl transaction; @BeforeEach void before() { @@ -66,7 +64,7 @@ void after(){ @Test void testCreateSpan() { - Span span = (Span) helper.createClientSpan("GET", "/_test", null, true); + SpanImpl span = (SpanImpl) helper.createClientSpan("GET", "/_test", null, true); assertThat(span).isNotNull(); assertThat(tracer.getActive()).isEqualTo(span); @@ -91,7 +89,7 @@ void testCreateSpan() { @Test void testCreateSpanWithClusterName() { - Span span = (Span) helper.createClientSpan("GET", "/_test", null, true); + SpanImpl span = (SpanImpl) helper.createClientSpan("GET", "/_test", null, true); assertThat(span).isNotNull(); assertThat(tracer.getActive()).isEqualTo(span); @@ -131,7 +129,7 @@ private static Response mockResponse(Map headers) { @Test void testNonSampledSpan() { TransactionTest.setRecorded(false, transaction); - Span esSpan = (Span) helper.createClientSpan("SEARCH", "/test", null, true); + SpanImpl esSpan = (SpanImpl) helper.createClientSpan("SEARCH", "/test", null, true); assertThat(esSpan).isNotNull(); try { assertThat(esSpan.isSampled()).isFalse(); @@ -160,7 +158,7 @@ public void testCaptureBodyUrls(boolean captureEverything) throws Exception { assertThat(config.getConfig(ElasticsearchConfiguration.class).getCaptureBodyUrls()).hasSizeGreaterThan(5); } - Span span = (Span) helper.createClientSpan("GET", "/_test", + SpanImpl span = (SpanImpl) helper.createClientSpan("GET", "/_test", new ByteArrayEntity(new byte[0]), true); assertThat(span).isNotNull(); assertThat(tracer.getActive()).isEqualTo(span); @@ -175,7 +173,7 @@ public void testCaptureBodyUrls(boolean captureEverything) throws Exception { .hasType("elasticsearch") .hasNoName(); - Db db = span.getContext().getDb(); + DbImpl db = span.getContext().getDb(); Assertions.assertThat(db.getType()).isEqualTo(ELASTICSEARCH); if (captureEverything) { assertThat((CharSequence) db.getStatementBuffer()).isNotNull(); @@ -194,8 +192,8 @@ public void testSpanIsSync() { testSpanSyncAttribute(true, (span -> assertThat(span).isSync())); } - private void testSpanSyncAttribute(boolean isSync, Function checkSyncAttribute) { - Span span = (Span) helper.createClientSpan("GET", "/_test", null, isSync); + private void testSpanSyncAttribute(boolean isSync, Function checkSyncAttribute) { + SpanImpl span = (SpanImpl) helper.createClientSpan("GET", "/_test", null, isSync); assertThat(span).isNotNull(); assertThat(tracer.getActive()).isEqualTo(span); diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/src/main/java/co/elastic/apm/agent/finaglehttpclient/FinaglePayloadSizeFilterInstrumentation.java b/apm-agent-plugins/apm-finagle-httpclient-plugin/src/main/java/co/elastic/apm/agent/finaglehttpclient/FinaglePayloadSizeFilterInstrumentation.java index 657f7bb444..5f4cf92195 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/src/main/java/co/elastic/apm/agent/finaglehttpclient/FinaglePayloadSizeFilterInstrumentation.java +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/src/main/java/co/elastic/apm/agent/finaglehttpclient/FinaglePayloadSizeFilterInstrumentation.java @@ -23,7 +23,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.sdk.logging.Logger; @@ -31,7 +31,6 @@ import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import co.elastic.apm.agent.tracer.Tracer; -import co.elastic.apm.agent.tracer.dispatch.HeaderUtils; import com.twitter.finagle.http.Request; import com.twitter.finagle.http.Response; import com.twitter.finagle.tracing.Trace; @@ -128,7 +127,7 @@ public static Object onBeforeExecute(@Nullable @Advice.Argument(0) Request reque if (request == null || INBOUND_REQUEST_CLASS.isInstance(request)) { return null; } - ElasticContext parentContext = tracer.currentContext(); + TraceState parentContext = tracer.currentContext(); AbstractSpan parent = parentContext.getSpan(); Span span = null; if (parent != null) { diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/src/test/java/co/elastic/apm/agent/finaglehttpclient/FinagleHttpClientTest.java b/apm-agent-plugins/apm-finagle-httpclient-plugin/src/test/java/co/elastic/apm/agent/finaglehttpclient/FinagleHttpClientTest.java index a30d90627c..23e4e8ab5f 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/src/test/java/co/elastic/apm/agent/finaglehttpclient/FinagleHttpClientTest.java +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/src/test/java/co/elastic/apm/agent/finaglehttpclient/FinagleHttpClientTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.finaglehttpclient; import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import com.twitter.finagle.Http; import com.twitter.finagle.Service; import com.twitter.finagle.http.Request; @@ -72,7 +72,7 @@ public void getWithTls() throws Exception { service.close(); } - Span span = expectSpan("/") + SpanImpl span = expectSpan("/") .withHost("sub-host") .withStatus(0) .withHttps() @@ -80,7 +80,7 @@ public void getWithTls() throws Exception { .withoutTraceContextHeaders() .verify(); assertThat(reporter.getErrors()).hasSize(1); - ErrorCapture error = reporter.getFirstError(); + ErrorCaptureImpl error = reporter.getFirstError(); assertThat(error.getTraceContext().getTraceId()).isEqualTo(span.getTraceContext().getTraceId()); assertThat(error.getTraceContext().getParentId()).isEqualTo(span.getTraceContext().getId()); assertThat(error.getException()).hasStackTraceContaining("SSLHandshakeException"); diff --git a/apm-agent-plugins/apm-grails-plugin/src/test/java/co/elastic/apm/agent/grails/GrailsTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-grails-plugin/src/test/java/co/elastic/apm/agent/grails/GrailsTransactionNameInstrumentationTest.java index 225ef4c222..90501be6f9 100644 --- a/apm-agent-plugins/apm-grails-plugin/src/test/java/co/elastic/apm/agent/grails/GrailsTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-grails-plugin/src/test/java/co/elastic/apm/agent/grails/GrailsTransactionNameInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.grails; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Scope; import grails.core.GrailsControllerClass; import grails.web.mapping.UrlMappingInfo; @@ -50,7 +50,7 @@ void testSetGrailsTransactionName() throws Exception { doReturn("Foo").when(controllerClass).getShortName(); final UrlMappingInfo mappingInfo = mock(UrlMappingInfo.class); doReturn("bar").when(mappingInfo).getActionName(); - final Transaction transaction = tracer.startRootTransaction(null).withName("override me"); + final TransactionImpl transaction = tracer.startRootTransaction(null).withName("override me"); try (Scope scope = transaction.activateInScope()) { handlerAdapter.handle(mock(HttpServletRequest.class), mock(HttpServletResponse.class), new GrailsControllerUrlMappingInfo(controllerClass, mappingInfo)); } catch (Exception ignore) { diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/main/java/co/elastic/apm/agent/grpc/GrpcHelper.java b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/main/java/co/elastic/apm/agent/grpc/GrpcHelper.java index 495a02eb2b..56ca09bb18 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/main/java/co/elastic/apm/agent/grpc/GrpcHelper.java +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/main/java/co/elastic/apm/agent/grpc/GrpcHelper.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -296,7 +296,7 @@ public void exitServerListenerMethod(@Nullable Throwable thrown, * @return client call span (activated) or {@literal null} if not within an exit span. */ @Nullable - public Span onClientCallCreationEntry(ElasticContext parent, + public Span onClientCallCreationEntry(TraceState parent, @Nullable MethodDescriptor method, @Nullable String authority) { @@ -333,7 +333,7 @@ public Span onClientCallCreationEntry(ElasticContext parent, * This is the 2nd method called during client call execution, the next is {@link #clientCallStartEnter(ClientCall, ClientCall.Listener, Metadata)}. * * @param clientCall client call - * @param spanFromEntry span created at {@link #onClientCallCreationEntry(ElasticContext, MethodDescriptor, String)} + * @param spanFromEntry span created at {@link #onClientCallCreationEntry(TraceState, MethodDescriptor, String)} */ public void onClientCallCreationExit(@Nullable ClientCall clientCall, @Nullable Span spanFromEntry) { if (clientCall != null) { diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcClientInstrumentationTest.java b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcClientInstrumentationTest.java index f971afeac9..b901a58a9d 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcClientInstrumentationTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.grpc.testapp.GrpcApp; import co.elastic.apm.agent.grpc.testapp.GrpcAppProvider; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -58,7 +58,7 @@ void beforeEach() throws Exception { @AfterEach void afterEach() throws Exception { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); if (transaction != null) { transaction.deactivate() @@ -77,16 +77,16 @@ public void simpleCall() { endRootTransaction(); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction).isNotNull(); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); checkSpan(span); assertThat(span.getOutcome()).isEqualTo(Outcome.SUCCESS); } - private void checkSpan(Span span) { + private void checkSpan(SpanImpl span) { assertThat(span.getType()).isEqualTo("external"); assertThat(span.getSubtype()).isEqualTo("grpc"); assertThat(span.getNameAsString()).isEqualTo("helloworld.Hello/SayHello"); @@ -136,7 +136,7 @@ public void cancelClientCall() throws Exception { assertThat(msg.cancel(true)).isTrue(); - Span span = reporter.getFirstSpan(200); + SpanImpl span = reporter.getFirstSpan(200); // we should have a span created and properly terminated, even if the server // thread is still waiting for proper termination. @@ -224,7 +224,7 @@ void clientCallAndListenerExceptionCheck(String method) { // even if there is an exception thrown, we should still have a span created. - Span span = getFirstSpan(); + SpanImpl span = getFirstSpan(); checkSpan(span); Outcome outcome = span.getOutcome(); @@ -239,7 +239,7 @@ void clientCallAndListenerExceptionCheck(String method) { } protected void endRootTransaction() { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); transaction @@ -252,7 +252,7 @@ private boolean isVersion161() { return getClass().getPackageName().contains(".v1_6_1"); } - private static Span getFirstSpan() { + private static SpanImpl getFirstSpan() { return reporter.getFirstSpan(1000); } diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcContextHeadersTest.java b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcContextHeadersTest.java index 5199640189..ea852d2eee 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcContextHeadersTest.java +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcContextHeadersTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.grpc.testapp.GrpcApp; import co.elastic.apm.agent.grpc.testapp.GrpcAppProvider; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -61,7 +61,7 @@ void simpleClientContextPropagation() { // transaction 1 (root transaction) will do the gRPC call and create a span // transaction 2 will handle the gRPC call and create a transaction - Transaction transaction1 = createRootTransaction(); + TransactionImpl transaction1 = createRootTransaction(); try { assertThat(app.sayHello("oscar", 0)).isEqualTo("hello(oscar)"); @@ -76,20 +76,20 @@ void simpleClientContextPropagation() { .hasSize(2); }); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(2); assertThat(transactions).contains(transaction1); - Transaction transaction2 = transactions.stream() + TransactionImpl transaction2 = transactions.stream() .filter((t) -> !t.equals(transaction1)) .findFirst() .orElseThrow(() -> null); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span span = spans.get(0); + SpanImpl span = spans.get(0); assertThat(transaction2.isChildOf(span)) .describedAs("server transaction parent %s should be client span %s", @@ -99,14 +99,14 @@ void simpleClientContextPropagation() { } - private static Transaction createRootTransaction() { + private static TransactionImpl createRootTransaction() { return tracer.startRootTransaction(AbstractGrpcClientInstrumentationTest.class.getClassLoader()) .withName("root") .withType("test") .activate(); } - private static void endRootTransaction(Transaction transaction) { + private static void endRootTransaction(TransactionImpl transaction) { transaction .withOutcome(Outcome.SUCCESS) .deactivate() diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcServerInstrumentationTest.java b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcServerInstrumentationTest.java index 084bb8675d..b1cf402511 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcServerInstrumentationTest.java +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/test/java/co/elastic/apm/agent/grpc/AbstractGrpcServerInstrumentationTest.java @@ -21,8 +21,8 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.grpc.testapp.GrpcApp; import co.elastic.apm.agent.grpc.testapp.GrpcAppProvider; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -69,7 +69,7 @@ void nestedCallShouldProduceTwoTransactions() { reporter.awaitTransactionCount(2); - for (Transaction transaction : reporter.getTransactions()) { + for (TransactionImpl transaction : reporter.getTransactions()) { checkUnaryTransactionSuccess(transaction); } } @@ -95,7 +95,7 @@ void asyncClientCallShouldWorkLikeRegularCall() throws Exception { String msg = app.sayHelloAsync("bob", 0).get(); assertThat(msg).isEqualTo("hello(bob)"); - Transaction transaction = getFirstTransaction(); + TransactionImpl transaction = getFirstTransaction(); checkUnaryTransactionSuccess(transaction); } @@ -103,7 +103,7 @@ private void simpleCallWithError(@Nullable String name, String expectedResult, O assertThat(app.sayHello(name, 0)) .isNull(); - Transaction transaction = getFirstTransaction(); + TransactionImpl transaction = getFirstTransaction(); checkUnaryTransaction(transaction, expectedResult, expectedOutcome); } @@ -187,11 +187,11 @@ void noNestedTransactionsForSingleCall() { reporter.awaitTransactionCount(1); } - private static void checkUnaryTransactionSuccess(Transaction transaction) { + private static void checkUnaryTransactionSuccess(TransactionImpl transaction) { checkUnaryTransaction(transaction, "OK", Outcome.SUCCESS); } - private static void checkUnaryTransaction(Transaction transaction, String expectedResult, Outcome expectedOutcome) { + private static void checkUnaryTransaction(TransactionImpl transaction, String expectedResult, Outcome expectedOutcome) { assertThat(transaction).isNotNull(); assertThat(transaction.getNameAsString()).isEqualTo("helloworld.Hello/SayHello"); assertThat(transaction.getType()).isEqualTo("request"); @@ -204,7 +204,7 @@ private static void checkNoTransaction() { getReporter().assertNoTransaction(100); } - private static Transaction getFirstTransaction() { + private static TransactionImpl getFirstTransaction() { return getReporter().getFirstTransaction(1000); } diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/main/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchHelper.java b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/main/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchHelper.java index e92d3bcae4..f93ac3d294 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/main/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchHelper.java +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/main/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchHelper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.hibernatesearch; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; @@ -32,7 +32,7 @@ private HibernateSearchHelper() { public static Span createAndActivateSpan(final Tracer tracer, final String methodName, final String query) { - ElasticContext active = tracer.currentContext(); + TraceState active = tracer.currentContext(); AbstractSpan activeSpan = active.getSpan(); // avoid creating the same span twice for example, when an instrumented API is wrapped if (activeSpan == null || activeSpan instanceof Span && HibernateSearchConstants.HIBERNATE_SEARCH_ORM_TYPE diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/test/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchAssertionHelper.java b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/test/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchAssertionHelper.java index 16e4a6af75..f9d81da6da 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/test/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchAssertionHelper.java +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/src/test/java/co/elastic/apm/agent/hibernatesearch/HibernateSearchAssertionHelper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.hibernatesearch; import co.elastic.apm.agent.MockReporter; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; @@ -31,7 +31,7 @@ private HibernateSearchAssertionHelper() { public static void assertApmSpanInformation(final MockReporter reporter, final String expectedQuery, final String searchMethod) { assertThat(reporter.getSpans().size()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span) .hasType(HibernateSearchConstants.HIBERNATE_SEARCH_ORM_SPAN_TYPE) .hasSubType(HibernateSearchConstants.HIBERNATE_SEARCH_ORM_TYPE) diff --git a/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java index 36923f4845..2d62702437 100644 --- a/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java +++ b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import javax.annotation.Nullable; @@ -34,7 +34,7 @@ public class HttpClientHelper { public static final String HTTP_SUBTYPE = "http"; @Nullable - public static Span startHttpClientSpan(ElasticContext activeContext, String method, @Nullable URI uri, @Nullable CharSequence hostName) { + public static Span startHttpClientSpan(TraceState activeContext, String method, @Nullable URI uri, @Nullable CharSequence hostName) { String uriString = null; String scheme = null; int port = -1; @@ -50,7 +50,7 @@ public static Span startHttpClientSpan(ElasticContext activeContext, Strin } @Nullable - public static Span startHttpClientSpan(ElasticContext activeContext, String method, @Nullable String uri, + public static Span startHttpClientSpan(TraceState activeContext, String method, @Nullable String uri, @Nullable String scheme, @Nullable CharSequence hostName, int port) { Span span = activeContext.createExitSpan(); if (span != null) { diff --git a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java index 8bfcd27ecc..7d0f33372f 100644 --- a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java @@ -19,17 +19,16 @@ package co.elastic.apm.agent.httpclient; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.context.Http; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.util.ResultUtil; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.tracer.ElasticContext; -import co.elastic.apm.agent.tracer.Outcome; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Scope; import co.elastic.apm.agent.tracer.dispatch.TextHeaderGetter; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -54,7 +53,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import static co.elastic.apm.agent.impl.transaction.TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; +import static co.elastic.apm.agent.impl.transaction.TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.any; @@ -70,7 +69,7 @@ public abstract class AbstractHttpClientInstrumentationTest extends AbstractInst @Rule public WireMockRule wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig().dynamicPort().dynamicHttpsPort(), false); - private ElasticContext emptyContext; + private TraceState emptyContext; @Before public final void setUpWiremock() { @@ -99,7 +98,7 @@ protected ResponseDefinitionBuilder dummyResponse() { @After public final void after() { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); transaction.deactivate().end(); assertThat(reporter.getTransactions()).hasSize(1); @@ -117,7 +116,7 @@ public void testHttpCall() { @Test public void testDisabledOutgoingHeaders() { - doReturn(true).when(config.getConfig(CoreConfiguration.class)).isOutgoingTraceContextHeadersInjectionDisabled(); + doReturn(true).when(config.getConfig(CoreConfigurationImpl.class)).isOutgoingTraceContextHeadersInjectionDisabled(); String path = "/"; performGetWithinTransaction(path); expectSpan(path).withoutTraceContextHeaders().verify(); @@ -126,7 +125,7 @@ public void testDisabledOutgoingHeaders() { @Test public void testContextPropagationFromExitParent() { String path = "/"; - Span exitSpan = Objects.requireNonNull(Objects.requireNonNull(Objects.requireNonNull(tracer.currentTransaction()).createExitSpan())); + SpanImpl exitSpan = Objects.requireNonNull(Objects.requireNonNull(Objects.requireNonNull(tracer.currentTransaction()).createExitSpan())); try { exitSpan.withType("custom").withSubtype("exit"); exitSpan.getContext().getDestination().withAddress("test-host").withPort(6000); @@ -142,7 +141,7 @@ public void testContextPropagationFromExitParent() { @Test public void testBaggagePropagatedWithoutTrace() { - ElasticContext baggageOnly = emptyContext.withUpdatedBaggage() + TraceState baggageOnly = emptyContext.withUpdatedBaggage() .put("foo", "bar") .buildContext(); try (Scope scope = baggageOnly.activateInScope()) { @@ -211,7 +210,7 @@ public void testHttpCallRedirect() { String path = "/redirect"; performGetWithinTransaction(path); - Span span = expectSpan(path).verify(); + SpanImpl span = expectSpan(path).verify(); verifyTraceContextHeaders(span, "/redirect"); verifyTraceContextHeaders(span, "/"); @@ -224,7 +223,7 @@ public void testHttpCallCircularRedirect() { String path = "/circular-redirect"; performGetWithinTransaction(path); - Span span = reporter.getFirstSpan(500); + SpanImpl span = reporter.getFirstSpan(500); assertThat(span).isNotNull(); assertThat(reporter.getSpans()).hasSize(1); @@ -324,17 +323,17 @@ public VerifyBuilder withoutRequestExecuted() { return this; } - public Span verify() { + public SpanImpl verify() { assertThat(reporter.getFirstSpan(500)).isNotNull(); assertThat(reporter.getSpans()).hasSize(1); - Span span = reporter.getSpans().get(0); + SpanImpl span = reporter.getSpans().get(0); int port = https ? wireMockRule.httpsPort() : wireMockRule.port(); String schema = https ? "https" : "http"; String baseUrl = String.format("%s://%s:%d", schema, host, port); - Http httpContext = span.getContext().getHttp(); + HttpImpl httpContext = span.getContext().getHttp(); assertThat(span) .hasName(String.format("%s %s", httpContext.getMethod(), host)) @@ -356,7 +355,7 @@ public Span verify() { assertThat(span).isAsync(); } - Destination destination = span.getContext().getDestination(); + DestinationImpl destination = span.getContext().getDestination(); int addressStartIndex = (host.startsWith("[")) ? 1 : 0; int addressEndIndex = (host.endsWith("]")) ? host.length() - 1 : host.length(); assertThat(destination.getAddress().toString()).isEqualTo(host.substring(addressStartIndex, addressEndIndex)); @@ -372,7 +371,7 @@ public Span verify() { verifyTraceContextHeaders(span, path); } else { findLoggedRequests(path).forEach(request -> - assertThat(TraceContext.containsTraceContextTextHeaders(request, HeaderAccessor.INSTANCE)).isFalse() + assertThat(TraceContextImpl.containsTraceContextTextHeaders(request, HeaderAccessor.INSTANCE)).isFalse() ); } } @@ -381,13 +380,13 @@ public Span verify() { } } - private void verifyTraceContextHeaders(Span span, String path) { + private void verifyTraceContextHeaders(SpanImpl span, String path) { Map headerMap = new HashMap<>(); span.propagateContext(headerMap, TextHeaderMapAccessor.INSTANCE, TextHeaderMapAccessor.INSTANCE); assertThat(headerMap).isNotEmpty(); final List loggedRequests = findLoggedRequests(path); loggedRequests.forEach(request -> { - assertThat(TraceContext.containsTraceContextTextHeaders(request, HeaderAccessor.INSTANCE)).isTrue(); + assertThat(TraceContextImpl.containsTraceContextTextHeaders(request, HeaderAccessor.INSTANCE)).isTrue(); AtomicInteger headerCount = new AtomicInteger(); HeaderAccessor.INSTANCE.forEach( W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, @@ -397,7 +396,7 @@ private void verifyTraceContextHeaders(Span span, String path) { ); assertThat(headerCount.get()).isEqualTo(1); headerMap.forEach((key, value) -> assertThat(request.getHeader(key)).isEqualTo(value)); - Transaction transaction = tracer.startChildTransaction(request, new HeaderAccessor(), AbstractHttpClientInstrumentationTest.class.getClassLoader()); + TransactionImpl transaction = tracer.startChildTransaction(request, new HeaderAccessor(), AbstractHttpClientInstrumentationTest.class.getClassLoader()); assertThat(transaction).isNotNull(); assertThat(transaction.getTraceContext().getTraceId()).isEqualTo(span.getTraceContext().getTraceId()); assertThat(transaction.getTraceContext().getParentId()).isEqualTo(span.getTraceContext().getId()); diff --git a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java index 6b68b08ab7..e40199c27f 100644 --- a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java +++ b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.httpclient; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -47,9 +47,9 @@ void afterTest() { void testNonDefaultPort() throws URISyntaxException { createSpanWithUrl("http://user:pass@testing.local:1234/path?query"); assertThat(reporter.getSpans()).hasSize(1); - Span httpSpan = reporter.getFirstSpan(); + SpanImpl httpSpan = reporter.getFirstSpan(); assertThat(httpSpan.getContext().getHttp().getUrl().toString()).isEqualTo("http://testing.local:1234/path?query"); - Destination destination = httpSpan.getContext().getDestination(); + DestinationImpl destination = httpSpan.getContext().getDestination(); assertThat(httpSpan.getContext().getServiceTarget()) .hasType("http") .hasName("testing.local:1234") @@ -63,9 +63,9 @@ void testNonDefaultPort() throws URISyntaxException { void testDefaultExplicitPort() throws URISyntaxException { createSpanWithUrl("https://www.elastic.co:443/products/apm"); assertThat(reporter.getSpans()).hasSize(1); - Span httpSpan = reporter.getFirstSpan(); + SpanImpl httpSpan = reporter.getFirstSpan(); assertThat(httpSpan.getContext().getHttp().getUrl().toString()).isEqualTo("https://www.elastic.co:443/products/apm"); - Destination destination = httpSpan.getContext().getDestination(); + DestinationImpl destination = httpSpan.getContext().getDestination(); assertThat(httpSpan.getContext().getServiceTarget()) .hasType("http") .hasName("www.elastic.co:443") @@ -78,13 +78,13 @@ void testDefaultExplicitPort() throws URISyntaxException { void testDefaultImplicitPort() throws URISyntaxException { createSpanWithUrl("https://www.elastic.co/products/apm"); assertThat(reporter.getSpans()).hasSize(1); - Span httpSpan = reporter.getFirstSpan(); + SpanImpl httpSpan = reporter.getFirstSpan(); assertThat(httpSpan.getContext().getHttp().getUrl().toString()).isEqualTo("https://www.elastic.co/products/apm"); assertThat(httpSpan.getContext().getServiceTarget()) .hasType("http") .hasName("www.elastic.co:443") .hasNameOnlyDestinationResource(); - Destination destination = httpSpan.getContext().getDestination(); + DestinationImpl destination = httpSpan.getContext().getDestination(); assertThat(destination.getAddress().toString()).isEqualTo("www.elastic.co"); assertThat(destination.getPort()).isEqualTo(443); } @@ -93,13 +93,13 @@ void testDefaultImplicitPort() throws URISyntaxException { void testDefaultImplicitPortWithIpv4() throws URISyntaxException { createSpanWithUrl("https://151.101.114.217/index.html"); assertThat(reporter.getSpans()).hasSize(1); - Span httpSpan = reporter.getFirstSpan(); + SpanImpl httpSpan = reporter.getFirstSpan(); assertThat(httpSpan.getContext().getHttp().getUrl().toString()).isEqualTo("https://151.101.114.217/index.html"); assertThat(httpSpan.getContext().getServiceTarget()) .hasType("http") .hasName("151.101.114.217:443") .hasNameOnlyDestinationResource(); - Destination destination = httpSpan.getContext().getDestination(); + DestinationImpl destination = httpSpan.getContext().getDestination(); assertThat(destination.getAddress().toString()).isEqualTo("151.101.114.217"); assertThat(destination.getPort()).isEqualTo(443); } @@ -108,9 +108,9 @@ void testDefaultImplicitPortWithIpv4() throws URISyntaxException { void testDefaultImplicitPortWithIpv6() throws URISyntaxException { createSpanWithUrl("http://[2001:db8:a0b:12f0::1]/index.html"); assertThat(reporter.getSpans()).hasSize(1); - Span httpSpan = reporter.getFirstSpan(); + SpanImpl httpSpan = reporter.getFirstSpan(); assertThat(httpSpan.getContext().getHttp().getUrl().toString()).isEqualTo("http://[2001:db8:a0b:12f0::1]/index.html"); - Destination destination = httpSpan.getContext().getDestination(); + DestinationImpl destination = httpSpan.getContext().getDestination(); assertThat(destination.getAddress().toString()).isEqualTo("2001:db8:a0b:12f0::1"); assertThat(destination.getPort()).isEqualTo(80); assertThat(httpSpan.getContext().getServiceTarget()) diff --git a/apm-agent-plugins/apm-jakarta-websocket-plugin/src/test/java/co/elastic/apm/agent/websocket/BaseServerEndpointInstrumentationTest.java b/apm-agent-plugins/apm-jakarta-websocket-plugin/src/test/java/co/elastic/apm/agent/websocket/BaseServerEndpointInstrumentationTest.java index d8f5df8dc8..2d8b68eb7d 100644 --- a/apm-agent-plugins/apm-jakarta-websocket-plugin/src/test/java/co/elastic/apm/agent/websocket/BaseServerEndpointInstrumentationTest.java +++ b/apm-agent-plugins/apm-jakarta-websocket-plugin/src/test/java/co/elastic/apm/agent/websocket/BaseServerEndpointInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.websocket; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.websocket.endpoint.WebSocketEndpoint; import org.junit.jupiter.api.Test; @@ -35,7 +35,7 @@ protected BaseServerEndpointInstrumentationTest(WebSocketEndpoint serverEndpoint @Test void testOnOpenWithActiveTransaction() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { serverEndpoint.onOpen(); } finally { @@ -54,7 +54,7 @@ void testOnOpenWithoutActiveTransaction() { @Test void testOnMessage() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { serverEndpoint.onMessage(""); } finally { @@ -66,7 +66,7 @@ void testOnMessage() { @Test void testOnError() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { serverEndpoint.onError(); } finally { @@ -78,7 +78,7 @@ void testOnError() { @Test void testOnClose() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { serverEndpoint.onClose(); } finally { @@ -95,7 +95,7 @@ void testOnClose() { protected abstract String getFrameworkVersion(); private void assertReportedTransactionNameAndFramework(String methodName) { - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getNameAsString()).isEqualTo(getWebSocketServerEndpointClassName() + '#' + methodName); assertThat(transaction.getFrameworkName()).isEqualTo(getFrameworkName()); diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/JavaConcurrent.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/JavaConcurrent.java index 3f06f75079..555ff1b425 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/JavaConcurrent.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/JavaConcurrent.java @@ -23,7 +23,7 @@ import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.sdk.state.GlobalState; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; @@ -43,7 +43,7 @@ @GlobalState public class JavaConcurrent { - private static final ReferenceCountedMap> contextMap = GlobalTracer.get().newReferenceCountedMap(); + private static final ReferenceCountedMap> contextMap = GlobalTracer.get().newReferenceCountedMap(); private static final List> RUNNABLE_CALLABLE_FJTASK_INSTRUMENTATION = Collections. >singletonList(RunnableCallableForkJoinTaskInstrumentation.class); @@ -83,12 +83,12 @@ private static boolean shouldAvoidContextPropagation(@Nullable Object executable * is already the active one on the current thread. */ @Nullable - public static ElasticContext restoreContext(Object o, Tracer tracer) { + public static TraceState restoreContext(Object o, Tracer tracer) { // When an Executor executes directly on the current thread we need to enable this thread for context propagation again needsContext.set(Boolean.TRUE); // we cannot remove yet, as this decrements the reference count, which may cause already ended spans to be recycled ahead of time - ElasticContext context = contextMap.get(o); + TraceState context = contextMap.get(o); if (context == null) { return null; } @@ -113,7 +113,7 @@ public static Runnable withContext(@Nullable Runnable runnable, Tracer tracer) { return runnable; } needsContext.set(Boolean.FALSE); - ElasticContext active = tracer.currentContext(); + TraceState active = tracer.currentContext(); if (active.isEmpty()) { return runnable; } @@ -124,7 +124,7 @@ public static Runnable withContext(@Nullable Runnable runnable, Tracer tracer) { return runnable; } - private static void captureContext(Object task, ElasticContext active) { + private static void captureContext(Object task, TraceState active) { DynamicTransformer.ensureInstrumented(task.getClass(), RUNNABLE_CALLABLE_FJTASK_INSTRUMENTATION); contextMap.put(task, active); // Do no discard branches leading to async operations so not to break span references @@ -142,7 +142,7 @@ public static Callable withContext(@Nullable Callable callable, Tracer return callable; } needsContext.set(Boolean.FALSE); - ElasticContext active = tracer.currentContext(); + TraceState active = tracer.currentContext(); if (active.isEmpty()) { return callable; } @@ -159,7 +159,7 @@ public static ForkJoinTask withContext(@Nullable ForkJoinTask task, Tr return task; } needsContext.set(Boolean.FALSE); - ElasticContext active = tracer.currentContext(); + TraceState active = tracer.currentContext(); if (active.isEmpty()) { return task; } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/RunnableCallableForkJoinTaskInstrumentation.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/RunnableCallableForkJoinTaskInstrumentation.java index 5ef881945c..ab2fc9f9f2 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/RunnableCallableForkJoinTaskInstrumentation.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/RunnableCallableForkJoinTaskInstrumentation.java @@ -20,10 +20,9 @@ import co.elastic.apm.agent.sdk.DynamicTransformer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; -import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Tracer; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -81,7 +80,7 @@ public static Object onEnter(@Advice.This Object thiz) { @Advice.OnMethodExit(suppress = Throwable.class, onThrowable = Throwable.class, inline = false) public static void onExit(@Nullable @Advice.Enter Object context) { if (context != null) { - ((ElasticContext) context).deactivate(); + ((TraceState) context).deactivate(); } } } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/AsyncTraceMethodInstrumentationTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/AsyncTraceMethodInstrumentationTest.java index 3e13c855c0..74c17fc801 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/AsyncTraceMethodInstrumentationTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/AsyncTraceMethodInstrumentationTest.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.matcher.MethodMatcher; @@ -44,14 +44,14 @@ class AsyncTraceMethodInstrumentationTest { private MockReporter reporter; private ElasticApmTracer tracer; - private CoreConfiguration coreConfiguration; + private CoreConfigurationImpl coreConfiguration; @BeforeEach void setUp(TestInfo testInfo) { MockTracer.MockInstrumentationSetup mockInstrumentationSetup = MockTracer.createMockInstrumentationSetup(); reporter = mockInstrumentationSetup.getReporter(); ConfigurationRegistry config = mockInstrumentationSetup.getConfig(); - coreConfiguration = config.getConfig(CoreConfiguration.class); + coreConfiguration = config.getConfig(CoreConfigurationImpl.class); MethodMatcher testTraceMethodMatcher = MethodMatcher.of("private co.elastic.apm.agent.concurrent.AsyncTraceMethodInstrumentationTest$TestAsyncTraceMethodsClass#*"); doReturn(Arrays.asList(testTraceMethodMatcher)).when(coreConfiguration).getTraceMethods(); @@ -66,7 +66,7 @@ void setUp(TestInfo testInfo) { } tracer = mockInstrumentationSetup.getTracer(); - assertThat(tracer.getConfig(CoreConfiguration.class).getTraceMethods()).containsExactly(testTraceMethodMatcher); + assertThat(tracer.getConfig(CoreConfigurationImpl.class).getTraceMethods()).containsExactly(testTraceMethodMatcher); ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install()); } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExcludedExecutorClassTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExcludedExecutorClassTest.java index 278458f86e..d213b5b732 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExcludedExecutorClassTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExcludedExecutorClassTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.concurrent; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -32,7 +32,7 @@ public class ExcludedExecutorClassTest extends AbstractInstrumentationTest { private ExecutorService executor; - private Transaction transaction; + private TransactionImpl transaction; @Before public void setUp() { diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorInstrumentationTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorInstrumentationTest.java index cbc36d65d7..a6395c5428 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorInstrumentationTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorInstrumentationTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.baggage.BaggageContext; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -61,7 +61,7 @@ public void tearDown() { @Test public void testExecutorExecute_Transaction() { - Transaction transaction = tracer.startRootTransaction(null).withName("Transaction").activate(); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("Transaction").activate(); executor.execute(() -> createAsyncSpan(transaction)); try { // wait for the async operation to end @@ -76,13 +76,13 @@ public void testExecutorExecute_Transaction() { @Test public void testBaggagePropagationWithTransaction() throws InterruptedException { - Transaction transaction = tracer.startRootTransaction(null).withName("Transaction").activate(); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("Transaction").activate(); BaggageContext transactionWithBaggage = tracer.currentContext().withUpdatedBaggage() .put("foo", "bar") .buildContext() .activate(); - AtomicReference> propagatedContext = new AtomicReference<>(); + AtomicReference> propagatedContext = new AtomicReference<>(); CountDownLatch doneLatch = new CountDownLatch(1); executor.execute(() -> { propagatedContext.set(tracer.currentContext()); @@ -105,7 +105,7 @@ public void testBaggagePropagationWithoutTransaction() throws InterruptedExcepti .buildContext() .activate(); - AtomicReference> propagatedContext = new AtomicReference<>(); + AtomicReference> propagatedContext = new AtomicReference<>(); CountDownLatch doneLatch = new CountDownLatch(1); executor.execute(() -> { propagatedContext.set(tracer.currentContext()); @@ -122,8 +122,8 @@ public void testBaggagePropagationWithoutTransaction() throws InterruptedExcepti @Test public void testExecutorExecute_Span() { - Transaction transaction = tracer.startRootTransaction(null).withName("Transaction").activate(); - Span nonAsyncSpan = transaction.createSpan().withName("NonAsync").activate(); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("Transaction").activate(); + SpanImpl nonAsyncSpan = transaction.createSpan().withName("NonAsync").activate(); executor.execute(() -> createAsyncSpan(transaction)); try { // wait for the async operation to end @@ -139,7 +139,7 @@ public void testExecutorExecute_Span() { } - private void createAsyncSpan(Transaction expectedCurrent) { + private void createAsyncSpan(TransactionImpl expectedCurrent) { assertThat(tracer.currentTransaction()).isEqualTo(expectedCurrent); tracer.getActive().createSpan().withName("Async").end(); } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceDoubleWrappingTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceDoubleWrappingTest.java index eaac85fa45..d72d75513e 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceDoubleWrappingTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceDoubleWrappingTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.concurrent; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -36,7 +36,7 @@ public class ExecutorServiceDoubleWrappingTest extends AbstractInstrumentationTe private static final Object TEST_OBJECT = new Object(); private final ExecutorService executor = Executors.newSingleThreadExecutor(); - private Transaction transaction; + private TransactionImpl transaction; @Before public void setUp() { @@ -66,7 +66,7 @@ public void testWrappingTransactionSubmitRunnableTwice() throws InterruptedExcep public void testWrappingTransactionSubmitRunnableWithResultTwice() throws InterruptedException, ExecutionException { Future future = executor.submit(this::createAsyncSpan, TEST_OBJECT); assertThat(future.get()).isEqualTo(TEST_OBJECT); - Span span = reporter.getFirstSpan(500); + SpanImpl span = reporter.getFirstSpan(500); assertThat(span.getNameAsString()).isEqualTo("Async"); assertThat(span.getTraceContext().getParentId()).isEqualTo(transaction.getTraceContext().getId()); } @@ -78,7 +78,7 @@ public void testWrappingTransactionSubmitCallableTwice() throws InterruptedExcep return TEST_OBJECT; }); assertThat(future.get()).isEqualTo(TEST_OBJECT); - Span span = reporter.getFirstSpan(500); + SpanImpl span = reporter.getFirstSpan(500); assertThat(span.getNameAsString()).isEqualTo("Async"); assertThat(span.getTraceContext().getParentId()).isEqualTo(transaction.getTraceContext().getId()); } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceInstrumentationTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceInstrumentationTest.java index 95bb769d2c..0407eca710 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceInstrumentationTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ExecutorServiceInstrumentationTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.concurrent; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -51,7 +51,7 @@ public class ExecutorServiceInstrumentationTest extends AbstractInstrumentationT private final ExecutorService executor; private CurrentThreadExecutor currentThreadExecutor; - private Transaction transaction; + private TransactionImpl transaction; public ExecutorServiceInstrumentationTest(Supplier supplier) { executor = supplier.get(); @@ -141,9 +141,9 @@ public void testExecutorSubmitCallableMethodReference() throws Exception { @Test public void testInvokeAll() throws Exception { - final List> futures = executor.invokeAll(Arrays.>asList(this::createAsyncSpan, () -> createAsyncSpan(), new Callable() { + final List> futures = executor.invokeAll(Arrays.>asList(this::createAsyncSpan, () -> createAsyncSpan(), new Callable() { @Override - public Span call() throws Exception { + public SpanImpl call() throws Exception { return createAsyncSpan(); } })); @@ -159,16 +159,16 @@ public void testNestedExecutions() throws Exception { @Test public void testInvokeAllTimed() throws Exception { - final List> futures = executor.invokeAll(Arrays.asList( - new Callable() { + final List> futures = executor.invokeAll(Arrays.asList( + new Callable() { @Override - public Span call() throws Exception { + public SpanImpl call() throws Exception { return createAsyncSpan(); } }, - new Callable() { + new Callable() { @Override - public Span call() throws Exception { + public SpanImpl call() throws Exception { return createAsyncSpan(); } }), 1, TimeUnit.SECONDS); @@ -178,9 +178,9 @@ public Span call() throws Exception { @Test public void testInvokeAny() throws Exception { - executor.invokeAny(Collections.singletonList(new Callable() { + executor.invokeAny(Collections.singletonList(new Callable() { @Override - public Span call() { + public SpanImpl call() { return createAsyncSpan(); } })); @@ -189,9 +189,9 @@ public Span call() { @Test public void testInvokeAnyTimed() throws Exception { - executor.invokeAny(Collections.>singletonList(new Callable() { + executor.invokeAny(Collections.>singletonList(new Callable() { @Override - public Span call() { + public SpanImpl call() { return createAsyncSpan(); } }), 1, TimeUnit.SECONDS); @@ -213,10 +213,10 @@ static Consumer of(ThrowingConsumer throwingConsumer) { void accept(T t) throws Exception; } - private Span createAsyncSpan() { + private SpanImpl createAsyncSpan() { assertThat(tracer.getActive()).isNotNull(); assertThat(tracer.getActive().getTraceContext().getId()).isEqualTo(transaction.getTraceContext().getId()); - final Span span = tracer.getActive().createSpan().withName("Async"); + final SpanImpl span = tracer.getActive().createSpan().withName("Async"); span.end(); return span; } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ForkJoinPoolTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ForkJoinPoolTest.java index cc644b6603..11b2553579 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ForkJoinPoolTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ForkJoinPoolTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.concurrent; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.tracer.TraceState; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -37,8 +37,8 @@ public class ForkJoinPoolTest extends AbstractInstrumentationTest { private ForkJoinPool pool; - private Transaction transaction; - private ElasticContext txWithBaggage; + private TransactionImpl transaction; + private TraceState txWithBaggage; @BeforeEach void setUp() { @@ -58,7 +58,7 @@ void tearDown() { @Test void testExecute() throws Exception { - final ForkJoinTask> task = newTask(() -> tracer.currentContext()); + final ForkJoinTask> task = newTask(() -> tracer.currentContext()); pool.execute(task); assertThat(task.get()).isSameAs(txWithBaggage); } @@ -90,7 +90,7 @@ void testCompletableFuture() throws Exception { void testParallelStream() { assertThat(Stream.of("foo", "bar", "baz") .parallel() - .>map(s -> tracer.currentContext()) + .>map(s -> tracer.currentContext()) .distinct()) .containsExactly(txWithBaggage); } diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScheduledExecutorServiceTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScheduledExecutorServiceTest.java index 5e61ef8e1a..73c6bdeeae 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScheduledExecutorServiceTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScheduledExecutorServiceTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.concurrent; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -36,7 +36,7 @@ public class ScheduledExecutorServiceTest extends AbstractInstrumentationTest { private ScheduledThreadPoolExecutor scheduler; - private Transaction transaction; + private TransactionImpl transaction; @BeforeEach void setUp() { @@ -53,14 +53,14 @@ void tearDown() { @Test void testScheduleCallable() throws Exception { - final ScheduledFuture> future = scheduler.schedule(() -> tracer.getActive(), 0, TimeUnit.SECONDS); + final ScheduledFuture> future = scheduler.schedule(() -> tracer.getActive(), 0, TimeUnit.SECONDS); assertThat(future.get()).isEqualTo(transaction); assertThat(tracer.getActive()).isEqualTo(transaction); } @Test void testScheduleRunnable() throws Exception { - AtomicReference> ref = new AtomicReference<>(); + AtomicReference> ref = new AtomicReference<>(); scheduler.schedule(() -> ref.set(tracer.getActive()), 0, TimeUnit.SECONDS).get(); assertThat(ref.get()).isEqualTo(transaction); assertThat(tracer.getActive()).isEqualTo(transaction); @@ -68,14 +68,14 @@ void testScheduleRunnable() throws Exception { @Test void testScheduleCallable_delayAndEndTransaction() throws Exception { - final ScheduledFuture> scheduledFuture = scheduler.schedule(() -> tracer.getActive(), 50, TimeUnit.MILLISECONDS); + final ScheduledFuture> scheduledFuture = scheduler.schedule(() -> tracer.getActive(), 50, TimeUnit.MILLISECONDS); verifyEndedTransactionIsStillReferenced(scheduledFuture); assertThat(scheduledFuture.get()).isEqualTo(transaction); } @Test void testScheduleRunnable_delayAndEndTransaction() throws Exception { - AtomicReference> ref = new AtomicReference<>(); + AtomicReference> ref = new AtomicReference<>(); ScheduledFuture scheduledTaskFuture = scheduler.schedule(() -> ref.set(tracer.getActive()), 50, TimeUnit.MILLISECONDS); verifyEndedTransactionIsStillReferenced(scheduledTaskFuture); assertThat(ref.get()).isEqualTo(transaction); diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScopeManagementTest.java b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScopeManagementTest.java index ac78d46be2..fd15bf408e 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScopeManagementTest.java +++ b/apm-agent-plugins/apm-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ScopeManagementTest.java @@ -21,8 +21,8 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.Test; import java.util.concurrent.Callable; @@ -43,8 +43,8 @@ void runTestWithAssertionsDisabled(Runnable test) { @Test void testWrongDeactivationOrder() { runTestWithAssertionsDisabled(() -> { - final Transaction transaction = tracer.startRootTransaction(null).activate(); - final Span span = transaction.createSpan().activate(); + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); + final SpanImpl span = transaction.createSpan().activate(); transaction.deactivate().end(); span.deactivate().end(); @@ -68,7 +68,7 @@ void testActivateTwice() { void testRedundantActivation() { disableRecyclingValidation(); runTestWithAssertionsDisabled(() -> { - final Transaction transaction = tracer.startRootTransaction(null).activate(); + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); transaction.createSpan().activate().end(); transaction.deactivate(); assertThat(tracer.getActive()).isEqualTo(transaction); @@ -80,8 +80,8 @@ void testRedundantActivation() { @Test void testSpanAndContextCallableActivation() { runTestWithAssertionsDisabled(() -> { - final Transaction transaction = tracer.startRootTransaction(null).activate(); - Callable callable = () -> tracer.currentTransaction(); + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); + Callable callable = () -> tracer.currentTransaction(); try { assertThat(callable.call()).isSameAs(transaction); } catch (Exception e) { @@ -95,7 +95,7 @@ void testSpanAndContextCallableActivation() { @Test void testContextAndSpanRunnableActivationInDifferentThread() throws Exception { - final Transaction transaction = tracer.startRootTransaction(null).activate(); + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); Executors.newSingleThreadExecutor().submit(() -> { assertThat(tracer.getActive()).isSameAs(transaction); assertThat(tracer.currentTransaction()).isSameAs(transaction); @@ -107,8 +107,8 @@ void testContextAndSpanRunnableActivationInDifferentThread() throws Exception { @Test void testContextAndSpanCallableActivationInDifferentThread() throws Exception { - final Transaction transaction = tracer.startRootTransaction(null).activate(); - Future transactionFuture = Executors.newSingleThreadExecutor().submit(() -> { + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); + Future transactionFuture = Executors.newSingleThreadExecutor().submit(() -> { assertThat(tracer.getActive()).isSameAs(transaction); return tracer.currentTransaction(); }); @@ -120,7 +120,7 @@ void testContextAndSpanCallableActivationInDifferentThread() throws Exception { @Test void testSpanAndContextRunnableActivationInDifferentThread() throws Exception { - final Transaction transaction = tracer.startRootTransaction(null).activate(); + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); Runnable runnable = () -> { assertThat(tracer.currentTransaction()).isSameAs(transaction); assertThat(tracer.getActive()).isSameAs(transaction); @@ -133,7 +133,7 @@ void testSpanAndContextRunnableActivationInDifferentThread() throws Exception { @Test void testSpanAndContextCallableActivationInDifferentThread() throws Exception { - final Transaction transaction = tracer.startRootTransaction(null).activate(); + final TransactionImpl transaction = tracer.startRootTransaction(null).activate(); assertThat(Executors.newSingleThreadExecutor().submit(() -> { assertThat(tracer.currentTransaction()).isSameAs(transaction); return tracer.currentTransaction(); diff --git a/apm-agent-plugins/apm-java-ldap-plugin/src/test/java/co/elastic/apm/agent/java_ldap/LdapClientAdviceTest.java b/apm-agent-plugins/apm-java-ldap-plugin/src/test/java/co/elastic/apm/agent/java_ldap/LdapClientAdviceTest.java index 262ccd0f29..ca47db7939 100644 --- a/apm-agent-plugins/apm-java-ldap-plugin/src/test/java/co/elastic/apm/agent/java_ldap/LdapClientAdviceTest.java +++ b/apm-agent-plugins/apm-java-ldap-plugin/src/test/java/co/elastic/apm/agent/java_ldap/LdapClientAdviceTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.java_ldap; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.test.TestPort; import co.elastic.apm.agent.tracer.Outcome; import com.unboundid.ldap.listener.InMemoryDirectoryServer; @@ -63,7 +63,7 @@ static void stopServer() { void testSuccessfulAuthentication() throws Exception { Hashtable environment = getEnvironment(); - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { new InitialDirContext(environment).close(); } catch (Exception ignored) { @@ -71,7 +71,7 @@ void testSuccessfulAuthentication() throws Exception { transaction.deactivate().end(); } - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans.size()).isEqualTo(1); assertSpan(spans.get(0), "authenticate", Outcome.SUCCESS); @@ -82,7 +82,7 @@ void testUnsuccessfulAuthentication() { Hashtable environment = getEnvironment(); environment.put(Context.SECURITY_CREDENTIALS, "wrong password"); - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { new InitialDirContext(environment).close(); } catch (Exception ignored) { @@ -91,7 +91,7 @@ void testUnsuccessfulAuthentication() { transaction.deactivate().end(); } - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans.size()).isEqualTo(1); assertSpan(spans.get(0), "authenticate", Outcome.FAILURE); @@ -101,7 +101,7 @@ void testUnsuccessfulAuthentication() { void testSearch() { Hashtable environment = getEnvironment(); - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { InitialDirContext context = new InitialDirContext(environment); context.search("dc=example,dc=com", "(&(objectClass=person)(uid=tobiasstadler))", null); @@ -111,7 +111,7 @@ void testSearch() { transaction.deactivate().end(); } - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans.size()).isEqualTo(2); assertSpan(spans.get(0), "authenticate", Outcome.SUCCESS); @@ -130,7 +130,7 @@ private static Hashtable getEnvironment() { return environment; } - static void assertSpan(Span span, String method, Outcome outcome) { + static void assertSpan(SpanImpl span, String method, Outcome outcome) { assertThat(span.getNameAsString()).isEqualTo("LDAP " + method); assertThat(span.getType()).isEqualTo("external"); assertThat(span.getSubtype()).isEqualTo("ldap"); diff --git a/apm-agent-plugins/apm-javalin-plugin/src/test/java/co/elastic/apm/agent/javalin/JavalinInstrumentationTest.java b/apm-agent-plugins/apm-javalin-plugin/src/test/java/co/elastic/apm/agent/javalin/JavalinInstrumentationTest.java index 8f28f8cdef..746ee2f630 100644 --- a/apm-agent-plugins/apm-javalin-plugin/src/test/java/co/elastic/apm/agent/javalin/JavalinInstrumentationTest.java +++ b/apm-agent-plugins/apm-javalin-plugin/src/test/java/co/elastic/apm/agent/javalin/JavalinInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.javalin; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import io.javalin.Javalin; import io.javalin.http.Context; import io.javalin.http.HandlerType; @@ -101,9 +101,9 @@ public void testBefore() throws Exception { final HttpResponse mainUrlResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); assertThat(mainUrlResponse.statusCode()).isEqualTo(404); assertThat(reporter.getFirstTransaction().getNameAsString()).isEqualTo("GET /before"); - final List spans = reporter.getSpans(); + final List spans = reporter.getSpans(); assertThat(spans).hasSize(2); - final List names = spans.stream().map(Span::getNameAsString).collect(Collectors.toList()); + final List names = spans.stream().map(SpanImpl::getNameAsString).collect(Collectors.toList()); assertThat(names).containsExactly("BEFORE /before", "GET /before"); } @@ -119,9 +119,9 @@ public void testAfter() throws Exception { assertThat(mainUrlResponse.headers().firstValue("foo").get()).isEqualTo("bar"); assertThat(reporter.getFirstTransaction().getNameAsString()).isEqualTo("GET /after"); assertThat(reporter.getFirstTransaction().getSpanCount().getTotal().get()).isEqualTo(3); - final List spans = reporter.getSpans(); + final List spans = reporter.getSpans(); assertThat(spans).hasSize(3); - final List names = spans.stream().map(Span::getNameAsString).collect(Collectors.toList()); + final List names = spans.stream().map(SpanImpl::getNameAsString).collect(Collectors.toList()); assertThat(names).containsExactly("GET /after", "AFTER /after", "AFTER /after"); } @@ -157,7 +157,7 @@ public void testFuturesGetInstrumented() throws Exception { final HttpResponse mainUrlResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); assertThat(mainUrlResponse.statusCode()).isEqualTo(404); assertThat(reporter.getFirstTransaction(500).getNameAsString()).isEqualTo("GET " + endpoint); - final Span span = reporter.getFirstSpan(500); + final SpanImpl span = reporter.getFirstSpan(500); assertThat(span.getNameAsString()).isEqualTo("GET " + endpoint); } @@ -175,9 +175,9 @@ public void testRenderSpan() throws Exception { assertThat(reporter.getFirstTransaction(500).getNameAsString()).isEqualTo("GET " + endpoint); assertThat(reporter.getSpans()).hasSize(2); - Span getSpan = reporter.getSpanByName("GET /render-span"); + SpanImpl getSpan = reporter.getSpanByName("GET /render-span"); assertThat(getSpan).isNotNull(); - Span renderSpan = reporter.getSpanByName("render my-template.abc"); + SpanImpl renderSpan = reporter.getSpanByName("render my-template.abc"); assertThat(renderSpan).isNotNull(); assertThat(renderSpan.getType()).isEqualTo("app"); assertThat(renderSpan.getSubtype()).isEqualTo("internal"); diff --git a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/src/test/java/co/elastic/apm/agent/jaxrs/JakartaeeJaxRsTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/src/test/java/co/elastic/apm/agent/jaxrs/JakartaeeJaxRsTransactionNameInstrumentationTest.java index d74ad9118c..35c0ccff68 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/src/test/java/co/elastic/apm/agent/jaxrs/JakartaeeJaxRsTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/src/test/java/co/elastic/apm/agent/jaxrs/JakartaeeJaxRsTransactionNameInstrumentationTest.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; @@ -140,7 +140,7 @@ public void testJaxRsFrameworkNameAndVersion() throws IOException { * @param path the path to make the get request against */ private void doRequest(String path) { - final Transaction request = tracer.startRootTransaction(null) + final TransactionImpl request = tracer.startRootTransaction(null) .withType("request") .activate(); try { diff --git a/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTest.java index 5eda6683e8..1473d4734a 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTest.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -137,7 +137,7 @@ public void testJaxRsFrameworkNameAndVersion() throws IOException { * @param path the path to make the get request against */ private void doRequest(String path) { - final Transaction request = tracer.startRootTransaction(null) + final TransactionImpl request = tracer.startRootTransaction(null) .withType("request") .activate(); try { diff --git a/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTestHelper.java b/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTestHelper.java index 5a947e307e..a27d6d7ca5 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTestHelper.java +++ b/apm-agent-plugins/apm-jaxrs-plugin/src/test/java/co/elastic/apm/agent/jaxrs/JaxRsTransactionNameInstrumentationTestHelper.java @@ -20,10 +20,10 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.TestObjectPoolFactory; import net.bytebuddy.agent.ByteBuddyAgent; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -58,7 +58,7 @@ public void testJaxRsTransactionNameWithoutJaxrsAnnotationInheritance() { doRequestConsumer.accept("test"); doRequestConsumer.accept("testInterface"); doRequestConsumer.accept("testAbstract"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(3); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("ResourceWithPath#testMethod"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("unnamed"); @@ -73,7 +73,7 @@ public void testJaxRsTransactionNameWithJaxrsAnnotationInheritance() { doRequestConsumer.accept("testInterface"); doRequestConsumer.accept("testAbstract"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(3); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("ResourceWithPath#testMethod"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("ResourceWithPathOnInterface#testMethod"); @@ -85,7 +85,7 @@ public void testJaxRsTransactionNameMethodDelegation() { doRequestConsumer.accept("methodDelegation/methodA"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("MethodDelegationResource#methodA"); } @@ -97,19 +97,19 @@ public void testProxyClassInstrumentationExclusion() { doRequestConsumer.accept("testViewProxy"); doRequestConsumer.accept("testProxyProxy"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(2); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("unnamed"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("unnamed"); } public void testJaxRsTransactionNameNonSampledTransactions() throws IOException { - config.getConfig(CoreConfiguration.class).getSampleRate().update(0.0, SpyConfiguration.CONFIG_SOURCE_NAME); + config.getConfig(CoreConfigurationImpl.class).getSampleRate().update(0.0, SpyConfiguration.CONFIG_SOURCE_NAME); ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install()); doRequestConsumer.accept("test"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("ResourceWithPath#testMethod"); } @@ -124,7 +124,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceEnabled() { doRequestConsumer.accept("testAbstract"); doRequestConsumer.accept("testInterface"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(3); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /test"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("GET /testAbstract"); @@ -141,7 +141,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceDisabled() { doRequestConsumer.accept("testInterface"); doRequestConsumer.accept("testAbstract"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(3); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /test"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("unnamed"); @@ -157,7 +157,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceEnabledOnMethod doRequestConsumer.accept("testWithPathMethod"); doRequestConsumer.accept("testWithPathMethod/15"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(2); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /testWithPathMethod"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("GET /testWithPathMethod/{id}"); @@ -172,7 +172,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceEnabledOnMethod doRequestConsumer.accept("testWithPathMethodSlash"); doRequestConsumer.accept("testWithPathMethodSlash/15"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(2); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /testWithPathMethodSlash"); assertThat(actualTransactions.get(1).getNameAsString()).isEqualTo("GET /testWithPathMethodSlash/{id}"); @@ -186,7 +186,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceEnabledOnMethod doRequestConsumer.accept("/foo/bar"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /foo/bar"); } @@ -199,7 +199,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceEnabledOnEmptyP doRequestConsumer.accept(""); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /"); } @@ -212,7 +212,7 @@ public void testJaxRsTransactionNameFromPathAnnotationInheritanceEnabledOnResour doRequestConsumer.accept("/testInterface/test"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(actualTransactions.get(0).getNameAsString()).isEqualTo("GET /testInterface/test"); } @@ -224,19 +224,19 @@ public void testJaxRsFrameworkNameAndVersion(String expectedVersion) throws IOEx doRequestConsumer.accept("test"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(reporter.getFirstTransaction().getFrameworkName()).isEqualTo("JAX-RS"); assertThat(reporter.getFirstTransaction().getFrameworkVersion()).isEqualTo(expectedVersion); } public void testJaxRsFrameworkNameAndVersionWithNonSampledTransaction(String expectedVersion) throws IOException { - config.getConfig(CoreConfiguration.class).getSampleRate().update(0.0, SpyConfiguration.CONFIG_SOURCE_NAME); + config.getConfig(CoreConfigurationImpl.class).getSampleRate().update(0.0, SpyConfiguration.CONFIG_SOURCE_NAME); ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install()); doRequestConsumer.accept("test"); - List actualTransactions = reporter.getTransactions(); + List actualTransactions = reporter.getTransactions(); assertThat(actualTransactions).hasSize(1); assertThat(reporter.getFirstTransaction().getFrameworkName()).isEqualTo("JAX-RS"); assertThat(reporter.getFirstTransaction().getFrameworkVersion()).isEqualTo(expectedVersion); diff --git a/apm-agent-plugins/apm-jaxws-plugin/src/test/java/co/elastic/apm/agent/jaxws/AbstractJaxWsInstrumentationTest.java b/apm-agent-plugins/apm-jaxws-plugin/src/test/java/co/elastic/apm/agent/jaxws/AbstractJaxWsInstrumentationTest.java index 55f5e6b06e..726327e0ab 100644 --- a/apm-agent-plugins/apm-jaxws-plugin/src/test/java/co/elastic/apm/agent/jaxws/AbstractJaxWsInstrumentationTest.java +++ b/apm-agent-plugins/apm-jaxws-plugin/src/test/java/co/elastic/apm/agent/jaxws/AbstractJaxWsInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.jaxws; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Scope; import org.junit.jupiter.api.Test; @@ -31,7 +31,7 @@ public abstract class AbstractJaxWsInstrumentationTest extends AbstractInstrumen @Test void testTransactionName() { - final Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); + final TransactionImpl transaction = tracer.startRootTransaction(getClass().getClassLoader()); try (Scope scope = transaction.activateInScope()) { helloWorldService.sayHello(); } finally { diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java index ca8f379e40..cc93cb87c0 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java +++ b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/JdbcHelper.java @@ -23,7 +23,7 @@ import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.jdbc.JdbcFilter; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -90,7 +90,7 @@ public String retrieveSqlForStatement(Object statement) { @Nullable - public Span createJdbcSpan(@Nullable String sql, Object statement, ElasticContext activeContext, boolean preparedStatement) { + public Span createJdbcSpan(@Nullable String sql, Object statement, TraceState activeContext, boolean preparedStatement) { if (!(statement instanceof Statement) || sql == null || isAlreadyMonitored(activeContext.getSpan())) { return null; } diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/AbstractJdbcInstrumentationTest.java b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/AbstractJdbcInstrumentationTest.java index 71dbd2e4f8..8a924884cb 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/AbstractJdbcInstrumentationTest.java +++ b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/AbstractJdbcInstrumentationTest.java @@ -20,12 +20,12 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.configuration.SpanConfiguration; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.sdk.internal.db.signature.SignatureParser; -import co.elastic.apm.agent.impl.context.Db; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.context.DbImpl; +import co.elastic.apm.agent.impl.context.DestinationImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.jdbc.helper.JdbcGlobalState; import org.junit.After; import org.junit.Before; @@ -68,7 +68,7 @@ public abstract class AbstractJdbcInstrumentationTest extends AbstractInstrument private PreparedStatement preparedStatement; @Nullable private PreparedStatement updatePreparedStatement; - private final Transaction transaction; + private final TransactionImpl transaction; private final SignatureParser signatureParser; AbstractJdbcInstrumentationTest(Connection connection, String expectedDbVendor, String expectedDbName) throws Exception { @@ -183,7 +183,7 @@ private void testStatement() throws SQLException { assertThat(resultSet.getInt("foo")).isEqualTo(1); assertThat(resultSet.getString("BAR")).isEqualTo("APM"); - Span span = assertSpanRecorded(sql, false, -1); + SpanImpl span = assertSpanRecorded(sql, false, -1); assertThat(span.getOutcome()).isEqualTo(Outcome.SUCCESS); } @@ -323,7 +323,7 @@ private void testUpdate(StatementExecutor statementConsumer) throws SQLE reporter.reset(); // unique key violation assertThatThrownBy(() -> statementConsumer.withStatement(statement, insert)).isInstanceOf(SQLException.class); - Span span = assertSpanRecorded(insert, false, -1); + SpanImpl span = assertSpanRecorded(insert, false, -1); assertThat(span.getOutcome()).isEqualTo(Outcome.FAILURE); } @@ -349,7 +349,7 @@ private void testPreparedStatementUpdate(PreparedStatementExecutor state int mappedStatements = JdbcGlobalState.statementSqlMap.approximateSize(); statement.close(); assertThat(JdbcGlobalState.statementSqlMap.approximateSize()).isLessThan(mappedStatements); - Span span = assertSpanRecorded(insert, false, -1); + SpanImpl span = assertSpanRecorded(insert, false, -1); assertThat(span.getOutcome()).isEqualTo(Outcome.FAILURE); } @@ -422,15 +422,15 @@ private void assertQuerySucceededAndSpanRecorded(ResultSet resultSet, String raw assertSpanRecorded(rawSql, preparedStatement, -1); } - private Span assertSpanRecorded(String rawSql, boolean preparedStatement, long expectedAffectedRows) throws SQLException { + private SpanImpl assertSpanRecorded(String rawSql, boolean preparedStatement, long expectedAffectedRows) throws SQLException { return assertSpanRecorded(rawSql, preparedStatement, expectedAffectedRows, expectedDbName); } - private Span assertSpanRecorded(String rawSql, boolean preparedStatement, long expectedAffectedRows, @Nullable String expectedDbInstance) throws SQLException { + private SpanImpl assertSpanRecorded(String rawSql, boolean preparedStatement, long expectedAffectedRows, @Nullable String expectedDbInstance) throws SQLException { assertThat(reporter.getSpans()) .describedAs("one span is expected") .hasSize(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); StringBuilder processedSql = new StringBuilder(); signatureParser.querySignature(rawSql, processedSql, preparedStatement); assertThat(span.getNameAsString()).isEqualTo(processedSql.toString()); @@ -438,7 +438,7 @@ private Span assertSpanRecorded(String rawSql, boolean preparedStatement, long e assertThat(span.getSubtype()).isEqualTo(expectedDbVendor); assertThat(span.getAction()).isEqualTo(DB_SPAN_ACTION); - Db db = span.getContext().getDb(); + DbImpl db = span.getContext().getDb(); assertThat(db).hasStatement(rawSql); DatabaseMetaData metaData = connection.getMetaData(); @@ -449,7 +449,7 @@ private Span assertSpanRecorded(String rawSql, boolean preparedStatement, long e .describedAs("unexpected affected rows count for statement %s", rawSql) .isEqualTo(expectedAffectedRows); - Destination destination = span.getContext().getDestination(); + DestinationImpl destination = span.getContext().getDestination(); assertThat(destination).hasLocalAddress(); if (expectedDbVendor.equals("h2")) { assertThat(destination).hasNoPort(); @@ -485,7 +485,7 @@ private void assertSpanRecordedWithoutConnection(String rawSql, boolean prepared assertThat(reporter.getSpans()) .describedAs("one span is expected") .hasSize(1); - Span jdbcSpan = reporter.getFirstSpan(); + SpanImpl jdbcSpan = reporter.getFirstSpan(); StringBuilder processedSql = new StringBuilder(); signatureParser.querySignature(rawSql, processedSql, preparedStatement); assertThat(jdbcSpan).hasName(processedSql.toString()) @@ -493,7 +493,7 @@ private void assertSpanRecordedWithoutConnection(String rawSql, boolean prepared .hasSubType("unknown") .hasAction(DB_SPAN_ACTION); - Db db = jdbcSpan.getContext().getDb(); + DbImpl db = jdbcSpan.getContext().getDb(); assertThat(db).hasStatement(rawSql); assertThat(db.getInstance()).isNull(); assertThat(db.getUser()).isNull(); diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java index 5c77ad732d..000fe01d3b 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java +++ b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -376,7 +376,7 @@ private void testUrl(String url, String expectedVendor, @Nullable String expecte // to make sure that at least the known ones always fit try { - Transaction transaction = tracer.startRootTransaction(this.getClass().getClassLoader()); + TransactionImpl transaction = tracer.startRootTransaction(this.getClass().getClassLoader()); assertThat(transaction).isNotNull(); transaction.createSpan() .withType("db") diff --git a/apm-agent-plugins/apm-jdk-httpserver-plugin/src/test/java/co/elastic/apm/agent/httpserver/HttpHandlerTest.java b/apm-agent-plugins/apm-jdk-httpserver-plugin/src/test/java/co/elastic/apm/agent/httpserver/HttpHandlerTest.java index eae5e67fed..8618e46f27 100644 --- a/apm-agent-plugins/apm-jdk-httpserver-plugin/src/test/java/co/elastic/apm/agent/httpserver/HttpHandlerTest.java +++ b/apm-agent-plugins/apm-jdk-httpserver-plugin/src/test/java/co/elastic/apm/agent/httpserver/HttpHandlerTest.java @@ -19,15 +19,15 @@ package co.elastic.apm.agent.httpserver; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.Socket; -import co.elastic.apm.agent.impl.context.Url; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.SocketImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; import co.elastic.apm.agent.tracer.util.ResultUtil; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; @@ -105,19 +105,19 @@ void testRootTransaction(int expectedStatus) throws IOException { assertThat(httpResponse.code()).isEqualTo(expectedStatus); assertThat(httpResponse.body().string()).isEmpty(); - Transaction transaction = reporter.getFirstTransaction(500); + TransactionImpl transaction = reporter.getFirstTransaction(500); assertThat(transaction.getTraceContext().getParentId().toString()).isEqualTo("0000000000000000"); assertThat(transaction.getType()).isEqualTo(co.elastic.apm.agent.tracer.Transaction.TYPE_REQUEST); assertThat(transaction.getNameAsString()).isEqualTo("GET /status_%d", expectedStatus); assertThat(transaction.getResult()).isEqualTo(ResultUtil.getResultByHttpStatus(expectedStatus)); assertThat(transaction.getOutcome()).isEqualTo(ResultUtil.getOutcomeByHttpServerStatus(expectedStatus)); - Request request = transaction.getContext().getRequest(); + RequestImpl request = transaction.getContext().getRequest(); - Socket socket = request.getSocket(); + SocketImpl socket = request.getSocket(); assertThat(socket.getRemoteAddress()).isEqualTo("127.0.0.1"); - Url url = request.getUrl(); + UrlImpl url = request.getUrl(); assertThat(url.getProtocol()).isEqualTo("http"); assertThat(url.getHostname()).isEqualTo("localhost"); assertThat(url.getPort()).isEqualTo(httpServer.getAddress().getPort()); @@ -130,7 +130,7 @@ void testRootTransaction(int expectedStatus) throws IOException { assertThat(request.getHeaders().get("Foo")).isEqualTo("abc"); - Response response = transaction.getContext().getResponse(); + ResponseImpl response = transaction.getContext().getResponse(); assertThat(response.getStatusCode()).isEqualTo(expectedStatus); assertThat(response.getHeaders().get("Bar")).isEqualTo("xyz"); @@ -149,7 +149,7 @@ void testChildTransaction() throws IOException { assertThat(httpResponse.code()).isEqualTo(200); assertThat(httpResponse.body().string()).isEmpty(); - TraceContext traceContext = reporter.getFirstTransaction(500).getTraceContext(); + TraceContextImpl traceContext = reporter.getFirstTransaction(500).getTraceContext(); assertThat(traceContext.getTraceId().toString()).isEqualTo("e00fef7cc6023c8e2c02d003cf50a266"); assertThat(traceContext.getParentId().toString()).isEqualTo("a048a11f61713b66"); diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsInstrumentationIT.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsInstrumentationIT.java index 8e57ce385b..e9d4282150 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsInstrumentationIT.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsInstrumentationIT.java @@ -21,15 +21,15 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; import co.elastic.apm.agent.impl.context.Headers; import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import jakarta.jms.Destination; @@ -70,7 +70,7 @@ @RunWith(Parameterized.class) public class JmsInstrumentationIT extends AbstractInstrumentationTest { - private static final String JMS_TRACE_PARENT_PROPERTY = TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace('-', '_'); + private static final String JMS_TRACE_PARENT_PROPERTY = TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace('-', '_'); // Keeping a static reference for resource cleaning private final static Set staticBrokerFacade = new HashSet<>(); @@ -78,7 +78,7 @@ public class JmsInstrumentationIT extends AbstractInstrumentationTest { private static final BlockingQueue resultQ = new ArrayBlockingQueue<>(5); private final BrokerFacade brokerFacade; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; private final ThreadLocal receiveNoWaitFlow = new ThreadLocal<>(); private final ThreadLocal expectNoTraces = new ThreadLocal<>(); @@ -89,7 +89,7 @@ public JmsInstrumentationIT(BrokerFacade brokerFacade, Class receiveMethod, Queue queue, boolean sleepBetweenCycles, boolean disableTimestamp) throws Exception { final CancellableThread thread = new CancellableThread(() -> { - Transaction transaction = null; + TransactionImpl transaction = null; Message message = null; try { transaction = tracer.startRootTransaction(null); @@ -338,23 +338,23 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi assertThat(incomingMessage).isNotNull(); verifyMessage(message, incomingMessage); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); int numSpans = spans.size(); if (!receiveNoWaitFlow.get()) { assertThat(numSpans).isGreaterThanOrEqualTo(3); } final String sendToTestQueueSpanName = "JMS SEND to queue " + queue.getQueueName(); - List sendSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestQueueSpanName)).collect(Collectors.toList()); + List sendSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestQueueSpanName)).collect(Collectors.toList()); assertThat(sendSpans).hasSize(1); - Span sendSpan = sendSpans.get(0); + SpanImpl sendSpan = sendSpans.get(0); final String receiveFromTestQueueSpanName = "JMS RECEIVE from queue " + queue.getQueueName(); - List receiveSpans = spans.stream().filter(span -> span.getNameAsString().equals(receiveFromTestQueueSpanName)).collect(Collectors.toList()); + List receiveSpans = spans.stream().filter(span -> span.getNameAsString().equals(receiveFromTestQueueSpanName)).collect(Collectors.toList()); assertThat(receiveSpans).hasSize(1); - Span receiveSpan = receiveSpans.get(0); + SpanImpl receiveSpan = receiveSpans.get(0); final String sendToTestNoopQueueSpanName = "JMS SEND to queue NOOP"; - List sendToNoopSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestNoopQueueSpanName)).collect(Collectors.toList()); - Span sendToNoopSpan = null; + List sendToNoopSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestNoopQueueSpanName)).collect(Collectors.toList()); + SpanImpl sendToNoopSpan = null; if (!receiveNoWaitFlow.get()) { assertThat(sendToNoopSpans).hasSize(1); sendToNoopSpan = sendToNoopSpans.get(0); @@ -365,7 +365,7 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi assertThat(spans.stream().filter(span -> span.getNameAsString().equals(receiveWithNoMessageSpanName)).count()).isGreaterThanOrEqualTo(numSpans - 3); //noinspection ConstantConditions - Id currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); + IdImpl currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); assertThat(sendSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); assertThat(sendSpan.getContext().getMessage().getQueueName()).isEqualTo(queue.getQueueName()); @@ -374,10 +374,10 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi .hasName(queue.getQueueName()) .hasDestinationResource("jms/" + queue.getQueueName()); - Id receiveTraceId = receiveSpan.getTraceContext().getTraceId(); - List receiveTransactions = reporter.getTransactions().stream().filter(transaction -> transaction.getTraceContext().getTraceId().equals(receiveTraceId)).collect(Collectors.toList()); + IdImpl receiveTraceId = receiveSpan.getTraceContext().getTraceId(); + List receiveTransactions = reporter.getTransactions().stream().filter(transaction -> transaction.getTraceContext().getTraceId().equals(receiveTraceId)).collect(Collectors.toList()); assertThat(receiveTransactions).hasSize(1); - Transaction receiveTransaction = receiveTransactions.get(0); + TransactionImpl receiveTransaction = receiveTransactions.get(0); assertThat(receiveSpan.getTraceContext().getParentId()).isEqualTo(receiveTransaction.getTraceContext().getId()); assertThat(receiveSpan.getContext().getMessage().getQueueName()).isEqualTo(queue.getQueueName()); // Body and headers should not be captured for receive spans @@ -389,7 +389,7 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi } else { assertThat(receiveSpan.getContext().getMessage().getAge()).isGreaterThanOrEqualTo(0); } - List spanLinks = receiveSpan.getSpanLinks(); + List spanLinks = receiveSpan.getSpanLinks(); assertThat(spanLinks).hasSize(1); assertThat(spanLinks.get(0).getTraceId()).isEqualTo(sendSpan.getTraceContext().getTraceId()); assertThat(spanLinks.get(0).getParentId()).isEqualTo(sendSpan.getTraceContext().getId()); @@ -416,7 +416,7 @@ private void verifyQueueSendReceiveOnNonTracedThread(Queue queue) assertThat(incomingMessage).isNotNull(); verifyMessage(message, incomingMessage); if (tracer.isRunning()) { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); if (transaction.isSampled()) { verifySendReceiveOnNonTracedThread(queue.getQueueName(), outgoingMessage); @@ -427,9 +427,9 @@ private void verifyQueueSendReceiveOnNonTracedThread(Queue queue) private void verifySendListenOnNonTracedThread(String destinationName, TextMessage message, int expectedReadTransactions) throws JMSException { reporter.awaitTransactionCount(expectedReadTransactions); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span sendSpan = spans.get(0); + SpanImpl sendSpan = spans.get(0); String spanName = sendSpan.getNameAsString(); assertThat(spanName).startsWith("JMS SEND to "); assertThat(spanName).endsWith(destinationName); @@ -442,12 +442,12 @@ private void verifySendListenOnNonTracedThread(String destinationName, TextMessa .hasDestinationResource("jms/" + destinationName); //noinspection ConstantConditions - Id currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); + IdImpl currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); assertThat(sendSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); - List receiveTransactions = reporter.getTransactions(); + List receiveTransactions = reporter.getTransactions(); assertThat(receiveTransactions).hasSize(expectedReadTransactions); - for (Transaction receiveTransaction : receiveTransactions) { + for (TransactionImpl receiveTransaction : receiveTransactions) { assertThat(receiveTransaction.getNameAsString()).startsWith("JMS RECEIVE from "); assertThat(receiveTransaction.getNameAsString()).endsWith(destinationName); assertThat(receiveTransaction.getFrameworkName()).isEqualTo("JMS"); @@ -463,7 +463,7 @@ private void verifySendListenOnNonTracedThread(String destinationName, TextMessa } } - private void verifyMessageHeaders(Message message, Transaction receiveTransaction) throws JMSException { + private void verifyMessageHeaders(Message message, TransactionImpl receiveTransaction) throws JMSException { Map headersMap = new HashMap<>(); for (Headers.Header header : receiveTransaction.getContext().getMessage().getHeaders()) { headersMap.put(header.getKey(), header.getValue()); @@ -484,8 +484,8 @@ private void verifyMessageHeaders(Message message, Transaction receiveTransactio private void verifySendReceiveOnNonTracedThread(String destinationName, TextMessage message) throws JMSException { MessagingConfiguration.JmsStrategy strategy = config.getConfig(MessagingConfiguration.class).getMessagePollingTransactionStrategy(); - List spans = reporter.getSpans(); - List receiveTransactions = reporter.getTransactions(); + List spans = reporter.getSpans(); + List receiveTransactions = reporter.getTransactions(); if (expectNoTraces.get()) { assertThat(spans).isEmpty(); @@ -500,7 +500,7 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess assertThat(spans).hasSize(2); } - Span sendInitialMessageSpan = spans.get(0); + SpanImpl sendInitialMessageSpan = spans.get(0); String spanName = sendInitialMessageSpan.getNameAsString(); assertThat(spanName).startsWith("JMS SEND to "); assertThat(spanName).endsWith(destinationName); @@ -514,7 +514,7 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess .hasDestinationResource("jms/"+destinationName); //noinspection ConstantConditions - Id currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); + IdImpl currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); assertThat(sendInitialMessageSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); if (!isActive) { @@ -526,8 +526,8 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess assertThat(receiveTransactions).hasSize(1); } - Id transactionId = null; - for (Transaction receiveTransaction : receiveTransactions) { + IdImpl transactionId = null; + for (TransactionImpl receiveTransaction : receiveTransactions) { assertThat(receiveTransaction.getNameAsString()).startsWith("JMS RECEIVE from "); assertThat(receiveTransaction.getNameAsString()).endsWith(destinationName); if (receiveTransaction.getSpanLinks().isEmpty()) { @@ -547,7 +547,7 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess } if (strategy != POLLING && !receiveNoWaitFlow.get()) { - Span sendNoopSpan = spans.get(1); + SpanImpl sendNoopSpan = spans.get(1); assertThat(sendNoopSpan.getNameAsString()).isEqualTo("JMS SEND to queue NOOP"); assertThat(sendNoopSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); // If both polling and handling transactions are captured, handling transaction would come second diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessageListenerTest.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessageListenerTest.java index fcebcfda02..25645574f4 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessageListenerTest.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessageListenerTest.java @@ -21,9 +21,8 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import testapp.TestMessageConsumer; import testapp.TestMessageListener; import testapp.TestMsgHandler; @@ -71,7 +70,7 @@ private void startAgent(){ @Test public void testJmsMessageListenerPackage_defaultConfig() throws Exception { // default configuration - doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfiguration.class)).getApplicationPackages(); + doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfigurationImpl.class)).getApplicationPackages(); startAgent(); @@ -83,7 +82,7 @@ public void testJmsMessageListenerPackage_defaultConfig() throws Exception { @Test public void testJmsMessageListenerPackage_customValue() throws Exception { - doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfiguration.class)).getApplicationPackages(); + doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfigurationImpl.class)).getApplicationPackages(); doReturn(Arrays.asList("testapp")).when(config.getConfig(MessagingConfiguration.class)).getJmsListenerPackages(); startAgent(); @@ -96,7 +95,7 @@ public void testJmsMessageListenerPackage_customValue() throws Exception { @Test public void testJmsMessageListenerPackage_applicationPackages() throws Exception { - doReturn(Arrays.asList("testapp")).when(config.getConfig(StacktraceConfiguration.class)).getApplicationPackages(); + doReturn(Arrays.asList("testapp")).when(config.getConfig(StacktraceConfigurationImpl.class)).getApplicationPackages(); startAgent(); @@ -121,7 +120,7 @@ private void testJmsMessageListenerPackage(boolean expectIncluded, JmsMessageLis Message message = mock(Message.class); - AtomicReference transaction = new AtomicReference<>(); + AtomicReference transaction = new AtomicReference<>(); switch (variant){ case MATCHING_NAME_CONVENTION: @@ -137,7 +136,7 @@ private void testJmsMessageListenerPackage(boolean expectIncluded, JmsMessageLis case LAMBDA: // lambda is instrumented through wrapping on the message consumer MessageListener listener = msg -> { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); }; TestMessageConsumer consumer = new TestMessageConsumer(); // listener should be wrapped on setter entry @@ -167,15 +166,15 @@ private void testJmsMessageListenerPackage(boolean expectIncluded, JmsMessageLis // will be instrumented by default as it's an inner class private static class InnerClassMsgHandler implements MessageListener { - private final AtomicReference transaction; + private final AtomicReference transaction; - public InnerClassMsgHandler(AtomicReference transaction) { + public InnerClassMsgHandler(AtomicReference transaction) { this.transaction = transaction; } @Override public void onMessage(Message message) { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); } } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessagePropertyAccessorTest.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessagePropertyAccessorTest.java index ffaf4cc65a..dd2ce6f909 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessagePropertyAccessorTest.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/co/elastic/apm/agent/jms/jakarta/JmsMessagePropertyAccessorTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.jms.jakarta; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import jakarta.jms.JMSException; import jakarta.jms.Message; import jakarta.jms.MessageNotWriteableException; @@ -55,11 +55,11 @@ void setHeader() throws JMSException { doReturn(null).when(msg).getStringProperty(any(String.class)); - JmsMessagePropertyAccessor.instance().setHeader(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "header-value", msg); + JmsMessagePropertyAccessor.instance().setHeader(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "header-value", msg); verify(msg).setStringProperty(headerName.capture(), headerValue.capture()); - assertThat(headerName.getValue()).isEqualTo(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace("-", "_")); + assertThat(headerName.getValue()).isEqualTo(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace("-", "_")); assertThat(headerValue.getValue()).isEqualTo("header-value"); } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMessageListener.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMessageListener.java index fe992bdba3..34795b42c2 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMessageListener.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMessageListener.java @@ -18,8 +18,8 @@ */ package testapp; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.GlobalTracer; import jakarta.jms.Message; @@ -28,14 +28,14 @@ public class TestMessageListener implements MessageListener { - private final AtomicReference transaction; + private final AtomicReference transaction; - public TestMessageListener(AtomicReference transaction) { + public TestMessageListener(AtomicReference transaction) { this.transaction = transaction; } @Override public void onMessage(Message message) { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); } } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMsgHandler.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMsgHandler.java index 4b9ce0c794..6ab2420feb 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMsgHandler.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/src/test/java/testapp/TestMsgHandler.java @@ -19,8 +19,8 @@ package testapp; -import co.elastic.apm.agent.impl.Tracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.GlobalTracer; import jakarta.jms.Message; @@ -30,14 +30,14 @@ // won't be instrumented by default as it does not fit naming conventions that we rely on by default public class TestMsgHandler implements MessageListener { - private final AtomicReference transaction; + private final AtomicReference transaction; - public TestMsgHandler(AtomicReference transaction) { + public TestMsgHandler(AtomicReference transaction) { this.transaction = transaction; } @Override public void onMessage(Message message) { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); } } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsInstrumentationIT.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsInstrumentationIT.java index b7d4d4df51..4bf65629a9 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsInstrumentationIT.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsInstrumentationIT.java @@ -21,15 +21,15 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; import co.elastic.apm.agent.impl.context.Headers; import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import org.junit.After; @@ -70,7 +70,7 @@ @RunWith(Parameterized.class) public class JmsInstrumentationIT extends AbstractInstrumentationTest { - private static final String JMS_TRACE_PARENT_PROPERTY = TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace('-', '_'); + private static final String JMS_TRACE_PARENT_PROPERTY = TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace('-', '_'); // Keeping a static reference for resource cleaning private final static Set staticBrokerFacade = new HashSet<>(); @@ -78,7 +78,7 @@ public class JmsInstrumentationIT extends AbstractInstrumentationTest { private static final BlockingQueue resultQ = new ArrayBlockingQueue<>(5); private final BrokerFacade brokerFacade; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; private final ThreadLocal receiveNoWaitFlow = new ThreadLocal<>(); private final ThreadLocal expectNoTraces = new ThreadLocal<>(); @@ -89,7 +89,7 @@ public JmsInstrumentationIT(BrokerFacade brokerFacade, Class receiveMethod, Queue queue, boolean sleepBetweenCycles, boolean disableTimestamp) throws Exception { final CancellableThread thread = new CancellableThread(() -> { - Transaction transaction = null; + TransactionImpl transaction = null; Message message = null; try { transaction = tracer.startRootTransaction(null); @@ -338,23 +338,23 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi assertThat(incomingMessage).isNotNull(); verifyMessage(message, incomingMessage); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); int numSpans = spans.size(); if (!receiveNoWaitFlow.get()) { assertThat(numSpans).isGreaterThanOrEqualTo(3); } final String sendToTestQueueSpanName = "JMS SEND to queue " + queue.getQueueName(); - List sendSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestQueueSpanName)).collect(Collectors.toList()); + List sendSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestQueueSpanName)).collect(Collectors.toList()); assertThat(sendSpans).hasSize(1); - Span sendSpan = sendSpans.get(0); + SpanImpl sendSpan = sendSpans.get(0); final String receiveFromTestQueueSpanName = "JMS RECEIVE from queue " + queue.getQueueName(); - List receiveSpans = spans.stream().filter(span -> span.getNameAsString().equals(receiveFromTestQueueSpanName)).collect(Collectors.toList()); + List receiveSpans = spans.stream().filter(span -> span.getNameAsString().equals(receiveFromTestQueueSpanName)).collect(Collectors.toList()); assertThat(receiveSpans).hasSize(1); - Span receiveSpan = receiveSpans.get(0); + SpanImpl receiveSpan = receiveSpans.get(0); final String sendToTestNoopQueueSpanName = "JMS SEND to queue NOOP"; - List sendToNoopSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestNoopQueueSpanName)).collect(Collectors.toList()); - Span sendToNoopSpan = null; + List sendToNoopSpans = spans.stream().filter(span -> span.getNameAsString().equals(sendToTestNoopQueueSpanName)).collect(Collectors.toList()); + SpanImpl sendToNoopSpan = null; if (!receiveNoWaitFlow.get()) { assertThat(sendToNoopSpans).hasSize(1); sendToNoopSpan = sendToNoopSpans.get(0); @@ -365,7 +365,7 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi assertThat(spans.stream().filter(span -> span.getNameAsString().equals(receiveWithNoMessageSpanName)).count()).isGreaterThanOrEqualTo(numSpans - 3); //noinspection ConstantConditions - Id currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); + IdImpl currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); assertThat(sendSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); assertThat(sendSpan.getContext().getMessage().getQueueName()).isEqualTo(queue.getQueueName()); @@ -374,10 +374,10 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi .hasName(queue.getQueueName()) .hasDestinationResource("jms/" + queue.getQueueName()); - Id receiveTraceId = receiveSpan.getTraceContext().getTraceId(); - List receiveTransactions = reporter.getTransactions().stream().filter(transaction -> transaction.getTraceContext().getTraceId().equals(receiveTraceId)).collect(Collectors.toList()); + IdImpl receiveTraceId = receiveSpan.getTraceContext().getTraceId(); + List receiveTransactions = reporter.getTransactions().stream().filter(transaction -> transaction.getTraceContext().getTraceId().equals(receiveTraceId)).collect(Collectors.toList()); assertThat(receiveTransactions).hasSize(1); - Transaction receiveTransaction = receiveTransactions.get(0); + TransactionImpl receiveTransaction = receiveTransactions.get(0); assertThat(receiveSpan.getTraceContext().getParentId()).isEqualTo(receiveTransaction.getTraceContext().getId()); assertThat(receiveSpan.getContext().getMessage().getQueueName()).isEqualTo(queue.getQueueName()); // Body and headers should not be captured for receive spans @@ -389,7 +389,7 @@ private void verifyQueueSendReceiveOnTracedThread(Queue queue, boolean disableTi } else { assertThat(receiveSpan.getContext().getMessage().getAge()).isGreaterThanOrEqualTo(0); } - List spanLinks = receiveSpan.getSpanLinks(); + List spanLinks = receiveSpan.getSpanLinks(); assertThat(spanLinks).hasSize(1); assertThat(spanLinks.get(0).getTraceId()).isEqualTo(sendSpan.getTraceContext().getTraceId()); assertThat(spanLinks.get(0).getParentId()).isEqualTo(sendSpan.getTraceContext().getId()); @@ -416,7 +416,7 @@ private void verifyQueueSendReceiveOnNonTracedThread(Queue queue) assertThat(incomingMessage).isNotNull(); verifyMessage(message, incomingMessage); if (tracer.isRunning()) { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); if (transaction.isSampled()) { verifySendReceiveOnNonTracedThread(queue.getQueueName(), outgoingMessage); @@ -427,9 +427,9 @@ private void verifyQueueSendReceiveOnNonTracedThread(Queue queue) private void verifySendListenOnNonTracedThread(String destinationName, TextMessage message, int expectedReadTransactions) throws JMSException { reporter.awaitTransactionCount(expectedReadTransactions); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span sendSpan = spans.get(0); + SpanImpl sendSpan = spans.get(0); String spanName = sendSpan.getNameAsString(); assertThat(spanName).startsWith("JMS SEND to "); assertThat(spanName).endsWith(destinationName); @@ -442,12 +442,12 @@ private void verifySendListenOnNonTracedThread(String destinationName, TextMessa .hasDestinationResource("jms/" + destinationName); //noinspection ConstantConditions - Id currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); + IdImpl currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); assertThat(sendSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); - List receiveTransactions = reporter.getTransactions(); + List receiveTransactions = reporter.getTransactions(); assertThat(receiveTransactions).hasSize(expectedReadTransactions); - for (Transaction receiveTransaction : receiveTransactions) { + for (TransactionImpl receiveTransaction : receiveTransactions) { assertThat(receiveTransaction.getNameAsString()).startsWith("JMS RECEIVE from "); assertThat(receiveTransaction.getNameAsString()).endsWith(destinationName); assertThat(receiveTransaction.getFrameworkName()).isEqualTo("JMS"); @@ -463,7 +463,7 @@ private void verifySendListenOnNonTracedThread(String destinationName, TextMessa } } - private void verifyMessageHeaders(Message message, Transaction receiveTransaction) throws JMSException { + private void verifyMessageHeaders(Message message, TransactionImpl receiveTransaction) throws JMSException { Map headersMap = new HashMap<>(); for (Headers.Header header : receiveTransaction.getContext().getMessage().getHeaders()) { headersMap.put(header.getKey(), header.getValue()); @@ -484,8 +484,8 @@ private void verifyMessageHeaders(Message message, Transaction receiveTransactio private void verifySendReceiveOnNonTracedThread(String destinationName, TextMessage message) throws JMSException { MessagingConfiguration.JmsStrategy strategy = config.getConfig(MessagingConfiguration.class).getMessagePollingTransactionStrategy(); - List spans = reporter.getSpans(); - List receiveTransactions = reporter.getTransactions(); + List spans = reporter.getSpans(); + List receiveTransactions = reporter.getTransactions(); if (expectNoTraces.get()) { assertThat(spans).isEmpty(); @@ -500,7 +500,7 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess assertThat(spans).hasSize(2); } - Span sendInitialMessageSpan = spans.get(0); + SpanImpl sendInitialMessageSpan = spans.get(0); String spanName = sendInitialMessageSpan.getNameAsString(); assertThat(spanName).startsWith("JMS SEND to "); assertThat(spanName).endsWith(destinationName); @@ -514,7 +514,7 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess .hasDestinationResource("jms/"+destinationName); //noinspection ConstantConditions - Id currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); + IdImpl currentTraceId = tracer.currentTransaction().getTraceContext().getTraceId(); assertThat(sendInitialMessageSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); if (!isActive) { @@ -526,8 +526,8 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess assertThat(receiveTransactions).hasSize(1); } - Id transactionId = null; - for (Transaction receiveTransaction : receiveTransactions) { + IdImpl transactionId = null; + for (TransactionImpl receiveTransaction : receiveTransactions) { assertThat(receiveTransaction.getNameAsString()).startsWith("JMS RECEIVE from "); assertThat(receiveTransaction.getNameAsString()).endsWith(destinationName); if (receiveTransaction.getSpanLinks().isEmpty()) { @@ -547,7 +547,7 @@ private void verifySendReceiveOnNonTracedThread(String destinationName, TextMess } if (strategy != POLLING && !receiveNoWaitFlow.get()) { - Span sendNoopSpan = spans.get(1); + SpanImpl sendNoopSpan = spans.get(1); assertThat(sendNoopSpan.getNameAsString()).isEqualTo("JMS SEND to queue NOOP"); assertThat(sendNoopSpan.getTraceContext().getTraceId()).isEqualTo(currentTraceId); // If both polling and handling transactions are captured, handling transaction would come second diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessageListenerTest.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessageListenerTest.java index 659373db7b..d6c27a89f7 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessageListenerTest.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessageListenerTest.java @@ -20,12 +20,11 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; import testapp.TestMessageConsumer; import testapp.TestMessageListener; import testapp.TestMsgHandler; @@ -73,7 +72,7 @@ private void startAgent(){ @Test public void testJmsMessageListenerPackage_defaultConfig() throws Exception { // default configuration - doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfiguration.class)).getApplicationPackages(); + doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfigurationImpl.class)).getApplicationPackages(); startAgent(); @@ -85,7 +84,7 @@ public void testJmsMessageListenerPackage_defaultConfig() throws Exception { @Test public void testJmsMessageListenerPackage_customValue() throws Exception { - doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfiguration.class)).getApplicationPackages(); + doReturn(Collections.emptyList()).when(config.getConfig(StacktraceConfigurationImpl.class)).getApplicationPackages(); doReturn(Arrays.asList("testapp")).when(config.getConfig(MessagingConfiguration.class)).getJmsListenerPackages(); startAgent(); @@ -98,7 +97,7 @@ public void testJmsMessageListenerPackage_customValue() throws Exception { @Test public void testJmsMessageListenerPackage_applicationPackages() throws Exception { - doReturn(Arrays.asList("testapp")).when(config.getConfig(StacktraceConfiguration.class)).getApplicationPackages(); + doReturn(Arrays.asList("testapp")).when(config.getConfig(StacktraceConfigurationImpl.class)).getApplicationPackages(); startAgent(); @@ -123,7 +122,7 @@ private void testJmsMessageListenerPackage(boolean expectIncluded, JmsMessageLis Message message = mock(Message.class); - AtomicReference transaction = new AtomicReference<>(); + AtomicReference transaction = new AtomicReference<>(); switch (variant){ case MATCHING_NAME_CONVENTION: @@ -139,7 +138,7 @@ private void testJmsMessageListenerPackage(boolean expectIncluded, JmsMessageLis case LAMBDA: // lambda is instrumented through wrapping on the message consumer MessageListener listener = msg -> { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); }; TestMessageConsumer consumer = new TestMessageConsumer(); // listener should be wrapped on setter entry @@ -169,15 +168,15 @@ private void testJmsMessageListenerPackage(boolean expectIncluded, JmsMessageLis // will be instrumented by default as it's an inner class private static class InnerClassMsgHandler implements MessageListener { - private final AtomicReference transaction; + private final AtomicReference transaction; - public InnerClassMsgHandler(AtomicReference transaction) { + public InnerClassMsgHandler(AtomicReference transaction) { this.transaction = transaction; } @Override public void onMessage(Message message) { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); } } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessagePropertyAccessorTest.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessagePropertyAccessorTest.java index bdf37d9663..5a6e49cbc7 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessagePropertyAccessorTest.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/co/elastic/apm/agent/jms/javax/JmsMessagePropertyAccessorTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.jms.javax; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -56,11 +56,11 @@ void setHeader() throws JMSException { doReturn(null).when(msg).getStringProperty(any(String.class)); - JmsMessagePropertyAccessor.instance().setHeader(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "header-value", msg); + JmsMessagePropertyAccessor.instance().setHeader(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME, "header-value", msg); verify(msg).setStringProperty(headerName.capture(), headerValue.capture()); - assertThat(headerName.getValue()).isEqualTo(TraceContext.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace("-", "_")); + assertThat(headerName.getValue()).isEqualTo(TraceContextImpl.ELASTIC_TRACE_PARENT_TEXTUAL_HEADER_NAME.replace("-", "_")); assertThat(headerValue.getValue()).isEqualTo("header-value"); } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMessageListener.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMessageListener.java index ab8425168a..ef5641c0a8 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMessageListener.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMessageListener.java @@ -18,9 +18,9 @@ */ package testapp; -import co.elastic.apm.agent.impl.Tracer; +import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import javax.jms.Message; import javax.jms.MessageListener; @@ -28,14 +28,14 @@ public class TestMessageListener implements MessageListener { - private final AtomicReference transaction; + private final AtomicReference transaction; - public TestMessageListener(AtomicReference transaction) { + public TestMessageListener(AtomicReference transaction) { this.transaction = transaction; } @Override public void onMessage(Message message) { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); } } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMsgHandler.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMsgHandler.java index 40e6186c45..a488190dc2 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMsgHandler.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/src/test/java/testapp/TestMsgHandler.java @@ -19,9 +19,9 @@ package testapp; -import co.elastic.apm.agent.impl.Tracer; +import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; import javax.jms.Message; import javax.jms.MessageListener; @@ -30,14 +30,14 @@ // won't be instrumented by default as it does not fit naming conventions that we rely on by default public class TestMsgHandler implements MessageListener { - private final AtomicReference transaction; + private final AtomicReference transaction; - public TestMsgHandler(AtomicReference transaction) { + public TestMsgHandler(AtomicReference transaction) { this.transaction = transaction; } @Override public void onMessage(Message message) { - transaction.set(GlobalTracer.get().require(Tracer.class).currentTransaction()); + transaction.set(GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction()); } } diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/src/main/java/co/elastic/apm/agent/jms/JmsInstrumentationHelper.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/src/main/java/co/elastic/apm/agent/jms/JmsInstrumentationHelper.java index f8929757ee..7fd3fb2feb 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/src/main/java/co/elastic/apm/agent/jms/JmsInstrumentationHelper.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/src/main/java/co/elastic/apm/agent/jms/JmsInstrumentationHelper.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.Transaction; @@ -219,7 +219,7 @@ public Object baseBeforeReceive(Class clazz, String methodName) { AbstractSpan createdSpan = null; boolean createPollingTransaction = false; boolean createPollingSpan = false; - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan == null) { createPollingTransaction = true; diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringJmsTest.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringJmsTest.java index dc4d176117..f710dc4fd9 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringJmsTest.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringJmsTest.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.jms.javax.spring; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQMapMessage; import org.junit.AfterClass; @@ -71,7 +71,7 @@ public static void teardown() throws JMSException { public void testSendListenSpringQueue() throws JMSException, InterruptedException { try (Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) { - Transaction transaction = startTestRootTransaction("JMS-Spring-Test Transaction"); + TransactionImpl transaction = startTestRootTransaction("JMS-Spring-Test Transaction"); final String key1 = "key1"; final String key2 = "key2"; @@ -96,23 +96,23 @@ public void testSendListenSpringQueue() throws JMSException, InterruptedExceptio assertThat(result.get(key1).toString()).isEqualTo(value1); assertThat(result.get(key2).toString()).isEqualTo(value2); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(2); - Transaction baseTransaction = transactions.get(1); - Id traceId = baseTransaction.getTraceContext().getTraceId(); + TransactionImpl baseTransaction = transactions.get(1); + IdImpl traceId = baseTransaction.getTraceContext().getTraceId(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); - Span sendSpan = spans.get(0); + SpanImpl sendSpan = spans.get(0); assertThat(sendSpan.getNameAsString()).isEqualTo("JMS SEND to queue " + SPRING_TEST_QUEUE); assertThat(sendSpan.getTraceContext().getTraceId()).isEqualTo(traceId); - Transaction receiveTransaction = transactions.get(0); + TransactionImpl receiveTransaction = transactions.get(0); verifyReceiveTransaction(traceId, sendSpan, receiveTransaction); } } - private void verifyReceiveTransaction(Id traceId, Span sendSpan, Transaction receiveTransaction) { + private void verifyReceiveTransaction(IdImpl traceId, SpanImpl sendSpan, TransactionImpl receiveTransaction) { assertThat(receiveTransaction.getNameAsString()).isEqualTo("JMS RECEIVE from queue " + SPRING_TEST_QUEUE); assertThat(receiveTransaction.getTraceContext().getTraceId()).isEqualTo(traceId); assertThat(receiveTransaction.getTraceContext().getParentId()).isEqualTo(sendSpan.getTraceContext().getId()); diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringMapMessageListener.java b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringMapMessageListener.java index 3f1e00aaa2..d599485918 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringMapMessageListener.java +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/src/test/java/co/elastic/apm/agent/jms/javax/spring/SpringMapMessageListener.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.jms.javax.spring; import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.apache.activemq.command.ActiveMQMapMessage; import org.springframework.jms.listener.SessionAwareMessageListener; import org.springframework.stereotype.Service; @@ -46,7 +46,7 @@ public void onMessage(MapMessage mapMessage, Session session) throws JMSExceptio } System.out.println("Received map message: "); map.forEach((key, value) -> System.out.println(" " + key + " --> " + value)); - Transaction transaction = GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction(); + TransactionImpl transaction = GlobalTracer.get().require(ElasticApmTracer.class).currentTransaction(); assertThat(transaction.isFinished()).isFalse(); SpringJmsTest.resultQueue.offer(map); } diff --git a/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleExecuteInstrumentation.java b/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleExecuteInstrumentation.java index 46c43b3956..2481b123da 100644 --- a/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleExecuteInstrumentation.java +++ b/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleExecuteInstrumentation.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.jsf; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Transaction; import net.bytebuddy.description.method.MethodDescription; @@ -46,7 +46,7 @@ static class BaseExecuteAdvice { @Nullable protected static Object createAndActivateSpan(boolean withExternalContext, @Nullable String requestServletPath, @Nullable String requestPathInfo) { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); if (activeContext.getSpan() instanceof Span) { Span parentSpan = (Span) activeContext.getSpan(); if (SPAN_SUBTYPE.equals(parentSpan.getSubtype()) && SPAN_ACTION.equals(parentSpan.getAction())) { diff --git a/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleRenderInstrumentation.java b/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleRenderInstrumentation.java index e098c4f499..e26ab550a9 100644 --- a/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleRenderInstrumentation.java +++ b/apm-agent-plugins/apm-jsf-plugin/src/main/java/co/elastic/apm/agent/jsf/AbstractJsfLifecycleRenderInstrumentation.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.jsf; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -64,7 +64,7 @@ public static class AdviceClass { @Nullable @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static Object createRenderSpan() { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan instanceof Span) { Span parSpan = (Span) parentSpan; diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/main/java/co/elastic/apm/agent/kafka/KafkaConsumerInstrumentation.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/main/java/co/elastic/apm/agent/kafka/KafkaConsumerInstrumentation.java index 385526a154..be030128f6 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/main/java/co/elastic/apm/agent/kafka/KafkaConsumerInstrumentation.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/main/java/co/elastic/apm/agent/kafka/KafkaConsumerInstrumentation.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.kafka; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Transaction; @@ -63,7 +63,7 @@ public static class KafkaPollEntryAdvice { @SuppressWarnings("unused") @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void pollStart() { - final ElasticContext activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); final AbstractSpan activeSpan = activeContext.getSpan(); if (activeSpan == null) { return; diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyClientIT.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyClientIT.java index b11581c11d..716fcd27b6 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyClientIT.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyClientIT.java @@ -19,13 +19,13 @@ package co.elastic.apm.agent.kafka; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; -import co.elastic.apm.agent.impl.context.Destination; -import co.elastic.apm.agent.impl.context.Message; -import co.elastic.apm.agent.impl.context.SpanContext; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.context.MessageImpl; +import co.elastic.apm.agent.impl.context.SpanContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.testutils.TestContainersUtils; import org.apache.kafka.clients.consumer.ConsumerConfig; @@ -85,13 +85,13 @@ public class KafkaLegacyClientIT extends AbstractInstrumentationTest { private static KafkaConsumer replyConsumer; private static KafkaProducer producer; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; private final MessagingConfiguration messagingConfiguration; private TestScenario testScenario; public KafkaLegacyClientIT() { - this.coreConfiguration = config.getConfig(CoreConfiguration.class); + this.coreConfiguration = config.getConfig(CoreConfigurationImpl.class); this.messagingConfiguration = config.getConfig(MessagingConfiguration.class); } @@ -140,7 +140,7 @@ public void startTransaction() { @After public void endTransaction() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.deactivate().end(); } @@ -205,7 +205,7 @@ public void testSendTwoRecords_PartiallyIterate() { @Test public void testBodyCaptureEnabled() { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); testScenario = TestScenario.BODY_CAPTURE_ENABLED; consumerThread.setIterationMode(RecordIterationMode.ITERABLE_FOR); sendTwoRecordsAndConsumeReplies(); @@ -247,10 +247,10 @@ public void testIgnoreTopic() { sendTwoRecordsAndConsumeReplies(); // we expect only one span for polling the reply topic - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); verifyPollSpanContents(spans.get(0)); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).isEmpty(); } @@ -274,22 +274,22 @@ private void sendTwoRecordsAndConsumeReplies() { } private void verifyTracing() { - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); // we expect two send spans to request topic and one poll span from reply topic assertThat(spans).hasSize(3); - Span sendRequestSpan0 = spans.get(0); + SpanImpl sendRequestSpan0 = spans.get(0); verifySendSpanContents(sendRequestSpan0); - Span sendRequestSpan1 = spans.get(1); + SpanImpl sendRequestSpan1 = spans.get(1); verifySendSpanContents(sendRequestSpan1); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).isEmpty(); - Span pollSpan = spans.get(2); + SpanImpl pollSpan = spans.get(2); verifyPollSpanContents(pollSpan); } - private void verifyPollSpanContents(Span pollSpan) { + private void verifyPollSpanContents(SpanImpl pollSpan) { assertThat(pollSpan.getType()).isEqualTo("messaging"); assertThat(pollSpan.getSubtype()).isEqualTo("kafka"); assertThat(pollSpan.getAction()).isEqualTo("poll"); @@ -300,15 +300,15 @@ private void verifyPollSpanContents(Span pollSpan) { .hasNoName(); } - private void verifySendSpanContents(Span sendSpan) { + private void verifySendSpanContents(SpanImpl sendSpan) { assertThat(sendSpan.getType()).isEqualTo("messaging"); assertThat(sendSpan.getSubtype()).isEqualTo("kafka"); assertThat(sendSpan.getAction()).isEqualTo("send"); assertThat(sendSpan.getNameAsString()).isEqualTo("KafkaProducer#send to " + REQUEST_TOPIC); - SpanContext context = sendSpan.getContext(); - Message message = context.getMessage(); + SpanContextImpl context = sendSpan.getContext(); + MessageImpl message = context.getMessage(); assertThat(message.getQueueName()).isEqualTo(REQUEST_TOPIC); - Destination destination = context.getDestination(); + DestinationImpl destination = context.getDestination(); if (testScenario != TestScenario.TOPIC_ADDRESS_COLLECTION_DISABLED) { assertThat(destination.getPort()).isEqualTo(kafkaPort); assertThat(destination.getAddress().toString()).isEqualTo(kafka.getContainerIpAddress()); diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/main/java/co/elastic/apm/agent/kafka/helper/KafkaInstrumentationHeadersHelper.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/main/java/co/elastic/apm/agent/kafka/helper/KafkaInstrumentationHeadersHelper.java index 14cc72b372..1f107281ab 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/main/java/co/elastic/apm/agent/kafka/helper/KafkaInstrumentationHeadersHelper.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/main/java/co/elastic/apm/agent/kafka/helper/KafkaInstrumentationHeadersHelper.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.dispatch.HeaderUtils; @@ -116,7 +116,7 @@ public void addSpanLinks(@Nullable ConsumerRecords records, AbstractSpan toPropagate, ProducerRecord producerRecord) { + public void setOutgoingTraceContextHeaders(TraceState toPropagate, ProducerRecord producerRecord) { toPropagate.propagateContext(producerRecord, KafkaRecordHeaderAccessor.instance(), null); } diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT.java index 48508ca34c..c8bd0a16d9 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT.java @@ -20,19 +20,19 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; import co.elastic.apm.agent.impl.baggage.BaggageContext; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.context.DestinationImpl; import co.elastic.apm.agent.impl.context.Headers; -import co.elastic.apm.agent.impl.context.Message; -import co.elastic.apm.agent.impl.context.SpanContext; -import co.elastic.apm.agent.impl.context.TransactionContext; +import co.elastic.apm.agent.impl.context.MessageImpl; +import co.elastic.apm.agent.impl.context.SpanContextImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.TestContainersUtils; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; @@ -102,13 +102,13 @@ public class KafkaIT extends AbstractInstrumentationTest { private static KafkaConsumer replyConsumer; private static KafkaProducer producer; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; private final MessagingConfiguration messagingConfiguration; private TestScenario testScenario; public KafkaIT() { - this.coreConfiguration = config.getConfig(CoreConfiguration.class); + this.coreConfiguration = config.getConfig(CoreConfigurationImpl.class); this.messagingConfiguration = config.getConfig(MessagingConfiguration.class); } @@ -153,7 +153,7 @@ public void startTransaction() { } private void startAndActivateTransaction(@Nullable Sampler sampler) { - Transaction transaction; + TransactionImpl transaction; if (sampler == null) { transaction = tracer.startRootTransaction(null); } else { @@ -170,7 +170,7 @@ private void startAndActivateTransaction(@Nullable Sampler sampler) { @After public void endTransaction() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.deactivate().end(); } @@ -235,7 +235,7 @@ public void testSendTwoRecords_PartiallyIterate() { @Test public void testBodyCaptureEnabled() { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); testScenario = TestScenario.BODY_CAPTURE_ENABLED; consumerThread.setIterationMode(RecordIterationMode.ITERABLE_FOR); sendTwoRecordsAndConsumeReplies(); @@ -264,11 +264,11 @@ public void testBatchProcessing() { testScenario = TestScenario.BATCH_PROCESSING; consumerThread.setIterationMode(RecordIterationMode.ITERATE_WITHIN_TRANSACTION); sendTwoRecordsAndConsumeReplies(); - List sendSpans = + List sendSpans = reporter.getSpans().stream().filter(span -> span.getNameAsString().contains("send to " + REQUEST_TOPIC)).collect(Collectors.toList()); assertThat(sendSpans).hasSize(2); - Transaction batchProcessingTransaction = reporter.getFirstTransaction(); - verifySpanLinks(batchProcessingTransaction.getSpanLinks(), sendSpans.toArray(new Span[2])); + TransactionImpl batchProcessingTransaction = reporter.getFirstTransaction(); + verifySpanLinks(batchProcessingTransaction.getSpanLinks(), sendSpans.toArray(new SpanImpl[2])); } @Test @@ -289,10 +289,10 @@ public void testIgnoreTopic() { sendTwoRecordsAndConsumeReplies(); // we expect only one span for polling the reply topic - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans.size()).isGreaterThanOrEqualTo(1); verifyPollSpanContents(spans); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).isEmpty(); } @@ -314,13 +314,13 @@ public void testTransactionCreationWithoutContext() { // We expect two transactions from records read from the request topic, each creating a send span as well. // In addition, we expect two transactions from the main test thread, iterating over reply messages. - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(2); - Span sendSpan1 = spans.get(0); + SpanImpl sendSpan1 = spans.get(0); verifySendSpanContents(sendSpan1, REPLY_TOPIC); - Span sendSpan2 = spans.get(1); + SpanImpl sendSpan2 = spans.get(1); verifySendSpanContents(sendSpan2, REPLY_TOPIC); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(4); verifyKafkaTransactionContents(transactions.get(0), null, null, REQUEST_TOPIC); verifyKafkaTransactionContents(transactions.get(1), null, null, REQUEST_TOPIC); @@ -397,29 +397,29 @@ private List> awaitReplyRecords(long timeoutMs, i } private void verifyTracing() { - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); // we expect two send spans to request topic, two send spans to reply topic and at least one poll span from reply topic assertThat(spans.size()).isGreaterThanOrEqualTo(5); - Span sendRequestSpan0 = spans.get(0); + SpanImpl sendRequestSpan0 = spans.get(0); verifySendSpanContents(sendRequestSpan0, REQUEST_TOPIC); - Span sendRequestSpan1 = spans.get(1); + SpanImpl sendRequestSpan1 = spans.get(1); verifySendSpanContents(sendRequestSpan1, REQUEST_TOPIC); - Span sendReplySpan0 = spans.get(2); + SpanImpl sendReplySpan0 = spans.get(2); verifySendSpanContents(sendReplySpan0, REPLY_TOPIC); - Span sendReplySpan1 = spans.get(3); + SpanImpl sendReplySpan1 = spans.get(3); verifySendSpanContents(sendReplySpan1, REPLY_TOPIC); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(2); verifyKafkaTransactionContents(transactions.get(0), sendRequestSpan0, FIRST_MESSAGE_VALUE, REQUEST_TOPIC); verifyKafkaTransactionContents(transactions.get(1), sendRequestSpan1, SECOND_MESSAGE_VALUE, REQUEST_TOPIC); - List pollSpans = spans.stream().filter(span -> !span.getSpanLinks().isEmpty()).collect(Collectors.toList()); + List pollSpans = spans.stream().filter(span -> !span.getSpanLinks().isEmpty()).collect(Collectors.toList()); verifyPollSpanContents(pollSpans, sendReplySpan0, sendReplySpan1); } - private void verifyPollSpanContents(List pollSpans, Span... sendSpans) { - List spanLinks = new ArrayList<>(); + private void verifyPollSpanContents(List pollSpans, SpanImpl... sendSpans) { + List spanLinks = new ArrayList<>(); // collecting Reply-Topic polling spans that returned with records pollSpans.forEach(pollSpan -> { assertThat(pollSpan.getType()).isEqualTo("messaging"); @@ -434,22 +434,22 @@ private void verifyPollSpanContents(List pollSpans, Span... sendSpans) { verifySpanLinks(spanLinks, sendSpans); } - private void verifySpanLinks(List spanLinks, Span... sendSpans) { + private void verifySpanLinks(List spanLinks, SpanImpl... sendSpans) { assertThat(spanLinks).hasSize(sendSpans.length); Arrays.stream(sendSpans).forEach( sendSpan -> assertThat(spanLinks.stream()).anyMatch(link -> link.getParentId().equals(sendSpan.getTraceContext().getId())) ); } - private void verifySendSpanContents(Span sendSpan, String topicName) { + private void verifySendSpanContents(SpanImpl sendSpan, String topicName) { assertThat(sendSpan.getType()).isEqualTo("messaging"); assertThat(sendSpan.getSubtype()).isEqualTo("kafka"); assertThat(sendSpan.getAction()).isEqualTo("send"); assertThat(sendSpan.getNameAsString()).isEqualTo("KafkaProducer#send to " + topicName); - SpanContext context = sendSpan.getContext(); - Message message = context.getMessage(); + SpanContextImpl context = sendSpan.getContext(); + MessageImpl message = context.getMessage(); assertThat(message.getQueueName()).isEqualTo(topicName); - Destination destination = context.getDestination(); + DestinationImpl destination = context.getDestination(); if (testScenario != TestScenario.TOPIC_ADDRESS_COLLECTION_DISABLED) { assertThat(destination.getPort()).isEqualTo(kafkaPort); assertThat(destination.getAddress().toString()).isEqualTo(kafka.getContainerIpAddress()); @@ -464,19 +464,19 @@ private void verifySendSpanContents(Span sendSpan, String topicName) { .hasDestinationResource("kafka/" + topicName); } - private void verifyKafkaTransactionContents(Transaction transaction, @Nullable Span parentSpan, + private void verifyKafkaTransactionContents(TransactionImpl transaction, @Nullable SpanImpl parentSpan, @Nullable String messageValue, String topic) { assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getNameAsString()).isEqualTo("Kafka record from " + topic); assertThat(transaction.getFrameworkName()).isEqualTo("Kafka"); - TraceContext traceContext = transaction.getTraceContext(); + TraceContextImpl traceContext = transaction.getTraceContext(); if (parentSpan != null) { assertThat(traceContext.getTraceId()).isEqualTo(parentSpan.getTraceContext().getTraceId()); assertThat(traceContext.getParentId()).isEqualTo(parentSpan.getTraceContext().getId()); } - TransactionContext transactionContext = transaction.getContext(); - Message message = transactionContext.getMessage(); + TransactionContextImpl transactionContext = transaction.getContext(); + MessageImpl message = transactionContext.getMessage(); assertThat(message.getAge()).isGreaterThanOrEqualTo(0); assertThat(message.getQueueName()).isEqualTo(topic); if (testScenario == TestScenario.BODY_CAPTURE_ENABLED && messageValue != null) { @@ -578,7 +578,7 @@ record = iterator.next(); producer.send(new ProducerRecord<>(REPLY_TOPIC, REPLY_KEY, record.value())); } } else if (iterationMode == RecordIterationMode.ITERATE_WITHIN_TRANSACTION) { - Transaction transaction = Objects.requireNonNull(tracer.startRootTransaction(null)) + TransactionImpl transaction = Objects.requireNonNull(tracer.startRootTransaction(null)) .withName("Batch-processing Transaction") .activate(); if (records.isEmpty()) { diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT_RealReporter.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT_RealReporter.java index 27029e47df..54c8b66757 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT_RealReporter.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaIT_RealReporter.java @@ -20,14 +20,14 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.report.Reporter; import co.elastic.apm.agent.testutils.TestContainersUtils; @@ -93,7 +93,7 @@ public class KafkaIT_RealReporter { private static KafkaConsumer replyConsumer; private static KafkaProducer producer; - private static CoreConfiguration coreConfiguration; + private static CoreConfigurationImpl coreConfiguration; private static MessagingConfiguration messagingConfiguration; private static TestScenario testScenario; @@ -126,7 +126,7 @@ public static void setup() { ); config = SpyConfiguration.createSpyConfig(); - StacktraceConfiguration stacktraceConfiguration = config.getConfig(StacktraceConfiguration.class); + StacktraceConfigurationImpl stacktraceConfiguration = config.getConfig(StacktraceConfigurationImpl.class); doReturn(30).when(stacktraceConfiguration).getStackTraceLimit(); tracer = new ElasticApmTracerBuilder() .configurationRegistry(config) @@ -135,7 +135,7 @@ public static void setup() { ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install()); testScenario = TestScenario.NORMAL; - coreConfiguration = config.getConfig(CoreConfiguration.class); + coreConfiguration = config.getConfig(CoreConfigurationImpl.class); messagingConfiguration = config.getConfig(MessagingConfiguration.class); } @@ -150,7 +150,7 @@ public static void tearDown() { @Before public void startTransaction() { - Transaction transaction; + TransactionImpl transaction; transaction = tracer.startRootTransaction(null); if (transaction != null) { transaction.activate() @@ -163,7 +163,7 @@ public void startTransaction() { @After public void endAndReportTransaction() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.deactivate().end(); } @@ -222,7 +222,7 @@ public void testSendTwoRecords_PartiallyIterate() { @Test public void testBodyCaptureEnabled() { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); testScenario = TestScenario.BODY_CAPTURE_ENABLED; consumerThread.setIterationMode(RecordIterationMode.ITERABLE_FOR); sendTwoRecordsAndConsumeReplies(); @@ -391,7 +391,7 @@ record = iterator.next(); producer.send(new ProducerRecord<>(REPLY_TOPIC, REPLY_KEY, record.value())); } } else if (iterationMode == RecordIterationMode.ITERATE_WITHIN_TRANSACTION) { - Transaction transaction = Objects.requireNonNull(tracer.startRootTransaction(null)) + TransactionImpl transaction = Objects.requireNonNull(tracer.startRootTransaction(null)) .withName("Batch-processing Transaction") .activate(); if (records.isEmpty()) { diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyBrokerIT.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyBrokerIT.java index 309719dda4..f621d4c907 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyBrokerIT.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaLegacyBrokerIT.java @@ -19,14 +19,14 @@ package co.elastic.apm.agent.kafka; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; -import co.elastic.apm.agent.impl.context.Message; -import co.elastic.apm.agent.impl.context.SpanContext; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.MessageImpl; +import co.elastic.apm.agent.impl.context.SpanContextImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.testutils.TestContainersUtils; import org.apache.kafka.clients.consumer.ConsumerConfig; @@ -87,13 +87,13 @@ public class KafkaLegacyBrokerIT extends AbstractInstrumentationTest { private static KafkaConsumer replyConsumer; private static KafkaProducer producer; - private final CoreConfiguration coreConfiguration; + private final CoreConfigurationImpl coreConfiguration; private final MessagingConfiguration messagingConfiguration; private TestScenario testScenario; public KafkaLegacyBrokerIT() { - this.coreConfiguration = config.getConfig(CoreConfiguration.class); + this.coreConfiguration = config.getConfig(CoreConfigurationImpl.class); this.messagingConfiguration = config.getConfig(MessagingConfiguration.class); } @@ -140,7 +140,7 @@ public void startTransaction() { @After public void endTransaction() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.deactivate().end(); } @@ -205,7 +205,7 @@ public void testSendTwoRecords_PartiallyIterate() { @Test public void testBodyCaptureEnabled() { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); testScenario = TestScenario.BODY_CAPTURE_ENABLED; consumerThread.setIterationMode(RecordIterationMode.ITERABLE_FOR); sendTwoRecordsAndConsumeReplies(); @@ -230,10 +230,10 @@ public void testIgnoreTopic() { sendTwoRecordsAndConsumeReplies(); // we expect only one span for polling the reply topic - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(1); verifyPollSpanContents(spans.get(0)); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).isEmpty(); } @@ -250,13 +250,13 @@ public void testTransactionCreationWithoutContext() { // We expect two transactions from records read from the request topic, each creating a send span as well. // In addition we expect two transactions from the main test thread, iterating over reply messages. - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(2); - Span sendSpan1 = spans.get(0); + SpanImpl sendSpan1 = spans.get(0); verifySendSpanContents(sendSpan1, REPLY_TOPIC); - Span sendSpan2 = spans.get(1); + SpanImpl sendSpan2 = spans.get(1); verifySendSpanContents(sendSpan2, REPLY_TOPIC); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(4); verifyKafkaTransactionContents(transactions.get(0), null, null, REQUEST_TOPIC); verifyKafkaTransactionContents(transactions.get(1), null, null, REQUEST_TOPIC); @@ -287,28 +287,28 @@ private void sendTwoRecordsAndConsumeReplies() { } private void verifyTracing() { - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); // we expect two send spans to request topic, two send spans to reply topic and one poll span from reply topic assertThat(spans).hasSize(5); - Span sendRequestSpan0 = spans.get(0); + SpanImpl sendRequestSpan0 = spans.get(0); verifySendSpanContents(sendRequestSpan0, REQUEST_TOPIC); - Span sendRequestSpan1 = spans.get(1); + SpanImpl sendRequestSpan1 = spans.get(1); verifySendSpanContents(sendRequestSpan1, REQUEST_TOPIC); - Span sendReplySpan0 = spans.get(2); + SpanImpl sendReplySpan0 = spans.get(2); verifySendSpanContents(sendReplySpan0, REPLY_TOPIC); - Span sendReplySpan1 = spans.get(3); + SpanImpl sendReplySpan1 = spans.get(3); verifySendSpanContents(sendReplySpan1, REPLY_TOPIC); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(2); verifyKafkaTransactionContents(transactions.get(0), sendRequestSpan0, FIRST_MESSAGE_VALUE, REQUEST_TOPIC); verifyKafkaTransactionContents(transactions.get(1), sendRequestSpan1, SECOND_MESSAGE_VALUE, REQUEST_TOPIC); - Span pollSpan = spans.get(4); + SpanImpl pollSpan = spans.get(4); verifyPollSpanContents(pollSpan); } - private void verifyPollSpanContents(Span pollSpan) { + private void verifyPollSpanContents(SpanImpl pollSpan) { assertThat(pollSpan.getType()).isEqualTo("messaging"); assertThat(pollSpan.getSubtype()).isEqualTo("kafka"); assertThat(pollSpan.getAction()).isEqualTo("poll"); @@ -320,13 +320,13 @@ private void verifyPollSpanContents(Span pollSpan) { .hasDestinationResource("kafka"); } - private void verifySendSpanContents(Span sendSpan, String topicName) { + private void verifySendSpanContents(SpanImpl sendSpan, String topicName) { assertThat(sendSpan.getType()).isEqualTo("messaging"); assertThat(sendSpan.getSubtype()).isEqualTo("kafka"); assertThat(sendSpan.getAction()).isEqualTo("send"); assertThat(sendSpan.getNameAsString()).isEqualTo("KafkaProducer#send to " + topicName); - SpanContext context = sendSpan.getContext(); - Message message = context.getMessage(); + SpanContextImpl context = sendSpan.getContext(); + MessageImpl message = context.getMessage(); assertThat(message.getQueueName()).isEqualTo(topicName); assertThat(context.getServiceTarget()) @@ -335,17 +335,17 @@ private void verifySendSpanContents(Span sendSpan, String topicName) { .hasDestinationResource("kafka/" + topicName); } - private void verifyKafkaTransactionContents(Transaction transaction, @Nullable Span parentSpan, + private void verifyKafkaTransactionContents(TransactionImpl transaction, @Nullable SpanImpl parentSpan, @Nullable String messageValue, String topic) { assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getNameAsString()).isEqualTo("Kafka record from " + topic); - TraceContext traceContext = transaction.getTraceContext(); + TraceContextImpl traceContext = transaction.getTraceContext(); if (parentSpan != null) { assertThat(traceContext.getTraceId()).isNotEqualTo(parentSpan.getTraceContext().getTraceId()); assertThat(traceContext.getParentId()).isNotEqualTo(parentSpan.getTraceContext().getId()); } - TransactionContext transactionContext = transaction.getContext(); - Message message = transactionContext.getMessage(); + TransactionContextImpl transactionContext = transaction.getContext(); + MessageImpl message = transactionContext.getMessage(); assertThat(message.getAge()).isGreaterThanOrEqualTo(0); assertThat(message.getQueueName()).isEqualTo(topic); if (testScenario == TestScenario.BODY_CAPTURE_ENABLED && messageValue != null) { diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaSpringIT.java b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaSpringIT.java index 7cabf3bd58..f5a78516d7 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaSpringIT.java +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/src/test/java/co/elastic/apm/agent/kafka/KafkaSpringIT.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.kafka; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.TestContainersUtils; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.producer.ProducerConfig; @@ -85,23 +85,23 @@ public static void tearDown() { @Test public void testBatchReceive() { - Transaction transaction1 = startTestRootTransaction("Send 1"); + TransactionImpl transaction1 = startTestRootTransaction("Send 1"); kafkaTemplate.send(BATCH_TOPIC, "data-1"); transaction1.deactivate().end(); - Transaction transaction2 = startTestRootTransaction("Send 2"); + TransactionImpl transaction2 = startTestRootTransaction("Send 2"); kafkaTemplate.send(BATCH_TOPIC, "data-2"); transaction2.deactivate().end(); reporter.awaitTransactionCount(3, 10000); reporter.awaitSpanCount(3); //two kafka exit spans + the batchListener span - List senderSpans = reporter.getSpans().stream() - .filter(AbstractSpan::isExit) + List senderSpans = reporter.getSpans().stream() + .filter(AbstractSpanImpl::isExit) .collect(Collectors.toList()); assertThat(senderSpans).hasSize(2); - Transaction batchReceive = reporter.getTransactions().stream() + TransactionImpl batchReceive = reporter.getTransactions().stream() .filter(transaction -> transaction.getNameAsString().equals("Spring Kafka Message Batch Processing")) .findFirst().orElse(null); @@ -111,7 +111,7 @@ public void testBatchReceive() { .hasSpanLink(senderSpans.get(0)) .hasSpanLink(senderSpans.get(1)); - Span listenerSpan = reporter.getSpanByName("batchListener"); + SpanImpl listenerSpan = reporter.getSpanByName("batchListener"); assertThat(listenerSpan) .isNotNull() .hasParent(batchReceive); @@ -121,20 +121,20 @@ public void testBatchReceive() { // it just verifies that non-batch listeners are caught by the standard kafka instrumentation @Test public void testNonBatchSingleReceive() { - Transaction transaction1 = startTestRootTransaction("Send 1"); + TransactionImpl transaction1 = startTestRootTransaction("Send 1"); kafkaTemplate.send(SINGLE_TOPIC, "data-1"); transaction1.deactivate().end(); reporter.awaitTransactionCount(2, 10000); reporter.awaitSpanCount(2); //one kafka exit spans + the singleListener span - Span senderSpan = reporter.getSpans().stream() - .filter(AbstractSpan::isExit) + SpanImpl senderSpan = reporter.getSpans().stream() + .filter(AbstractSpanImpl::isExit) .findFirst().orElse(null); assertThat(senderSpan).isNotNull(); - Transaction singleReceive = reporter.getTransactions().stream() + TransactionImpl singleReceive = reporter.getTransactions().stream() .filter(transaction -> "messaging".equals(transaction.getType())) .findFirst().orElse(null); @@ -142,7 +142,7 @@ public void testNonBatchSingleReceive() { .isNotNull() .hasParent(senderSpan); - Span listenerSpan = reporter.getSpanByName("singleListener"); + SpanImpl listenerSpan = reporter.getSpanByName("singleListener"); assertThat(listenerSpan) .isNotNull() .hasParent(singleReceive); diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLogManagerCorrelationInstrumentationTest.java b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLogManagerCorrelationInstrumentationTest.java index 081905a8de..9de71a7a0e 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLogManagerCorrelationInstrumentationTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLogManagerCorrelationInstrumentationTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.loginstr.correlation.AbstractLogCorrelationHelper; import org.jboss.logmanager.ExtHandler; import org.jboss.logmanager.ExtLogRecord; @@ -38,7 +38,7 @@ import java.util.Map; import java.util.Objects; -import static co.elastic.apm.agent.impl.transaction.TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; +import static co.elastic.apm.agent.impl.transaction.TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; import static org.assertj.core.api.Assertions.assertThat; public class JBossLogManagerCorrelationInstrumentationTest extends AbstractInstrumentationTest { @@ -48,7 +48,7 @@ public class JBossLogManagerCorrelationInstrumentationTest extends AbstractInstr private static final LoggingCorrelationVerifier loggingCorrelationVerifier = new LoggingCorrelationVerifier(); private static Logger logger; - private Transaction transaction; + private TransactionImpl transaction; @BeforeAll static void initializeLogger() { @@ -115,14 +115,14 @@ protected void doPublish(ExtLogRecord record) { String traceParent = record.getMessage(); assertThat(traceParent).isNotNull(); Map textHeaderMap = Map.of(W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, traceParent); - TraceContext childTraceContext = TraceContext.with64BitId(tracer); + TraceContextImpl childTraceContext = TraceContextImpl.with64BitId(tracer); childTraceContext.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE); System.out.println("childTraceContext = " + childTraceContext); assertThat(childTraceContext.getTraceId().toString()).isEqualTo(traceId.toString()); assertThat(childTraceContext.getParentId().toString()).isEqualTo(transactionId.toString()); if (shouldContainErrorId) { assertThat(errorId).isNotNull(); - ErrorCapture activeError = ErrorCapture.getActive(); + ErrorCaptureImpl activeError = ErrorCaptureImpl.getActive(); assertThat(activeError).isNotNull(); assertThat(activeError.getTraceContext().getId().toString()).isEqualTo(errorId.toString()); } else { diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLoggingCorrelationInstrumentationTest.java b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLoggingCorrelationInstrumentationTest.java index af869e005f..60062911d7 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLoggingCorrelationInstrumentationTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/src/test/java/co/elastic/apm/agent/jbosslogging/correlation/JBossLoggingCorrelationInstrumentationTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.loginstr.correlation.AbstractLogCorrelationHelper; import org.jboss.logging.Logger; import org.jboss.logging.MDC; @@ -37,7 +37,7 @@ import java.util.logging.Handler; import java.util.logging.LogRecord; -import static co.elastic.apm.agent.impl.transaction.TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; +import static co.elastic.apm.agent.impl.transaction.TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; import static org.assertj.core.api.Assertions.assertThat; public class JBossLoggingCorrelationInstrumentationTest extends AbstractInstrumentationTest { @@ -47,7 +47,7 @@ public class JBossLoggingCorrelationInstrumentationTest extends AbstractInstrume private static final LoggingCorrelationVerifier loggingCorrelationVerifier = new LoggingCorrelationVerifier(); private static Logger logger; - private Transaction transaction; + private TransactionImpl transaction; @BeforeAll static void initializeLogger() { @@ -119,14 +119,14 @@ public void publish(LogRecord record) { String traceParent = record.getMessage(); assertThat(traceParent).isNotNull(); Map textHeaderMap = Map.of(W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, traceParent); - TraceContext childTraceContext = TraceContext.with64BitId(tracer); + TraceContextImpl childTraceContext = TraceContextImpl.with64BitId(tracer); childTraceContext.asChildOf(textHeaderMap, TextHeaderMapAccessor.INSTANCE); System.out.println("childTraceContext = " + childTraceContext); assertThat(childTraceContext.getTraceId().toString()).isEqualTo(traceId.toString()); assertThat(childTraceContext.getParentId().toString()).isEqualTo(transactionId.toString()); if (shouldContainErrorId) { assertThat(errorId).isNotNull(); - ErrorCapture activeError = ErrorCapture.getActive(); + ErrorCaptureImpl activeError = ErrorCaptureImpl.getActive(); assertThat(activeError).isNotNull(); assertThat(activeError.getTraceContext().getId().toString()).isEqualTo(errorId.toString()); } else { diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTest.java b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTest.java index 4d5ab75fa7..e8cfe0480a 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.loginstr.LoggingInstrumentationTest; import co.elastic.apm.agent.loginstr.LoggerFacade; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; @@ -36,8 +36,6 @@ import java.net.URI; import java.net.URISyntaxException; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.List; import java.util.Objects; @@ -57,7 +55,7 @@ static void resetConfigFactory() { @AfterAll static void reInitLogging() { - LoggingConfiguration.init(List.of(), ""); + LoggingConfigurationImpl.init(List.of(), ""); } private static final Marker TEST_MARKER = MarkerManager.getMarker("TEST"); diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTestVersions.java b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTestVersions.java index d6a5fc3278..302f0132f5 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTestVersions.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/src/test/java/co/elastic/apm/agent/log4j2/Log4j2InstrumentationTestVersions.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.log4j2; import co.elastic.apm.agent.testutils.JUnit4TestClassWithDependencyRunner; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.junit.After; import org.junit.AfterClass; @@ -47,7 +47,7 @@ public static void resetConfigFactory() { @AfterClass public static void reInitLogging() { - LoggingConfiguration.init(List.of(), ""); + LoggingConfigurationImpl.init(List.of(), ""); } @Before diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/main/java/co/elastic/apm/agent/loginstr/reformatting/AbstractEcsReformattingHelper.java b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/main/java/co/elastic/apm/agent/loginstr/reformatting/AbstractEcsReformattingHelper.java index 623c854314..041df393c4 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/main/java/co/elastic/apm/agent/loginstr/reformatting/AbstractEcsReformattingHelper.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/main/java/co/elastic/apm/agent/loginstr/reformatting/AbstractEcsReformattingHelper.java @@ -28,11 +28,8 @@ import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import co.elastic.apm.agent.tracer.Tracer; -import co.elastic.apm.agent.tracer.configuration.CoreConfiguration; import co.elastic.apm.agent.tracer.configuration.LoggingConfiguration; -import co.elastic.apm.agent.tracer.configuration.ServerlessConfiguration; import co.elastic.apm.agent.tracer.service.Service; -import co.elastic.apm.agent.tracer.service.ServiceAwareTracer; import javax.annotation.Nullable; import java.util.List; diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/LoggingInstrumentationTest.java b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/LoggingInstrumentationTest.java index 422fcc9b2e..b7b5a5d110 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/LoggingInstrumentationTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/LoggingInstrumentationTest.java @@ -19,12 +19,12 @@ package co.elastic.apm.agent.loginstr; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; -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.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.LogEcsReformatting; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import co.elastic.apm.agent.logging.TestUtils; import co.elastic.apm.agent.loginstr.correlation.AbstractLogCorrelationHelper; import co.elastic.apm.agent.loginstr.reformatting.Utils; @@ -75,10 +75,10 @@ public abstract class LoggingInstrumentationTest extends AbstractInstrumentation private final SimpleDateFormat timestampFormat; private final SimpleDateFormat utcTimestampFormat; - private LoggingConfiguration loggingConfig; + private LoggingConfigurationImpl loggingConfig; private String serviceName; - private Transaction transaction; - private Span childSpan; + private TransactionImpl transaction; + private SpanImpl childSpan; public LoggingInstrumentationTest() { logger = createLoggerFacade(); @@ -91,11 +91,11 @@ public LoggingInstrumentationTest() { @Before @BeforeEach public void setup() throws Exception { - doReturn(SERVICE_VERSION).when(config.getConfig(CoreConfiguration.class)).getServiceVersion(); - doReturn(ENVIRONMENT).when(config.getConfig(CoreConfiguration.class)).getEnvironment(); - doReturn(SERVICE_NODE_NAME).when(config.getConfig(CoreConfiguration.class)).getServiceNodeName(); + doReturn(SERVICE_VERSION).when(config.getConfig(CoreConfigurationImpl.class)).getServiceVersion(); + doReturn(ENVIRONMENT).when(config.getConfig(CoreConfigurationImpl.class)).getEnvironment(); + doReturn(SERVICE_NODE_NAME).when(config.getConfig(CoreConfigurationImpl.class)).getServiceNodeName(); - loggingConfig = config.getConfig(LoggingConfiguration.class); + loggingConfig = config.getConfig(LoggingConfigurationImpl.class); doReturn(ADDITIONAL_FIELDS).when(loggingConfig).getLogEcsReformattingAdditionalFields(); logger.open(); @@ -354,7 +354,7 @@ private void verifyErrorCaptureAndCorrelation(boolean isErrorLine, JsonNode ecsL final JsonNode errorJsonNode = ecsLogLineTree.get(AbstractLogCorrelationHelper.ERROR_ID_MDC_KEY); if (isErrorLine) { assertThat(errorJsonNode).describedAs("missing error ID").isNotNull(); - List errors = reporter.getErrors().stream() + List errors = reporter.getErrors().stream() .filter(error -> errorJsonNode.textValue().equals(error.getTraceContext().getId().toString())) .collect(Collectors.toList()); assertThat(errors).hasSize(1); diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/correlation/CorrelationIdMapAdapterTest.java b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/correlation/CorrelationIdMapAdapterTest.java index 6b7e3037fe..0e225ca6ea 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/correlation/CorrelationIdMapAdapterTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/correlation/CorrelationIdMapAdapterTest.java @@ -21,8 +21,8 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Scope; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -53,7 +53,7 @@ void testNoContext() { @Test void testTransactionContext() { - Transaction transaction = tracer.startRootTransaction(null); + TransactionImpl transaction = tracer.startRootTransaction(null); try (Scope scope = transaction.activateInScope()) { assertThat(CorrelationIdMapAdapter.get()).containsOnlyKeys("trace.id", "transaction.id"); } finally { @@ -64,8 +64,8 @@ void testTransactionContext() { @Test void testSpanContext() { - Transaction transaction = tracer.startRootTransaction(null); - Span span = transaction.createSpan(); + TransactionImpl transaction = tracer.startRootTransaction(null); + SpanImpl span = transaction.createSpan(); try (Scope scope = span.activateInScope()) { assertThat(CorrelationIdMapAdapter.get()).containsOnlyKeys("trace.id", "transaction.id"); } finally { diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/error/AbstractErrorLoggingInstrumentationTest.java b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/error/AbstractErrorLoggingInstrumentationTest.java index bfe0fbce37..fb21844018 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/error/AbstractErrorLoggingInstrumentationTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/error/AbstractErrorLoggingInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.loginstr.error; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -28,7 +28,7 @@ public abstract class AbstractErrorLoggingInstrumentationTest extends AbstractInstrumentationTest { - private Transaction transaction; + private TransactionImpl transaction; @BeforeEach void startTransaction() { diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/reformatting/UtilsTest.java b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/reformatting/UtilsTest.java index 8cf473a39c..75431e1f35 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/reformatting/UtilsTest.java +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/src/test/java/co/elastic/apm/agent/loginstr/reformatting/UtilsTest.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.tracer.configuration.LogEcsReformatting; -import co.elastic.apm.agent.logging.LoggingConfiguration; +import co.elastic.apm.agent.logging.LoggingConfigurationImpl; import org.junit.jupiter.api.Test; import javax.annotation.Nullable; @@ -33,7 +33,7 @@ public class UtilsTest extends AbstractInstrumentationTest { private static final String fileSeparator = System.getProperty("file.separator"); @Nullable - private final String logEcsFormattingDestinationDir = config.getConfig(LoggingConfiguration.class).getLogEcsFormattingDestinationDir(); + private final String logEcsFormattingDestinationDir = config.getConfig(LoggingConfigurationImpl.class).getLogEcsFormattingDestinationDir(); private String computeReformattedLogFilePathWithConfiguredDir(String logFilePath) { return Utils.computeLogReformattingFilePath(logFilePath, logEcsFormattingDestinationDir); @@ -49,7 +49,7 @@ void testReformattedPathComputation() { @Test void testReplace() { - doReturn(LogEcsReformatting.REPLACE).when(config.getConfig(LoggingConfiguration.class)).getLogEcsReformatting(); + doReturn(LogEcsReformatting.REPLACE).when(config.getConfig(LoggingConfigurationImpl.class)).getLogEcsReformatting(); assertThat(computeReformattedLogFilePathWithConfiguredDir("/test/absolute/path/app.log")).isEqualTo(replaceFileSeparator("/test/absolute/path/app.ecs.json")); assertThat(computeReformattedLogFilePathWithConfiguredDir("/test/absolute/path/app")).isEqualTo(replaceFileSeparator("/test/absolute/path/app.ecs.json")); assertThat(computeReformattedLogFilePathWithConfiguredDir("/test/absolute/path/app.log.1")).isEqualTo(replaceFileSeparator("/test/absolute/path/app.log.ecs.json")); diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerConfigInstrumentationTest.java b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerConfigInstrumentationTest.java index 3b05335fb6..a4ceee4141 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerConfigInstrumentationTest.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerConfigInstrumentationTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -52,7 +52,7 @@ public class MicrometerConfigInstrumentationTest { @Before public void setUp() { config = SpyConfiguration.createSpyConfig(); - doReturn(50L).when(config.getConfig(ReporterConfiguration.class)).getMetricsIntervalMs(); + doReturn(50L).when(config.getConfig(ReporterConfigurationImpl.class)).getMetricsIntervalMs(); reporter = new MockReporter(); } @@ -74,7 +74,7 @@ public void testConfigMapWasUpdated() { @Test public void testConfigMapWasUpdatedWhenInstrumentConfigDisabled() { - doReturn(false).when(config.getConfig(CoreConfiguration.class)).isInstrument(); + doReturn(false).when(config.getConfig(CoreConfigurationImpl.class)).isInstrument(); ElasticApmAgent.initInstrumentation(MockTracer.createRealTracer(reporter, config), ByteBuddyAgent.install()); MicrometerMetricsReporter.OneSecondStepSimpleConfig oneSecondStepSimpleConfig = new MicrometerMetricsReporter.OneSecondStepSimpleConfig(); SimpleMeterRegistry registryOneSecondStep = new SimpleMeterRegistry(oneSecondStepSimpleConfig, Clock.SYSTEM); diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationStepTest.java b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationStepTest.java index 13ebb2a18c..8d5aae964e 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationStepTest.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationStepTest.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -60,7 +60,7 @@ public class MicrometerInstrumentationStepTest { @Before public void setUp() { config = SpyConfiguration.createSpyConfig(); - doReturn(30_000L).when(config.getConfig(ReporterConfiguration.class)).getMetricsIntervalMs(); + doReturn(30_000L).when(config.getConfig(ReporterConfigurationImpl.class)).getMetricsIntervalMs(); reporter = new MockReporter(); } @@ -83,7 +83,7 @@ public void testStepVsCumulativeMultiple() { @Test public void testStepVsCumulativeMultipleSameInterval() { - doReturn(1_000L).when(config.getConfig(ReporterConfiguration.class)).getMetricsIntervalMs(); + doReturn(1_000L).when(config.getConfig(ReporterConfigurationImpl.class)).getMetricsIntervalMs(); final FooBar result = new FooBar(21,21); testStepVsCumulative(result, true); } diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationTest.java b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationTest.java index 279cbb1f4d..236acd6c08 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationTest.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerInstrumentationTest.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import io.micrometer.core.instrument.Clock; @@ -52,7 +52,7 @@ public class MicrometerInstrumentationTest { @Before public void setUp() { config = SpyConfiguration.createSpyConfig(); - doReturn(50L).when(config.getConfig(ReporterConfiguration.class)).getMetricsIntervalMs(); + doReturn(50L).when(config.getConfig(ReporterConfigurationImpl.class)).getMetricsIntervalMs(); reporter = new MockReporter(); lastMeasuredMetricSetNumber = 0; lastFooSamples = 0; @@ -73,7 +73,7 @@ public void testRegisterMeterRegistry() { @Test public void testReportedWhenInstrumentConfigDisabled() { - doReturn(false).when(config.getConfig(CoreConfiguration.class)).isInstrument(); + doReturn(false).when(config.getConfig(CoreConfigurationImpl.class)).isInstrument(); ElasticApmAgent.initInstrumentation(MockTracer.createRealTracer(reporter, config), ByteBuddyAgent.install()); SimpleMeterRegistry registry = new SimpleMeterRegistry(new OneSecondStepSimpleConfig(), Clock.SYSTEM); registry.counter("foo").increment(); diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java index 026936f4fc..bfb23e129b 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.micrometer; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import com.dslplatform.json.JsonWriter; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; @@ -50,7 +50,7 @@ public class MicrometerMeterRegistrySerializerTest { @BeforeAll static void setup() { - MetricsConfiguration config = mock(MetricsConfiguration.class); + MetricsConfigurationImpl config = mock(MetricsConfigurationImpl.class); serializer = new MicrometerMeterRegistrySerializer(config); } diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporterTest.java b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporterTest.java index 18b64638e1..51e685e7cf 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporterTest.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporterTest.java @@ -20,10 +20,10 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -74,7 +74,7 @@ void setUp() { meterRegistry = new CompositeMeterRegistry(Clock.SYSTEM, List.of(nestedCompositeMeterRegistry)); reporter = new MockReporter(); tracer = MockTracer.createRealTracer(reporter); - doReturn(61_000L).when(tracer.getConfig(ReporterConfiguration.class)).getMetricsIntervalMs(); + doReturn(61_000L).when(tracer.getConfig(ReporterConfigurationImpl.class)).getMetricsIntervalMs(); metricsReporter = new MicrometerMetricsReporter(tracer, true); //all calls to run() are explicit from the tests //note the default mode is CUMULATIVE, so no need to addConfig(meterRegistry, meterRegistryConfig); metricsReporter.registerMeterRegistry(meterRegistry); @@ -121,7 +121,7 @@ void testMultipleMetricSets() { @Test void testDisabledMetrics() { doReturn(List.of(WildcardMatcher.valueOf("root.metric"), WildcardMatcher.valueOf("root.metric.exclude.*"))) - .when(tracer.getConfig(ReporterConfiguration.class)).getDisableMetrics(); + .when(tracer.getConfig(ReporterConfigurationImpl.class)).getDisableMetrics(); List tags = List.of(Tag.of("foo", "bar")); meterRegistry.counter("root.metric", tags).increment(42); @@ -136,7 +136,7 @@ void testDisabledMetrics() { @Test void testDedotMetricName() { - assertThat(tracer.getConfig(MetricsConfiguration.class).isDedotCustomMetrics()).isTrue(); + assertThat(tracer.getConfig(MetricsConfigurationImpl.class).isDedotCustomMetrics()).isTrue(); meterRegistry.counter("foo.bar").increment(42); JsonNode metricSet = getSingleMetricSet(); @@ -145,7 +145,7 @@ void testDedotMetricName() { @Test void testDisableDedotMetricName() { - doReturn(false).when(tracer.getConfig(MetricsConfiguration.class)).isDedotCustomMetrics(); + doReturn(false).when(tracer.getConfig(MetricsConfigurationImpl.class)).isDedotCustomMetrics(); meterRegistry.counter("foo.bar").increment(42); JsonNode metricSet = getSingleMetricSet(); @@ -202,7 +202,7 @@ void testCounter() { @Test void testCounterWithMetricsIntervalDisabled() { - doReturn(0L).when(tracer.getConfig(ReporterConfiguration.class)).getMetricsIntervalMs(); + doReturn(0L).when(tracer.getConfig(ReporterConfigurationImpl.class)).getMetricsIntervalMs(); meterRegistry.counter("counter", List.of(Tag.of("foo", "bar"), Tag.of("baz", "qux"))).increment(42); List metricSets = getMetricSets(null); assertThat(metricSets).isEmpty(); diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/src/test/java/co/elastic/apm/agent/mongodb/AbstractMongoClientInstrumentationIT.java b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/src/test/java/co/elastic/apm/agent/mongodb/AbstractMongoClientInstrumentationIT.java index 1ca709459c..fe9dcb46da 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/src/test/java/co/elastic/apm/agent/mongodb/AbstractMongoClientInstrumentationIT.java +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/src/test/java/co/elastic/apm/agent/mongodb/AbstractMongoClientInstrumentationIT.java @@ -19,10 +19,9 @@ package co.elastic.apm.agent.mongodb; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.testutils.TestContainersUtils; import co.elastic.apm.agent.testutils.assertions.DbAssert; @@ -71,7 +70,7 @@ public void startTransaction() { @After public void endTransaction() throws Exception { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); if (currentTransaction != null) { currentTransaction.deactivate().end(); } @@ -100,7 +99,7 @@ public void testErrorSpanHasFailureOutcome() throws Exception { // trying to drop when it does not exist creates an error dropCollection(); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(3); verifySpan(spans.get(0), getSpanName("create"), Outcome.SUCCESS); @@ -235,7 +234,7 @@ public void testCaptureAllCommands() throws Exception { private void checkReportedSpans(String... operations) { assertThat(reporter.getNumReportedSpans()).isEqualTo(operations.length); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); assertThat(spans).hasSize(operations.length); for (int i = 0; i < operations.length; i++) { verifySpan(spans.get(i), getSpanName(operations[i]), Outcome.SUCCESS); @@ -246,7 +245,7 @@ protected boolean isAsync(){ return false; } - private void verifySpan(Span span, String expectedName, Outcome expectedOutcome) { + private void verifySpan(SpanImpl span, String expectedName, Outcome expectedOutcome) { assertThat(span) .hasName(expectedName) diff --git a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientAsyncInstrumentation.java b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientAsyncInstrumentation.java index 6e192c571e..49e72ed2b7 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientAsyncInstrumentation.java +++ b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientAsyncInstrumentation.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import net.bytebuddy.asm.Advice; @@ -83,7 +83,7 @@ public static Object[] onBeforeEnqueue(final @Advice.Origin Class currentContext = tracer.currentContext(); + TraceState currentContext = tracer.currentContext(); if (currentContext.isPropagationRequired(request, OkHttp3RequestHeaderGetter.INSTANCE)) { Request.Builder builder = originalRequest.newBuilder(); currentContext.propagateContext(builder, OkHttp3RequestHeaderSetter.INSTANCE, request, OkHttp3RequestHeaderGetter.INSTANCE); diff --git a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientInstrumentation.java b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientInstrumentation.java index 0652951f09..9d63e4f9ce 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientInstrumentation.java +++ b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttp3ClientInstrumentation.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.okhttp; import co.elastic.apm.agent.httpclient.HttpClientHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import net.bytebuddy.asm.Advice; @@ -67,7 +67,7 @@ public static Object[] onBeforeExecute(final @Advice.FieldValue("originalRequest span.activate(); } - ElasticContext toPropagate = tracer.currentContext(); + TraceState toPropagate = tracer.currentContext(); if (toPropagate.isPropagationRequired(request, OkHttp3RequestHeaderGetter.INSTANCE)) { Request.Builder builder = ((Request) originalRequest).newBuilder(); toPropagate.propagateContext(builder, OkHttp3RequestHeaderSetter.INSTANCE, request, OkHttp3RequestHeaderGetter.INSTANCE); diff --git a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientAsyncInstrumentation.java b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientAsyncInstrumentation.java index aedf7110b8..b89237132a 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientAsyncInstrumentation.java +++ b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientAsyncInstrumentation.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import com.squareup.okhttp.Call; @@ -80,7 +80,7 @@ public static Object[] onBeforeEnqueue(final @Advice.Origin Class toPropagate = tracer.currentContext(); + TraceState toPropagate = tracer.currentContext(); if (toPropagate.isPropagationRequired(request, OkHttpRequestHeaderGetter.INSTANCE)) { Request.Builder builder = originalRequest.newBuilder(); toPropagate.propagateContext(builder, OkHttpRequestHeaderSetter.INSTANCE, request, OkHttpRequestHeaderGetter.INSTANCE); diff --git a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientInstrumentation.java b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientInstrumentation.java index 6707bc9206..d1e0d1d01b 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientInstrumentation.java +++ b/apm-agent-plugins/apm-okhttp-plugin/src/main/java/co/elastic/apm/agent/okhttp/OkHttpClientInstrumentation.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.okhttp; import co.elastic.apm.agent.httpclient.HttpClientHelper; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import com.squareup.okhttp.HttpUrl; @@ -64,7 +64,7 @@ public static Object[] onBeforeExecute(@Advice.FieldValue("originalRequest") @Nu span.activate(); } - ElasticContext toPropagate = tracer.currentContext(); + TraceState toPropagate = tracer.currentContext(); if (toPropagate.isPropagationRequired(request, OkHttpRequestHeaderGetter.INSTANCE)) { Request.Builder builder = request.newBuilder(); toPropagate.propagateContext(builder, OkHttpRequestHeaderSetter.INSTANCE, request, OkHttpRequestHeaderGetter.INSTANCE); diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyDoubleHistogramBuilder.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyDoubleHistogramBuilder.java index 5d4b0034ec..e5ed3d380a 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyDoubleHistogramBuilder.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyDoubleHistogramBuilder.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.embeddedotel.proxy; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.GlobalTracer; import io.opentelemetry.api.metrics.DoubleHistogramBuilder; @@ -31,7 +31,7 @@ public class ProxyDoubleHistogramBuilder { public ProxyDoubleHistogramBuilder(DoubleHistogramBuilder delegate) { this.delegate = delegate; //apply default bucket boundaries - List boundaries = GlobalTracer.get().getConfig(MetricsConfiguration.class).getCustomMetricsHistogramBoundaries(); + List boundaries = GlobalTracer.get().getConfig(MetricsConfigurationImpl.class).getCustomMetricsHistogramBoundaries(); delegate.setExplicitBucketBoundariesAdvice(boundaries); } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyLongHistogramBuilder.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyLongHistogramBuilder.java index 4ff5bee219..a6b996466c 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyLongHistogramBuilder.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/src/main/java/co/elastic/apm/agent/embeddedotel/proxy/ProxyLongHistogramBuilder.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.embeddedotel.proxy; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.tracer.GlobalTracer; import io.opentelemetry.api.metrics.LongHistogramBuilder; @@ -32,7 +32,7 @@ public class ProxyLongHistogramBuilder { public ProxyLongHistogramBuilder(LongHistogramBuilder delegate) { this.delegate = delegate; //apply default bucket boundaries, they are guaranteed to be ordered - List boundaries = GlobalTracer.get().getConfig(MetricsConfiguration.class).getCustomMetricsHistogramBoundaries(); + List boundaries = GlobalTracer.get().getConfig(MetricsConfigurationImpl.class).getCustomMetricsHistogramBoundaries(); delegate.setExplicitBucketBoundariesAdvice(convertToLongBoundaries(boundaries)); } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/AbstractOtelMetricsTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/AbstractOtelMetricsTest.java index 185e47ad99..eea1cc5142 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/AbstractOtelMetricsTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/AbstractOtelMetricsTest.java @@ -22,11 +22,11 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import co.elastic.apm.agent.util.AtomicDouble; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.DoubleCounter; @@ -81,7 +81,7 @@ public abstract class AbstractOtelMetricsTest { protected static ConfigurationRegistry config; - private ReporterConfiguration reporterConfig; + private ReporterConfigurationImpl reporterConfig; /** * The meter provider is lazily initialized on first usage (when {@link #createMeter(String)} is called). @@ -99,7 +99,7 @@ public static synchronized void beforeAll() { reporter = mockInstrumentationSetup.getReporter(); //Metrics export should work even with instrument=false - CoreConfiguration coreConfig = config.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = config.getConfig(CoreConfigurationImpl.class); doReturn(false).when(coreConfig).isInstrument(); assertThat(tracer.isRunning()).isTrue(); @@ -115,7 +115,7 @@ public static synchronized void afterAll() { @BeforeEach public void setup() { SpyConfiguration.reset(config); - reporterConfig = config.getConfig(ReporterConfiguration.class); + reporterConfig = config.getConfig(ReporterConfigurationImpl.class); // we use explicit flush in tests instead of periodic reporting to prevent flakyness doReturn(1_000_000L).when(reporterConfig).getMetricsIntervalMs(); meterProvider = null; @@ -279,7 +279,7 @@ public void testSameMetricDifferentMeter() { @Test public void testDedotSettingIgnored() { - MetricsConfiguration config = tracer.getConfig(MetricsConfiguration.class); + MetricsConfigurationImpl config = tracer.getConfig(MetricsConfigurationImpl.class); doReturn(true).when(config).isDedotCustomMetrics(); Meter meter1 = createMeter("test"); @@ -295,7 +295,7 @@ public void testDedotSettingIgnored() { @Test public void testMetricDisabling() { - MetricsConfiguration config = tracer.getConfig(MetricsConfiguration.class); + MetricsConfigurationImpl config = tracer.getConfig(MetricsConfigurationImpl.class); doReturn(List.of( WildcardMatcher.valueOf("metric.a") )).when(reporterConfig).getDisableMetrics(); @@ -588,7 +588,7 @@ public void testUpDownCounter() { @Test public void testHistogram() { - MetricsConfiguration metricsConfig = config.getConfig(MetricsConfiguration.class); + MetricsConfigurationImpl metricsConfig = config.getConfig(MetricsConfigurationImpl.class); doReturn(List.of(5d, 10d, 25d)).when(metricsConfig).getCustomMetricsHistogramBoundaries(); Meter testMeter = createMeter("test"); @@ -641,7 +641,7 @@ public void testHistogram() { */ @Test public void testDefaultHistogramBuckets() { - MetricsConfiguration metricsConfig = config.getConfig(MetricsConfiguration.class); + MetricsConfigurationImpl metricsConfig = config.getConfig(MetricsConfigurationImpl.class); List boundaries = metricsConfig.getCustomMetricsHistogramBoundaries(); assertThat(boundaries).isNotEmpty(); diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/MetricExportTimingTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/MetricExportTimingTest.java index 21a934aa7d..d575f6a1ca 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/MetricExportTimingTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/MetricExportTimingTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.otelmetricsdk; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import org.junit.jupiter.api.Test; @@ -34,7 +34,7 @@ public class MetricExportTimingTest extends AbstractInstrumentationTest { */ @Test void testMetricExportIntervalRespected() throws Exception { - ReporterConfiguration reporterConfig = tracer.getConfig(ReporterConfiguration.class); + ReporterConfigurationImpl reporterConfig = tracer.getConfig(ReporterConfigurationImpl.class); doReturn(50L).when(reporterConfig).getMetricsIntervalMs(); try (SdkMeterProvider meterProvider = SdkMeterProvider.builder().build()) { diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/PrivateUserSdkOtelMetricsTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/PrivateUserSdkOtelMetricsTest.java index 5bd9e711cf..336b71bc13 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/PrivateUserSdkOtelMetricsTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/src/test/java/co/elastic/apm/agent/otelmetricsdk/PrivateUserSdkOtelMetricsTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.otelmetricsdk; -import co.elastic.apm.agent.configuration.MetricsConfiguration; +import co.elastic.apm.agent.configuration.MetricsConfigurationImpl; import io.opentelemetry.api.metrics.DoubleHistogram; import io.opentelemetry.api.metrics.DoubleHistogramBuilder; import io.opentelemetry.api.metrics.Meter; @@ -120,7 +120,7 @@ public void testCustomHistogramView() { View.builder().setAggregation(Aggregation.explicitBucketHistogram(List.of(1.0, 5.0))).build() ); - MetricsConfiguration metricsConfig = config.getConfig(MetricsConfiguration.class); + MetricsConfigurationImpl metricsConfig = config.getConfig(MetricsConfigurationImpl.class); doReturn(List.of(42.0)).when(metricsConfig).getCustomMetricsHistogramBoundaries(); Meter testMeter = createMeter("test"); diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/WithSpanInstrumentation.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/WithSpanInstrumentation.java index dda35da0d5..038179b1c6 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/WithSpanInstrumentation.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/WithSpanInstrumentation.java @@ -19,14 +19,15 @@ package co.elastic.apm.agent.opentelemetry; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.stacktrace.StacktraceConfiguration; +import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.opentelemetry.tracing.OTelHelper; import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -46,7 +47,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.classLoaderCanLoadClass; @@ -64,11 +64,11 @@ public class WithSpanInstrumentation extends AbstractOpenTelemetryInstrumentatio protected static final Tracer tracer = GlobalTracer.get(); private final CoreConfiguration coreConfig; - private final StacktraceConfiguration stacktraceConfig; + private final StacktraceConfigurationImpl stacktraceConfig; public WithSpanInstrumentation(ElasticApmTracer tracer) { coreConfig = tracer.getConfig(CoreConfiguration.class); - stacktraceConfig = tracer.getConfig(StacktraceConfiguration.class); + stacktraceConfig = tracer.getConfig(StacktraceConfigurationImpl.class); } @Override @@ -113,7 +113,7 @@ public static Object onMethodEnter( @Advice.Origin Method method, @Advice.AllArguments Object[] methodArguments) { - ElasticContext activeContext = tracer.currentContext(); + TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan == null) { logger.debug("Not creating span for {} because there is no currently active span.", signature); @@ -153,7 +153,7 @@ public static Object onMethodEnter( span.withName(spanName.isEmpty() ? signature : spanName) .activate(); - ((co.elastic.apm.agent.impl.transaction.Span) span).withOtelKind(OTelHelper.map(otelKind)); + ((SpanImpl) span).withOtelKind(OTelHelper.map(otelKind)); return span; } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/baggage/OtelBaggage.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/baggage/OtelBaggage.java index c4f77684b7..d037722c84 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/baggage/OtelBaggage.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/baggage/OtelBaggage.java @@ -18,6 +18,7 @@ */ package co.elastic.apm.agent.opentelemetry.baggage; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import io.opentelemetry.api.baggage.Baggage; @@ -26,9 +27,9 @@ public class OtelBaggage { - private static final WeakMap translationCache = WeakConcurrent.buildMap(); + private static final WeakMap translationCache = WeakConcurrent.buildMap(); - public static Baggage fromElasticBaggage(co.elastic.apm.agent.impl.baggage.Baggage elasticBaggage) { + public static Baggage fromElasticBaggage(BaggageImpl elasticBaggage) { BaggageBuilder builder = Baggage.builder(); for (String key : elasticBaggage.keys()) { builder.put(key, elasticBaggage.get(key), BaggageEntryMetadata.create(elasticBaggage.getMetadata(key))); @@ -39,13 +40,13 @@ public static Baggage fromElasticBaggage(co.elastic.apm.agent.impl.baggage.Bagga return result; } - public static co.elastic.apm.agent.impl.baggage.Baggage toElasticBaggage(Baggage otelBaggage) { + public static BaggageImpl toElasticBaggage(Baggage otelBaggage) { if (otelBaggage == null || otelBaggage.isEmpty()) { - return co.elastic.apm.agent.impl.baggage.Baggage.EMPTY; + return BaggageImpl.EMPTY; } - co.elastic.apm.agent.impl.baggage.Baggage translated = translationCache.get(otelBaggage); + BaggageImpl translated = translationCache.get(otelBaggage); if (translated == null) { - co.elastic.apm.agent.impl.baggage.Baggage.Builder builder = co.elastic.apm.agent.impl.baggage.Baggage.builder(); + BaggageImpl.Builder builder = BaggageImpl.builder(); otelBaggage.forEach((key, value) -> { String metadata = value.getMetadata().getValue(); builder.put(key, value.getValue(), metadata.isEmpty() ? null : metadata); diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/context/OTelContextStorage.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/context/OTelContextStorage.java index 0a57567a16..0c3075c6e7 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/context/OTelContextStorage.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/context/OTelContextStorage.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.opentelemetry.context; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.ElasticContext; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; import co.elastic.apm.agent.opentelemetry.tracing.OTelBridgeContext; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -66,7 +66,7 @@ public Scope attach(@Nullable Context toAttach) { @Nullable @Override public Context current() { - ElasticContext current = tracer.currentContext(); + TraceStateImpl current = tracer.currentContext(); if (current.isEmpty()) { return null; } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelBridgeContext.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelBridgeContext.java index 1de40831e2..1f52d4dfbf 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelBridgeContext.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelBridgeContext.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.opentelemetry.tracing; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; import co.elastic.apm.agent.opentelemetry.baggage.OtelBaggage; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; @@ -32,9 +32,9 @@ import java.util.Objects; /** - * Bridge implementation of OpenTelemetry {@link Context} that allows to provide compatibility with {@link ElasticContext}. + * Bridge implementation of OpenTelemetry {@link Context} that allows to provide compatibility with {@link TraceStateImpl}. */ -public class OTelBridgeContext extends ElasticContext implements Context, Scope { +public class OTelBridgeContext extends TraceStateImpl implements Context, Scope { /** * Original root context as returned by {@link Context#root()} before instrumentation. @@ -86,7 +86,7 @@ public static OTelBridgeContext bridgeRootContext(ElasticApmTracer tracer, Conte * @param currentContext elastic (currently active) context * @return bridged context with span as active */ - public static OTelBridgeContext wrapElasticActiveSpan(ElasticApmTracer tracer, ElasticContext currentContext) { + public static OTelBridgeContext wrapElasticActiveSpan(ElasticApmTracer tracer, TraceStateImpl currentContext) { if (root == null) { // Ensure that root context is being accessed at least once to capture the original root // OTel 1.0 directly calls ArrayBasedContext.root() which is not publicly accessible, later versions delegate @@ -108,7 +108,7 @@ public static OTelBridgeContext wrapElasticActiveSpan(ElasticApmTracer tracer, E @Nullable @Override - public AbstractSpan getSpan() { + public AbstractSpanImpl getSpan() { // get otel span from context Span span = Span.fromContext(otelContext); if (span instanceof OTelSpan) { @@ -118,11 +118,11 @@ public AbstractSpan getSpan() { } @Override - public Baggage getBaggage() { + public BaggageImpl getBaggage() { io.opentelemetry.api.baggage.Baggage otelBaggage = io.opentelemetry.api.baggage.Baggage.fromContext(otelContext); if (otelBaggage == null || otelBaggage.isEmpty()) { - return Baggage.EMPTY; + return BaggageImpl.EMPTY; } return OtelBaggage.toElasticBaggage(otelBaggage); } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java index e107c16313..140be3594e 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpan.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.opentelemetry.tracing; -import co.elastic.apm.agent.impl.context.Url; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.impl.transaction.OTelSpanKind; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; @@ -46,9 +47,9 @@ public class OTelSpan implements Span { static final String ILLEGAL_ATTRIBUTE_VALUE_TYPE_MESSAGE_FORMAT = "`%s` attribute's value type must be boolean, `%s` is illegal"; private static final Logger eventLogger = LoggerUtils.logOnce(LoggerFactory.getLogger(OTelSpan.class)); - private final AbstractSpan span; + private final AbstractSpanImpl span; - public OTelSpan(AbstractSpan span) { + public OTelSpan(AbstractSpanImpl span) { this.span = span; span.incrementReferences(); } @@ -113,17 +114,17 @@ public Span updateName(String name) { @Override public void end() { - if (span instanceof Transaction) { - onTransactionEnd((Transaction) span); - } else if (span instanceof co.elastic.apm.agent.impl.transaction.Span) { - onSpanEnd((co.elastic.apm.agent.impl.transaction.Span) span); + if (span instanceof TransactionImpl) { + onTransactionEnd((TransactionImpl) span); + } else if (span instanceof SpanImpl) { + onSpanEnd((SpanImpl) span); } span.end(); } - private void onTransactionEnd(Transaction t) { + private void onTransactionEnd(TransactionImpl t) { Map attributes = span.getOtelAttributes(); boolean isRpc = attributes.containsKey("rpc.system"); @@ -142,7 +143,7 @@ private void onTransactionEnd(Transaction t) { t.setFrameworkVersion(VersionUtils.getVersion(OpenTelemetry.class, "io.opentelemetry", "opentelemetry-api")); } - private void onSpanEnd(co.elastic.apm.agent.impl.transaction.Span s) { + private void onSpanEnd(SpanImpl s) { Map attributes = s.getOtelAttributes(); @@ -224,7 +225,7 @@ private void onSpanEnd(co.elastic.apm.agent.impl.transaction.Span s) { } } - netPort = Url.normalizePort(netPort, httpScheme); + netPort = UrlImpl.normalizePort(netPort, httpScheme); s.getContext().getServiceTarget() .withType(subType) @@ -264,10 +265,10 @@ private static URI parseURI(@Nullable String s) { @Override public void end(long timestamp, TimeUnit unit) { - if (span instanceof Transaction) { - onTransactionEnd((Transaction) span); - } else if (span instanceof co.elastic.apm.agent.impl.transaction.Span) { - onSpanEnd((co.elastic.apm.agent.impl.transaction.Span) span); + if (span instanceof TransactionImpl) { + onTransactionEnd((TransactionImpl) span); + } else if (span instanceof SpanImpl) { + onSpanEnd((SpanImpl) span); } span.end(unit.toMicros(timestamp)); } @@ -282,7 +283,7 @@ public boolean isRecording() { return span.isSampled(); } - public AbstractSpan getInternalSpan() { + public AbstractSpanImpl getInternalSpan() { return span; } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java index ef550e9d0e..659965fdef 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java @@ -19,11 +19,11 @@ package co.elastic.apm.agent.opentelemetry.tracing; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.baggage.Baggage; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.baggage.BaggageImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.impl.transaction.MultiValueMapAccessor; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.opentelemetry.baggage.OtelBaggage; import co.elastic.apm.agent.sdk.internal.util.LoggerUtils; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; @@ -147,10 +147,10 @@ public SpanBuilder setStartTimestamp(long startTimestamp, TimeUnit unit) { @Override public Span startSpan() { - AbstractSpan span; + AbstractSpanImpl span; - Baggage parentBaggage; - AbstractSpan parentSpan = null; + BaggageImpl parentBaggage; + AbstractSpanImpl parentSpan = null; Context remoteContext = null; if (parent != null) { @@ -181,8 +181,8 @@ public Span startSpan() { } span.withName(spanName); - if (span instanceof Transaction) { - Transaction t = ((Transaction) span); + if (span instanceof TransactionImpl) { + TransactionImpl t = ((TransactionImpl) span); t.setFrameworkName("OpenTelemetry API"); String otelVersion = VersionUtils.getVersion(OpenTelemetry.class, "io.opentelemetry", "opentelemetry-api"); @@ -199,7 +199,7 @@ public Span startSpan() { // Add the links to the span for (int i = 0; i < links.size(); i++) { - span.addSpanLink(TraceContext.fromParentContext(), ((OTelSpanContext) links.get(i)).getElasticTraceContext()); + span.addSpanLink(TraceContextImpl.fromParentContext(), ((OTelSpanContext) links.get(i)).getElasticTraceContext()); } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanContext.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanContext.java index 74700ccd15..b5cc133882 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanContext.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanContext.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.opentelemetry.tracing; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import io.opentelemetry.api.trace.SpanContext; import io.opentelemetry.api.trace.TraceFlags; import io.opentelemetry.api.trace.TraceState; @@ -28,11 +28,11 @@ import java.util.List; public class OTelSpanContext implements SpanContext { - private final TraceContext traceContext; + private final TraceContextImpl traceContext; - protected TraceContext getElasticTraceContext() {return traceContext;} + protected TraceContextImpl getElasticTraceContext() {return traceContext;} - public OTelSpanContext(TraceContext traceContext) { + public OTelSpanContext(TraceContextImpl traceContext) { this.traceContext = traceContext; } diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/metrics/EmbeddedMetricSDKShutdownTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/metrics/EmbeddedMetricSDKShutdownTest.java index a95572aff4..c64671248f 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/metrics/EmbeddedMetricSDKShutdownTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/metrics/EmbeddedMetricSDKShutdownTest.java @@ -23,7 +23,7 @@ import co.elastic.apm.agent.bci.ElasticApmAgent; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.opentelemetry.OtelTestUtils; -import co.elastic.apm.agent.report.ReporterConfiguration; +import co.elastic.apm.agent.report.ReporterConfigurationImpl; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.metrics.LongCounter; import io.opentelemetry.api.metrics.Meter; @@ -47,7 +47,7 @@ public void verifyMetricsFlushedOnAgentShutdown() { ElasticApmTracer tracer = mockInstrumentationSetup.getTracer(); MockReporter reporter = mockInstrumentationSetup.getReporter(); - ReporterConfiguration reporterConfig = mockInstrumentationSetup.getConfig().getConfig(ReporterConfiguration.class); + ReporterConfigurationImpl reporterConfig = mockInstrumentationSetup.getConfig().getConfig(ReporterConfigurationImpl.class); doReturn(1_000_000L).when(reporterConfig).getMetricsIntervalMs(); assertThat(tracer.isRunning()).isTrue(); ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install()); diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryAnnotationsTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryAnnotationsTest.java index 91d1580d7b..e78a7ac679 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryAnnotationsTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryAnnotationsTest.java @@ -18,8 +18,9 @@ */ package co.elastic.apm.agent.opentelemetry.tracing; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.assertions.Assertions; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanKind; @@ -55,7 +56,7 @@ public void after() { public void withSpanAnnotationTestWithMethodSignatureSpanName() { executeSpanInTransactionAndAssertTransaction((ignore) -> fooSpan()); - co.elastic.apm.agent.impl.transaction.Span firstSpan = reporter.getFirstSpan(); + SpanImpl firstSpan = reporter.getFirstSpan(); assertThat(firstSpan.getNameAsString()).isEqualTo("ElasticOpenTelemetryAnnotationsTest#fooSpan"); assertThat(reporter.getFirstSpan().isChildOf(reporter.getFirstTransaction())).isTrue(); } @@ -64,7 +65,7 @@ public void withSpanAnnotationTestWithMethodSignatureSpanName() { public void withSpanAnnotationTestWithSpanNameFromAnnotation() { executeSpanInTransactionAndAssertTransaction((ignore) -> barSpan()); - co.elastic.apm.agent.impl.transaction.Span firstSpan = reporter.getFirstSpan(); + SpanImpl firstSpan = reporter.getFirstSpan(); assertThat(firstSpan.getNameAsString()).isEqualTo("barSpan"); assertThat(reporter.getFirstSpan().isChildOf(reporter.getFirstTransaction())).isTrue(); } @@ -73,7 +74,7 @@ public void withSpanAnnotationTestWithSpanNameFromAnnotation() { public void withSpanAnnotationSpanAttributes() { executeSpanInTransactionAndAssertTransaction((ignore) -> fooSpanWithAttrs("foobar", "objectAsString", 2073, 2.69)); - co.elastic.apm.agent.impl.transaction.Span firstSpan = reporter.getFirstSpan(); + SpanImpl firstSpan = reporter.getFirstSpan(); assertThat(firstSpan.getNameAsString()).isEqualTo("ElasticOpenTelemetryAnnotationsTest#fooSpanWithAttrs"); assertThat(firstSpan.isChildOf(reporter.getFirstTransaction())).isTrue(); assertThat(firstSpan.getOtelAttributes().get("attr1")).isEqualTo("foobar"); @@ -93,7 +94,7 @@ private void executeSpanInTransactionAndAssertTransaction(Consumer function) assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getSpans()).hasSize(1); - Transaction reportedTransaction = reporter.getFirstTransaction(); + TransactionImpl reportedTransaction = reporter.getFirstTransaction(); assertThat(reportedTransaction.getNameAsString()).isEqualTo("transaction"); } @@ -122,7 +123,7 @@ protected void fooSpanWithAttrs(@SpanAttribute("attr1") String string, private void checkNoActiveContext() { Assertions.assertThat(tracer.currentContext()) .describedAs("no active elastic context is expected") - .satisfies(ElasticContext::isEmpty); + .satisfies(TraceStateImpl::isEmpty); assertThat(Context.current()) .describedAs("no active otel context is expected") .isSameAs(Context.root()) diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryTest.java index 2c0a5ee8c2..e814e69645 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/ElasticOpenTelemetryTest.java @@ -18,10 +18,7 @@ */ package co.elastic.apm.agent.opentelemetry.tracing; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; -import co.elastic.apm.agent.impl.transaction.OTelSpanKind; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.*; import co.elastic.apm.agent.opentelemetry.SemAttributes; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.dispatch.TextHeaderSetter; @@ -71,7 +68,7 @@ public void testTransaction() { } assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo("transaction"); assertThat(transaction.getBaggage()) .hasSize(1) @@ -94,7 +91,7 @@ public void testTracerBuilder() { .end(); assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo("transaction"); } @@ -109,7 +106,7 @@ public void testTransactionWithAttribute() { .end(); assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getOtelAttributes().get("boolean")).isEqualTo(true); assertThat(transaction.getOtelAttributes().get("long")).isEqualTo(42L); @@ -120,7 +117,7 @@ public void testTransactionWithAttribute() { @Test public void testBaggageInteroperability() { - ElasticContext elasticContext = tracer.currentContext().withUpdatedBaggage() + TraceStateImpl elasticContext = tracer.currentContext().withUpdatedBaggage() .put("foo", "elastic") .put("bar", "el2", "metadata") .buildContext() @@ -160,7 +157,7 @@ public void testTransactionWithSpanManualPropagation() { assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getSpans()).hasSize(1); - Transaction reportedTransaction = reporter.getFirstTransaction(); + TransactionImpl reportedTransaction = reporter.getFirstTransaction(); assertThat(reportedTransaction.getNameAsString()).isEqualTo("transaction"); assertThat(reporter.getFirstSpan().getNameAsString()).isEqualTo("span"); @@ -193,11 +190,11 @@ public void testOtelBaggageOnElasticSpan() { Baggage baggage = Baggage.builder().put("foo", "bar").build(); try (Scope scope = baggage.makeCurrent()) { - Transaction tr = tracer.startRootTransaction(null).activate(); + TransactionImpl tr = tracer.startRootTransaction(null).activate(); assertThat(tr).hasBaggage("foo", "bar"); Baggage baggage2 = Baggage.builder().put("foo2", "bar2").build(); try (Scope scope2 = baggage2.makeCurrent()) { - co.elastic.apm.agent.impl.transaction.Span elasticSpan = tracer.currentContext().createSpan(); + SpanImpl elasticSpan = tracer.currentContext().createSpan(); assertThat(elasticSpan) .hasBaggage("foo2", "bar2") .hasBaggageCount(1); @@ -284,8 +281,8 @@ public void otelBridgedRootContext() { .isSameAs(Context.current()); } - public ElasticContext checkBridgedContext(Context context) { - assertThat(context).isInstanceOf(ElasticContext.class); + public TraceStateImpl checkBridgedContext(Context context) { + assertThat(context).isInstanceOf(TraceStateImpl.class); // we have to check class name as the wrapper class is loaded in the plugin CL and it is also loadable from // the current CL, thus making class equality not work as expected @@ -293,7 +290,7 @@ public ElasticContext checkBridgedContext(Context context) { .describedAs("root context should be wrapped") .doesNotStartWith("io.opentelemetry"); - return (ElasticContext) context; + return (TraceStateImpl) context; } @Test @@ -349,7 +346,7 @@ private static void checkCurrentContext(Context expected, String assertMsg) { assertThat(expected) .describedAs("otel context should also be an elastic context") - .isInstanceOf(ElasticContext.class); + .isInstanceOf(TraceStateImpl.class); assertThat(tracer.currentContext()) .describedAs(assertMsg) @@ -415,7 +412,7 @@ public void contextActivationFromElastic() { ContextKey key = ContextKey.named("key"); Context context = Context.root().with(key, "value"); - ElasticContext bridgedContext = checkBridgedContext(context); + TraceStateImpl bridgedContext = checkBridgedContext(context); // activate context from elastic API using a bridged context try (co.elastic.apm.agent.tracer.Scope scope = bridgedContext.activateInScope()) { @@ -456,7 +453,7 @@ private void checkCurrentContextKey(ContextKey key, String expectedValue private void checkNoActiveContext() { assertThat(tracer.currentContext()) .describedAs("no active elastic context is expected") - .satisfies(ElasticContext::isEmpty); + .satisfies(TraceStateImpl::isEmpty); assertThat(Context.current()) .describedAs("no active otel context is expected") .isSameAs(Context.root()) @@ -466,7 +463,7 @@ private void checkNoActiveContext() { @Test public void otelStateWithActiveElasticTransaction() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); try { assertThat(tracer.currentContext()).isSameAs(transaction); @@ -493,7 +490,7 @@ public void otelStateWithActiveElasticTransaction() { @Test public void otelSpanOverActiveElasticTransaction() { - Transaction transaction = startTestRootTransaction(); + TransactionImpl transaction = startTestRootTransaction(); String spanId; try { @@ -520,7 +517,7 @@ public void otelSpanOverActiveElasticTransaction() { assertThat(reporter.getFirstTransaction()).isSameAs(transaction); assertThat(reporter.getNumReportedSpans()).isEqualTo(1); - AbstractSpan reportedSpan = reporter.getFirstSpan().getSpan(); + AbstractSpanImpl reportedSpan = reporter.getFirstSpan().getSpan(); assertThat(reportedSpan).isNotNull(); assertThat(reportedSpan.getNameAsString()).isEqualTo("otel span"); assertThat(reportedSpan.getTraceContext().getId().toString()).isEqualTo(spanId); @@ -529,7 +526,7 @@ public void otelSpanOverActiveElasticTransaction() { @Test public void overrideElasticTransactionName() { - Transaction transaction = startTestRootTransaction() + TransactionImpl transaction = startTestRootTransaction() .withName("Elastic Provided High-Prio Name", co.elastic.apm.agent.tracer.AbstractSpan.PRIORITY_USER_SUPPLIED); try { @@ -552,13 +549,13 @@ public void elasticSpanOverOtelSpan() { .spanBuilder("otel transaction") .startSpan(); - Transaction transaction; + TransactionImpl transaction; try (Scope scope = otelSpan.makeCurrent()) { transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); - co.elastic.apm.agent.impl.transaction.Span elasticSpan = transaction.createSpan(); + SpanImpl elasticSpan = transaction.createSpan(); try (co.elastic.apm.agent.tracer.Scope elasticScope = elasticSpan.activateInScope()) { assertThat(tracer.getActive()).isNotNull(); tracer.getActive().withName("elastic span"); @@ -578,7 +575,7 @@ public void elasticSpanOverOtelSpan() { assertThat(transaction.getNameAsString()).isEqualTo("otel transaction"); assertThat(reporter.getNumReportedSpans()).isEqualTo(1); - AbstractSpan reportedSpan = reporter.getFirstSpan().getSpan(); + AbstractSpanImpl reportedSpan = reporter.getFirstSpan().getSpan(); assertThat(reportedSpan).isNotNull(); assertThat(reportedSpan.getNameAsString()).isEqualTo("elastic span"); assertThat(reportedSpan.getTraceContext().isChildOf(transaction.getTraceContext())).isTrue(); @@ -605,7 +602,7 @@ public void testOTelSpanAttributesCopiedAsIs() { )); } - private static void checkOTelAttributes(AbstractSpan context, Map expected) { + private static void checkOTelAttributes(AbstractSpanImpl context, Map expected) { assertThat(context.getOtelAttributes()) .containsAllEntriesOf(expected) .hasSameSizeAs(expected); @@ -662,7 +659,7 @@ public void startEndWithExplicitTimestamp() { } assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getNameAsString()).isEqualTo("transaction"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(transaction.getTimestamp()).isEqualTo(startTransaction.toEpochMilli() * 1000); @@ -671,7 +668,7 @@ public void startEndWithExplicitTimestamp() { assertThat(reporter.getSpans()).hasSize(1); - co.elastic.apm.agent.impl.transaction.Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getNameAsString()).isEqualTo("span"); assertThat(span.getOutcome()).isEqualTo(Outcome.UNKNOWN); assertThat(span.getTimestamp()).isEqualTo(startSpan.toEpochMilli() * 1000); diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanDiscardingTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanDiscardingTest.java index 6ff7903bd0..9948dd67df 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanDiscardingTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanDiscardingTest.java @@ -18,7 +18,8 @@ */ package co.elastic.apm.agent.opentelemetry.tracing; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; @@ -41,7 +42,7 @@ public class OTelSpanDiscardingTest extends AbstractOpenTelemetryTest { @Before public void before() { - doReturn(TimeDuration.of("100ms")).when(config.getConfig(CoreConfiguration.class)).getSpanMinDuration(); + doReturn(TimeDuration.of("100ms")).when(config.getConfig(CoreConfigurationImpl.class)).getSpanMinDuration(); } @Test @@ -90,7 +91,7 @@ private void runTest(Scenario scenario) { } transaction.end(); assertThat(reporter.getTransactions()).hasSize(1); - List spans = reporter.getSpans(); + List spans = reporter.getSpans(); switch (scenario) { case DISCARD: case DISCARD_SET_EXPLICITLY: diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanLinkTest.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanLinkTest.java index ea1a8b10b0..60c1cd3a93 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanLinkTest.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanLinkTest.java @@ -21,7 +21,7 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.opentelemetry.global.ElasticOpenTelemetry; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; @@ -62,12 +62,12 @@ void checkSpanLinks(int linkCount, boolean withAttributes) { SpanBuilder spanbuilder = tracer.spanBuilder("span"); assertThat(spanbuilder).isInstanceOf(OTelSpanBuilder.class); - TraceContext[] contexts = new TraceContext[linkCount]; + TraceContextImpl[] contexts = new TraceContextImpl[linkCount]; AttributesBuilder builder = Attributes.builder(); builder.put("key1", 33); builder.put("key2", true); for (int i = 0; i < linkCount; i++) { - TraceContext traceContext1 = TraceContext.with64BitId(etracer); + TraceContextImpl traceContext1 = TraceContextImpl.with64BitId(etracer); traceContext1.asRootSpan(ConstantSampler.of(false)); SpanContext context1 = new OTelSpanContext(traceContext1); if (withAttributes) { @@ -81,7 +81,7 @@ void checkSpanLinks(int linkCount, boolean withAttributes) { } OTelSpan span = (OTelSpan) spanbuilder.startSpan(); - List links = span.getInternalSpan().getSpanLinks(); + List links = span.getInternalSpan().getSpanLinks(); assertThat(links.size()).isEqualTo(linkCount); for (int i = 0; i < linkCount; i++) { diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/specs/OTelBridgeStepsDefinitions.java b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/specs/OTelBridgeStepsDefinitions.java index c1d00c1029..dea9a4cb24 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/specs/OTelBridgeStepsDefinitions.java +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/test/java/specs/OTelBridgeStepsDefinitions.java @@ -18,12 +18,9 @@ */ package specs; -import co.elastic.apm.agent.impl.context.ServiceTarget; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.OTelSpanKind; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.impl.transaction.*; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.opentelemetry.global.ElasticOpenTelemetry; import co.elastic.apm.agent.opentelemetry.tracing.ElasticOpenTelemetryTest; import co.elastic.apm.agent.opentelemetry.tracing.OTelSpan; @@ -100,7 +97,7 @@ public void createOTelSpanWithRemoteContext() { @Then("Elastic bridged transaction has remote context as parent") public void bridgedTransactionWithRemoteContextParent() { - TraceContext traceContext = getBridgedTransaction().getTraceContext(); + TraceContextImpl traceContext = getBridgedTransaction().getTraceContext(); assertThat(traceContext.isRoot()).isFalse(); assertThat(traceContext.getParentId().toString()).isEqualTo(REMOTE_PARENT_ID); assertThat(traceContext.getTraceId().toString()).isEqualTo(REMOTE_PARENT_TRACE_ID); @@ -125,7 +122,7 @@ public void createOTelSpanWithoutParent(){ @Then("Elastic bridged transaction is a root transaction") public void bridgedTransactionIsRootTransaction() { - TraceContext traceContext = getBridgedTransaction().getTraceContext(); + TraceContextImpl traceContext = getBridgedTransaction().getTraceContext(); assertThat(traceContext.isRoot()).isTrue(); } @@ -146,7 +143,7 @@ public void bridgedSpanHasLocalParent() { SpanContext otelParentContext = io.opentelemetry.api.trace.Span.fromContext(localParentContext).getSpanContext(); - TraceContext bridgedSpanContext = getBridgedSpan().getTraceContext(); + TraceContextImpl bridgedSpanContext = getBridgedSpan().getTraceContext(); assertThat(bridgedSpanContext.getTraceId().toString()).isEqualTo(otelParentContext.getTraceId()); assertThat(bridgedSpanContext.getParentId().toString()).isEqualTo(otelParentContext.getSpanId()); } @@ -157,7 +154,7 @@ public void bridgedSpanHasLocalParent() { public void otelSpanIsCreatedWithKind(String kind) { // we have to use a parent transaction as we are creating a span // the parent transaction is created by another step definition, thus we reuse the existing state - Transaction parentTransaction = state.getTransaction(); + TransactionImpl parentTransaction = state.getTransaction(); Function createSpanWithKind = k -> { SpanBuilder spanBuilder = getOtel().getTracer("") @@ -262,14 +259,14 @@ public void bridgeSpanType(String type) { @Then("Elastic bridged {contextType} type is {string}") public void bridgeObjectType(String contextType, String expected) { - AbstractSpan bridgedObject = getBridgedAbstractSpan(); + AbstractSpanImpl bridgedObject = getBridgedAbstractSpan(); String type; - if (bridgedObject instanceof Transaction) { + if (bridgedObject instanceof TransactionImpl) { assertThat(contextType).isEqualTo("transaction"); - type = ((Transaction) bridgedObject).getType(); + type = ((TransactionImpl) bridgedObject).getType(); } else { assertThat(contextType).isEqualTo("span"); - type = ((Span) bridgedObject).getType(); + type = ((SpanImpl) bridgedObject).getType(); } assertThat(type).isEqualTo(expected); @@ -315,7 +312,7 @@ public void bridgedTransactionResultNull() { @Then("Elastic bridged span service target type is {string} and name is {string}") public void bridgedSpanTargetServiceType(String type, String name) { - ServiceTarget serviceTarget = getBridgedSpan().getContext().getServiceTarget(); + ServiceTargetImpl serviceTarget = getBridgedSpan().getContext().getServiceTarget(); assertThat(serviceTarget).hasType(type); if (name != null && !name.isEmpty()) { @@ -337,20 +334,20 @@ public void otelSpanEnds() { otelSpan.end(); } - private AbstractSpan getBridgedAbstractSpan() { - return getBridgedObject(AbstractSpan.class); + private AbstractSpanImpl getBridgedAbstractSpan() { + return getBridgedObject(AbstractSpanImpl.class); } - private Transaction getBridgedTransaction() { - return getBridgedObject(Transaction.class); + private TransactionImpl getBridgedTransaction() { + return getBridgedObject(TransactionImpl.class); } - private Span getBridgedSpan() { - return getBridgedObject(Span.class); + private SpanImpl getBridgedSpan() { + return getBridgedObject(SpanImpl.class); } - private > T getBridgedObject(Class expectedType) { - AbstractSpan internalSpan = otelSpan.getInternalSpan(); + private > T getBridgedObject(Class expectedType) { + AbstractSpanImpl internalSpan = otelSpan.getInternalSpan(); assertThat(internalSpan).isInstanceOf(expectedType); return expectedType.cast(internalSpan); } diff --git a/apm-agent-plugins/apm-opentelemetry/pom.xml b/apm-agent-plugins/apm-opentelemetry/pom.xml index aea7599cd0..4130599fa6 100644 --- a/apm-agent-plugins/apm-opentelemetry/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/pom.xml @@ -36,7 +36,6 @@ - ${project.groupId} apm-agent-core diff --git a/apm-agent-plugins/apm-opentracing-plugin/pom.xml b/apm-agent-plugins/apm-opentracing-plugin/pom.xml index b72bd68386..fdeee8763a 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentracing-plugin/pom.xml @@ -16,7 +16,6 @@ - ${project.groupId} apm-agent-core diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmScopeInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmScopeInstrumentation.java index e3becb8cca..92212b8cfc 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmScopeInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmScopeInstrumentation.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.opentracingimpl; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -34,8 +34,8 @@ public class ApmScopeInstrumentation extends OpenTracingBridgeInstrumentation { public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void release(@Advice.Argument(value = 0, typing = Assigner.Typing.DYNAMIC) @Nullable Object context) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).deactivate(); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).deactivate(); } } } diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanBuilderInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanBuilderInstrumentation.java index b343ba3fe0..90a4b0ac35 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanBuilderInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanBuilderInstrumentation.java @@ -21,9 +21,9 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.impl.sampling.Sampler; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -76,28 +76,28 @@ public static Object createSpan(@Advice.Argument(value = 0, typing = Assigner.Ty @Advice.FieldValue(value = "operationName") String operationName, @Advice.FieldValue(value = "microseconds") long microseconds, @Advice.Argument(1) @Nullable Iterable> baggage) { - AbstractSpan parent = null; - if (parentContext instanceof AbstractSpan) { - parent = (AbstractSpan) parentContext; + AbstractSpanImpl parent = null; + if (parentContext instanceof AbstractSpanImpl) { + parent = (AbstractSpanImpl) parentContext; } return doCreateTransactionOrSpan(parent, tags, operationName, microseconds, baggage, PrivilegedActionUtils.getClassLoader(spanBuilderClass)); } @Nullable - public static AbstractSpan doCreateTransactionOrSpan(@Nullable AbstractSpan parentContext, - Map tags, - String operationName, long microseconds, - @Nullable Iterable> baggage, ClassLoader applicationClassLoader) { - AbstractSpan result = null; + public static AbstractSpanImpl doCreateTransactionOrSpan(@Nullable AbstractSpanImpl parentContext, + Map tags, + String operationName, long microseconds, + @Nullable Iterable> baggage, ClassLoader applicationClassLoader) { + AbstractSpanImpl result = null; ElasticApmTracer tracer = OpenTracingBridgeInstrumentation.tracer.require(ElasticApmTracer.class); if (tracer != null) { if (parentContext == null) { result = createTransaction(tags, operationName, microseconds, baggage, tracer, applicationClassLoader); } else { if (microseconds >= 0) { - result = tracer.startSpan(TraceContext.fromParent(), parentContext, parentContext.getBaggage(), microseconds); + result = tracer.startSpan(TraceContextImpl.fromParent(), parentContext, parentContext.getBaggage(), microseconds); } else { - result = tracer.startSpan(TraceContext.fromParent(), parentContext, parentContext.getBaggage()); + result = tracer.startSpan(TraceContextImpl.fromParent(), parentContext, parentContext.getBaggage()); } } } @@ -116,8 +116,8 @@ public static AbstractSpan doCreateTransactionOrSpan(@Nullable AbstractSpan createTransaction(Map tags, String operationName, long microseconds, - @Nullable Iterable> baggage, ElasticApmTracer tracer, ClassLoader classLoader) { + private static AbstractSpanImpl createTransaction(Map tags, String operationName, long microseconds, + @Nullable Iterable> baggage, ElasticApmTracer tracer, ClassLoader classLoader) { if ("client".equals(tags.get("span.kind"))) { logger.info("Ignoring transaction '{}', as a span.kind client can never be a transaction. " + "Consider creating a span for the whole request.", operationName); @@ -130,7 +130,7 @@ private static AbstractSpan createTransaction(Map tags, Strin } else { sampler = tracer.getSampler(); } - Transaction transaction = tracer.startChildTransaction(baggage, OpenTracingTextMapBridge.instance(), sampler, microseconds, classLoader); + TransactionImpl transaction = tracer.startChildTransaction(baggage, OpenTracingTextMapBridge.instance(), sampler, microseconds, classLoader); if (transaction != null) { transaction.setFrameworkName(FRAMEWORK_NAME); } diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanInstrumentation.java index 09a7e4c5b7..db9d43842e 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ApmSpanInstrumentation.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.opentracingimpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.util.ResultUtil; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -66,15 +66,15 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void finishInternal(@Advice.FieldValue(value = "dispatcher", typing = Assigner.Typing.DYNAMIC) @Nullable Object context, @Advice.Argument(0) long finishMicros) { - if (context instanceof AbstractSpan) { - doFinishInternal((AbstractSpan) context, finishMicros); + if (context instanceof AbstractSpanImpl) { + doFinishInternal((AbstractSpanImpl) context, finishMicros); } } - public static void doFinishInternal(AbstractSpan abstractSpan, long finishMicros) { + public static void doFinishInternal(AbstractSpanImpl abstractSpan, long finishMicros) { abstractSpan.incrementReferences(); - if (abstractSpan instanceof Transaction) { - Transaction transaction = (Transaction) abstractSpan; + if (abstractSpan instanceof TransactionImpl) { + TransactionImpl transaction = (TransactionImpl) abstractSpan; if (transaction.getType() == null) { if (transaction.getContext().getRequest().hasContent()) { transaction.withType(co.elastic.apm.agent.tracer.Transaction.TYPE_REQUEST); @@ -99,8 +99,8 @@ public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void setOperationName(@Advice.FieldValue(value = "dispatcher", typing = Assigner.Typing.DYNAMIC) @Nullable Object context, @Advice.Argument(0) @Nullable String operationName) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).withName(operationName, PRIORITY_USER_SUPPLIED); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).withName(operationName, PRIORITY_USER_SUPPLIED); } else { logger.warn("Calling setOperationName on an already finished span"); } @@ -119,8 +119,8 @@ public static void log(@Advice.FieldValue(value = "dispatcher", typing = Assigne @Advice.Argument(0) long epochTimestampMicros, @Advice.Argument(1) Map fields) { - if (context instanceof AbstractSpan) { - AbstractSpan span = (AbstractSpan) context; + if (context instanceof AbstractSpanImpl) { + AbstractSpanImpl span = (AbstractSpanImpl) context; if ("error".equals(fields.get("event"))) { final Object errorObject = fields.get("error.object"); if (errorObject instanceof Throwable) { @@ -152,28 +152,28 @@ public static void handleTag(@Advice.FieldValue(value = "dispatcher", typing = A if (value == null) { return; } - if (abstractSpanObj instanceof Transaction) { - handleTransactionTag((Transaction) abstractSpanObj, key, value); - } else if (abstractSpanObj instanceof Span) { - handleSpanTag((Span) abstractSpanObj, key, value); + if (abstractSpanObj instanceof TransactionImpl) { + handleTransactionTag((TransactionImpl) abstractSpanObj, key, value); + } else if (abstractSpanObj instanceof SpanImpl) { + handleSpanTag((SpanImpl) abstractSpanObj, key, value); } else { logger.warn("Calling setTag on an already finished span"); } } - private static void handleTransactionTag(Transaction transaction, String key, Object value) { + private static void handleTransactionTag(TransactionImpl transaction, String key, Object value) { if (!handleSpecialTransactionTag(transaction, key, value)) { addTag(transaction, key, value); } } - private static void handleSpanTag(Span span, String key, Object value) { + private static void handleSpanTag(SpanImpl span, String key, Object value) { if (!handleSpecialSpanTag(span, key, value)) { addTag(span, key, value); } } - private static void addTag(AbstractSpan transaction, String key, Object value) { + private static void addTag(AbstractSpanImpl transaction, String key, Object value) { if (value instanceof Number) { transaction.addLabel(key, (Number) value); } else if (value instanceof Boolean) { @@ -185,7 +185,7 @@ private static void addTag(AbstractSpan transaction, String key, Object value // unfortunately, we can't use the constants in io.opentracing.tag.Tags, // as we can't declare a direct dependency on the OT API - private static boolean handleSpecialTransactionTag(Transaction transaction, String key, Object value) { + private static boolean handleSpecialTransactionTag(TransactionImpl transaction, String key, Object value) { if ("type".equals(key)) { transaction.withType(value.toString()); return true; @@ -228,7 +228,7 @@ private static boolean handleSpecialTransactionTag(Transaction transaction, Stri return false; } - private static boolean handleSpecialSpanTag(Span span, String key, Object value) { + private static boolean handleSpecialSpanTag(SpanImpl span, String key, Object value) { //noinspection IfCanBeSwitch if ("type".equals(key)) { if (span.getSubtype() == null && span.getAction() == null) { diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ElasticApmTracerInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ElasticApmTracerInstrumentation.java index fa9e090e80..fd992996fc 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ElasticApmTracerInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ElasticApmTracerInstrumentation.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.opentracingimpl; -import co.elastic.apm.agent.impl.Tracer; +import co.elastic.apm.agent.impl.ElasticApmTracer; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -30,7 +30,7 @@ public class ElasticApmTracerInstrumentation extends OpenTracingBridgeInstrument public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void close() { - tracer.require(Tracer.class).stop(); + tracer.require(ElasticApmTracer.class).stop(); } } diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ExternalSpanContextInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ExternalSpanContextInstrumentation.java index 30a05603d6..f6b618694c 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ExternalSpanContextInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ExternalSpanContextInstrumentation.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.opentracingimpl; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import net.bytebuddy.asm.Advice; import net.bytebuddy.asm.Advice.AssignReturned.ToFields.ToField; import net.bytebuddy.description.method.MethodDescription; @@ -75,10 +75,10 @@ public static Object toTraceId(@Advice.FieldValue(value = "textMap", typing = As @Advice.AssignReturned.ToReturned @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String onExit(@Advice.FieldValue(value = "childTraceContext", typing = Assigner.Typing.DYNAMIC) @Nullable Object childTraceContextObj) { - if (!(childTraceContextObj instanceof TraceContext)) { + if (!(childTraceContextObj instanceof TraceContextImpl)) { return null; } - return ((TraceContext) childTraceContextObj).getTraceId().toString(); + return ((TraceContextImpl) childTraceContextObj).getTraceId().toString(); } } } @@ -106,19 +106,19 @@ public static Object toSpanId(@Advice.FieldValue(value = "textMap", typing = Ass @Advice.AssignReturned.ToReturned @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String onExit(@Advice.FieldValue(value = "childTraceContext", typing = Assigner.Typing.DYNAMIC) @Nullable Object childTraceContextObj) { - if (!(childTraceContextObj instanceof TraceContext)) { + if (!(childTraceContextObj instanceof TraceContextImpl)) { return null; } - return ((TraceContext) childTraceContextObj).getParentId().toString(); + return ((TraceContextImpl) childTraceContextObj).getParentId().toString(); } } } @Nullable - public static TraceContext parseTextMap(Iterable> textMap) { + public static TraceContextImpl parseTextMap(Iterable> textMap) { ElasticApmTracer tracer = OpenTracingBridgeInstrumentation.tracer.require(ElasticApmTracer.class); if (tracer != null) { - TraceContext childTraceContext = TraceContext.with64BitId(tracer); + TraceContextImpl childTraceContext = TraceContextImpl.with64BitId(tracer); if (childTraceContext.asChildOf(textMap, OpenTracingTextMapBridge.instance())) { return childTraceContext; } diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ScopeManagerInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ScopeManagerInstrumentation.java index f0cdce5070..4b45451d81 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ScopeManagerInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/ScopeManagerInstrumentation.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.opentracingimpl; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -56,8 +56,8 @@ public ActivateInstrumentation() { public static class AdviceClass { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void doActivate(@Advice.Argument(value = 0, typing = Assigner.Typing.DYNAMIC) @Nullable Object context) { - if (context instanceof AbstractSpan) { - ((AbstractSpan) context).activate(); + if (context instanceof AbstractSpanImpl) { + ((AbstractSpanImpl) context).activate(); } } } diff --git a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/SpanContextInstrumentation.java b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/SpanContextInstrumentation.java index 9d81be2899..dcd48a9eac 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/SpanContextInstrumentation.java +++ b/apm-agent-plugins/apm-opentracing-plugin/src/main/java/co/elastic/apm/agent/opentracingimpl/SpanContextInstrumentation.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.opentracingimpl; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.ElasticContext; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceStateImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import net.bytebuddy.asm.Advice; @@ -66,15 +66,15 @@ public static class AdviceClass { @Advice.AssignReturned.ToReturned @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static Iterable> baggageItems(@Advice.FieldValue(value = "traceContext", typing = Assigner.Typing.DYNAMIC) @Nullable Object context) { - if (context instanceof ElasticContext) { - return doGetBaggage((ElasticContext) context); + if (context instanceof TraceStateImpl) { + return doGetBaggage((TraceStateImpl) context); } else { logger.info("The traceContext is null"); return null; } } - public static Iterable> doGetBaggage(ElasticContext traceContext) { + public static Iterable> doGetBaggage(TraceStateImpl traceContext) { Map baggage = new HashMap(); traceContext.propagateContext(baggage, OpenTracingTextMapBridge.instance(), null); return baggage.entrySet(); @@ -93,10 +93,10 @@ public static class AdviceClass { @Advice.AssignReturned.ToReturned @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String toTraceId(@Advice.FieldValue(value = "traceContext", typing = Assigner.Typing.DYNAMIC) @Nullable Object context) { - if (!(context instanceof AbstractSpan)) { + if (!(context instanceof AbstractSpanImpl)) { return null; } - AbstractSpan traceContext = (AbstractSpan) context; + AbstractSpanImpl traceContext = (AbstractSpanImpl) context; return traceContext.getTraceContext().getTraceId().toString(); } } @@ -113,10 +113,10 @@ public static class AdviceClass { @Advice.AssignReturned.ToReturned @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static String toTraceId(@Advice.FieldValue(value = "traceContext", typing = Assigner.Typing.DYNAMIC) @Nullable Object context) { - if (!(context instanceof AbstractSpan)) { + if (!(context instanceof AbstractSpanImpl)) { return null; } - AbstractSpan traceContext = (AbstractSpan) context; + AbstractSpanImpl traceContext = (AbstractSpanImpl) context; return traceContext.getTraceContext().getId().toString(); } } diff --git a/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessHelper.java b/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessHelper.java index 15ce912362..288d2c6f82 100644 --- a/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessHelper.java +++ b/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessHelper.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.process; import co.elastic.apm.agent.sdk.state.GlobalVariables; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -54,7 +54,7 @@ public static boolean isTracingOnCurrentThread() { return inTracingContext.get() == Boolean.TRUE; } - static void startProcess(ElasticContext activeContext, Process process, List command) { + static void startProcess(TraceState activeContext, Process process, List command) { INSTANCE.doStartProcess(activeContext, process, command.get(0)); } @@ -73,7 +73,7 @@ static void endProcessSpan(@Nonnull Process process, int exitValue) { * @param process started process * @param processName process name */ - void doStartProcess(ElasticContext activeContext, @Nonnull Process process, @Nonnull String processName) { + void doStartProcess(TraceState activeContext, @Nonnull Process process, @Nonnull String processName) { if (inFlightSpans.contains(process)) { return; } diff --git a/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessStartInstrumentation.java b/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessStartInstrumentation.java index 929b0904ca..b746e70af7 100644 --- a/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessStartInstrumentation.java +++ b/apm-agent-plugins/apm-process-plugin/src/main/java/co/elastic/apm/agent/process/ProcessStartInstrumentation.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.process; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -58,7 +58,7 @@ public static void onExit(@Advice.This ProcessBuilder processBuilder, @Advice.Return @Nullable Process process, @Advice.Thrown @Nullable Throwable t) { - ElasticContext activeContext = tracer.currentContext(); + TraceState activeContext = tracer.currentContext(); AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan == null) { return; diff --git a/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/CommonsExecAsyncInstrumentationTest.java b/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/CommonsExecAsyncInstrumentationTest.java index 616a6f69f2..931d856406 100644 --- a/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/CommonsExecAsyncInstrumentationTest.java +++ b/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/CommonsExecAsyncInstrumentationTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.process; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.test.JavaExecutable; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecuteResultHandler; @@ -78,8 +78,8 @@ void processWithExitValueCheck() throws Exception { terminateTransaction(); } - private static CompletableFuture> asyncProcessHasTransactionContext() throws Exception { - final CompletableFuture> future = new CompletableFuture<>(); + private static CompletableFuture> asyncProcessHasTransactionContext() throws Exception { + final CompletableFuture> future = new CompletableFuture<>(); DefaultExecuteResultHandler handler = new DefaultExecuteResultHandler() { // note: calling super is required otherwise process termination is not detected and waits forever @@ -112,7 +112,7 @@ public void onProcessFailed(ExecuteException e) { } private static void startTransaction() { - Transaction transaction = tracer.startRootTransaction(CommonsExecAsyncInstrumentationTest.class.getClassLoader()); + TransactionImpl transaction = tracer.startRootTransaction(CommonsExecAsyncInstrumentationTest.class.getClassLoader()); assertThat(transaction).isNotNull(); transaction.withType("request") @@ -121,7 +121,7 @@ private static void startTransaction() { } private static void terminateTransaction() { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); transaction.deactivate().end(); diff --git a/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/ProcessHelperTest.java b/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/ProcessHelperTest.java index 84f95db191..42d847c1a2 100644 --- a/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/ProcessHelperTest.java +++ b/apm-agent-plugins/apm-process-plugin/src/test/java/co/elastic/apm/agent/process/ProcessHelperTest.java @@ -20,10 +20,10 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.TransactionUtils; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import org.junit.jupiter.api.BeforeEach; @@ -48,14 +48,14 @@ class ProcessHelperTest extends AbstractInstrumentationTest { // of this instrumentation is. Also, integration test cover this feature for the general case with a packaged // agent and thus they don't have such limitation - private Transaction transaction; + private TransactionImpl transaction; private WeakMap> storageMap; private ProcessHelper helper; @BeforeEach void before() { - transaction = new Transaction(tracer); + transaction = new TransactionImpl(tracer); TransactionUtils.fillTransaction(transaction); storageMap = WeakConcurrent.buildMap(); @@ -95,7 +95,7 @@ void checkSpanNaming() { helper.doEndProcess(process, true); - Span span = getFirstSpan(); + SpanImpl span = getFirstSpan(); assertThat(span.getNameAsString()).isEqualTo(binaryName); assertThat(span.getType()).isEqualTo("process"); @@ -109,7 +109,7 @@ void startTwiceShouldIgnore() { Process process = mock(Process.class); helper.doStartProcess(transaction, process, "hello"); - Span span = (Span) storageMap.get(process); + SpanImpl span = (SpanImpl) storageMap.get(process); helper.doStartProcess(transaction, process, "hello"); assertThat(storageMap.get(process)) @@ -223,7 +223,7 @@ void waitForWithTimeoutDoesNotEndProcessSpan() { helper.doEndProcess(process, true); assertThat(storageMap).isEmpty(); - Span span = getFirstSpan(); + SpanImpl span = getFirstSpan(); assertThat(span.getOutcome()).isEqualTo(Outcome.SUCCESS); } @@ -245,7 +245,7 @@ void destroyWithoutProcessTerminatedShouldEndSpan() { assertThat(getFirstSpan().getOutcome()).isEqualTo(Outcome.UNKNOWN); } - private Span getFirstSpan() { + private SpanImpl getFirstSpan() { assertThat(reporter.getSpans()).hasSize(1); return reporter.getSpans().get(0); } diff --git a/apm-agent-plugins/apm-profiling-plugin/pom.xml b/apm-agent-plugins/apm-profiling-plugin/pom.xml index c5f1960ee6..26b9099251 100644 --- a/apm-agent-plugins/apm-profiling-plugin/pom.xml +++ b/apm-agent-plugins/apm-profiling-plugin/pom.xml @@ -16,7 +16,6 @@ - ${project.groupId} apm-agent-core diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java index 3042fee406..a1252e9081 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/CallTree.java @@ -18,11 +18,12 @@ */ package co.elastic.apm.agent.profiler; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.sdk.internal.collections.LongList; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Span; import co.elastic.apm.agent.impl.transaction.StackFrame; -import co.elastic.apm.agent.impl.transaction.TraceContext; import co.elastic.apm.agent.profiler.collections.LongHashSet; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -71,12 +72,12 @@ public class CallTree implements Recyclable { * Used in {@link #spanify} to override the parent. */ @Nullable - private TraceContext activeContextOfDirectParent; + private TraceContextImpl activeContextOfDirectParent; private long deactivationTimestamp = -1; private boolean isSpan; private int depth; /** - * @see co.elastic.apm.agent.impl.transaction.AbstractSpan#childIds + * @see AbstractSpanImpl#childIds */ @Nullable private ChildList childIds; @@ -115,12 +116,12 @@ public CallTree getNthParent(int n) { return parent; } - public void activation(TraceContext traceContext, long activationTimestamp) { + public void activation(TraceContextImpl traceContext, long activationTimestamp) { this.activeContextOfDirectParent = traceContext; this.activationTimestamp = activationTimestamp; } - protected void handleDeactivation(TraceContext deactivatedSpan, long activationTimestamp, long deactivationTimestamp) { + protected void handleDeactivation(TraceContextImpl deactivatedSpan, long activationTimestamp, long deactivationTimestamp) { if (deactivatedSpan.idEquals(activeContextOfDirectParent)) { this.deactivationTimestamp = deactivationTimestamp; } else { @@ -167,7 +168,7 @@ public static CallTree.Root createRoot(ObjectPool rootPool, byte[] traceCo * @param minDurationNs * @param root */ - protected CallTree addFrame(List stackFrames, int index, @Nullable TraceContext activeSpan, long activationTimestamp, long nanoTime, ObjectPool callTreePool, long minDurationNs, Root root) { + protected CallTree addFrame(List stackFrames, int index, @Nullable TraceContextImpl activeSpan, long activationTimestamp, long nanoTime, ObjectPool callTreePool, long minDurationNs, Root root) { count++; lastSeen = nanoTime; // c ee ← traceContext not set - they are not a child of the active span but the frame below them @@ -227,7 +228,7 @@ private void transferMaybeChildIdsToChildIds() { } } - private CallTree addChild(StackFrame frame, List stackFrames, int index, @Nullable TraceContext traceContext, long activationTimestamp, long nanoTime, ObjectPool callTreePool, long minDurationNs, Root root) { + private CallTree addChild(StackFrame frame, List stackFrames, int index, @Nullable TraceContextImpl traceContext, long activationTimestamp, long nanoTime, ObjectPool callTreePool, long minDurationNs, Root root) { CallTree callTree = callTreePool.createInstance(); callTree.set(this, frame, nanoTime); if (traceContext != null) { @@ -375,13 +376,13 @@ private void toString(Appendable out, int level) throws IOException { } } - int spanify(CallTree.Root root, TraceContext parentContext, TraceContext nonInferredParentContext) { + int spanify(CallTree.Root root, TraceContextImpl parentContext, TraceContextImpl nonInferredParentContext) { int createdSpans = 0; if (activeContextOfDirectParent != null) { parentContext = activeContextOfDirectParent; nonInferredParentContext = activeContextOfDirectParent; } - Span span = null; + SpanImpl span = null; if (!isPillar() || isLeaf()) { createdSpans++; span = asSpan(root, parentContext, nonInferredParentContext); @@ -397,9 +398,9 @@ int spanify(CallTree.Root root, TraceContext parentContext, TraceContext nonInfe return createdSpans; } - protected Span asSpan(Root root, TraceContext parentContext, TraceContext nonInferredParentContext) { + protected SpanImpl asSpan(Root root, TraceContextImpl parentContext, TraceContextImpl nonInferredParentContext) { transferMaybeChildIdsToChildIds(); - Span span = parentContext.createSpan(root.getEpochMicros(this.start)) + SpanImpl span = parentContext.createSpan(root.getEpochMicros(this.start)) .withType("app") .withSubtype("inferred"); @@ -493,8 +494,8 @@ public void resetState() { /** * When a regular span is activated, - * we want it's {@link TraceContext#getId() span.id} to be added to the call tree that represents the - * {@linkplain CallTree.Root#topOfStack top of the stack} to ensure correct parent/child relationships via re-parenting (See also {@link Span#childIds}). + * we want it's {@link TraceContextImpl#getId() span.id} to be added to the call tree that represents the + * {@linkplain CallTree.Root#topOfStack top of the stack} to ensure correct parent/child relationships via re-parenting (See also {@link SpanImpl#childIds}). *

    * However, the {@linkplain CallTree.Root#topOfStack current top of the stack} may turn out to not be the right target. * Consider this example: @@ -593,23 +594,23 @@ public static class Root extends CallTree implements Recyclable { * The context of the thread root, * mostly a transaction or a span which got activated in an auxiliary thread */ - protected TraceContext rootContext; + protected TraceContextImpl rootContext; /** * The context of the transaction or span which is currently {@link ElasticApmTracer#getActive() active}. * This is lazily deserialized from {@link #activeSpanSerialized} if there's an actual {@linkplain #addStackTrace stack trace} * for this activation. */ @Nullable - private TraceContext activeSpan; + private TraceContextImpl activeSpan; /** * The timestamp of when {@link #activeSpan} got activated */ private long activationTimestamp = -1; /** * The context of the transaction or span which is currently {@link ElasticApmTracer#getActive() active}, - * in its {@linkplain TraceContext#serialize serialized} form. + * in its {@linkplain TraceContextImpl#serialize serialized} form. */ - private byte[] activeSpanSerialized = new byte[TraceContext.SERIALIZED_LENGTH]; + private byte[] activeSpanSerialized = new byte[TraceContextImpl.SERIALIZED_LENGTH]; @Nullable private CallTree previousTopOfStack; @Nullable @@ -618,7 +619,7 @@ public static class Root extends CallTree implements Recyclable { private final LongHashSet activeSet = new LongHashSet(); public Root(ElasticApmTracer tracer) { - this.rootContext = TraceContext.with64BitId(tracer); + this.rootContext = TraceContextImpl.with64BitId(tracer); } private void set(byte[] traceContext, @Nullable String serviceName, @Nullable String serviceVersion, long nanoTime) { @@ -636,10 +637,10 @@ public void setActiveSpan(byte[] activeSpanSerialized, long timestamp) { public void onActivation(byte[] active, long timestamp) { setActiveSpan(active, timestamp); if (topOfStack != null) { - long spanId = TraceContext.getSpanId(active); + long spanId = TraceContextImpl.getSpanId(active); activeSet.add(spanId); if (!isNestedActivation(topOfStack)) { - topOfStack.addMaybeChildId(spanId, TraceContext.getParentId(active)); + topOfStack.addMaybeChildId(spanId, TraceContextImpl.getParentId(active)); } } } @@ -673,7 +674,7 @@ public void onDeactivation(byte[] deactivated, byte[] active, long timestamp) { // that's because isNestedActivation is only called if topOfStack != null // this optimizes for the case where we have no stack traces for a fast executing transaction if (topOfStack != null) { - long spanId = TraceContext.getSpanId(deactivated); + long spanId = TraceContextImpl.getSpanId(deactivated); activeSet.remove(spanId); } } @@ -684,7 +685,7 @@ public void addStackTrace(ElasticApmTracer tracer, List stackTrace, boolean firstFrameAfterActivation = false; if (activeSpan == null) { firstFrameAfterActivation = true; - activeSpan = TraceContext.with64BitId(tracer); + activeSpan = TraceContextImpl.with64BitId(tracer); activeSpan.deserialize(activeSpanSerialized, rootContext.getServiceName(), rootContext.getServiceVersion()); } previousTopOfStack = topOfStack; @@ -726,12 +727,12 @@ private CallTree findCommonAncestor(CallTree previousTopOfStack, CallTree topOfS /** * Creates spans for call tree nodes if they are either not a {@linkplain #isPillar() pillar} or are a {@linkplain #isLeaf() leaf}. - * Nodes which are not converted to {@link Span}s are part of the {@link Span#stackFrames} for the nodes which do get converted to a span. + * Nodes which are not converted to {@link SpanImpl}s are part of the {@link SpanImpl#stackFrames} for the nodes which do get converted to a span. *

    * Parent/child relationships with the regular spans are maintained. * One exception is that an inferred span can't be the parent of a regular span. * That is because the regular spans have already been reported once the inferred spans are created. - * In the future, we might make it possible to update the {@link TraceContext#parentId} + * In the future, we might make it possible to update the {@link TraceContextImpl#parentId} * of a regular span so that it correctly reflects being a child of an inferred span. *

    */ @@ -744,7 +745,7 @@ public int spanify() { return createdSpans; } - public TraceContext getRootContext() { + public TraceContextImpl getRootContext() { return rootContext; } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingActivationListener.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingActivationListener.java index 2e299f63d5..e139081dbd 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingActivationListener.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/ProfilingActivationListener.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.impl.ActivationListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.sdk.internal.ThreadUtil; import java.util.Objects; @@ -40,17 +40,17 @@ public ProfilingActivationListener(ElasticApmTracer tracer) { } @Override - public void beforeActivate(AbstractSpan context) { + public void beforeActivate(AbstractSpanImpl context) { if (context.isSampled() && !ThreadUtil.isVirtual(Thread.currentThread())) { - AbstractSpan active = tracer.getActive(); + AbstractSpanImpl active = tracer.getActive(); profiler.onActivation(context.getTraceContext(), active != null ? active.getTraceContext() : null); } } @Override - public void afterDeactivate(AbstractSpan deactivatedContext) { + public void afterDeactivate(AbstractSpanImpl deactivatedContext) { if (deactivatedContext.isSampled() && !ThreadUtil.isVirtual(Thread.currentThread())) { - AbstractSpan active = tracer.getActive(); + AbstractSpanImpl active = tracer.getActive(); profiler.onDeactivation(deactivatedContext.getTraceContext(), active != null ? active.getTraceContext() : null); } } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java index 860a0896de..daa584520c 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/main/java/co/elastic/apm/agent/profiler/SamplingProfiler.java @@ -19,11 +19,11 @@ package co.elastic.apm.agent.profiler; import co.elastic.apm.agent.common.util.WildcardMatcher; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.tracer.AbstractLifecycleListener; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Span; import co.elastic.apm.agent.impl.transaction.StackFrame; -import co.elastic.apm.agent.impl.transaction.TraceContext; import co.elastic.apm.agent.profiler.asyncprofiler.AsyncProfiler; import co.elastic.apm.agent.profiler.asyncprofiler.JfrParser; import co.elastic.apm.agent.profiler.collections.Long2ObjectHashMap; @@ -77,8 +77,8 @@ *

    *

    * The {@link #onActivation} and {@link #onDeactivation} methods are called by {@link ProfilingActivationListener} - * which register an {@link ActivationEvent} to a {@linkplain #eventBuffer ring buffer} whenever a {@link Span} - * gets {@link Span#activate()}d or {@link Span#deactivate()}d while a {@linkplain #profilingSessionOngoing profiling session is ongoing}. + * which register an {@link ActivationEvent} to a {@linkplain #eventBuffer ring buffer} whenever a {@link SpanImpl} + * gets {@link SpanImpl#activate()}d or {@link SpanImpl#deactivate()}d while a {@linkplain #profilingSessionOngoing profiling session is ongoing}. * A background thread consumes the {@link ActivationEvent}s and writes them to a {@linkplain #activationEventsBuffer direct buffer} * which is flushed to a {@linkplain #activationEventsFileChannel file}. * That is necessary because within a profiling session (which lasts 10s by default) there may be many more {@link ActivationEvent}s @@ -102,11 +102,11 @@ * After both the JFR file and the file containing the {@link ActivationEvent}s have been written, * it's now time to process them in tandem by correlating based on thread ids and timestamps. * The result of this correlation, performed by {@link #processTraces}, - * are {@link CallTree}s which are created for each thread which has seen an {@linkplain Span#activate() activation} + * are {@link CallTree}s which are created for each thread which has seen an {@linkplain SpanImpl#activate() activation} * and at least one stack trace. * Once {@linkplain ActivationEvent#handleDeactivationEvent(SamplingProfiler) handling the deactivation event} of the root span in a thread * (after which {@link ElasticApmTracer#getActive()} would return {@code null}), - * the {@link CallTree} is {@linkplain CallTree#spanify(CallTree.Root, TraceContext, TraceContext) converted into regular spans}. + * the {@link CallTree} is {@linkplain CallTree#spanify(CallTree.Root, TraceContextImpl, TraceContextImpl) converted into regular spans}. *

    *

    * Overall, the allocation rate does not depend on the number of {@link ActivationEvent}s but only on @@ -125,17 +125,17 @@ public class SamplingProfiler extends AbstractLifecycleListener implements Runna private static final int PRE_ALLOCATE_ACTIVATION_EVENTS_FILE_MB = 10; private static final int MAX_ACTIVATION_EVENTS_FILE_SIZE = ACTIVATION_EVENTS_IN_FILE * ActivationEvent.SERIALIZED_SIZE; private static final int ACTIVATION_EVENTS_BUFFER_SIZE = ActivationEvent.SERIALIZED_SIZE * 4 * 1024; - private final EventTranslatorTwoArg ACTIVATION_EVENT_TRANSLATOR = - new EventTranslatorTwoArg() { + private final EventTranslatorTwoArg ACTIVATION_EVENT_TRANSLATOR = + new EventTranslatorTwoArg() { @Override - public void translateTo(ActivationEvent event, long sequence, TraceContext active, TraceContext previouslyActive) { + public void translateTo(ActivationEvent event, long sequence, TraceContextImpl active, TraceContextImpl previouslyActive) { event.activation(active, Thread.currentThread().getId(), previouslyActive, nanoClock.nanoTime()); } }; - private final EventTranslatorTwoArg DEACTIVATION_EVENT_TRANSLATOR = - new EventTranslatorTwoArg() { + private final EventTranslatorTwoArg DEACTIVATION_EVENT_TRANSLATOR = + new EventTranslatorTwoArg() { @Override - public void translateTo(ActivationEvent event, long sequence, TraceContext active, TraceContext previouslyActive) { + public void translateTo(ActivationEvent event, long sequence, TraceContextImpl active, TraceContextImpl previouslyActive) { event.deactivation(active, Thread.currentThread().getId(), previouslyActive, nanoClock.nanoTime()); } }; @@ -173,7 +173,7 @@ public void translateTo(ActivationEvent event, long sequence, TraceContext activ @Nullable private FileChannel activationEventsFileChannel; private final ObjectPool callTreePool; - private final TraceContext contextForLogging; + private final TraceContextImpl contextForLogging; private boolean previouslyEnabled = false; @@ -208,7 +208,7 @@ public SamplingProfiler(final ElasticApmTracer tracer, NanoClock nanoClock, @Nul // tells the ring buffer to not override slots which have not been read yet this.eventBuffer.addGatingSequences(sequence); this.poller = eventBuffer.newPoller(); - contextForLogging = TraceContext.with64BitId(tracer); + contextForLogging = TraceContextImpl.with64BitId(tracer); this.callTreePool = tracer.getObjectPoolFactory().createRecyclableObjectPool(2 * 1024, new Allocator() { @Override public CallTree createInstance() { @@ -298,7 +298,7 @@ public ActivationEvent newInstance() { * @param previouslyActive the span which has previously been activated * @return {@code true}, if the event could be processed, {@code false} if the internal event queue is full which means the event has been discarded */ - public boolean onActivation(TraceContext activeSpan, @Nullable TraceContext previouslyActive) { + public boolean onActivation(TraceContextImpl activeSpan, @Nullable TraceContextImpl previouslyActive) { if (profilingSessionOngoing) { if (previouslyActive == null) { AsyncProfiler.getInstance(config.getProfilerLibDirectory(), config.getAsyncProfilerSafeMode()).enableProfilingCurrentThread(); @@ -323,7 +323,7 @@ public boolean onActivation(TraceContext activeSpan, @Nullable TraceContext prev * @param previouslyActive the span which has previously been activated * @return {@code true}, if the event could be processed, {@code false} if the internal event queue is full which means the event has been discarded */ - public boolean onDeactivation(TraceContext activeSpan, @Nullable TraceContext previouslyActive) { + public boolean onDeactivation(TraceContextImpl activeSpan, @Nullable TraceContextImpl previouslyActive) { if (profilingSessionOngoing) { if (previouslyActive == null) { AsyncProfiler.getInstance(config.getProfilerLibDirectory(), config.getAsyncProfilerSafeMode()).disableProfilingCurrentThread(); @@ -799,8 +799,8 @@ private static class ActivationEvent { Long.SIZE / Byte.SIZE + // timestamp Short.SIZE / Byte.SIZE + // serviceName index Short.SIZE / Byte.SIZE + // serviceVersion index - TraceContext.SERIALIZED_LENGTH + // traceContextBuffer - TraceContext.SERIALIZED_LENGTH + // previousContextBuffer + TraceContextImpl.SERIALIZED_LENGTH + // traceContextBuffer + TraceContextImpl.SERIALIZED_LENGTH + // previousContextBuffer 1 + // rootContext Long.SIZE / Byte.SIZE + // threadId 1; // activation @@ -816,21 +816,21 @@ private static class ActivationEvent { private String serviceName; @Nullable private String serviceVersion; - private byte[] traceContextBuffer = new byte[TraceContext.SERIALIZED_LENGTH]; - private byte[] previousContextBuffer = new byte[TraceContext.SERIALIZED_LENGTH]; + private byte[] traceContextBuffer = new byte[TraceContextImpl.SERIALIZED_LENGTH]; + private byte[] previousContextBuffer = new byte[TraceContextImpl.SERIALIZED_LENGTH]; private boolean rootContext; private long threadId; private boolean activation; - public void activation(TraceContext context, long threadId, @Nullable TraceContext previousContext, long nanoTime) { + public void activation(TraceContextImpl context, long threadId, @Nullable TraceContextImpl previousContext, long nanoTime) { set(context, threadId, true, previousContext != null ? previousContext : null, nanoTime); } - public void deactivation(TraceContext context, long threadId, @Nullable TraceContext previousContext, long nanoTime) { + public void deactivation(TraceContextImpl context, long threadId, @Nullable TraceContextImpl previousContext, long nanoTime) { set(context, threadId, false, previousContext != null ? previousContext : null, nanoTime); } - private void set(TraceContext traceContext, long threadId, boolean activation, @Nullable TraceContext previousContext, long nanoTime) { + private void set(TraceContextImpl traceContext, long threadId, boolean activation, @Nullable TraceContextImpl previousContext, long nanoTime) { traceContext.serialize(traceContextBuffer); this.threadId = threadId; this.activation = activation; @@ -887,7 +887,7 @@ private void startProfiling(SamplingProfiler samplingProfiler) { } } - private TraceContext deserialize(SamplingProfiler samplingProfiler, byte[] traceContextBuffer) { + private TraceContextImpl deserialize(SamplingProfiler samplingProfiler, byte[] traceContextBuffer) { samplingProfiler.contextForLogging.deserialize(traceContextBuffer, null, null); return samplingProfiler.contextForLogging; } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java index 738712e825..6fe80f177d 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java @@ -22,9 +22,9 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.impl.transaction.StackFrame; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.objectpool.NoopObjectPool; import co.elastic.apm.agent.testutils.DisabledOnAppleSilicon; import org.junit.jupiter.api.AfterEach; @@ -77,25 +77,25 @@ void testSpanification() throws Exception { assertThat(callTree.spanify()).isEqualTo(4); assertThat(reporter.getSpans()).hasSize(4); assertThat(reporter.getSpans().stream() - .map(Span::getNameAsString) + .map(SpanImpl::getNameAsString) ).containsExactly("CallTreeTest#d", "CallTreeTest#b", "CallTreeTest#a", "CallTreeTest#e"); - Span d = reporter.getSpans().get(0); + SpanImpl d = reporter.getSpans().get(0); assertThat(d.getNameAsString()).isEqualTo("CallTreeTest#d"); assertThat(d.getDuration()).isEqualTo(TimeUnit.MILLISECONDS.toMicros(10)); assertThat(d.getStackFrames().stream().map(StackFrame::getMethodName)).containsExactly("c"); - Span b = reporter.getSpans().get(1); + SpanImpl b = reporter.getSpans().get(1); assertThat(b.getNameAsString()).isEqualTo("CallTreeTest#b"); assertThat(b.getDuration()).isEqualTo(TimeUnit.MILLISECONDS.toMicros(20)); assertThat(b.getStackFrames()).isEmpty(); - Span a = reporter.getSpans().get(2); + SpanImpl a = reporter.getSpans().get(2); assertThat(a.getNameAsString()).isEqualTo("CallTreeTest#a"); assertThat(a.getDuration()).isEqualTo(TimeUnit.MILLISECONDS.toMicros(30)); assertThat(a.getStackFrames()).isEmpty(); - Span e = reporter.getSpans().get(3); + SpanImpl e = reporter.getSpans().get(3); assertThat(e.getNameAsString()).isEqualTo("CallTreeTest#e"); assertThat(e.getDuration()).isEqualTo(TimeUnit.MILLISECONDS.toMicros(10)); assertThat(e.getStackFrames()).isEmpty(); @@ -103,13 +103,13 @@ void testSpanification() throws Exception { @Test void testCallTreeWithActiveSpan() { - TraceContext rootContext = CallTreeTest.rootTraceContext(tracer); + TraceContextImpl rootContext = CallTreeTest.rootTraceContext(tracer); CallTree.Root root = CallTree.createRoot(NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)), rootContext.serialize(), rootContext.getServiceName(), rootContext.getServiceVersion(),0); NoopObjectPool callTreePool = NoopObjectPool.ofRecyclable(CallTree::new); root.addStackTrace(tracer, List.of(StackFrame.of("A", "a")), 0, callTreePool, 0); - TraceContext spanContext = TraceContext.with64BitId(tracer); - TraceContext.fromParentContext().asChildOf(spanContext, rootContext); + TraceContextImpl spanContext = TraceContextImpl.with64BitId(tracer); + TraceContextImpl.fromParentContext().asChildOf(spanContext, rootContext); root.onActivation(spanContext.serialize(), TimeUnit.MILLISECONDS.toNanos(5)); root.addStackTrace(tracer, List.of(StackFrame.of("A", "b"), StackFrame.of("A", "a")), TimeUnit.MILLISECONDS.toNanos(10), callTreePool, 0); @@ -149,10 +149,10 @@ void testCallTreeWithActiveSpan() { @Test void testSpanWithInvertedActivation() { - TraceContext rootContext = CallTreeTest.rootTraceContext(tracer); + TraceContextImpl rootContext = CallTreeTest.rootTraceContext(tracer); - TraceContext childSpanContext = TraceContext.with64BitId(tracer); - TraceContext.fromParentContext().asChildOf(childSpanContext, rootContext); + TraceContextImpl childSpanContext = TraceContextImpl.with64BitId(tracer); + TraceContextImpl.fromParentContext().asChildOf(childSpanContext, rootContext); NoopObjectPool rootPool = NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)); NoopObjectPool childPool = NoopObjectPool.ofRecyclable(CallTree::new); @@ -177,7 +177,7 @@ void testSpanWithInvertedActivation() { @Test void testSpanWithNestedActivation() { - TraceContext rootContext = CallTreeTest.rootTraceContext(tracer); + TraceContextImpl rootContext = CallTreeTest.rootTraceContext(tracer); NoopObjectPool rootPool = NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)); NoopObjectPool childPool = NoopObjectPool.ofRecyclable(CallTree::new); diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java index ae64d3387a..99040fba40 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java @@ -21,16 +21,13 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpyConfiguration; +import co.elastic.apm.agent.impl.transaction.*; import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.sampling.ConstantSampler; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.StackFrame; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.objectpool.NoopObjectPool; -import co.elastic.apm.agent.objectpool.ObjectPool; +import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.impl.ListBasedObjectPool; import co.elastic.apm.agent.testutils.DisabledOnAppleSilicon; import org.junit.jupiter.api.AfterEach; @@ -84,9 +81,9 @@ void tearDown() throws IOException { @Test void testCallTree() { - TraceContext traceContext = TraceContext.with64BitId(MockTracer.create()); + TraceContextImpl traceContext = TraceContextImpl.with64BitId(MockTracer.create()); CallTree.Root root = CallTree.createRoot(NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)), traceContext.serialize(), traceContext.getServiceName(), traceContext.getServiceVersion(), 0); - ObjectPool callTreePool = ListBasedObjectPool.ofRecyclable(new ArrayList<>(), Integer.MAX_VALUE, CallTree::new); + ObservableObjectPool callTreePool = ListBasedObjectPool.ofRecyclable(new ArrayList<>(), Integer.MAX_VALUE, CallTree::new); root.addStackTrace(tracer, List.of(StackFrame.of("A", "a")), 0, callTreePool, 0); root.addStackTrace(tracer, List.of(StackFrame.of("A", "b"), StackFrame.of("A", "a")), TimeUnit.MILLISECONDS.toNanos(10), callTreePool, 0); root.addStackTrace(tracer, List.of(StackFrame.of("A", "b"), StackFrame.of("A", "a")), TimeUnit.MILLISECONDS.toNanos(20), callTreePool, 0); @@ -322,7 +319,7 @@ void testDectivationBeforeEnd2() throws Exception { */ @Test void testDectivationBeforeEnd_DontStealChildIdsOfUnrelatedActivations() throws Exception { - Map> spans = assertCallTree(new String[]{ + Map> spans = assertCallTree(new String[]{ " c c ", " b b ", "a a a aa", @@ -350,7 +347,7 @@ void testDectivationBeforeEnd_DontStealChildIdsOfUnrelatedActivations() throws E */ @Test void testDectivationBeforeEnd_DontStealChildIdsOfUnrelatedActivations_Nested() throws Exception { - Map> spans = assertCallTree(new String[]{ + Map> spans = assertCallTree(new String[]{ " c c ", " b b ", "a a a aa", @@ -487,7 +484,7 @@ void testActivationBetweenMethods_WithCommonAncestor() throws Exception { */ @Test void testNestedActivation() throws Exception { - Map> spans = assertCallTree(new String[]{ + Map> spans = assertCallTree(new String[]{ "a a a", " 12 21 " }, new Object[][] { @@ -507,7 +504,7 @@ void testNestedActivation() throws Exception { */ @Test void testNestedActivationAfterMethodEnds_RootChangesToC() throws Exception { - Map> spans = assertCallTree(new String[]{ + Map> spans = assertCallTree(new String[]{ " bbb ", " aaa ccc ", "1 23 321" @@ -564,7 +561,7 @@ void testRegularActivationFollowedByNestedActivationAfterMethodEnds() throws Exc */ @Test void testNestedActivationAfterMethodEnds_CommonAncestorA() throws Exception { - Map> spans = assertCallTree(new String[]{ + Map> spans = assertCallTree(new String[]{ " b b b ccc ", " aa a a aaa a ", "1 2 2 34 43 1" @@ -855,7 +852,7 @@ private void assertCallTree(String[] stackTraces, Object[][] expectedTree) throw assertCallTree(stackTraces, expectedTree, null); } - private Map> assertCallTree(String[] stackTraces, Object[][] expectedTree, @Nullable Object[][] expectedSpans) throws Exception { + private Map> assertCallTree(String[] stackTraces, Object[][] expectedTree, @Nullable Object[][] expectedSpans) throws Exception { CallTree.Root root = getCallTree(tracer, stackTraces); StringBuilder expectedResult = new StringBuilder(); for (int i = 0; i < expectedTree.length; i++) { @@ -879,7 +876,7 @@ private Map> assertCallTree(String[] stackTraces, Object if (expectedSpans != null) { root.spanify(); - Map> spans = reporter.getSpans() + Map> spans = reporter.getSpans() .stream() .collect(toMap( s -> s.getNameAsString().replaceAll(".*#", ""), @@ -896,7 +893,7 @@ private Map> assertCallTree(String[] stackTraces, Object String parentName = getParentName(expectedSpans, i, nestingLevel); assertThat(spans).containsKey(spanName); assertThat(spans).containsKey(parentName); - AbstractSpan span = spans.get(spanName); + AbstractSpanImpl span = spans.get(spanName); assertThat(span.isChildOf(spans.get(parentName))) .withFailMessage("Expected %s (%s) to be a child of %s (%s) but was %s (%s)", spanName, span.getTraceContext().getId(), @@ -904,7 +901,7 @@ private Map> assertCallTree(String[] stackTraces, Object reporter.getSpans() .stream() .filter(s -> s.getTraceContext().getId().equals(span.getTraceContext().getParentId())).findAny() - .map(Span::getNameAsString) + .map(SpanImpl::getNameAsString) .orElse(null), span.getTraceContext().getParentId()) .isTrue(); @@ -915,14 +912,14 @@ private Map> assertCallTree(String[] stackTraces, Object reporter.getSpans() .stream() .filter(s -> s.getTraceContext().getId().equals(span.getTraceContext().getParentId())).findAny() - .map(Span::getNameAsString) + .map(SpanImpl::getNameAsString) .orElse(null), span.getTraceContext().getParentId()) .isFalse(); assertThat(span.getDuration()) .describedAs("Unexpected duration for span %s", span) .isEqualTo(durationMs * 1000); - assertThat(Objects.requireNonNullElse(((Span) span).getStackFrames(), List.of()) + assertThat(Objects.requireNonNullElse(((SpanImpl) span).getStackFrames(), List.of()) .stream() .map(StackFrame::getMethodName) .collect(Collectors.toList())) @@ -960,12 +957,12 @@ public static CallTree.Root getCallTree(ElasticApmTracer tracer, String[] stackT FixedNanoClock nanoClock = (FixedNanoClock) profilingFactory.getNanoClock(); nanoClock.setNanoTime(0); profiler.setProfilingSessionOngoing(true); - Transaction transaction = tracer + TransactionImpl transaction = tracer .startRootTransaction(ConstantSampler.of(true), 0, null) .withName("Call Tree Root") .activate(); transaction.getTraceContext().getClock().init(0, 0); - Map> spanMap = new HashMap<>(); + Map> spanMap = new HashMap<>(); List stackTraceEvents = new ArrayList<>(); for (int i = 0; i < stackTraces[0].length(); i++) { nanoClock.setNanoTime(i * TimeUnit.MILLISECONDS.toNanos(10)); @@ -1014,17 +1011,17 @@ public StackTraceEvent(List trace, long nanoTime) { } } - private static void handleSpanEvent(ElasticApmTracer tracer, Map> spanMap, String name, long nanoTime) { + private static void handleSpanEvent(ElasticApmTracer tracer, Map> spanMap, String name, long nanoTime) { if (!spanMap.containsKey(name)) { - Span span = tracer.getActive().createSpan(nanoTime / 1000).appendToName(name).activate(); + SpanImpl span = tracer.getActive().createSpan(nanoTime / 1000).appendToName(name).activate(); spanMap.put(name, span); } else { spanMap.get(name).deactivate().end(nanoTime / 1000); } } - public static TraceContext rootTraceContext(ElasticApmTracer tracer) { - TraceContext traceContext = TraceContext.with64BitId(tracer); + public static TraceContextImpl rootTraceContext(ElasticApmTracer tracer) { + TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); traceContext.asRootSpan(ConstantSampler.of(true)); return traceContext; } diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java index d6c0f9d368..1a68e2d2a0 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.objectpool.ObjectPoolFactory; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.testutils.DisabledOnAppleSilicon; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; @@ -39,12 +39,12 @@ void testFillQueue() throws Exception { System.out.println(System.getProperty("os.name")); ElasticApmTracer tracer = MockTracer.create(); - when(tracer.getObjectPoolFactory()).thenReturn(new ObjectPoolFactory()); + when(tracer.getObjectPoolFactory()).thenReturn(new ObjectPoolFactoryImpl()); SamplingProfiler profiler = new SamplingProfiler(tracer, new SystemNanoClock()); profiler.setProfilingSessionOngoing(true); - TraceContext traceContext = TraceContext.with64BitId(tracer); + TraceContextImpl traceContext = TraceContextImpl.with64BitId(tracer); assertThat(profiler.onActivation(traceContext, null)).isTrue(); long timeAfterFirstEvent = System.nanoTime(); diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerReplay.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerReplay.java index e213f316cc..703c9f24e7 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerReplay.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerReplay.java @@ -20,6 +20,7 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -33,7 +34,7 @@ /** * Can be used in combination with the files created by * {@link ProfilingConfiguration#backupDiagnosticFiles} to replay the creation of profiler-inferred spans. - * This is useful, for example, to troubleshoot why {@link co.elastic.apm.agent.impl.transaction.Span#childIds} are set as expected. + * This is useful, for example, to troubleshoot why {@link SpanImpl#childIds} are set as expected. */ public class SamplingProfilerReplay { diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java index 6e5816777e..de7e720185 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java @@ -23,8 +23,8 @@ import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.configuration.SpyConfiguration; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.testutils.DisabledOnAppleSilicon; import co.elastic.apm.agent.tracer.Scope; import co.elastic.apm.agent.tracer.configuration.TimeDuration; @@ -163,7 +163,7 @@ void testProfileTransaction() throws Exception { setupProfiler(true); awaitProfilerStarted(profiler); - Transaction transaction = tracer.startRootTransaction(null).withName("transaction"); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("transaction"); try (Scope scope = transaction.activateInScope()) { // makes sure that the rest will be captured by another profiling session // this tests that restoring which threads to profile works @@ -179,23 +179,23 @@ void testProfileTransaction() throws Exception { .timeout(5000, TimeUnit.MILLISECONDS) .untilAsserted(() -> assertThat(reporter.getSpans()).hasSize(5)); - Optional testProfileTransaction = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#testProfileTransaction")).findAny(); + Optional testProfileTransaction = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#testProfileTransaction")).findAny(); assertThat(testProfileTransaction).isPresent(); assertThat(testProfileTransaction.get().isChildOf(transaction)).isTrue(); - Optional inferredSpanA = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#aInferred")).findAny(); + Optional inferredSpanA = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#aInferred")).findAny(); assertThat(inferredSpanA).isPresent(); assertThat(inferredSpanA.get().isChildOf(testProfileTransaction.get())).isTrue(); - Optional explicitSpanB = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("bExplicit")).findAny(); + Optional explicitSpanB = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("bExplicit")).findAny(); assertThat(explicitSpanB).isPresent(); assertThat(explicitSpanB.get().isChildOf(inferredSpanA.get())).isTrue(); - Optional inferredSpanC = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#cInferred")).findAny(); + Optional inferredSpanC = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#cInferred")).findAny(); assertThat(inferredSpanC).isPresent(); assertThat(inferredSpanC.get().isChildOf(explicitSpanB.get())).isTrue(); - Optional inferredSpanD = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#dInferred")).findAny(); + Optional inferredSpanD = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("SamplingProfilerTest#dInferred")).findAny(); assertThat(inferredSpanD).isPresent(); assertThat(inferredSpanD.get().isChildOf(inferredSpanC.get())).isTrue(); } @@ -208,7 +208,7 @@ void testVirtualThreadsExcluded() throws Exception { AtomicReference profilingActive = new AtomicReference<>(); Runnable task = () -> { - Transaction transaction = tracer.startRootTransaction(null).withName("transaction"); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("transaction"); try (Scope scope = transaction.activateInScope()) { // makes sure that the rest will be captured by another profiling session // this tests that restoring which threads to profile works @@ -238,7 +238,7 @@ void testPostProcessingDisabled() throws Exception { doReturn(false).when(profilingConfig).isPostProcessingEnabled(); awaitProfilerStarted(profiler); - Transaction transaction = tracer.startRootTransaction(null).withName("transaction"); + TransactionImpl transaction = tracer.startRootTransaction(null).withName("transaction"); try (Scope scope = transaction.activateInScope()) { // makes sure that the rest will be captured by another profiling session // this tests that restoring which threads to profile works @@ -253,13 +253,13 @@ void testPostProcessingDisabled() throws Exception { .timeout(5000, TimeUnit.MILLISECONDS) .untilAsserted(() -> assertThat(reporter.getSpans()).hasSize(1)); - Optional explicitSpanB = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("bExplicit")).findAny(); + Optional explicitSpanB = reporter.getSpans().stream().filter(s -> s.getNameAsString().equals("bExplicit")).findAny(); assertThat(explicitSpanB).isPresent(); assertThat(explicitSpanB.get().isChildOf(transaction)).isTrue(); } - private void aInferred(Transaction transaction) throws Exception { - Span span = transaction.createSpan().withName("bExplicit").withType("custom"); + private void aInferred(TransactionImpl transaction) throws Exception { + SpanImpl span = transaction.createSpan().withName("bExplicit").withType("custom"); try (Scope spanScope = span.activateInScope()) { cInferred(); } finally { diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-common/src/test/java/co/elastic/apm/agent/quartzjob/AbstractJobTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-quartz/apm-quartz-common/src/test/java/co/elastic/apm/agent/quartzjob/AbstractJobTransactionNameInstrumentationTest.java index bccc2f42a2..a5a5a417b0 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-common/src/test/java/co/elastic/apm/agent/quartzjob/AbstractJobTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-quartz/apm-quartz-common/src/test/java/co/elastic/apm/agent/quartzjob/AbstractJobTransactionNameInstrumentationTest.java @@ -21,8 +21,8 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -73,12 +73,12 @@ void testJobManualCall() throws SchedulerException, InterruptedException { executeTestJobCreatingSpan(tracer, true); reporter.awaitTransactionCount(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); verifyTransaction(transaction, "TestJobCreatingSpan#execute"); assertThat(reporter.getNumReportedSpans()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getTraceContext().getParentId()).isEqualTo(transaction.getTraceContext().getId()); } @@ -103,7 +103,7 @@ void testJobWithResult() throws SchedulerException { JobDetail job = buildJobDetailTestJobWithResult("dummyJobName"); scheduler.scheduleJob(job, createTrigger()); - Transaction transaction = verifyTransactionFromJobDetails(job, Outcome.SUCCESS); + TransactionImpl transaction = verifyTransactionFromJobDetails(job, Outcome.SUCCESS); assertThat(transaction.getResult()).isEqualTo("this is the result"); } @@ -115,9 +115,9 @@ void testJobWithException() throws SchedulerException { verifyTransactionFromJobDetails(job, Outcome.FAILURE); } - abstract Transaction verifyTransactionFromJobDetails(JobDetail job, Outcome expectedOutcome); + abstract TransactionImpl verifyTransactionFromJobDetails(JobDetail job, Outcome expectedOutcome); - public Transaction verifyTransaction(Transaction transaction, String expectedName) { + public TransactionImpl verifyTransaction(TransactionImpl transaction, String expectedName) { assertThat(transaction.getType()).isEqualToIgnoringCase("scheduled"); assertThat(transaction.getNameAsString()) .isEqualTo(expectedName); diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/src/test/java/co/elastic/apm/agent/quartzjob/Quartz1JobTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/src/test/java/co/elastic/apm/agent/quartzjob/Quartz1JobTransactionNameInstrumentationTest.java index 365104d42b..76019569b5 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/src/test/java/co/elastic/apm/agent/quartzjob/Quartz1JobTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/src/test/java/co/elastic/apm/agent/quartzjob/Quartz1JobTransactionNameInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.quartzjob; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import org.quartz.Job; import org.quartz.JobDetail; @@ -35,10 +35,10 @@ class Quartz1JobTransactionNameInstrumentationTest extends AbstractJobTransactionNameInstrumentationTest { @Override - public Transaction verifyTransactionFromJobDetails(JobDetail job, Outcome expectedOutcome) { + public TransactionImpl verifyTransactionFromJobDetails(JobDetail job, Outcome expectedOutcome) { reporter.awaitTransactionCount(1, 2000); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); await().untilAsserted(() -> assertThat(reporter.getTransactions().size()).isEqualTo(1)); verifyTransaction(transaction, String.format("%s.%s", job.getKey().getGroup(), job.getKey().getName())); @@ -111,7 +111,7 @@ public TestJobCreatingSpan(ElasticApmTracer tracer, boolean traced) { @Override public void execute(JobExecutionContext context) throws JobExecutionException { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); if (traced) { assertThat(transaction).isNotNull(); transaction.createSpan().end(); diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/src/test/java/co/elastic/apm/agent/quartzjob/Quartz2JobTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/src/test/java/co/elastic/apm/agent/quartzjob/Quartz2JobTransactionNameInstrumentationTest.java index 2ec969cd59..5352cad882 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/src/test/java/co/elastic/apm/agent/quartzjob/Quartz2JobTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/src/test/java/co/elastic/apm/agent/quartzjob/Quartz2JobTransactionNameInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.quartzjob; import co.elastic.apm.agent.impl.ElasticApmTracer; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import org.junit.jupiter.api.Test; import org.quartz.Job; @@ -47,10 +47,10 @@ class Quartz2JobTransactionNameInstrumentationTest extends AbstractJobTransactionNameInstrumentationTest { @Override - public Transaction verifyTransactionFromJobDetails(JobDetail job, Outcome expectedOutcome) { + public TransactionImpl verifyTransactionFromJobDetails(JobDetail job, Outcome expectedOutcome) { reporter.awaitTransactionCount(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); await().untilAsserted(() -> assertThat(reporter.getTransactions().size()).isEqualTo(1)); verifyTransaction(transaction, String.format("%s.%s", job.getKey().getGroup(), job.getKey().getName())); @@ -128,7 +128,7 @@ public TestJobCreatingSpan(ElasticApmTracer tracer, boolean traced) { @Override public void execute(JobExecutionContext context) throws JobExecutionException { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); if (traced) { assertThat(transaction).isNotNull(); transaction.createSpan().end(); diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java index 35ec95f310..81e3d6d531 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/main/java/co/elastic/apm/agent/rabbitmq/ChannelInstrumentation.java @@ -22,7 +22,7 @@ import co.elastic.apm.agent.rabbitmq.header.RabbitMQTextHeaderSetter; import co.elastic.apm.agent.sdk.DynamicTransformer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import com.rabbitmq.client.AMQP; @@ -155,7 +155,7 @@ public static Object[] onBasicPublish(@Advice.This Channel channel, return new Object[]{properties, exitSpan}; } - private static AMQP.BasicProperties propagateTraceContext(ElasticContext toPropagate, + private static AMQP.BasicProperties propagateTraceContext(TraceState toPropagate, @Nullable AMQP.BasicProperties originalBasicProperties) { AMQP.BasicProperties properties = originalBasicProperties; if (properties == null) { diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java index 1899aa6f42..05c2b52464 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/src/test/java/co/elastic/apm/agent/rabbitmq/RabbitMQIT.java @@ -43,17 +43,14 @@ */ import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.*; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.context.DestinationImpl; import co.elastic.apm.agent.impl.context.Headers; -import co.elastic.apm.agent.impl.context.Message; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Id; +import co.elastic.apm.agent.impl.context.MessageImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.testutils.TestContainersUtils; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration.RabbitMQNamingMode; @@ -156,8 +153,8 @@ void contextPropagationWithProperties() throws IOException, InterruptedException void bodyCaptureNotSupported() throws IOException, InterruptedException { // body capture is not supported because at the RabbitMQ driver level // the message is provided as a byte array. - CoreConfiguration config = AbstractInstrumentationTest.config.getConfig(CoreConfiguration.class); - doReturn(CoreConfiguration.EventType.ALL).when(config).getCaptureBody(); + CoreConfigurationImpl config = AbstractInstrumentationTest.config.getConfig(CoreConfigurationImpl.class); + doReturn(CoreConfigurationImpl.EventType.ALL).when(config).getCaptureBody(); performTest( emptyProperties(), @@ -184,7 +181,7 @@ void headersCaptureEnabledByDefault() throws IOException, InterruptedException { @Test void headersCaptureDisabled() throws IOException, InterruptedException { - CoreConfiguration coreConfiguration = config.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfiguration = config.getConfig(CoreConfigurationImpl.class); doReturn(false).when(coreConfiguration).isCaptureHeaders(); testHeadersCapture(Map.of("message-header", "header value"), Map.of(), false); @@ -192,7 +189,7 @@ void headersCaptureDisabled() throws IOException, InterruptedException { @Test void headersCaptureSanitize() throws IOException, InterruptedException { - CoreConfiguration coreConfiguration = config.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfiguration = config.getConfig(CoreConfigurationImpl.class); doReturn(List.of(WildcardMatcher.valueOf("secret*"))).when(coreConfiguration).getSanitizeFieldNames(); testHeadersCapture( @@ -247,7 +244,7 @@ private void performTest(@Nullable AMQP.BasicProperties properties) throws IOExc private void performTest(@Nullable AMQP.BasicProperties properties, boolean shouldIgnore, String channelName, - BiConsumer messageCheck) throws IOException, InterruptedException { + BiConsumer messageCheck) throws IOException, InterruptedException { performTest(properties, shouldIgnore, channelName, TEST_ROUTING_KEY, messageCheck); } @@ -256,7 +253,7 @@ private void performTest(@Nullable AMQP.BasicProperties properties, boolean shouldIgnore, String channelName, String routingKey, - BiConsumer messageCheck) throws IOException, InterruptedException { + BiConsumer messageCheck) throws IOException, InterruptedException { Channel channel = connection.createChannel(); String exchange = createExchange(channel, channelName); @@ -283,7 +280,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp } }); - Transaction rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); + TransactionImpl rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); channel.basicPublish(exchange, routingKey, properties, MSG); @@ -310,12 +307,12 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp getReporter().awaitTransactionCount(2); getReporter().awaitSpanCount(1); - Transaction childTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); + TransactionImpl childTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); String transactionNameSuffix = !routingKey.equals(TEST_ROUTING_KEY) ? routingKey: exchange; checkTransaction(childTransaction, exchange, transactionNameSuffix, "RabbitMQ"); - Span span = getReporter().getSpans().get(0); + SpanImpl span = getReporter().getSpans().get(0); checkSendSpan(span, exchange, transactionNameSuffix); // span should be child of the first transaction @@ -324,14 +321,13 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp checkParentChild(span, childTransaction); // common assertions on span & transaction message - Message spanMessage = span.getContext().getMessage(); - Message transactionMessage = childTransaction.getContext().getMessage(); + MessageImpl spanMessage = span.getContext().getMessage(); + MessageImpl transactionMessage = childTransaction.getContext().getMessage(); // test-specific assertions on captured message messageCheck.accept(transactionMessage, spanMessage); } - @Test void testPollingWithinTransactionNoMessage() throws IOException { Channel channel = connection.createChannel(); @@ -344,12 +340,12 @@ void testPollingWithinTransactionNoMessage() throws IOException { reporter.awaitTransactionCount(1); reporter.awaitSpanCount(1); - Span pollingSpan = findSpanByAction("poll"); + SpanImpl pollingSpan = findSpanByAction("poll"); checkPollSpan(pollingSpan, null, queueName, "", false); } @NotNull - private Span findSpanByAction(String action) { + private SpanImpl findSpanByAction(String action) { return reporter.getSpans().stream().filter(span -> Objects.requireNonNull(span.getAction()).equals(action)).findFirst().get(); } @@ -365,10 +361,10 @@ void testPollingWithinTransactionGetMessage() throws IOException { reporter.awaitTransactionCount(1); reporter.awaitSpanCount(2); - Span sendSpan = findSpanByAction("send"); + SpanImpl sendSpan = findSpanByAction("send"); checkSendSpan(sendSpan, exchange); - Span pollingSpan = findSpanByAction("poll"); + SpanImpl pollingSpan = findSpanByAction("poll"); checkPollSpan(pollingSpan, sendSpan, queueName, exchange, true); } @@ -427,7 +423,7 @@ private void pollingTest(boolean withinTransaction, boolean withResult, Supplier String queue = createQueue.get(); - Transaction rootTransaction = null; + TransactionImpl rootTransaction = null; if (withinTransaction) { rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); } @@ -487,7 +483,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp .build(); - Transaction rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); + TransactionImpl rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); channel.basicPublish(exchange, rpcQueueName, properties, MSG); @@ -529,10 +525,10 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp // parent/child relationships are used to find who is who as we don't have other fields like name // to distinguish them - Span clientRequestRpc = null; - Span serverReplyRpc = null; - for (Span s : getReporter().getSpans()) { - Id spanParentId = s.getTraceContext().getParentId(); + SpanImpl clientRequestRpc = null; + SpanImpl serverReplyRpc = null; + for (SpanImpl s : getReporter().getSpans()) { + IdImpl spanParentId = s.getTraceContext().getParentId(); if (rootTransaction.getTraceContext().getId().equals(spanParentId)) { // client request is child of root transaction assertThat(clientRequestRpc).isNull(); @@ -545,11 +541,11 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp assertThat(clientRequestRpc).isNotNull(); assertThat(serverReplyRpc).isNotNull(); - Transaction serverSideRpc = null; - Transaction clientSideRpc = null; - for (Transaction t : getReporter().getTransactions()) { + TransactionImpl serverSideRpc = null; + TransactionImpl clientSideRpc = null; + for (TransactionImpl t : getReporter().getTransactions()) { if (t != rootTransaction) { - Id transactionParentId = t.getTraceContext().getParentId(); + IdImpl transactionParentId = t.getTraceContext().getParentId(); if (clientRequestRpc.getTraceContext().getId().equals(transactionParentId)) { assertThat(serverSideRpc).isNull(); serverSideRpc = t; @@ -577,13 +573,13 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp } - private void endRootTransaction(Transaction rootTransaction) { + private void endRootTransaction(TransactionImpl rootTransaction) { rootTransaction.deactivate().end(); } - static Transaction getNonRootTransaction(Transaction rootTransaction, List transactions) { - Transaction childTransaction = null; - for (Transaction t : transactions) { + static TransactionImpl getNonRootTransaction(TransactionImpl rootTransaction, List transactions) { + TransactionImpl childTransaction = null; + for (TransactionImpl t : transactions) { if (t != rootTransaction) { assertThat(childTransaction).isNull(); childTransaction = t; @@ -623,7 +619,7 @@ private AMQP.BasicProperties emptyProperties() { return new AMQP.BasicProperties.Builder().headers(new HashMap<>()).build(); } - static void checkParentChild(AbstractSpan parent, AbstractSpan child) { + static void checkParentChild(AbstractSpanImpl parent, AbstractSpanImpl child) { assertThat(child.getTraceContext().getParentId()) .describedAs("child (%s) should be a child of (%s)", child, parent) .isEqualTo(parent.getTraceContext().getId()); @@ -633,15 +629,15 @@ static void checkParentChild(AbstractSpan parent, AbstractSpan child) { .isEqualTo(parent.getTraceContext().getTraceId()); } - private static void checkTransaction(Transaction transaction, String exchange) { + private static void checkTransaction(TransactionImpl transaction, String exchange) { checkTransaction(transaction, exchange, "RabbitMQ"); } - static void checkTransaction(Transaction transaction, String exchange, String frameworkName) { + static void checkTransaction(TransactionImpl transaction, String exchange, String frameworkName) { checkTransaction(transaction, exchange, exchange, frameworkName); } - static void checkTransaction(Transaction transaction, String exchange, String transactionNameSuffix, String frameworkName) { + static void checkTransaction(TransactionImpl transaction, String exchange, String transactionNameSuffix, String frameworkName) { assertThat(transaction.getType()).isEqualTo("messaging"); assertThat(transaction.getNameAsString()) .isEqualTo("RabbitMQ RECEIVE from %s", transactionNameSuffix.isEmpty() ? "" : transactionNameSuffix); @@ -652,7 +648,7 @@ static void checkTransaction(Transaction transaction, String exchange, String tr checkMessage(transaction.getContext().getMessage(), exchange, true); } - private static void checkMessage(Message message, String queueName, boolean withRoutingKeyCheck) { + private static void checkMessage(MessageImpl message, String queueName, boolean withRoutingKeyCheck) { assertThat(message.getQueueName()).isEqualTo(queueName); // RabbitMQ does not provide timestamp by default @@ -665,7 +661,7 @@ private static void checkMessage(Message message, String queueName, boolean with } - private static void checkMessageBodyNotCaptured(Message message) { + private static void checkMessageBodyNotCaptured(MessageImpl message) { assertThat(message.getBodyForRead()).describedAs("body capture isn't supported").isNull(); } @@ -675,7 +671,7 @@ private static void checkMessageBodyNotCaptured(Message message) { "traceparent" }; - private static void checkDistributedTracingHeaders(Message message, boolean expectTracingHeaders) { + private static void checkDistributedTracingHeaders(MessageImpl message, boolean expectTracingHeaders) { HashMap headersMap = getHeadersMap(message); if (expectTracingHeaders) { assertThat(headersMap) @@ -688,7 +684,7 @@ private static void checkDistributedTracingHeaders(Message message, boolean expe } } - private static void checkHeaders(Message message, Map expectedHeaders) { + private static void checkHeaders(MessageImpl message, Map expectedHeaders) { HashMap headersMap = getHeadersMap(message); for (String key : DISTRIBUTED_TRACING_HEADERS) { headersMap.remove(key); @@ -698,26 +694,26 @@ private static void checkHeaders(Message message, Map expectedHe .containsAllEntriesOf(expectedHeaders); } - private static HashMap getHeadersMap(Message message) { + private static HashMap getHeadersMap(MessageImpl message) { Headers headers = message.getHeaders(); HashMap headersMap = new HashMap<>(); headers.forEach(h -> headersMap.put(h.getKey(), h.getValue().toString())); return headersMap; } - private static void checkSendSpan(Span span, String exchange) { + private static void checkSendSpan(SpanImpl span, String exchange) { checkSendSpan(span, exchange, exchange, connection.getAddress().getHostAddress(), connection.getPort()); } - private static void checkSendSpan(Span span, String exchange, String spanNameSuffix) { + private static void checkSendSpan(SpanImpl span, String exchange, String spanNameSuffix) { checkSendSpan(span, exchange, spanNameSuffix, connection.getAddress().getHostAddress(), connection.getPort()); } - static void checkSendSpan(Span span, String exchange, String host, int port) { + static void checkSendSpan(SpanImpl span, String exchange, String host, int port) { checkSendSpan(span, exchange, exchange, host, port); } - static void checkSendSpan(Span span, String exchange, String spanNameSuffix, String host, int port) { + static void checkSendSpan(SpanImpl span, String exchange, String spanNameSuffix, String host, int port) { String exchangeName = exchange.isEmpty() ? "" : exchange; String spanName = spanNameSuffix.isEmpty() ? "" : spanNameSuffix; checkSpanCommon(span, @@ -730,7 +726,7 @@ static void checkSendSpan(Span span, String exchange, String spanNameSuffix, Str checkSpanDestination(span, host, port, String.format("rabbitmq/%s", exchangeName)); } - private static void checkPollSpan(Span pollSpan, @Nullable Span sendSpan, String queue, String normalizedExchange, boolean withRoutingKeyCheck) { + private static void checkPollSpan(SpanImpl pollSpan, @Nullable SpanImpl sendSpan, String queue, String normalizedExchange, boolean withRoutingKeyCheck) { checkSpanCommon(pollSpan, "poll", String.format("RabbitMQ POLL from %s", queue), @@ -743,7 +739,7 @@ private static void checkPollSpan(Span pollSpan, @Nullable Span sendSpan, String String.format("rabbitmq/%s", normalizedExchange) ); - List spanLinks = pollSpan.getSpanLinks(); + List spanLinks = pollSpan.getSpanLinks(); if (sendSpan != null) { assertThat(spanLinks).hasSize(1); assertThat(spanLinks.get(0).getTraceId()).isEqualTo(sendSpan.getTraceContext().getTraceId()); @@ -753,7 +749,7 @@ private static void checkPollSpan(Span pollSpan, @Nullable Span sendSpan, String } } - private static void checkSpanCommon(Span span, String expectedAction, String expectedName, String expectedQueueName, boolean withRoutingKeyCheck) { + private static void checkSpanCommon(SpanImpl span, String expectedAction, String expectedName, String expectedQueueName, boolean withRoutingKeyCheck) { assertThat(span.getType()).isEqualTo("messaging"); assertThat(span.getSubtype()).isEqualTo("rabbitmq"); assertThat(span.getAction()).isEqualTo(expectedAction); @@ -766,8 +762,8 @@ private static void checkSpanCommon(Span span, String expectedAction, String exp assertThat(span.getOutcome()).isEqualTo(Outcome.SUCCESS); } - static void checkSpanDestination(Span span, String expectedHostAddress, int expectedPort, String expectedResource) { - Destination destination = span.getContext().getDestination(); + static void checkSpanDestination(SpanImpl span, String expectedHostAddress, int expectedPort, String expectedResource) { + DestinationImpl destination = span.getContext().getDestination(); assertThat(destination.getAddress().toString()).isEqualTo(expectedHostAddress); assertThat(destination.getPort()).isEqualTo(expectedPort); diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/AbstractRabbitMqTest.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/AbstractRabbitMqTest.java index fef5420765..6cafbc1ecb 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/AbstractRabbitMqTest.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/AbstractRabbitMqTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.rabbitmq; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; import org.junit.Test; @@ -31,7 +31,6 @@ import static co.elastic.apm.agent.rabbitmq.RabbitMQIT.getNonRootTransaction; import static co.elastic.apm.agent.rabbitmq.TestConstants.QUEUE_NAME; import static co.elastic.apm.agent.rabbitmq.TestConstants.TOPIC_EXCHANGE_NAME; -import static co.elastic.apm.agent.tracer.configuration.MessagingConfiguration.JmsStrategy.POLLING; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.mockito.Mockito.doReturn; @@ -42,9 +41,9 @@ public abstract class AbstractRabbitMqTest extends RabbitMqTestBase { @Test public void verifyThatTransactionWithSpanCreated() { rabbitTemplate.convertAndSend(TOPIC_EXCHANGE_NAME, TestConstants.ROUTING_KEY, MESSAGE); - Transaction receiveTransaction = reporter.getFirstTransaction(1000); + TransactionImpl receiveTransaction = reporter.getFirstTransaction(1000); checkTransaction(receiveTransaction, TOPIC_EXCHANGE_NAME, "Spring AMQP"); - Span testSpan = reporter.getFirstSpan(1000); + SpanImpl testSpan = reporter.getFirstSpan(1000); assertThat(testSpan.getNameAsString()).isEqualTo("testSpan"); assertThat(testSpan.getType()).isEqualTo("custom"); checkParentChild(receiveTransaction, testSpan); @@ -56,9 +55,9 @@ public void verifyThatTransactionWithSpanCreated_NamingModeQueue() { doReturn(MessagingConfiguration.RabbitMQNamingMode.QUEUE).when(messagingConfiguration).getRabbitMQNamingMode(); rabbitTemplate.convertAndSend(TOPIC_EXCHANGE_NAME, TestConstants.ROUTING_KEY, MESSAGE); - Transaction receiveTransaction = reporter.getFirstTransaction(1000); + TransactionImpl receiveTransaction = reporter.getFirstTransaction(1000); checkTransaction(receiveTransaction, QUEUE_NAME, "Spring AMQP"); - Span testSpan = reporter.getFirstSpan(1000); + SpanImpl testSpan = reporter.getFirstSpan(1000); assertThat(testSpan.getNameAsString()).isEqualTo("testSpan"); assertThat(testSpan.getType()).isEqualTo("custom"); checkParentChild(receiveTransaction, testSpan); @@ -66,23 +65,23 @@ public void verifyThatTransactionWithSpanCreated_NamingModeQueue() { @Test public void verifyThatTransactionWithSpanCreated_DistributedTracing() { - Transaction rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); + TransactionImpl rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); rabbitTemplate.convertAndSend(TOPIC_EXCHANGE_NAME, TestConstants.ROUTING_KEY, MESSAGE); rootTransaction.deactivate().end(); getReporter().awaitTransactionCount(2); getReporter().awaitSpanCount(2); - Transaction receiveTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); + TransactionImpl receiveTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); checkTransaction(receiveTransaction, TOPIC_EXCHANGE_NAME, "Spring AMQP"); assertThat(receiveTransaction.getSpanCount().getTotal().get()).isEqualTo(1); - List spans = getReporter().getSpans(); - Span sendSpan = spans.stream().filter(span -> span.getType().equals("messaging")).findFirst().get(); + List spans = getReporter().getSpans(); + SpanImpl sendSpan = spans.stream().filter(span -> span.getType().equals("messaging")).findFirst().get(); checkSendSpan(sendSpan, TOPIC_EXCHANGE_NAME, LOCALHOST_ADDRESS, container.getAmqpPort()); checkParentChild(sendSpan, receiveTransaction); - Span testSpan = spans.stream().filter(span -> span.getType().equals("custom")).findFirst().get(); + SpanImpl testSpan = spans.stream().filter(span -> span.getType().equals("custom")).findFirst().get(); assertThat(testSpan.getNameAsString()).isEqualTo("testSpan"); checkParentChild(receiveTransaction, testSpan); } @@ -90,27 +89,27 @@ public void verifyThatTransactionWithSpanCreated_DistributedTracing() { @Test public void verifyTransactionWithDefaultExchangeName() { rabbitTemplate.convertAndSend(TestConstants.QUEUE_NAME, MESSAGE); - Transaction receiveTransaction = reporter.getFirstTransaction(1000); + TransactionImpl receiveTransaction = reporter.getFirstTransaction(1000); checkTransaction(receiveTransaction, "", "Spring AMQP"); assertThat(receiveTransaction.getSpanCount().getTotal().get()).isEqualTo(1); - Span testSpan = reporter.getFirstSpan(1000); + SpanImpl testSpan = reporter.getFirstSpan(1000); assertThat(testSpan.getNameAsString()).isEqualTo("testSpan"); } @Test public void verifyTransactionWithDefaultExchangeName_DistributedTracing() { - Transaction rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); + TransactionImpl rootTransaction = startTestRootTransaction("Rabbit-Test Root Transaction"); rabbitTemplate.convertAndSend(TestConstants.QUEUE_NAME, MESSAGE); rootTransaction.deactivate().end(); getReporter().awaitTransactionCount(2); getReporter().awaitSpanCount(2); - Transaction receiveTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); + TransactionImpl receiveTransaction = getNonRootTransaction(rootTransaction, getReporter().getTransactions()); checkTransaction(receiveTransaction, "", "Spring AMQP"); assertThat(receiveTransaction.getSpanCount().getTotal().get()).isEqualTo(1); - Span sendSpan = getReporter().getSpans().stream().filter(span -> span.getType().equals("messaging")).findFirst().get(); + SpanImpl sendSpan = getReporter().getSpans().stream().filter(span -> span.getType().equals("messaging")).findFirst().get(); checkSendSpan(sendSpan, "", LOCALHOST_ADDRESS, container.getAmqpPort()); checkParentChild(sendSpan, receiveTransaction); } diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/FanoutIT.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/FanoutIT.java index 6a636b5929..6d2dca3192 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/FanoutIT.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/FanoutIT.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.rabbitmq; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.rabbitmq.config.FanoutConfiguration; import org.junit.Test; import org.junit.runner.RunWith; @@ -46,15 +46,15 @@ public void verifyThatTransactionWithSpanCreated() { getReporter().awaitTransactionCount(2); getReporter().awaitSpanCount(2); - List transactionList = getReporter().getTransactions(); + List transactionList = getReporter().getTransactions(); assertThat(transactionList.size()).isEqualTo(2); - for (Transaction transaction : transactionList) { + for (TransactionImpl transaction : transactionList) { assertThat(transaction.getNameAsString()).isEqualTo("RabbitMQ RECEIVE from foobar"); assertThat(transaction.getSpanCount().getTotal().get()).isEqualTo(1); } - List testSpans = getReporter().getSpans(); - for (Span testSpan : testSpans) { + List testSpans = getReporter().getSpans(); + for (SpanImpl testSpan : testSpans) { assertThat(testSpan.getNameAsString()).isEqualTo("testSpan"); } } diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/SpringAmqpBatchIT.java b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/SpringAmqpBatchIT.java index 361fd0af00..a77243764d 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/SpringAmqpBatchIT.java +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/src/test/java/co/elastic/apm/agent/rabbitmq/SpringAmqpBatchIT.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.rabbitmq; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.rabbitmq.components.batch.BatchListenerComponent; import co.elastic.apm.agent.rabbitmq.config.BatchConfiguration; import co.elastic.apm.agent.tracer.configuration.MessagingConfiguration; @@ -63,17 +63,17 @@ public void testTransactionPerMessage_noDistributedTracing() { getReporter().awaitTransactionCount(4); - List transactionList = getReporter().getTransactions(); + List transactionList = getReporter().getTransactions(); assertThat(transactionList.size()).isEqualTo(4); - for (Transaction transaction : transactionList) { + for (TransactionImpl transaction : transactionList) { assertThat(transaction.getNameAsString()).isEqualTo("Spring AMQP RECEIVE from "); assertThat(transaction.getSpanCount().getTotal().get()).isEqualTo(1); } - List spans = getReporter().getSpans(); + List spans = getReporter().getSpans(); assertThat(spans.size()).isEqualTo(4); - for (Span span : spans) { + for (SpanImpl span : spans) { assertThat(span.getNameAsString()).isEqualTo("testSpan"); } } @@ -82,7 +82,7 @@ public void testTransactionPerMessage_noDistributedTracing() { public void testTransactionPerMessage_withDistributedTracing() { doReturn(MessagingConfiguration.BatchStrategy.SINGLE_HANDLING).when(config.getConfig(MessagingConfiguration.class)).getMessageBatchStrategy(); - Transaction rootTraceTransaction = getTracer().startRootTransaction(null); + TransactionImpl rootTraceTransaction = getTracer().startRootTransaction(null); Objects.requireNonNull(rootTraceTransaction).activate(); batchingRabbitTemplate.convertAndSend(TestConstants.QUEUE_NAME, "hello"); @@ -95,30 +95,30 @@ public void testTransactionPerMessage_withDistributedTracing() { // 4 custom spans and 2 send spans because batch size is configured to 2 getReporter().awaitSpanCount(6); - List customSpans = getReporter().getSpans().stream() + List customSpans = getReporter().getSpans().stream() .filter(span -> Objects.equals(span.getType(), "custom")) .sorted(Comparator.comparing(span -> span.getTraceContext().getId().toString())) .collect(Collectors.toList()); assertThat(customSpans.size()).isEqualTo(4); - for (Span span : customSpans) { + for (SpanImpl span : customSpans) { assertThat(span.getNameAsString()).isEqualTo("testSpan"); assertThat(span.getTraceContext().getTraceId().toString()).isEqualTo(traceId); } - List sendSpans = getReporter().getSpans().stream() + List sendSpans = getReporter().getSpans().stream() .filter(span -> Objects.equals(span.getType(), "messaging")) .sorted(Comparator.comparing(span -> span.getTraceContext().getId().toString())) .collect(Collectors.toList()); assertThat(sendSpans.size()).isEqualTo(2); - for (Span span : sendSpans) { + for (SpanImpl span : sendSpans) { assertThat(span.getNameAsString()).isEqualTo("RabbitMQ SEND to "); assertThat(span.getTraceContext().getTraceId().toString()).isEqualTo(traceId); } getReporter().awaitTransactionCount(4); - List transactionList = new ArrayList<>(getReporter().getTransactions()); + List transactionList = new ArrayList<>(getReporter().getTransactions()); assertThat(transactionList.size()).isEqualTo(4); - for (Transaction transaction : transactionList) { + for (TransactionImpl transaction : transactionList) { assertThat(transaction.getNameAsString()).isEqualTo("Spring AMQP RECEIVE from "); assertThat(transaction.getSpanCount().getTotal().get()).isEqualTo(1); assertThat(transaction.getTraceContext().getTraceId().toString()).isEqualTo(traceId); @@ -138,7 +138,7 @@ public void testTransactionPerMessage_withDistributedTracing() { @Test public void testTransactionPerBatch() { - Transaction rootTraceTransaction = getTracer().startRootTransaction(null); + TransactionImpl rootTraceTransaction = getTracer().startRootTransaction(null); Objects.requireNonNull(rootTraceTransaction).activate(); batchingRabbitTemplate.convertAndSend(TestConstants.QUEUE_NAME, "hello"); @@ -148,14 +148,14 @@ public void testTransactionPerBatch() { // expecting one transaction per batch, of which configured size is 2 getReporter().awaitTransactionCount(2); - List transactionList = getReporter().getTransactions(); + List transactionList = getReporter().getTransactions(); getReporter().awaitUntilTimeout(200, () -> assertThat(transactionList.size()).isEqualTo(2)); - List spans = getReporter().getSpans(); + List spans = getReporter().getSpans(); // Expecting 2 send spans (one per two-message batch) and 4 custom test-spans assertThat(spans.size()).isEqualTo(6); - List sendSpans = getReporter().getSpans().stream() + List sendSpans = getReporter().getSpans().stream() .filter(span -> Objects.equals(span.getNameAsString(), "RabbitMQ SEND to ")) .collect(Collectors.toList()); assertThat(sendSpans.size()).isEqualTo(2); @@ -164,7 +164,7 @@ public void testTransactionPerBatch() { assertThat(span.getTraceContext().getParentId()).isEqualTo(rootTraceTransaction.getTraceContext().getId()); }); - List testSpans = getReporter().getSpans().stream() + List testSpans = getReporter().getSpans().stream() .filter(span -> Objects.equals(span.getNameAsString(), "testSpan")) .collect(Collectors.toList()); assertThat(testSpans.size()).isEqualTo(4); @@ -174,7 +174,7 @@ public void testTransactionPerBatch() { assertThat(span.getTraceContext().getTraceId()).isNotEqualTo(rootTraceTransaction.getTraceContext().getTraceId()); }); - for (Transaction transaction : transactionList) { + for (TransactionImpl transaction : transactionList) { assertThat(transaction.getNameAsString()).isEqualTo("Spring AMQP Message Batch Processing"); assertThat(transaction.getSpanCount().getTotal().get()).isEqualTo(2); assertThat(testSpans.stream() @@ -183,10 +183,10 @@ public void testTransactionPerBatch() { ).isEqualTo(2); assertThat(transaction.getTraceContext().getTraceId()).isNotEqualTo(rootTraceTransaction.getTraceContext().getTraceId()); - List spanLinks = transaction.getSpanLinks(); + List spanLinks = transaction.getSpanLinks(); // we expect one span link because each batch of two messages is related to a single send span assertThat(spanLinks.size()).isEqualTo(1); - TraceContext spanLink = spanLinks.get(0); + TraceContextImpl spanLink = spanLinks.get(0); assertThat(sendSpans.stream().anyMatch(sendSpan -> sendSpan.getTraceContext().getId().equals(spanLink.getParentId()))).isTrue(); assertThat(sendSpans.stream().anyMatch(sendSpan -> sendSpan.getTraceContext().getTraceId().equals(spanLink.getTraceId()))).isTrue(); } diff --git a/apm-agent-plugins/apm-reactor-plugin/src/main/java/co/elastic/apm/agent/reactor/TracedSubscriber.java b/apm-agent-plugins/apm-reactor-plugin/src/main/java/co/elastic/apm/agent/reactor/TracedSubscriber.java index a1438d936b..5b381c78b2 100644 --- a/apm-agent-plugins/apm-reactor-plugin/src/main/java/co/elastic/apm/agent/reactor/TracedSubscriber.java +++ b/apm-agent-plugins/apm-reactor-plugin/src/main/java/co/elastic/apm/agent/reactor/TracedSubscriber.java @@ -23,7 +23,7 @@ import co.elastic.apm.agent.sdk.state.GlobalVariables; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; @@ -47,7 +47,7 @@ public class TracedSubscriber implements CoreSubscriber { private static final AtomicBoolean isRegistered = GlobalVariables.get(ReactorInstrumentation.class, "reactor-hook-enabled", new AtomicBoolean(false)); - private static final ReferenceCountedMap, ElasticContext> contextMap = GlobalTracer.get().newReferenceCountedMap(); + private static final ReferenceCountedMap, TraceState> contextMap = GlobalTracer.get().newReferenceCountedMap(); private static final String HOOK_KEY = "elastic-apm"; @@ -57,13 +57,13 @@ public class TracedSubscriber implements CoreSubscriber { private final Context context; - TracedSubscriber(CoreSubscriber subscriber, Tracer tracer, ElasticContext context) { + TracedSubscriber(CoreSubscriber subscriber, Tracer tracer, TraceState context) { this.subscriber = subscriber; this.tracer = tracer; contextMap.put(this, context); // store our span/transaction into reactor context for later lookup without relying on active tracer state - this.context = subscriber.currentContext().put(ElasticContext.class, context); + this.context = subscriber.currentContext().put(TraceState.class, context); } @Override @@ -78,7 +78,7 @@ public Context currentContext() { */ @Override public void onSubscribe(Subscription s) { - ElasticContext context = getContext(); + TraceState context = getContext(); boolean hasActivated = doEnter("onSubscribe", context); Throwable thrown = null; try { @@ -99,7 +99,7 @@ public void onSubscribe(Subscription s) { */ @Override public void onNext(T next) { - ElasticContext context = getContext(); + TraceState context = getContext(); boolean hasActivated = doEnter("onNext", context); Throwable thrown = null; try { @@ -120,7 +120,7 @@ public void onNext(T next) { */ @Override public void onError(Throwable t) { - ElasticContext context = getContext(); + TraceState context = getContext(); boolean hasActivated = doEnter("onError", context); try { subscriber.onError(t); @@ -135,7 +135,7 @@ public void onError(Throwable t) { */ @Override public void onComplete() { - ElasticContext context = getContext(); + TraceState context = getContext(); boolean hasActivated = doEnter("onComplete", context); try { subscriber.onComplete(); @@ -152,7 +152,7 @@ public void onComplete() { * @param context context * @return {@literal true} if context has been activated */ - private boolean doEnter(String method, @Nullable ElasticContext context) { + private boolean doEnter(String method, @Nullable TraceState context) { debugTrace(true, method, context); if (context == null || tracer.currentContext() == context) { @@ -171,7 +171,7 @@ private boolean doEnter(String method, @Nullable ElasticContext context) { * @param method method name (only for debugging) * @param context context */ - private void doExit(boolean deactivate, String method, @Nullable ElasticContext context) { + private void doExit(boolean deactivate, String method, @Nullable TraceState context) { debugTrace(false, method, context); if (context == null || !deactivate) { @@ -194,7 +194,7 @@ private void discardIf(boolean condition) { contextMap.remove(this); } - private void debugTrace(boolean isEnter, String method, @Nullable ElasticContext context) { + private void debugTrace(boolean isEnter, String method, @Nullable TraceState context) { if (!log.isTraceEnabled()) { return; } @@ -205,7 +205,7 @@ private void debugTrace(boolean isEnter, String method, @Nullable ElasticContext * @return context associated with {@literal this}. */ @Nullable - private ElasticContext getContext() { + private TraceState getContext() { return contextMap.get(this); } @@ -252,11 +252,11 @@ public CoreSubscriber apply(Publisher publisher, CoreSubscriber active = tracer.currentContext(); + TraceState active = tracer.currentContext(); // fallback to using context-stored span/transaction if not already active if (active.isEmpty()) { - active = subscriber.currentContext().getOrDefault(ElasticContext.class, null); + active = subscriber.currentContext().getOrDefault(TraceState.class, null); } if (active == null || active.isEmpty()) { diff --git a/apm-agent-plugins/apm-reactor-plugin/src/test/java/co/elastic/apm/agent/reactor/TracedSubscriberTest.java b/apm-agent-plugins/apm-reactor-plugin/src/test/java/co/elastic/apm/agent/reactor/TracedSubscriberTest.java index aa99e7c493..90ebb2290a 100644 --- a/apm-agent-plugins/apm-reactor-plugin/src/test/java/co/elastic/apm/agent/reactor/TracedSubscriberTest.java +++ b/apm-agent-plugins/apm-reactor-plugin/src/test/java/co/elastic/apm/agent/reactor/TracedSubscriberTest.java @@ -20,9 +20,9 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.baggage.BaggageContext; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; +import co.elastic.apm.agent.tracer.TraceState; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -45,7 +45,7 @@ class TracedSubscriberTest extends AbstractInstrumentationTest { private static final Scheduler PUBLISH_SCHEDULER = Schedulers.newElastic("publish"); @Nullable - private Transaction transaction; + private TransactionImpl transaction; private static long mainThreadId; @@ -239,7 +239,7 @@ private static long currentThreadId() { return Thread.currentThread().getId(); } - static Predicate inMainThread(@Nullable AbstractSpan expectedContext, int expectedValue) { + static Predicate inMainThread(@Nullable AbstractSpanImpl expectedContext, int expectedValue) { return observation -> { observation.checkThread(true) .checkActiveContext(expectedContext) @@ -248,7 +248,7 @@ static Predicate inMainThread(@Nullable AbstractSpan expecte }; } - static Predicate inOtherThread(@Nullable ElasticContext expectedContext, int expectedValue) { + static Predicate inOtherThread(@Nullable TraceState expectedContext, int expectedValue) { return observation -> { observation .checkActiveContext(expectedContext) @@ -278,7 +278,7 @@ static Predicate noActiveContext(int expectedValue) { */ private static class TestObservation { @Nullable - private final ElasticContext activeContext; + private final TraceState activeContext; private final Long threadId; private final int value; @@ -314,7 +314,7 @@ TestObservation checkThread(boolean mainThread) { return this; } - TestObservation checkActiveContext(@Nullable ElasticContext expectedActiveContext) { + TestObservation checkActiveContext(@Nullable TraceState expectedActiveContext) { if (expectedActiveContext == null) { assertThat(activeContext.isEmpty()) .describedAs("unexpected active context in thread %d", threadId) @@ -334,7 +334,7 @@ TestObservation checkValue(int expectedValue) { } - private static void checkActiveContext(@Nullable AbstractSpan expectedActive) { + private static void checkActiveContext(@Nullable AbstractSpanImpl expectedActive) { assertThat(tracer.getActive()) .describedAs("active context not available") .isNotNull() diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/src/test/java/co/elastic/apm/agent/redis/AbstractRedisInstrumentationTest.java b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/src/test/java/co/elastic/apm/agent/redis/AbstractRedisInstrumentationTest.java index 87237dda14..f4f7b2581e 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/src/test/java/co/elastic/apm/agent/redis/AbstractRedisInstrumentationTest.java +++ b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/src/test/java/co/elastic/apm/agent/redis/AbstractRedisInstrumentationTest.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.redis; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Destination; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.After; import org.junit.Before; import org.junit.jupiter.api.AfterEach; @@ -62,7 +62,7 @@ public final void initRedis() throws IOException { @After @AfterEach public final void stopRedis() { - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); if (transaction != null) { transaction.deactivate().end(); } @@ -71,18 +71,18 @@ public final void stopRedis() { public void assertTransactionWithRedisSpans(String... commands) { await().untilAsserted(() -> assertThat(reporter.getSpans()).hasSize(commands.length)); - assertThat(reporter.getSpans().stream().map(Span::getNameAsString)).containsExactly(commands); - assertThat(reporter.getSpans().stream().map(Span::getType).distinct()).containsExactly("db"); - assertThat(reporter.getSpans().stream().map(Span::getSubtype).distinct()).containsExactly("redis"); - assertThat(reporter.getSpans().stream().map(Span::getAction).distinct()).containsExactly("query"); - assertThat(reporter.getSpans().stream().map(Span::isExit).distinct()).containsExactly(true); - assertThat(reporter.getSpans().stream().map(Span::getOutcome).distinct()).containsExactly(Outcome.SUCCESS); + assertThat(reporter.getSpans().stream().map(SpanImpl::getNameAsString)).containsExactly(commands); + assertThat(reporter.getSpans().stream().map(SpanImpl::getType).distinct()).containsExactly("db"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getSubtype).distinct()).containsExactly("redis"); + assertThat(reporter.getSpans().stream().map(SpanImpl::getAction).distinct()).containsExactly("query"); + assertThat(reporter.getSpans().stream().map(SpanImpl::isExit).distinct()).containsExactly(true); + assertThat(reporter.getSpans().stream().map(SpanImpl::getOutcome).distinct()).containsExactly(Outcome.SUCCESS); verifyDestinationDetails(reporter.getSpans()); } - private void verifyDestinationDetails(List spanList) { - for (Span span : spanList) { - Destination destination = span.getContext().getDestination(); + private void verifyDestinationDetails(List spanList) { + for (SpanImpl span : spanList) { + DestinationImpl destination = span.getContext().getDestination(); if (destinationAddressSupported()) { assertThat(destination.getAddress().toString()).isEqualTo(expectedAddress); assertThat(destination.getPort()).isEqualTo(redisPort); diff --git a/apm-agent-plugins/apm-scala-concurrent-plugin/src/main/java/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentation.java b/apm-agent-plugins/apm-scala-concurrent-plugin/src/main/java/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentation.java index 59277bfc5c..e9f604f95c 100644 --- a/apm-agent-plugins/apm-scala-concurrent-plugin/src/main/java/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentation.java +++ b/apm-agent-plugins/apm-scala-concurrent-plugin/src/main/java/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentation.java @@ -19,9 +19,8 @@ package co.elastic.apm.agent.scalaconcurrent; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; -import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Tracer; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import net.bytebuddy.asm.Advice; @@ -43,7 +42,7 @@ public abstract class FutureInstrumentation extends ElasticApmInstrumentation { private static final Tracer tracer = GlobalTracer.get(); @SuppressWarnings("WeakerAccess") - public static final ReferenceCountedMap> promisesToContext = tracer.newReferenceCountedMap(); + public static final ReferenceCountedMap> promisesToContext = tracer.newReferenceCountedMap(); @Nonnull @Override @@ -66,7 +65,7 @@ public ElementMatcher getMethodMatcher() { public static class AdviceClass { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void onExit(@Advice.This Object thiz) { - final ElasticContext context = tracer.currentContext(); + final TraceState context = tracer.currentContext(); if (!context.isEmpty()) { promisesToContext.put(thiz, context); } @@ -93,7 +92,7 @@ public static class AdviceClass { public static Object onEnter(@Advice.This Object thiz) { // We cannot remove yet, as this may decrement the ref count of the span to 0 if it has already ended, // thus causing it to be recycled just before we activate it on the current thread. So we first get(). - ElasticContext context = promisesToContext.get(thiz); + TraceState context = promisesToContext.get(thiz); if (context != null) { context.activate(); // Now it's safe to remove, as ref count is at least 2 @@ -105,7 +104,7 @@ public static Object onEnter(@Advice.This Object thiz) { @Advice.OnMethodExit(suppress = Throwable.class, inline = false) public static void onExit(@Advice.Enter @Nullable Object contextObj) { if (contextObj != null) { - ElasticContext context = (ElasticContext) contextObj; + TraceState context = (TraceState) contextObj; context.deactivate(); } } diff --git a/apm-agent-plugins/apm-scala-concurrent-plugin/src/test/scala/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentationSpec.scala b/apm-agent-plugins/apm-scala-concurrent-plugin/src/test/scala/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentationSpec.scala index 79e7a296e4..3dd92274e8 100644 --- a/apm-agent-plugins/apm-scala-concurrent-plugin/src/test/scala/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentationSpec.scala +++ b/apm-agent-plugins/apm-scala-concurrent-plugin/src/test/scala/co/elastic/apm/agent/scalaconcurrent/FutureInstrumentationSpec.scala @@ -2,7 +2,7 @@ package co.elastic.apm.agent.scalaconcurrent import co.elastic.apm.agent.MockReporter import co.elastic.apm.agent.bci.ElasticApmAgent -import co.elastic.apm.agent.configuration.{CoreConfiguration, SpyConfiguration} +import co.elastic.apm.agent.configuration.{CoreConfigurationImpl, SpyConfiguration} import co.elastic.apm.agent.impl.{ElasticApmTracer, ElasticApmTracerBuilder} import munit.FunSuite import net.bytebuddy.agent.ByteBuddyAgent @@ -17,12 +17,12 @@ class FutureInstrumentationSpec extends FunSuite { private var reporter: MockReporter = _ private var tracer: ElasticApmTracer = _ - private var coreConfiguration: CoreConfiguration = _ + private var CoreConfigurationImpl: CoreConfigurationImpl = _ override def beforeEach(context: BeforeEach): Unit = { reporter = new MockReporter val config: ConfigurationRegistry = SpyConfiguration.createSpyConfig - coreConfiguration = config.getConfig(classOf[CoreConfiguration]) + CoreConfigurationImpl = config.getConfig(classOf[CoreConfigurationImpl]) tracer = new ElasticApmTracerBuilder().configurationRegistry(config).reporter(reporter).build ElasticApmAgent.initInstrumentation(tracer, ByteBuddyAgent.install) tracer.start(false) diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledInstrumentationTest.java b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledInstrumentationTest.java index 7503ada5ce..9d07159abd 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledInstrumentationTest.java +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledInstrumentationTest.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.scheduled; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -31,8 +31,8 @@ public abstract class AbstractScheduledInstrumentationTest extends AbstractInstrumentationTest { - protected static List checkTransactions(AbstractCounter counter, int expectedCount, String expectedName) { - List transactions = reporter.getTransactions(); + protected static List checkTransactions(AbstractCounter counter, int expectedCount, String expectedName) { + List transactions = reporter.getTransactions(); assertThat(transactions).hasSize(counter.getInvocationCount()).hasSize(expectedCount); transactions.forEach(t -> { assertThat(t.getNameAsString()).isEqualTo(expectedName); @@ -40,9 +40,9 @@ protected static List checkTransactions(AbstractCounter counter, in return transactions; } - protected static void checkOutcome(List transactions, Outcome outcome) { + protected static void checkOutcome(List transactions, Outcome outcome) { assertThat(transactions.stream() - .map(AbstractSpan::getOutcome) + .map(AbstractSpanImpl::getOutcome) .collect(Collectors.toSet())) .containsExactly(outcome); } diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledTransactionNameInstrumentationTest.java index 9ad8b35a74..38195697cc 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/AbstractScheduledTransactionNameInstrumentationTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.scheduled; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.jupiter.api.Test; import java.util.List; @@ -35,7 +35,7 @@ void testJeeScheduledAnnotatedMethodsAreTraced() { jeeCounter.scheduled(); jeeCounter.scheduled(); jeeCounter.scheduled(); - List transactions = checkTransactions(jeeCounter, 3, "JeeCounterImpl#scheduled"); + List transactions = checkTransactions(jeeCounter, 3, "JeeCounterImpl#scheduled"); checkOutcome(transactions, Outcome.SUCCESS); } @@ -44,7 +44,7 @@ void testJeeJ7RepeatableScheduledAnnotatedMethodsAreTraced() { JeeCounter jeeCounter = createJeeCounterImpl(); jeeCounter.scheduledJava7Repeatable(); jeeCounter.scheduledJava7Repeatable(); - List transactions = checkTransactions(jeeCounter, 2, "JeeCounterImpl#scheduledJava7Repeatable"); + List transactions = checkTransactions(jeeCounter, 2, "JeeCounterImpl#scheduledJava7Repeatable"); checkOutcome(transactions, Outcome.SUCCESS); } @@ -54,7 +54,7 @@ void testThrownErrorOutcomes() { assertThatThrownBy(throwCounter::throwingException); - List transactions = checkTransactions(throwCounter, 1, "ThrowingCounterImpl#throwingException"); + List transactions = checkTransactions(throwCounter, 1, "ThrowingCounterImpl#throwingException"); checkOutcome(transactions, Outcome.FAILURE); } diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/SpringScheduledTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/SpringScheduledTransactionNameInstrumentationTest.java index 0f3e936d9a..f10e4263b7 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/SpringScheduledTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/SpringScheduledTransactionNameInstrumentationTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.scheduled; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.jupiter.api.Test; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Schedules; @@ -34,7 +34,7 @@ void testSpringScheduledAnnotatedMethodsAreTraced() { springCounter.scheduled(); springCounter.scheduled(); - List transactions = checkTransactions(springCounter, 2, "SpringCounter#scheduled"); + List transactions = checkTransactions(springCounter, 2, "SpringCounter#scheduled"); checkOutcome(transactions, Outcome.SUCCESS); } @@ -44,7 +44,7 @@ void testSpringJ8RepeatableScheduledAnnotatedMethodsAreTraced() { springCounter.scheduledJava8Repeatable(); springCounter.scheduledJava8Repeatable(); - List transactions = checkTransactions(springCounter, 2, "SpringCounter#scheduledJava8Repeatable"); + List transactions = checkTransactions(springCounter, 2, "SpringCounter#scheduledJava8Repeatable"); checkOutcome(transactions, Outcome.SUCCESS); } @@ -54,7 +54,7 @@ void testSpringJ7RepeatableScheduledAnnotatedMethodsAreTraced() { springCounter.scheduledJava7Repeatable(); springCounter.scheduledJava7Repeatable(); - List transactions = checkTransactions(springCounter, 2, "SpringCounter#scheduledJava7Repeatable"); + List transactions = checkTransactions(springCounter, 2, "SpringCounter#scheduledJava7Repeatable"); checkOutcome(transactions, Outcome.SUCCESS); } diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/TimerTaskInstrumentationTest.java b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/TimerTaskInstrumentationTest.java index 51bde1ac88..49c8a4e1a0 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/TimerTaskInstrumentationTest.java +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/src/test/java/co/elastic/apm/agent/scheduled/TimerTaskInstrumentationTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.scheduled; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.Test; import java.util.Timer; @@ -40,11 +40,11 @@ void testTimerTask_scheduleWithFixedRate() { assertThat(reporter.getTransactions() .stream() - .map(AbstractSpan::getNameAsString)) + .map(AbstractSpanImpl::getNameAsString)) .containsExactly("TestTimerTask#run", "TestTimerTask#run"); assertThat(reporter.getTransactions() .stream() - .map(Transaction::getFrameworkName)) + .map(TransactionImpl::getFrameworkName)) .containsExactly("TimerTask", "TimerTask"); } @@ -57,7 +57,7 @@ void testTimerTask_scheduleWithFixedDelay() { assertThat(reporter.getTransactions() .stream() - .map(AbstractSpan::getNameAsString)) + .map(AbstractSpanImpl::getNameAsString)) .containsExactly("TestTimerTask#run", "TestTimerTask#run"); } diff --git a/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaAsyncServletTest.java b/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaAsyncServletTest.java index 380761ceb1..8cb7e8a300 100644 --- a/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaAsyncServletTest.java +++ b/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaAsyncServletTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.servlet; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.eclipse.jetty.servlet.ServletContextHandler; import org.junit.jupiter.api.Test; @@ -99,7 +99,7 @@ private void assertHasOneTransaction(String path, Predicate bodyPredicat assertThat(reporter.getFirstTransaction(500)).isNotNull(); assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getFirstTransaction().getNameAsString()).contains("Servlet").contains("#doGet"); - final TransactionContext context = reporter.getFirstTransaction().getContext(); + final TransactionContextImpl context = reporter.getFirstTransaction().getContext(); assertThat(context.getRequest().getUrl().getPathname()).isEqualTo(path); assertThat(context.getResponse().getStatusCode()).isEqualTo(status); } @@ -109,7 +109,7 @@ public static class AsyncStartServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final AsyncContext asyncContext = req.startAsync(); - final Transaction transaction = tracer.currentTransaction(); + final TransactionImpl transaction = tracer.currentTransaction(); asyncContext.start(() -> { try { assertThat(tracer.getActive()).isSameAs(transaction); diff --git a/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaServletInstrumentationTest.java b/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaServletInstrumentationTest.java index 74cc1431e1..1cc7760dab 100644 --- a/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaServletInstrumentationTest.java +++ b/apm-agent-plugins/apm-servlet-jakarta-test/src/test/java/co/elastic/apm/agent/servlet/JakartaServletInstrumentationTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.servlet; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.util.ResultUtil; -import co.elastic.apm.agent.impl.transaction.Span; import jakarta.servlet.DispatcherType; import jakarta.servlet.Filter; import jakarta.servlet.FilterChain; @@ -133,21 +133,21 @@ void testClientError() throws Exception { @Test void testForward_DispatchSpansDisabled() throws Exception { - doReturn(false).when(getConfig().getConfig(CoreConfiguration.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); + doReturn(false).when(getConfig().getConfig(CoreConfigurationImpl.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); callServlet(1, "/forward"); assertThat(reporter.getSpans()).isEmpty(); } @Test void testInclude_DispatchSpansDisabled() throws Exception { - doReturn(false).when(getConfig().getConfig(CoreConfiguration.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); + doReturn(false).when(getConfig().getConfig(CoreConfigurationImpl.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); callServlet(1, "/include"); assertThat(reporter.getSpans()).isEmpty(); } @Test void testClientError_DispatchSpansDisabled() throws Exception { - doReturn(false).when(getConfig().getConfig(CoreConfiguration.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); + doReturn(false).when(getConfig().getConfig(CoreConfigurationImpl.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); callServlet(1, "/unknown", "Hello Error!", 404); assertThat(reporter.getSpans()).isEmpty(); // TODO - ERROR NOT CAPTURED @@ -174,7 +174,7 @@ void testServletInstrumentationWithPathInfo() throws Exception { void testForwardWithPathInfo_verifyThatSpanNameContainsOriginalServletPathAndPathInfo() throws Exception { callServlet(1, "/forward/path", "Hello World! /forward-path-info", 200); assertThat(reporter.getSpans().size()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getType()).isEqualTo(SPAN_TYPE); assertThat(span.getSubtype()).isEqualTo(SPAN_SUBTYPE); assertThat(span.getAction()).isEqualTo(FORWARD.getAction()); @@ -185,7 +185,7 @@ void testForwardWithPathInfo_verifyThatSpanNameContainsOriginalServletPathAndPat void testIncludeWithPathInfo_verifyThatSpanNameContainsOriginalServletPathAndPathInfo() throws Exception { callServlet(1, "/include/path", "Hello World! /include-path-info", 200); assertThat(reporter.getSpans().size()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getType()).isEqualTo(SPAN_TYPE); assertThat(span.getSubtype()).isEqualTo(SPAN_SUBTYPE); assertThat(span.getAction()).isEqualTo(INCLUDE.getAction()); diff --git a/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletApiAdvice.java b/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletApiAdvice.java index 65695644e1..077cc52742 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletApiAdvice.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletApiAdvice.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.servlet; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Scope; @@ -127,7 +127,7 @@ public static activeContext = tracer.currentContext(); + final TraceState activeContext = tracer.currentContext(); final AbstractSpan parentSpan = activeContext.getSpan(); if (parentSpan != null) { Object servletPath = null; diff --git a/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletServiceNameHelper.java b/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletServiceNameHelper.java index e58bdf02dc..85bc37bb26 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletServiceNameHelper.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletServiceNameHelper.java @@ -18,7 +18,6 @@ */ package co.elastic.apm.agent.servlet; -import co.elastic.apm.agent.tracer.service.ServiceAwareTracer; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; @@ -44,11 +43,6 @@ public static void determineServiceName(ServletContextAdapter void determineServiceName(ServletContextAdapter ServiceInfo detectServiceInfo(ServletContextAdapter adapter, ServletContext servletContext, ClassLoader servletContextClassLoader) { diff --git a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ApmFilterTest.java b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ApmFilterTest.java index 9182631d7a..ab877431d7 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ApmFilterTest.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ApmFilterTest.java @@ -19,14 +19,14 @@ package co.elastic.apm.agent.servlet; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Response; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.context.Url; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -63,13 +63,13 @@ class ApmFilterTest extends AbstractInstrumentationTest { private WebConfiguration webConfiguration; - private CoreConfiguration coreConfiguration; + private CoreConfigurationImpl coreConfiguration; private MockFilterChain filterChain; @BeforeEach void setUp() { webConfiguration = tracer.getConfig(WebConfiguration.class); - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); filterChain = new MockFilterChain(); } @@ -92,8 +92,8 @@ void testURLTransaction() throws IOException, ServletException { request.setQueryString("foo=bar"); filterChain.doFilter(request, new MockHttpServletResponse()); - TransactionContext transactionContext = reporter.getFirstTransaction().getContext(); - Url url = transactionContext.getRequest().getUrl(); + TransactionContextImpl transactionContext = reporter.getFirstTransaction().getContext(); + UrlImpl url = transactionContext.getRequest().getUrl(); assertThat(url.getProtocol()).isEqualTo("http"); assertThat(url.getSearch()).isEqualTo("foo=bar"); assertThat(url.getPort()).isEqualTo(80); @@ -285,11 +285,11 @@ void testAllHeaderRecording() throws IOException, ServletException { mockResponse.addHeader("bar", "baz"); filterChain.doFilter(get, mockResponse); assertThat(reporter.getTransactions()).hasSize(1); - final Request request = reporter.getFirstTransaction().getContext().getRequest(); + final RequestImpl request = reporter.getFirstTransaction().getContext().getRequest(); assertThat(request.getHeaders().isEmpty()).isFalse(); assertThat(request.getHeaders().get("foo")).isEqualTo("bar"); assertThat(request.getCookies().get("foo")).isEqualTo("bar"); - final Response response = reporter.getFirstTransaction().getContext().getResponse(); + final ResponseImpl response = reporter.getFirstTransaction().getContext().getResponse(); assertThat(response.getHeaders().get("foo")).isEqualTo("bar"); assertThat(response.getHeaders().get("bar")).isEqualTo("baz"); } @@ -340,7 +340,7 @@ public void destroy() { private static class SimpleTestFilter implements Filter { @Nullable - AbstractSpan active = null; + AbstractSpanImpl active = null; @Override public void init(FilterConfig filterConfig) { diff --git a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/AsyncServletTest.java b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/AsyncServletTest.java index 953f4a6287..ebe91e2ce7 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/AsyncServletTest.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/AsyncServletTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.servlet; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.eclipse.jetty.servlet.ServletContextHandler; import org.junit.jupiter.api.Test; @@ -98,7 +98,7 @@ private void assertHasOneTransaction(String path, Predicate bodyPredicat assertThat(reporter.getFirstTransaction(500)).isNotNull(); assertThat(reporter.getTransactions()).hasSize(1); assertThat(reporter.getFirstTransaction().getNameAsString()).contains("Servlet").contains("#doGet"); - final TransactionContext context = reporter.getFirstTransaction().getContext(); + final TransactionContextImpl context = reporter.getFirstTransaction().getContext(); assertThat(context.getRequest().getUrl().getPathname()).isEqualTo(path); assertThat(context.getResponse().getStatusCode()).isEqualTo(status); } @@ -108,7 +108,7 @@ public static class AsyncStartServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final AsyncContext asyncContext = req.startAsync(); - final Transaction transaction = tracer.currentTransaction(); + final TransactionImpl transaction = tracer.currentTransaction(); asyncContext.start(() -> { try { assertThat(tracer.getActive()).isSameAs(transaction); diff --git a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/InitServiceNameInstrumentationTest.java b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/InitServiceNameInstrumentationTest.java index e5414a459e..24ccdcaec4 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/InitServiceNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/InitServiceNameInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.servlet; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.TraceContext; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterConfig; import org.springframework.mock.web.MockServletConfig; @@ -98,7 +98,7 @@ void testFilterInit() { } private void assertServiceInfo() { - TraceContext traceContext = reporter.getFirstTransaction().getTraceContext(); + TraceContextImpl traceContext = reporter.getFirstTransaction().getTraceContext(); assertThat(traceContext.getServiceName()).isEqualTo("service-name-from-manifest"); assertThat(traceContext.getServiceVersion()).isEqualTo("1.42.0"); } diff --git a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletInstrumentationTest.java b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletInstrumentationTest.java index 255602a91c..cfb953495a 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletInstrumentationTest.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletInstrumentationTest.java @@ -18,10 +18,10 @@ */ package co.elastic.apm.agent.servlet; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.util.ResultUtil; -import co.elastic.apm.agent.impl.transaction.Span; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Transaction; import okhttp3.Response; @@ -125,7 +125,7 @@ void testInclude_verifyThatSpanNameContainsTargetServletPath() throws Exception void testClientError() throws Exception { callServlet(1, "/unknown", "Hello Error!", 404); assertThat(reporter.getSpans().size()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getType()).isEqualTo(SPAN_TYPE); assertThat(span.getSubtype()).isEqualTo(SPAN_SUBTYPE); assertThat(span.getAction()).isEqualTo(ERROR.getAction()); @@ -136,21 +136,21 @@ void testClientError() throws Exception { @Test void testForward_DispatchSpansDisabled() throws Exception { - doReturn(false).when(getConfig().getConfig(CoreConfiguration.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); + doReturn(false).when(getConfig().getConfig(CoreConfigurationImpl.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); callServlet(1, "/forward"); assertThat(reporter.getSpans()).isEmpty(); } @Test void testInclude_DispatchSpansDisabled() throws Exception { - doReturn(false).when(getConfig().getConfig(CoreConfiguration.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); + doReturn(false).when(getConfig().getConfig(CoreConfigurationImpl.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); callServlet(1, "/include"); assertThat(reporter.getSpans()).isEmpty(); } @Test void testClientError_DispatchSpansDisabled() throws Exception { - doReturn(false).when(getConfig().getConfig(CoreConfiguration.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); + doReturn(false).when(getConfig().getConfig(CoreConfigurationImpl.class)).isInstrumentationEnabled(eq(Constants.SERVLET_API_DISPATCH)); callServlet(1, "/unknown", "Hello Error!", 404); assertThat(reporter.getSpans()).isEmpty(); assertThat(reporter.getErrors().size()).isEqualTo(1); @@ -176,7 +176,7 @@ void testServletInstrumentationWithPathInfo() throws Exception { void testForwardWithPathInfo_verifyThatSpanNameContainsOriginalServletPathAndPathInfo() throws Exception { callServlet(1, "/forward/path", "Hello World! /forward-path-info", 200); assertThat(reporter.getSpans().size()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getType()).isEqualTo(SPAN_TYPE); assertThat(span.getSubtype()).isEqualTo(SPAN_SUBTYPE); assertThat(span.getAction()).isEqualTo(FORWARD.getAction()); @@ -187,7 +187,7 @@ void testForwardWithPathInfo_verifyThatSpanNameContainsOriginalServletPathAndPat void testIncludeWithPathInfo_verifyThatSpanNameContainsOriginalServletPathAndPathInfo() throws Exception { callServlet(1, "/include/path", "Hello World! /include-path-info", 200); assertThat(reporter.getSpans().size()).isEqualTo(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getType()).isEqualTo(SPAN_TYPE); assertThat(span.getSubtype()).isEqualTo(SPAN_SUBTYPE); assertThat(span.getAction()).isEqualTo(INCLUDE.getAction()); diff --git a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletTransactionHelperTest.java b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletTransactionHelperTest.java index 4e8ca7c636..13dc1d44e3 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletTransactionHelperTest.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/ServletTransactionHelperTest.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.MockTracer; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.tracer.util.TransactionNameUtils; import org.junit.jupiter.api.BeforeEach; @@ -53,14 +53,14 @@ void setUp() { @Test void setTransactionNameByServletClass() { - Transaction transaction = new Transaction(MockTracer.create()); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()); TransactionNameUtils.setTransactionNameByServletClass("GET", ServletTransactionHelperTest.class, transaction.getAndOverrideName(PRIORITY_LOW_LEVEL_FRAMEWORK)); assertThat(transaction.getNameAsString()).isEqualTo("ServletTransactionHelperTest#doGet"); } @Test void setTransactionNameByServletClassNullMethod() { - Transaction transaction = new Transaction(MockTracer.create()); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()); TransactionNameUtils.setTransactionNameByServletClass(null, ServletTransactionHelperTest.class, transaction.getAndOverrideName(PRIORITY_LOW_LEVEL_FRAMEWORK)); assertThat(transaction.getNameAsString()).isEqualTo("ServletTransactionHelperTest"); } @@ -86,7 +86,7 @@ void testGroupUrlsOverridesServletName() { WildcardMatcher.valueOf("/foo/bar/*") )).when(webConfig).getUrlGroups(); - Transaction transaction = new Transaction(MockTracer.create()); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()); TransactionNameUtils.setTransactionNameByServletClass("GET", ServletTransactionHelperTest.class, transaction.getAndOverrideName(PRIORITY_LOW_LEVEL_FRAMEWORK)); servletTransactionHelper.applyDefaultTransactionName("GET", "/foo/bar/baz", null, transaction); assertThat(transaction.getNameAsString()).isEqualTo("GET /foo/bar/*"); @@ -94,7 +94,7 @@ void testGroupUrlsOverridesServletName() { @Nonnull private String getTransactionName(String method, String path) { - Transaction transaction = new Transaction(MockTracer.create()); + TransactionImpl transaction = new TransactionImpl(MockTracer.create()); servletTransactionHelper.applyDefaultTransactionName(method, path, null, transaction); return transaction.getNameAsString(); } diff --git a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/TestRequestBodyCapturing.java b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/TestRequestBodyCapturing.java index c4a8f01257..e83b5c491c 100644 --- a/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/TestRequestBodyCapturing.java +++ b/apm-agent-plugins/apm-servlet-plugin/src/test/java/co/elastic/apm/agent/servlet/TestRequestBodyCapturing.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.servlet; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.report.serialize.SerializationConstants; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; import org.apache.commons.lang3.RandomStringUtils; @@ -52,7 +52,7 @@ import java.util.Collections; import java.util.stream.Stream; -import static co.elastic.apm.agent.impl.context.AbstractContext.REDACTED_CONTEXT_STRING; +import static co.elastic.apm.agent.impl.context.AbstractContextImpl.REDACTED_CONTEXT_STRING; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; @@ -62,7 +62,7 @@ class TestRequestBodyCapturing extends AbstractInstrumentationTest { private InputStreamConsumer streamConsumer; private InputStreamCloser streamCloser; private WebConfiguration webConfiguration; - private CoreConfiguration coreConfiguration; + private CoreConfigurationImpl coreConfiguration; private MockFilterChain filterChain; static Stream streamConsumers() { @@ -86,8 +86,8 @@ static Stream streamConsumers() { @BeforeEach void setUp() { webConfiguration = tracer.getConfig(WebConfiguration.class); - coreConfiguration = tracer.getConfig(CoreConfiguration.class); - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); filterChain = new MockFilterChain(new HttpServlet() { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { @@ -117,7 +117,7 @@ void testReadTextPlain(InputStreamConsumer consumer) throws Exception { @Test void testCaptureBodyOff() throws Exception { - doReturn(CoreConfiguration.EventType.OFF).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.OFF).when(coreConfiguration).getCaptureBody(); executeRequest(filterChain, "foo".getBytes(StandardCharsets.UTF_8), "text/plain"); final Object body = reporter.getFirstTransaction().getContext().getRequest().getBody(); @@ -127,19 +127,19 @@ void testCaptureBodyOff() throws Exception { @ParameterizedTest @ValueSource(strings = {"ALL", "TRANSACTIONS", "ERRORS"}) - void testCaptureBodyNotOff(CoreConfiguration.EventType eventType) throws Exception { + void testCaptureBodyNotOff(CoreConfigurationImpl.EventType eventType) throws Exception { streamCloser = is -> { throw new RuntimeException(); }; doReturn(eventType).when(coreConfiguration).getCaptureBody(); executeRequest(filterChain, "foo".getBytes(StandardCharsets.UTF_8), "text/plain"); - final Transaction transaction = reporter.getFirstTransaction(); + final TransactionImpl transaction = reporter.getFirstTransaction(); final Object body = transaction.getContext().getRequest().getBody(); assertThat(body).isNotNull(); // this is not [REDACTED] in this test as the BodyProcessor is not active in MockReporter assertThat(body.toString()).isEqualTo("foo"); - final ErrorCapture error = reporter.getFirstError(); + final ErrorCaptureImpl error = reporter.getFirstError(); assertThat(error).isNotNull(); assertThat(error.getContext().getRequest().getBody().toString()).isEqualTo("foo"); } @@ -215,7 +215,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I @Test void testTrackPostParams() throws IOException, ServletException { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); MockHttpServletRequest request = new MockHttpServletRequest("POST", "/foo/bar"); request.addParameter("foo", "bar"); request.addParameter("baz", "qux", "quux"); @@ -230,7 +230,7 @@ void testTrackPostParams() throws IOException, ServletException { @Test void testTrackPostParamsDisabled() throws IOException, ServletException { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); doReturn(Collections.emptyList()).when(webConfiguration).getCaptureContentTypes(); MockHttpServletRequest request = new MockHttpServletRequest("POST", "/foo/bar"); request.addParameter("foo", "bar"); @@ -243,7 +243,7 @@ void testTrackPostParamsDisabled() throws IOException, ServletException { @Test void testNoExplicitEndOfInput() { - final Transaction transaction = tracer.startRootTransaction(getClass().getClassLoader()); + final TransactionImpl transaction = tracer.startRootTransaction(getClass().getClassLoader()); transaction.getContext().getRequest().withBodyBuffer(); transaction.end(); assertThat(reporter.getFirstTransaction().getContext().getRequest().getBody().toString()).isEqualTo(""); diff --git a/apm-agent-plugins/apm-sparkjava-plugin/src/test/java/co/elastic/apm/agent/sparkjava/RoutesAdviceTest.java b/apm-agent-plugins/apm-sparkjava-plugin/src/test/java/co/elastic/apm/agent/sparkjava/RoutesAdviceTest.java index 7af62208e9..f9ae3d93e5 100644 --- a/apm-agent-plugins/apm-sparkjava-plugin/src/test/java/co/elastic/apm/agent/sparkjava/RoutesAdviceTest.java +++ b/apm-agent-plugins/apm-sparkjava-plugin/src/test/java/co/elastic/apm/agent/sparkjava/RoutesAdviceTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.sparkjava; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import okhttp3.OkHttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -72,7 +72,7 @@ void testTransactionName() throws IOException { okhttp3.Response response = httpClient.newCall(request).execute(); assertThat(response.body().string()).isEqualTo("bar"); - Transaction transaction = reporter.getFirstTransaction(500); + TransactionImpl transaction = reporter.getFirstTransaction(500); assertThat(transaction.getNameAsString()).isEqualTo("GET /foo/:bar"); assertThat(transaction.getFrameworkName()).isEqualTo("Spark"); assertThat(transaction.getFrameworkVersion()).isEqualTo("2.9.3"); diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/FeignClientTest.java b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/FeignClientTest.java index ae9ebf00d1..f98244285f 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/FeignClientTest.java +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/FeignClientTest.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.resttemplate; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Http; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import com.github.tomakehurst.wiremock.junit.WireMockRule; import feign.Feign; @@ -46,7 +46,7 @@ public class FeignClientTest extends AbstractInstrumentationTest { @Rule public WireMockRule wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig().dynamicPort(), false); - private Transaction rootTransaction; + private TransactionImpl rootTransaction; private String baseUrl = null; @@ -78,8 +78,8 @@ public void testThatSpanCreated() { reporter.awaitSpanCount(1); - Span span = reporter.getFirstSpan(); - Http http = span.getContext().getHttp(); + SpanImpl span = reporter.getFirstSpan(); + HttpImpl http = span.getContext().getHttp(); assertThat(span.getNameAsString()).isEqualTo("GET 127.0.0.1"); assertThat(http.getMethod()).isEqualTo("GET"); diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/SprintRestTemplateIntegration.java b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/SprintRestTemplateIntegration.java index 40a099941a..ef90f32d6e 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/SprintRestTemplateIntegration.java +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/src/test/java/co/elastic/apm/agent/resttemplate/SprintRestTemplateIntegration.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.resttemplate; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.context.Http; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import com.github.tomakehurst.wiremock.junit.WireMockRule; import org.junit.After; @@ -42,7 +42,7 @@ public class SprintRestTemplateIntegration extends AbstractInstrumentationTest { private final RestTemplate restTemplate; - private Transaction rootTransaction; + private TransactionImpl rootTransaction; private final boolean expectSpan; @@ -83,8 +83,8 @@ public void getRoot() { } else { reporter.awaitSpanCount(1); - Span span = reporter.getFirstSpan(); - Http http = span.getContext().getHttp(); + SpanImpl span = reporter.getFirstSpan(); + HttpImpl http = span.getContext().getHttp(); assertThat(http.getMethod()).isEqualTo("GET"); assertThat(http.getUrl().toString()).isEqualTo(url); } diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientExchangeFunctionInstrumentation.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientExchangeFunctionInstrumentation.java index 54e651ae9a..6ae015d439 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientExchangeFunctionInstrumentation.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/src/main/java/co/elastic/apm/agent/springwebclient/WebClientExchangeFunctionInstrumentation.java @@ -20,11 +20,10 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; -import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import net.bytebuddy.asm.Advice; import net.bytebuddy.asm.Advice.AssignReturned.ToArguments.ToArgument; import net.bytebuddy.description.NamedElement; @@ -86,7 +85,7 @@ public static Object[] onBefore(@Advice.Argument(0) ClientRequest clientRequest) span.activate(); } - ElasticContext toPropagate = tracer.currentContext(); + TraceState toPropagate = tracer.currentContext(); if (!toPropagate.isEmpty()) { ClientRequest.Builder builder = ClientRequest.from(clientRequest); toPropagate.propagateContext(builder, WebClientRequestHeaderSetter.INSTANCE, null); diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/main/java/co/elastic/apm/agent/springwebflux/TransactionAwareSubscriber.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/main/java/co/elastic/apm/agent/springwebflux/TransactionAwareSubscriber.java index 3747089052..e3bc75bda2 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/main/java/co/elastic/apm/agent/springwebflux/TransactionAwareSubscriber.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/main/java/co/elastic/apm/agent/springwebflux/TransactionAwareSubscriber.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Transaction; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; @@ -72,7 +72,7 @@ class TransactionAwareSubscriber implements CoreSubscriber, Subscription { // store transaction into subscriber context it can be looked-up by reactor when the transaction // is not already active in current thread. - this.context = subscriber.currentContext().put(ElasticContext.class, transaction); + this.context = subscriber.currentContext().put(TraceState.class, transaction); } @Override diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/AbstractServerInstrumentationTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/AbstractServerInstrumentationTest.java index 7b75f987a3..e27585baad 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/AbstractServerInstrumentationTest.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/AbstractServerInstrumentationTest.java @@ -19,12 +19,12 @@ package co.elastic.apm.agent.springwebflux; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.Url; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.springwebflux.testapp.GreetingWebClient; import co.elastic.apm.agent.springwebflux.testapp.WebFluxApplication; @@ -121,9 +121,9 @@ private void hello(boolean expectHeaders) { String expectedName = client.useFunctionalEndpoint() ? "GET /functional/hello" : "GreetingAnnotated#getHello"; - Transaction transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); + TransactionImpl transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); - Request request = transaction.getContext().getRequest(); + RequestImpl request = transaction.getContext().getRequest(); checkUrl(transaction, "/hello"); @@ -160,7 +160,7 @@ private void hello(boolean expectHeaders) { @Test void headerCaptureDisabled() { - CoreConfiguration coreConfig = getConfig().getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = getConfig().getConfig(CoreConfigurationImpl.class); doReturn(false).when(coreConfig).isCaptureHeaders(); hello(false); @@ -172,7 +172,7 @@ void dispatch404() { .expectErrorMatches(expectClientError(404)) .verify(); - Transaction transaction = checkTransaction(getFirstTransaction(), "GET unknown route", "GET", 404); + TransactionImpl transaction = checkTransaction(getFirstTransaction(), "GET unknown route", "GET", 404); assertThat(transaction.getResult()).isEqualTo("HTTP 4xx"); assertThat(transaction.getContext().getRequest().getMethod()).isEqualTo("GET"); @@ -189,7 +189,7 @@ void dispatch404_usePathAsName() { .expectErrorMatches(expectClientError(404)) .verify(); - Transaction transaction = checkTransaction(getFirstTransaction(), "GET /*/error-404", "GET", 404); + TransactionImpl transaction = checkTransaction(getFirstTransaction(), "GET /*/error-404", "GET", 404); assertThat(transaction.getResult()).isEqualTo("HTTP 4xx"); assertThat(transaction.getContext().getRequest().getMethod()).isEqualTo("GET"); @@ -240,7 +240,7 @@ void transactionDuration() { .verifyComplete(); String expectedName = client.useFunctionalEndpoint() ? "GET /functional/duration" : "GreetingAnnotated#duration"; - Transaction transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); + TransactionImpl transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); assertThat(transaction.getDurationMs()) .isCloseTo(duration * 1d, Offset.offset(duration / 2d)); @@ -257,7 +257,7 @@ void shouldInstrumentPathWithParameters() { String expectedName = client.useFunctionalEndpoint() ? "GET " + client.getPathPrefix() + "/with-parameters/{id}" : "GreetingAnnotated#withParameters"; - Transaction transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); + TransactionImpl transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); checkUrl(transaction, "/with-parameters/1234"); } @@ -407,7 +407,7 @@ private static Predicate> checkSSE(final int index) { } private void checkChildSpans(String expectedName, String pathAndQuery) { - Transaction transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); + TransactionImpl transaction = checkTransaction(getFirstTransaction(), expectedName, "GET", 200); checkUrl(transaction, pathAndQuery); @@ -417,8 +417,8 @@ private void checkChildSpans(String expectedName, String pathAndQuery) { }); } - static void checkUrl(GreetingWebClient client, Transaction transaction, String pathAndQuery) { - Url url = transaction.getContext().getRequest().getUrl(); + static void checkUrl(GreetingWebClient client, TransactionImpl transaction, String pathAndQuery) { + UrlImpl url = transaction.getContext().getRequest().getUrl(); assertThat(url.getProtocol()).isEqualTo("http"); assertThat(url.getHostname()).isEqualTo("localhost"); @@ -439,19 +439,19 @@ static void checkUrl(GreetingWebClient client, Transaction transaction, String p .isEqualTo(String.format("http://localhost:%d%s%s", client.getPort(), client.getPathPrefix(), pathAndQuery)); } - private void checkUrl(Transaction transaction, String pathAndQuery) { + private void checkUrl(TransactionImpl transaction, String pathAndQuery) { checkUrl(client, transaction, pathAndQuery); } - protected Transaction getFirstTransaction() { + protected TransactionImpl getFirstTransaction() { return reporter.getFirstTransaction(200); } - protected ErrorCapture getFirstError() { + protected ErrorCaptureImpl getFirstError() { return reporter.getFirstError(200); } - static Transaction checkTransaction(Transaction transaction, String expectedName, String expectedMethod, int expectedStatus) { + static TransactionImpl checkTransaction(TransactionImpl transaction, String expectedName, String expectedMethod, int expectedStatus) { assertThat(transaction.getType()).isEqualTo("request"); assertThat(transaction.getNameAsString()).isEqualTo(expectedName); diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/ServletContainerTest.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/ServletContainerTest.java index 3ce767dcec..f1c1c75e9c 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/ServletContainerTest.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/src/test/java/co/elastic/apm/agent/springwebflux/ServletContainerTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.springwebflux; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.springwebflux.testapp.GreetingWebClient; import co.elastic.apm.agent.springwebflux.testapp.WebFluxApplication; import org.junit.jupiter.api.AfterAll; @@ -71,7 +71,7 @@ void shouldOnlyCreateOneTransaction() throws InterruptedException { .verifyComplete(); // at least one transaction expected - Transaction transaction = reporter.getFirstTransaction(200); + TransactionImpl transaction = reporter.getFirstTransaction(200); // transaction naming should be set by webflux instrumentation AbstractServerInstrumentationTest.checkTransaction(transaction, "GET /functional/with-parameters/{id}", "GET", 200); diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml index 677cae94cc..5014a846c3 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml @@ -37,6 +37,12 @@ + + ${project.groupId} + apm-agent-core + ${project.version} + + org.springframework.boot spring-boot-starter-webflux diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingAnnotated.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingAnnotated.java index 3ce7f49bc5..338cd24982 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingAnnotated.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingAnnotated.java @@ -19,13 +19,12 @@ package co.elastic.apm.agent.springwebflux.testapp; import co.elastic.apm.agent.impl.ElasticApmTracer; +import co.elastic.apm.agent.impl.transaction.IdImpl; import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.GlobalTracer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -171,13 +170,13 @@ public Mono customTransactionName() { log.debug("enter customTransactionName"); try { - Id transactionId = null; + IdImpl transactionId = null; if (!GlobalTracer.isNoop()) { // Transaction should be active, even if we are outside of Mono/Flux execution // In practice, it's called after onSubscribe and before onNext, thus the active context is not provided // by reactor plugin, but only by the webflux plugin that keeps the transaction active. ElasticApmTracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); - Transaction transaction = Objects.requireNonNull(tracer.currentTransaction(), "active transaction is required"); + TransactionImpl transaction = Objects.requireNonNull(tracer.currentTransaction(), "active transaction is required"); // This mimics setting the name through the public API. We cannot use the public API if we want to test span recycling transaction.withName("user-provided-name", AbstractSpan.PRIORITY_USER_SUPPLIED); transactionId = transaction.getTraceContext().getId(); diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingFunctional.java b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingFunctional.java index 2ade37aa58..d58e116347 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingFunctional.java +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/GreetingFunctional.java @@ -21,9 +21,8 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.Transaction; -import co.elastic.apm.agent.tracer.GlobalTracer; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; @@ -83,10 +82,10 @@ public RouterFunction route(GreetingHandler greetingHandler) { .GET("/functional/duration", accept(MediaType.TEXT_PLAIN), request -> response(greetingHandler.duration(getDuration(request)))) // custom transaction name set through API .GET("/functional/custom-transaction-name", accept(MediaType.TEXT_PLAIN), request -> { - Id transactionId = null; + IdImpl transactionId = null; if (!GlobalTracer.isNoop()) { ElasticApmTracer tracer = GlobalTracer.get().require(ElasticApmTracer.class); - Transaction transaction = Objects.requireNonNull(tracer.currentTransaction(), "active transaction is required"); + TransactionImpl transaction = Objects.requireNonNull(tracer.currentTransaction(), "active transaction is required"); // This mimics setting the name through the public API. We cannot use the public API if we want to test span recycling transaction.withName("user-provided-name", AbstractSpan.PRIORITY_USER_SUPPLIED); transactionId = transaction.getTraceContext().getId(); diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index c7b86d8426..bedbf509ef 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -31,12 +31,6 @@ - - ${project.groupId} - apm-agent-core - ${project.version} - - co.elastic.apm diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/main/java/co/elastic/apm/agent/springwebmvc/AbstractSpringServiceNameInstrumentation.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/main/java/co/elastic/apm/agent/springwebmvc/AbstractSpringServiceNameInstrumentation.java index e38a5491f1..649047e62c 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/main/java/co/elastic/apm/agent/springwebmvc/AbstractSpringServiceNameInstrumentation.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/main/java/co/elastic/apm/agent/springwebmvc/AbstractSpringServiceNameInstrumentation.java @@ -18,7 +18,6 @@ */ package co.elastic.apm.agent.springwebmvc; -import co.elastic.apm.agent.tracer.service.ServiceAwareTracer; import co.elastic.apm.agent.tracer.service.ServiceInfo; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; import co.elastic.apm.agent.servlet.Constants; @@ -76,14 +75,9 @@ public static class Helper { public static void detectSpringServiceName(ServletContextAdapter adapter, WebApplicationContext applicationContext, @Nullable ServletContext servletContext) { - ServiceAwareTracer serviceAwareTracer = tracer.probe(ServiceAwareTracer.class); - if (serviceAwareTracer == null) { - return; - } - // avoid having two service names for a standalone jar // one based on Implementation-Title and one based on spring.application.name - if (!serviceAwareTracer.autoDetectedServiceInfo().isMultiServiceContainer()) { + if (!tracer.autoDetectedServiceInfo().isMultiServiceContainer()) { return; } @@ -105,7 +99,7 @@ public static void detectSpringServiceName(ServletContextAdapte ServiceInfo fromSpringApplicationNameProperty = ServiceInfo.of(applicationContext.getEnvironment().getProperty("spring.application.name", "")); ServiceInfo fromApplicationContextApplicationName = ServiceInfo.of(removeLeadingSlash(applicationContext.getApplicationName())); - serviceAwareTracer.setServiceInfoForClassLoader(classLoader, fromSpringApplicationNameProperty + tracer.setServiceInfoForClassLoader(classLoader, fromSpringApplicationNameProperty .withFallback(fromServletContext) .withFallback(fromApplicationContextApplicationName)); } diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/AbstractSpringTransactionNameInstrumentationTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/AbstractSpringTransactionNameInstrumentationTest.java index b2d167a248..b94f52300c 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/AbstractSpringTransactionNameInstrumentationTest.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/AbstractSpringTransactionNameInstrumentationTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.springwebmvc; import co.elastic.apm.agent.AbstractInstrumentationTest; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.Transaction; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; @@ -192,7 +192,7 @@ public static class TestController { @GetMapping("/test") public CharSequence test() { - Transaction currentTransaction = tracer.currentTransaction(); + TransactionImpl currentTransaction = tracer.currentTransaction(); assertThat(currentTransaction).isNotNull(); return currentTransaction.getNameAsString(); } diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationTest.java index 4ddb38e1bd..bd11adf470 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationTest.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.springwebmvc.exception; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -56,7 +56,7 @@ protected void assertExceptionCapture(Class exceptionClazz, MockHttpServletRespo protected void assertExceptionCapture(Class exceptionClazz, MockHttpServletResponse response, int statusCode, String responseContent, String exceptionMessageContains, String childSpanNameContains) throws UnsupportedEncodingException { assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); if (childSpanNameContains == null) { assertThat(reporter.getSpans()).isEmpty(); } else { diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationWithExceptionResolverTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationWithExceptionResolverTest.java index b3774107ed..57f3d4b2d6 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationWithExceptionResolverTest.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/AbstractExceptionHandlerInstrumentationWithExceptionResolverTest.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.springwebmvc.exception; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.springwebmvc.exception.testapp.exception_resolver.ExceptionResolverController; import co.elastic.apm.agent.springwebmvc.exception.testapp.exception_resolver.ExceptionResolverRuntimeException; import org.junit.jupiter.params.ParameterizedTest; @@ -48,7 +48,7 @@ public abstract class AbstractExceptionHandlerInstrumentationWithExceptionResolv @ParameterizedTest @ValueSource(booleans = {true,false}) public void testCallApiWithExceptionThrown(boolean useAttributeBasedPropagation) throws Exception { - CoreConfiguration coreConfig = config.getConfig(CoreConfiguration.class); + CoreConfigurationImpl coreConfig = config.getConfig(CoreConfigurationImpl.class); doReturn(useAttributeBasedPropagation).when(coreConfig).isUseServletAttributesForExceptionPropagation(); ResultActions resultActions = this.mockMvc.perform(get("/exception-resolver/throw-exception")); diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithExceptionHandlerTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithExceptionHandlerTest.java index 3773281f2f..cc9f10c51a 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithExceptionHandlerTest.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithExceptionHandlerTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.springwebmvc.exception; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.springwebmvc.exception.testapp.exception_handler.ExceptionHandlerController; import co.elastic.apm.agent.springwebmvc.exception.testapp.exception_handler.ExceptionHandlerRuntimeException; import co.elastic.apm.agent.springwebmvc.exception.testapp.exception_handler.ExceptionHandlerRuntimeException200; @@ -51,7 +51,7 @@ public void testExceptionCapture() throws Exception { @Test public void testExceptionCapture_IgnoreException() throws Exception { doReturn(List.of(WildcardMatcher.valueOf("co.elastic.apm.agent.springwebmvc.exception.testapp.exception_handler.ExceptionHandlerRuntimeException"))) - .when(config.getConfig(CoreConfiguration.class)).getIgnoreExceptions(); + .when(config.getConfig(CoreConfigurationImpl.class)).getIgnoreExceptions(); this.mockMvc.perform(get("/exception-handler/throw-exception")); diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithGlobalAdviceTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithGlobalAdviceTest.java index bb8172a14e..9c7f482683 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithGlobalAdviceTest.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/exception/Spring5ExceptionHandlerInstrumentationWithGlobalAdviceTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.springwebmvc.exception; import co.elastic.apm.agent.common.util.WildcardMatcher; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.springwebmvc.exception.testapp.controller_advice.ControllerAdviceController; import co.elastic.apm.agent.springwebmvc.exception.testapp.controller_advice.ControllerAdviceRuntimeException; import co.elastic.apm.agent.springwebmvc.exception.testapp.controller_advice.ControllerAdviceRuntimeException200; @@ -56,7 +56,7 @@ public void testExceptionCaptureWithGlobalControllerAdvice() throws Exception { public void testExceptionCaptureWithGlobalControllerAdvice_IgnoreExceptions() throws Exception { doReturn(List.of(WildcardMatcher.valueOf("co.elastic.apm.agent.springwebmvc.exception.testapp.controller_advice.ControllerAdviceRuntimeException"))) - .when(config.getConfig(CoreConfiguration.class)).getIgnoreExceptions(); + .when(config.getConfig(CoreConfigurationImpl.class)).getIgnoreExceptions(); this.mockMvc.perform(get("/controller-advice/throw-exception")); diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/template/AbstractViewRenderingInstrumentationTest.java b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/template/AbstractViewRenderingInstrumentationTest.java index e59d3f362b..2262ca30cf 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/template/AbstractViewRenderingInstrumentationTest.java +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/src/test/java/co/elastic/apm/agent/springwebmvc/template/AbstractViewRenderingInstrumentationTest.java @@ -19,7 +19,7 @@ package co.elastic.apm.agent.springwebmvc.template; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -57,7 +57,7 @@ void verifySpanCapture(String spanSubType, String spanSuffix, MockHttpServletRes String responseString = response.getContentAsString(); assertEquals(messageContent, responseString.trim().replaceAll("\r\n", "\n")); assertEquals(1, reporter.getSpans().size()); - Span firstSpan = reporter.getSpans().get(0); + SpanImpl firstSpan = reporter.getSpans().get(0); assertEquals("template", firstSpan.getType()); assertEquals(spanSubType, firstSpan.getSubtype()); assertEquals("render", firstSpan.getAction()); diff --git a/apm-agent-plugins/apm-struts-plugin/src/main/java/co/elastic/apm/agent/struts/ActionProxyAdvice.java b/apm-agent-plugins/apm-struts-plugin/src/main/java/co/elastic/apm/agent/struts/ActionProxyAdvice.java index 7de8cfbc8d..9f2ca4390b 100644 --- a/apm-agent-plugins/apm-struts-plugin/src/main/java/co/elastic/apm/agent/struts/ActionProxyAdvice.java +++ b/apm-agent-plugins/apm-struts-plugin/src/main/java/co/elastic/apm/agent/struts/ActionProxyAdvice.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.struts; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -38,7 +38,7 @@ public class ActionProxyAdvice { @Nullable public static Object onEnterExecute(@Advice.This ActionProxy actionProxy) { - ElasticContext activeContext = GlobalTracer.get().currentContext(); + TraceState activeContext = GlobalTracer.get().currentContext(); Transaction transaction = activeContext.getTransaction(); if (transaction == null) { return null; diff --git a/apm-agent-plugins/apm-struts-plugin/src/test/java/co/elastic/apm/agent/struts/ActionProxyAdviceTest.java b/apm-agent-plugins/apm-struts-plugin/src/test/java/co/elastic/apm/agent/struts/ActionProxyAdviceTest.java index 625aeebf14..4d1a655880 100644 --- a/apm-agent-plugins/apm-struts-plugin/src/test/java/co/elastic/apm/agent/struts/ActionProxyAdviceTest.java +++ b/apm-agent-plugins/apm-struts-plugin/src/test/java/co/elastic/apm/agent/struts/ActionProxyAdviceTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.struts; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.StrutsTestCase; @@ -55,7 +55,7 @@ public synchronized void tearDown() throws Exception { } public void testExecuteAction() throws ServletException, UnsupportedEncodingException { - Transaction transaction = AbstractInstrumentationTest.getTracer().startRootTransaction(null).withName("struts-test").activate(); + TransactionImpl transaction = AbstractInstrumentationTest.getTracer().startRootTransaction(null).withName("struts-test").activate(); executeAction("/test1"); transaction.end(); @@ -63,7 +63,7 @@ public void testExecuteAction() throws ServletException, UnsupportedEncodingExce } public void testExecuteCustomMethodAction() throws ServletException, UnsupportedEncodingException { - Transaction transaction = AbstractInstrumentationTest.getTracer().startRootTransaction(null).withName("struts-test").activate(); + TransactionImpl transaction = AbstractInstrumentationTest.getTracer().startRootTransaction(null).withName("struts-test").activate(); executeAction("/test2"); transaction.end(); @@ -71,12 +71,12 @@ public void testExecuteCustomMethodAction() throws ServletException, Unsupported } public void testChainedAction() throws ServletException, UnsupportedEncodingException { - Transaction transaction = AbstractInstrumentationTest.getTracer().startRootTransaction(null).withName("struts-test").activate(); + TransactionImpl transaction = AbstractInstrumentationTest.getTracer().startRootTransaction(null).withName("struts-test").activate(); executeAction("/test3"); transaction.end(); assertThat(AbstractInstrumentationTest.getReporter().getFirstTransaction().getNameAsString()).isEqualTo("TestAction#chainedAction"); - Span span = AbstractInstrumentationTest.getReporter().getFirstSpan(); + SpanImpl span = AbstractInstrumentationTest.getReporter().getFirstSpan(); assertThat(span.getNameAsString()).isEqualTo("TestAction#execute"); assertThat(span.getType()).isEqualTo("app"); assertThat(span.getSubtype()).isEqualTo("internal"); diff --git a/apm-agent-plugins/apm-urlconnection-plugin/src/main/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentation.java b/apm-agent-plugins/apm-urlconnection-plugin/src/main/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentation.java index 85155b989f..a7ff424f58 100644 --- a/apm-agent-plugins/apm-urlconnection-plugin/src/main/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentation.java +++ b/apm-agent-plugins/apm-urlconnection-plugin/src/main/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentation.java @@ -24,11 +24,10 @@ import co.elastic.apm.agent.sdk.state.GlobalState; import co.elastic.apm.agent.tracer.AbstractSpan; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; import co.elastic.apm.agent.tracer.Tracer; -import co.elastic.apm.agent.tracer.dispatch.HeaderUtils; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.NamedElement; @@ -86,7 +85,7 @@ public static Object enter(@Advice.This HttpURLConnection thiz, boolean actuallyConnected = connected || responseCode != -1; boolean isNestedCall = callDepth.isNestedCallAndIncrement(); - ElasticContext activeContext = tracer.currentContext(); + TraceState activeContext = tracer.currentContext(); AbstractSpan parentSpan = activeContext.getSpan(); Span span = null; if (parentSpan != null) { diff --git a/apm-agent-plugins/apm-urlconnection-plugin/src/test/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentationTest.java b/apm-agent-plugins/apm-urlconnection-plugin/src/test/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentationTest.java index 1200f0ad9a..467838f64d 100644 --- a/apm-agent-plugins/apm-urlconnection-plugin/src/test/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentationTest.java +++ b/apm-agent-plugins/apm-urlconnection-plugin/src/test/java/co/elastic/apm/agent/urlconnection/HttpUrlConnectionInstrumentationTest.java @@ -19,9 +19,9 @@ package co.elastic.apm.agent.urlconnection; import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; -import co.elastic.apm.agent.impl.context.Http; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.tracer.Scope; import org.junit.Ignore; import org.junit.Test; @@ -48,7 +48,7 @@ protected void performGet(String path) throws Exception { public void testEndInDifferentThread() throws Exception { final HttpURLConnection urlConnection = (HttpURLConnection) new URL(getBaseUrl() + "/").openConnection(); urlConnection.connect(); - AbstractSpan active = tracer.getActive(); + AbstractSpanImpl active = tracer.getActive(); final Thread thread = new Thread(() -> { try (Scope scope = active.activateInScope()) { urlConnection.getInputStream(); @@ -148,10 +148,10 @@ public void testGetResponseCodeWithUnhandledException() { assertThat(reporter.getFirstSpan(500)).isNotNull(); assertThat(reporter.getSpans()).hasSize(1); - Span span = reporter.getSpans().get(0); + SpanImpl span = reporter.getSpans().get(0); assertThat(span.getNameAsString()).isEqualTo("GET unknown"); - Http http = span.getContext().getHttp(); + HttpImpl http = span.getContext().getHttp(); assertThat(http.getStatusCode()).isEqualTo(0); assertThat(http.getUrl().toString()).isEqualTo("http://unknown"); } diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/AbstractVertxWebClientHelper.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/AbstractVertxWebClientHelper.java index ab306a28fb..f24537b77d 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/AbstractVertxWebClientHelper.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/AbstractVertxWebClientHelper.java @@ -20,7 +20,7 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; @@ -51,8 +51,8 @@ public void setHeader(String headerName, String headerValue, HttpClientRequest c } } - public void startSpanOrFollowRedirect(ElasticContext activeContext, HttpContext httpContext, HttpClientRequest httpRequest) { - ElasticContext existingPropagationCtx = httpContext.get(PROPAGATION_CONTEXT_KEY); + public void startSpanOrFollowRedirect(TraceState activeContext, HttpContext httpContext, HttpClientRequest httpRequest) { + TraceState existingPropagationCtx = httpContext.get(PROPAGATION_CONTEXT_KEY); if (existingPropagationCtx != null) { // Repropagate headers in case of redirects @@ -65,7 +65,7 @@ public void startSpanOrFollowRedirect(ElasticContext activeContext, HttpConte URI requestUri = URI.create(httpRequest.absoluteURI()); Span span = HttpClientHelper.startHttpClientSpan(activeContext, getMethod(httpRequest), requestUri, null); - ElasticContext toPropagate = activeContext; + TraceState toPropagate = activeContext; if (span != null) { //no need to increment references of the span, the span will be kept alive by the incrementReferences() on the context below httpContext.set(WEB_CLIENT_SPAN_KEY, span); @@ -80,7 +80,7 @@ public void startSpanOrFollowRedirect(ElasticContext activeContext, HttpConte } public void followRedirect(HttpContext httpContext, HttpClientRequest httpRequest) { - ElasticContext existingPropagationCtx = httpContext.get(PROPAGATION_CONTEXT_KEY); + TraceState existingPropagationCtx = httpContext.get(PROPAGATION_CONTEXT_KEY); if (existingPropagationCtx != null) { existingPropagationCtx.propagateContext(httpRequest, HeaderSetter.INSTANCE, null); } @@ -96,7 +96,7 @@ public void failSpan(HttpContext httpContext, Throwable thrown, @Nullable Abs private void finalizeSpan(HttpContext httpContext, int statusCode, @Nullable Throwable thrown, @Nullable AbstractSpan parent) { Span span = httpContext.get(WEB_CLIENT_SPAN_KEY); - ElasticContext propagationCtx = httpContext.get(PROPAGATION_CONTEXT_KEY); + TraceState propagationCtx = httpContext.get(PROPAGATION_CONTEXT_KEY); if (propagationCtx != null) { // Setting to null removes from the attributes map httpContext.set(WEB_CLIENT_SPAN_KEY, null); diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/GenericHandlerWrapper.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/GenericHandlerWrapper.java index 9463669629..5fc975f7fc 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/GenericHandlerWrapper.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/GenericHandlerWrapper.java @@ -19,16 +19,16 @@ package co.elastic.apm.agent.vertx; import co.elastic.apm.agent.tracer.AbstractSpan; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import io.vertx.core.Handler; public class GenericHandlerWrapper implements Handler { protected final Handler actualHandler; - private final ElasticContext parentContext; + private final TraceState parentContext; - public GenericHandlerWrapper(ElasticContext parentContext, Handler actualHandler) { + public GenericHandlerWrapper(TraceState parentContext, Handler actualHandler) { this.parentContext = parentContext; this.actualHandler = actualHandler; parentContext.incrementReferences(); @@ -52,7 +52,7 @@ public void handle(T event) { } public static Handler wrapIfNonEmptyContext(Handler handler) { - ElasticContext currentContext = GlobalTracer.get().currentContext(); + TraceState currentContext = GlobalTracer.get().currentContext(); if (!currentContext.isEmpty()) { handler = new GenericHandlerWrapper<>(currentContext, handler); diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/SetTimerWrapper.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/SetTimerWrapper.java index be3b30492c..72b827c46b 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/SetTimerWrapper.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/main/java/co/elastic/apm/agent/vertx/SetTimerWrapper.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.vertx; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.GlobalTracer; import io.vertx.core.Handler; @@ -39,12 +39,12 @@ public void handle(Long event) { } } - public SetTimerWrapper(ElasticContext parentContext, Handler actualHandler) { + public SetTimerWrapper(TraceState parentContext, Handler actualHandler) { super(parentContext, actualHandler); } public static Handler wrapTimerIfNonEmptyContext(Handler handler) { - ElasticContext current = GlobalTracer.get().currentContext(); + TraceState current = GlobalTracer.get().currentContext(); // do not wrap if there is no parent span or if we are in the recursive context of the same type of timer if (!current.isEmpty() && !handler.getClass().getName().equals(activeTimerHandlerPerThread.get())) { diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/AbstractVertxWebTest.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/AbstractVertxWebTest.java index b666302773..b18ef160a0 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/AbstractVertxWebTest.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/AbstractVertxWebTest.java @@ -19,10 +19,10 @@ package co.elastic.apm.agent.vertx.helper; import co.elastic.apm.agent.AbstractInstrumentationTest; -import co.elastic.apm.agent.configuration.CoreConfiguration; -import co.elastic.apm.agent.impl.context.TransactionContext; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; import co.elastic.apm.agent.tracer.configuration.WebConfiguration; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import io.vertx.ext.web.Router; import io.vertx.junit5.VertxTestContext; import okhttp3.Response; @@ -49,7 +49,7 @@ public abstract class AbstractVertxWebTest extends AbstractInstrumentationTest { protected static final String CALL_ON_CONTEXT = "on-context"; protected WebConfiguration webConfiguration; - protected CoreConfiguration coreConfiguration; + protected CoreConfigurationImpl coreConfiguration; @BeforeAll static void setCache() throws IOException { @@ -60,7 +60,7 @@ static void setCache() throws IOException { @BeforeEach void setUp() { webConfiguration = tracer.getConfig(WebConfiguration.class); - coreConfiguration = tracer.getConfig(CoreConfiguration.class); + coreConfiguration = tracer.getConfig(CoreConfigurationImpl.class); } @Nullable @@ -124,11 +124,11 @@ protected void expectTransaction(Response response, String path, String expected reporter.getFirstTransaction(500); assertThat(reporter.getTransactions() .stream() - .map(AbstractSpan::getNameAsString) + .map(AbstractSpanImpl::getNameAsString) .distinct()) .describedAs("transaction service name should be inherited from test class name") .containsExactly(expectedTransactionName); - TransactionContext context = reporter.getFirstTransaction().getContext(); + TransactionContextImpl context = reporter.getFirstTransaction().getContext(); assertThat(context.getResponse().getStatusCode()).isEqualTo(expectedStatusCode); assertThat(context.getRequest().getUrl().getPathname()).isEqualTo(path); } diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxServerClientTest.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxServerClientTest.java index 21023b60bf..03e23aa05d 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxServerClientTest.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxServerClientTest.java @@ -18,8 +18,8 @@ */ package co.elastic.apm.agent.vertx.helper; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.ext.web.Router; @@ -51,13 +51,13 @@ void testBasicDownstreamCall(String targetPath) throws Exception { reporter.awaitTransactionCount(2); reporter.awaitSpanCount(1); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions.stream().map(t -> t.getNameAsString())).containsAll(Set.of("GET /downstream", "GET /" + targetPath)); - Transaction firstTransaction = transactions.stream().filter(t -> t.getNameAsString().contains(targetPath)).findFirst().get(); - Transaction secondTransaction = transactions.stream().filter(t -> t.getNameAsString().contains("downstream")).findFirst().get(); + TransactionImpl firstTransaction = transactions.stream().filter(t -> t.getNameAsString().contains(targetPath)).findFirst().get(); + TransactionImpl secondTransaction = transactions.stream().filter(t -> t.getNameAsString().contains("downstream")).findFirst().get(); - Span exitSpan = reporter.getFirstSpan(); + SpanImpl exitSpan = reporter.getFirstSpan(); assertThat(exitSpan.isChildOf(firstTransaction)).isTrue(); assertThat(secondTransaction.isChildOf(exitSpan)).isTrue(); @@ -73,16 +73,16 @@ void testDownstreamCallWithExtraSpan(String targetPath) throws Exception { reporter.awaitTransactionCount(2); reporter.awaitSpanCount(2); - List transactions = reporter.getTransactions(); + List transactions = reporter.getTransactions(); assertThat(transactions.stream().map(t -> t.getNameAsString())).containsAll(Set.of("GET /downstream", "GET /with-extra-span/" + targetPath)); - Transaction firstTransaction = transactions.stream().filter(t -> t.getNameAsString().contains(targetPath)).findFirst().get(); - Transaction secondTransaction = transactions.stream().filter(t -> t.getNameAsString().contains("downstream")).findFirst().get(); + TransactionImpl firstTransaction = transactions.stream().filter(t -> t.getNameAsString().contains(targetPath)).findFirst().get(); + TransactionImpl secondTransaction = transactions.stream().filter(t -> t.getNameAsString().contains("downstream")).findFirst().get(); - List spans = reporter.getSpans(); - Span exitSpan = spans.stream().filter(s -> s.getNameAsString().contains("GET")).findFirst().get(); - Span customSpan = spans.stream().filter(s -> s.getNameAsString().equals("custom-child-span")).findFirst().get(); + List spans = reporter.getSpans(); + SpanImpl exitSpan = spans.stream().filter(s -> s.getNameAsString().contains("GET")).findFirst().get(); + SpanImpl customSpan = spans.stream().filter(s -> s.getNameAsString().equals("custom-child-span")).findFirst().get(); assertThat(customSpan.isChildOf(firstTransaction)).isTrue(); assertThat(exitSpan.isChildOf(customSpan)).isTrue(); diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxWebTest.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxWebTest.java index 3dab442a7e..4f050613b5 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxWebTest.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/CommonVertxWebTest.java @@ -18,13 +18,13 @@ */ package co.elastic.apm.agent.vertx.helper; -import co.elastic.apm.agent.configuration.CoreConfiguration; +import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.context.Request; -import co.elastic.apm.agent.impl.context.TransactionContext; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.sdk.internal.util.VersionUtils; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; @@ -60,7 +60,7 @@ public abstract class CommonVertxWebTest extends AbstractVertxWebTest { void testBasicVertxWebCall() throws Exception { Response response = http().get("/test"); expectTransaction(response, "/test", DEFAULT_RESPONSE_BODY, "GET /test", 200); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getFrameworkName()).isEqualTo(AbstractVertxWebHelper.FRAMEWORK_NAME); String vertxVersion = VersionUtils.getVersion(RoutingContext.class, "io.vertx", "vertx-web"); @@ -98,7 +98,7 @@ void testCallWithoutHeaders() throws Exception { Response response = http().get("/test", headers); expectTransaction(response, "/test", DEFAULT_RESPONSE_BODY, "GET /test", 200); - TransactionContext context = reporter.getFirstTransaction().getContext(); + TransactionContextImpl context = reporter.getFirstTransaction().getContext(); assertThat(context.getRequest().getHeaders().size()).isEqualTo(0); assertThat(context.getResponse().getHeaders().size()).isEqualTo(0); assertThat(context.getRequest().getFormUrlEncodedParameters().size()).isEqualTo(0); @@ -136,13 +136,13 @@ void testCallWithPathGroupAsTransactionName() throws Exception { @Test void testCallWithQueryParameters() throws Exception { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); doReturn(List.of(WildcardMatcher.valueOf("application/x-www-form-urlencoded*"))).when(webConfiguration).getCaptureContentTypes(); Response response = http().post("/post?par1=abc&par2=xyz", "Some Body", MediaType.get("application/x-www-form-urlencoded")); expectTransaction(response, "/post", DEFAULT_RESPONSE_BODY, "POST /post", 200); - Request request = reporter.getFirstTransaction().getContext().getRequest(); + RequestImpl request = reporter.getFirstTransaction().getContext().getRequest(); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getFormUrlEncodedParameters().size()).isEqualTo(2); assertThat(request.getFormUrlEncodedParameters().containsIgnoreCase("par1")).isEqualTo(true); @@ -155,7 +155,7 @@ void testCallWithQueryParameters() throws Exception { @Test void testCallWithBodyCapturing() throws Exception { - doReturn(CoreConfiguration.EventType.ALL).when(coreConfiguration).getCaptureBody(); + doReturn(CoreConfigurationImpl.EventType.ALL).when(coreConfiguration).getCaptureBody(); doReturn(List.of(WildcardMatcher.valueOf("application/json*"))).when(webConfiguration).getCaptureContentTypes(); String jsonBody = "{\"key\":\"Some JSON\"}"; @@ -163,7 +163,7 @@ void testCallWithBodyCapturing() throws Exception { Response response = http().post("/post?par1=abc&par2=xyz", jsonBody, MediaType.get("application/json")); expectTransaction(response, "/post", DEFAULT_RESPONSE_BODY, "POST /post", 200); - Request request = reporter.getFirstTransaction().getContext().getRequest(); + RequestImpl request = reporter.getFirstTransaction().getContext().getRequest(); assertThat(request.getFormUrlEncodedParameters().size()).isEqualTo(0); assertThat(request.getUrl().getSearch()).isEqualTo("par1=abc&par2=xyz"); assertThat(request.getBody()).isInstanceOf(CharBuffer.class); @@ -201,7 +201,7 @@ void testContextPropagationToVertxEngine(String callType) throws Exception { expectTransaction(response, path, DEFAULT_RESPONSE_BODY, "GET " + path, 200); reporter.awaitSpanCount(1); assertThat(reporter.getSpans()).hasSize(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getNameAsString()).isEqualTo(callType + "-child-span"); assertThat(span.getParent()).isEqualTo(reporter.getFirstTransaction()); } @@ -214,7 +214,7 @@ void testContextPropagationToVertxContext(String callType) throws Exception { expectTransaction(response, path, DEFAULT_RESPONSE_BODY, "GET " + path, 200); reporter.awaitSpanCount(1); assertThat(reporter.getSpans()).hasSize(1); - Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span.getNameAsString()).isEqualTo(callType + "-child-span"); assertThat(span.getParent()).isEqualTo(reporter.getFirstTransaction()); } @@ -224,7 +224,7 @@ void testTransactionRecyclingWithAsyncSpan() throws Exception { String path = "/" + CALL_SCHEDULED_SHIFTED; Response response = http().get(path); expectTransaction(response, path, DEFAULT_RESPONSE_BODY, "GET " + path, 200); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); // Mock reporter expects the reference count to be at 1 at test end, // so we decrement it here to emulate real reporter behaviour which would recycle ended transactions directly. @@ -261,26 +261,26 @@ void testParallel() { assertThat(reporter.getTransactions().stream().map(transaction -> transaction.getContext().getRequest().getUrl().getPathname())) .containsExactlyInAnyOrder("/parallel/1", "/parallel/2", "/parallel/3", "/parallel/4", "/parallel/5"); - assertThat(reporter.getTransactions().stream().map(AbstractSpan::getNameAsString).distinct()).containsExactlyInAnyOrder("GET /parallel/:param"); + assertThat(reporter.getTransactions().stream().map(AbstractSpanImpl::getNameAsString).distinct()).containsExactlyInAnyOrder("GET /parallel/:param"); assertThat(reporter.getFirstTransaction().getSpanCount().getTotal().get()).isEqualTo(3); - AbstractSpan t1 = transaction("/parallel/1"); - AbstractSpan t2 = transaction("/parallel/2"); - AbstractSpan t3 = transaction("/parallel/3"); - AbstractSpan t4 = transaction("/parallel/4"); - AbstractSpan t5 = transaction("/parallel/5"); + AbstractSpanImpl t1 = transaction("/parallel/1"); + AbstractSpanImpl t2 = transaction("/parallel/2"); + AbstractSpanImpl t3 = transaction("/parallel/3"); + AbstractSpanImpl t4 = transaction("/parallel/4"); + AbstractSpanImpl t5 = transaction("/parallel/5"); assertThat(spansContaining("-1").size()).isEqualTo(3); - assertThat(spansContaining("-1").stream().map(Span::getParent).distinct()).containsExactly(t1); + assertThat(spansContaining("-1").stream().map(SpanImpl::getParent).distinct()).containsExactly(t1); assertThat(spansContaining("-2").size()).isEqualTo(3); - assertThat(spansContaining("-2").stream().map(Span::getParent).distinct()).containsExactly(t2); + assertThat(spansContaining("-2").stream().map(SpanImpl::getParent).distinct()).containsExactly(t2); assertThat(spansContaining("-3").size()).isEqualTo(3); - assertThat(spansContaining("-3").stream().map(Span::getParent).distinct()).containsExactly(t3); + assertThat(spansContaining("-3").stream().map(SpanImpl::getParent).distinct()).containsExactly(t3); assertThat(spansContaining("-4").size()).isEqualTo(3); - assertThat(spansContaining("-4").stream().map(Span::getParent).distinct()).containsExactly(t4); + assertThat(spansContaining("-4").stream().map(SpanImpl::getParent).distinct()).containsExactly(t4); assertThat(spansContaining("-5").size()).isEqualTo(3); - assertThat(spansContaining("-5").stream().map(Span::getParent).distinct()).containsExactly(t5); + assertThat(spansContaining("-5").stream().map(SpanImpl::getParent).distinct()).containsExactly(t5); executorService.shutdown(); } @@ -300,11 +300,11 @@ void testWrongMethod() throws Exception { expectTransaction(response, "/post", "", "GET unknown route", 405); } - private List spansContaining(String name) { + private List spansContaining(String name) { return reporter.getSpans().stream().filter(span -> span.getNameAsString().contains(name)).collect(Collectors.toList()); } - private Transaction transaction(String path) { + private TransactionImpl transaction(String path) { return reporter.getTransactions().stream().filter(t -> t.getContext().getRequest().getUrl().getPathname().equals(path)).findAny().get(); } @@ -332,7 +332,7 @@ protected void initRoutes(Router router) { router.get("/" + CALL_SCHEDULED_SHIFTED).handler(routingContext -> { routingContext.vertx() .setTimer(500, tid -> { - Span child = Objects.requireNonNull(tracer.getActive()).createSpan(); + SpanImpl child = Objects.requireNonNull(tracer.getActive()).createSpan(); child.withName(CALL_SCHEDULED_SHIFTED + "-child-span"); child.end(); }); @@ -345,11 +345,11 @@ protected void initRoutes(Router router) { .runOnContext(new HandlerWithCustomNamedSpan(getDefaultHandlerImpl(), routingContext, CALL_ON_CONTEXT))); router.get("/parallel/:param").handler(routingContext -> routingContext.vertx().setTimer(1, tid_1 -> { - Span asyncChild = Objects.requireNonNull(tracer.getActive()).createSpan(); + SpanImpl asyncChild = Objects.requireNonNull(tracer.getActive()).createSpan(); asyncChild.withName("first-child-" + routingContext.pathParam("param")); routingContext.vertx().executeBlocking(p -> { - Span blockingChild = Objects.requireNonNull(tracer.getActive()).createSpan(); + SpanImpl blockingChild = Objects.requireNonNull(tracer.getActive()).createSpan(); blockingChild.withName("second-child-" + routingContext.pathParam("param")); try { @@ -359,7 +359,7 @@ protected void initRoutes(Router router) { } routingContext.vertx().setTimer(1, tid_2 -> { - Span thirdChild = Objects.requireNonNull(tracer.getActive()).createSpan(); + SpanImpl thirdChild = Objects.requireNonNull(tracer.getActive()).createSpan(); thirdChild.withName("third-child-" + routingContext.pathParam("param")); getDefaultHandlerImpl().handle(routingContext); thirdChild.end(); diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/HandlerWithCustomNamedSpan.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/HandlerWithCustomNamedSpan.java index 846158c9ca..3209a3f819 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/HandlerWithCustomNamedSpan.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/helper/HandlerWithCustomNamedSpan.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.tracer.GlobalTracer; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; -import co.elastic.apm.agent.impl.transaction.Span; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; @@ -39,11 +39,11 @@ public HandlerWithCustomNamedSpan(Handler handler, RoutingContex @Override public void handle(Void v) { - AbstractSpan active = GlobalTracer.get().require(ElasticApmTracer.class).getActive(); + AbstractSpanImpl active = GlobalTracer.get().require(ElasticApmTracer.class).getActive(); if (active == null) { return; } - Span child = active.createSpan(); + SpanImpl child = active.createSpan(); child.withName(spanName + "-child-span"); child.activate(); handler.handle(routingContext); diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/webclient/AbstractVertxWebClientTest.java b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/webclient/AbstractVertxWebClientTest.java index 202a8a60e2..3eb6e8349f 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/webclient/AbstractVertxWebClientTest.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/src/test/java/co/elastic/apm/agent/vertx/webclient/AbstractVertxWebClientTest.java @@ -19,8 +19,8 @@ package co.elastic.apm.agent.vertx.webclient; import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; -import co.elastic.apm.agent.impl.error.ErrorCapture; -import co.elastic.apm.agent.impl.transaction.AbstractSpan; +import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.ext.web.client.HttpRequest; @@ -48,7 +48,7 @@ public void setUp() { // This property is needed as otherwise Vert.x event loop threads won't have a context class loader (null) // which leads to NullPointerExceptions when spans are JSON validated in Unit tests System.setProperty("vertx.disableTCCL", "true"); - AbstractSpan activeSpan = tracer.getActive(); + AbstractSpanImpl activeSpan = tracer.getActive(); // deactivate current span to avoid tracing web client creation for JUnit test activeSpan.deactivate(); @@ -88,7 +88,7 @@ public void testFailedRequest() { // expected } - ErrorCapture error = reporter.getFirstError(500); + ErrorCaptureImpl error = reporter.getFirstError(500); assertThat(error.getException()).isNotNull(); assertThat(error.getException().getClass()).isNotNull(); assertThat(error.getException().getMessage()).contains("not-existing.com"); diff --git a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/src/main/java/co/elastic/apm/agent/vertx/v4/webclient/HttpContextInstrumentation.java b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/src/main/java/co/elastic/apm/agent/vertx/v4/webclient/HttpContextInstrumentation.java index 47b8fa5325..773de3dfa3 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/src/main/java/co/elastic/apm/agent/vertx/v4/webclient/HttpContextInstrumentation.java +++ b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/src/main/java/co/elastic/apm/agent/vertx/v4/webclient/HttpContextInstrumentation.java @@ -18,7 +18,7 @@ */ package co.elastic.apm.agent.vertx.v4.webclient; -import co.elastic.apm.agent.tracer.ElasticContext; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Transaction; import co.elastic.apm.agent.vertx.AbstractVertxWebClientHelper; import co.elastic.apm.agent.vertx.AbstractVertxWebHelper; @@ -81,7 +81,7 @@ public static class HttpContextPrepareRequestAdvice extends AdviceBase { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void prepareRequest(@Advice.This HttpContext httpContext) { - ElasticContext currentContext = tracer.currentContext(); + TraceState currentContext = tracer.currentContext(); if (!currentContext.isEmpty()) { currentContext.incrementReferences(); httpContext.set(WEB_CLIENT_PARENT_CONTEXT_KEY, currentContext); @@ -110,7 +110,7 @@ public static class HttpContextSendRequestAdvice extends AdviceBase { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void sendRequest(@Advice.This HttpContext httpContext, @Advice.Argument(value = 0) HttpClientRequest request, @Advice.FieldValue(value = "context") Context vertxContext) { - ElasticContext parent = httpContext.get(WEB_CLIENT_PARENT_CONTEXT_KEY); + TraceState parent = httpContext.get(WEB_CLIENT_PARENT_CONTEXT_KEY); if (parent != null) { // Setting to null removes from the context attributes map @@ -181,7 +181,7 @@ public static class HttpContextFailAdvice extends AdviceBase { @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static void fail(@Advice.This HttpContext httpContext, @Advice.Argument(value = 0) Throwable thrown) { - ElasticContext parent = httpContext.get(WEB_CLIENT_PARENT_CONTEXT_KEY); + TraceState parent = httpContext.get(WEB_CLIENT_PARENT_CONTEXT_KEY); if (parent != null) { httpContext.set(WEB_CLIENT_PARENT_CONTEXT_KEY, null); try { diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/BaggageContextBuilder.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/BaggageContextBuilder.java index e8e36f4c65..fa6563581c 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/BaggageContextBuilder.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/BaggageContextBuilder.java @@ -41,5 +41,5 @@ public interface BaggageContextBuilder { /** * @return the created context with the baggage updates applied. */ - ElasticContext buildContext(); + TraceState buildContext(); } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java index 692ffdca5e..ab5b8d7607 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/GlobalTracer.java @@ -25,6 +25,7 @@ import co.elastic.apm.agent.tracer.reference.ReferenceCounted; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.tracer.service.Service; +import co.elastic.apm.agent.tracer.service.ServiceInfo; import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; @@ -99,7 +100,7 @@ public Set getTraceHeaderNames() { } @Override - public ElasticContext currentContext() { + public TraceState currentContext() { return tracer.currentContext(); } @@ -129,8 +130,8 @@ public Transaction startRootTransaction(@Nullable ClassLoader initiatingClass @Nullable @Override - public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter textHeadersGetter, @Nullable ClassLoader initiatingClassLoader) { - return tracer.startChildTransaction(headerCarrier, textHeadersGetter, initiatingClassLoader); + public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headerGetter, @Nullable ClassLoader initiatingClassLoader) { + return tracer.startChildTransaction(headerCarrier, headerGetter, initiatingClassLoader); } @Nullable @@ -201,4 +202,19 @@ public void reportMetric(JsonWriter metrics) { tracer.reportMetric(metrics); } + @Nullable + @Override + public ServiceInfo getServiceInfoForClassLoader(@Nullable ClassLoader initiatingClassLoader) { + return tracer.getServiceInfoForClassLoader(initiatingClassLoader); + } + + @Override + public void setServiceInfoForClassLoader(@Nullable ClassLoader classLoader, ServiceInfo serviceInfo) { + tracer.setServiceInfoForClassLoader(classLoader, serviceInfo); + } + + @Override + public ServiceInfo autoDetectedServiceInfo() { + return tracer.autoDetectedServiceInfo(); + } } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopElasticContext.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTraceState.java similarity index 91% rename from apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopElasticContext.java rename to apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTraceState.java index 1f662c7328..34520f7b51 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopElasticContext.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTraceState.java @@ -23,17 +23,17 @@ import javax.annotation.Nullable; -public class NoopElasticContext implements ElasticContext { +public class NoopTraceState implements TraceState { - static final NoopElasticContext INSTANCE = new NoopElasticContext(); + static final NoopTraceState INSTANCE = new NoopTraceState(); @Override - public NoopElasticContext activate() { + public NoopTraceState activate() { return this; } @Override - public NoopElasticContext deactivate() { + public NoopTraceState deactivate() { return this; } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java index 85fab5a76a..f954e321cc 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/NoopTracer.java @@ -25,6 +25,7 @@ import co.elastic.apm.agent.tracer.reference.ReferenceCounted; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.tracer.service.Service; +import co.elastic.apm.agent.tracer.service.ServiceInfo; import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; @@ -76,8 +77,8 @@ public Set getTraceHeaderNames() { } @Override - public ElasticContext currentContext() { - return NoopElasticContext.INSTANCE; + public TraceState currentContext() { + return NoopTraceState.INSTANCE; } @Nullable @@ -106,7 +107,7 @@ public Transaction startRootTransaction(@Nullable ClassLoader initiatingClass @Nullable @Override - public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter textHeadersGetter, @Nullable ClassLoader initiatingClassLoader) { + public Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headerGetter, @Nullable ClassLoader initiatingClassLoader) { return null; } @@ -167,4 +168,19 @@ public void addShutdownHook(AutoCloseable hook) { @Override public void reportMetric(JsonWriter metrics) { } + + @Nullable + @Override + public ServiceInfo getServiceInfoForClassLoader(@Nullable ClassLoader initiatingClassLoader) { + return null; + } + + @Override + public void setServiceInfoForClassLoader(@Nullable ClassLoader classLoader, ServiceInfo serviceInfo) { + } + + @Override + public ServiceInfo autoDetectedServiceInfo() { + return ServiceInfo.empty(); + } } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ElasticContext.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TraceState.java similarity index 97% rename from apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ElasticContext.java rename to apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TraceState.java index 4f86c8bd6a..1cd5287036 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/ElasticContext.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/TraceState.java @@ -24,7 +24,7 @@ import javax.annotation.Nullable; -public interface ElasticContext> extends ActivateableInScope, ReferenceCounted { +public interface TraceState> extends ActivateableInScope, ReferenceCounted { /** * @return the span/transaction that is associated to this context, {@literal null} if there is none @@ -113,7 +113,7 @@ public interface ElasticContext> extends Activateabl * @return {@literal true} when span limit is reached and the caller can optimize and not create a span. The caller * is expected to call this method before every span creation operation for proper dropped spans accounting. If not * called before attempting span creation, a span will be created and dropped before reporting. - *
    + *
    * Expected caller behavior depends on the returned value: *

      *
    • {@literal true} returned means the caller is expected to NOT call {@link #createSpan()} or {@link #createExitSpan()}
    • diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java index 4f1d6efc2e..706eff4f76 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/Tracer.java @@ -25,6 +25,7 @@ import co.elastic.apm.agent.tracer.reference.ReferenceCounted; import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; import co.elastic.apm.agent.tracer.service.Service; +import co.elastic.apm.agent.tracer.service.ServiceInfo; import com.dslplatform.json.JsonWriter; import javax.annotation.Nullable; @@ -48,7 +49,7 @@ public interface Tracer { Set getTraceHeaderNames(); - ElasticContext currentContext(); + TraceState currentContext(); @Nullable AbstractSpan getActive(); @@ -75,13 +76,13 @@ public interface Tracer { * available), then it will be started as the root transaction of the trace. * * @param headerCarrier the Object from which context headers can be obtained, typically a request or a message - * @param textHeadersGetter provides the trace context headers required in order to create a child transaction + * @param headerGetter provides the trace context headers required in order to create a child transaction * @param initiatingClassLoader the class loader corresponding to the service which initiated the creation of the transaction. * Used to determine the service name. * @return a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise */ @Nullable - Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter textHeadersGetter, @Nullable ClassLoader initiatingClassLoader); + Transaction startChildTransaction(@Nullable C headerCarrier, HeaderGetter headerGetter, @Nullable ClassLoader initiatingClassLoader); @Nullable ErrorCapture captureException(@Nullable Throwable e, @Nullable ClassLoader initiatingClassLoader); @@ -111,4 +112,22 @@ public interface Tracer { void flush(); void completeMetaData(String name, String version, String id, String region); + + @Nullable + ServiceInfo getServiceInfoForClassLoader(@Nullable ClassLoader initiatingClassLoader); + + /** + * Sets the service name and version for all {@link co.elastic.apm.agent.tracer.Transaction}s, + * {@link co.elastic.apm.agent.tracer.Span}s and {@link co.elastic.apm.agent.tracer.ErrorCapture}s which are created + * by the service which corresponds to the provided {@link ClassLoader}. + *

      + * The main use case is being able to differentiate between multiple services deployed to the same application server. + *

      + * + * @param classLoader the class loader which corresponds to a particular service + * @param serviceInfo the service name and version for this class loader + */ + void setServiceInfoForClassLoader(@Nullable ClassLoader classLoader, ServiceInfo serviceInfo); + + ServiceInfo autoDetectedServiceInfo(); } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/StacktraceConfiguration.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/StacktraceConfiguration.java index 7090a0108c..21ab9562fb 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/StacktraceConfiguration.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/StacktraceConfiguration.java @@ -21,5 +21,6 @@ import java.util.Collection; public interface StacktraceConfiguration { + Collection getApplicationPackages(); } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/service/ServiceAwareTracer.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/service/ServiceAwareTracer.java deleted file mode 100644 index 30634926fe..0000000000 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/service/ServiceAwareTracer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package co.elastic.apm.agent.tracer.service; - -import co.elastic.apm.agent.tracer.Tracer; - -import javax.annotation.Nullable; - -public interface ServiceAwareTracer extends Tracer { - - @Nullable - ServiceInfo getServiceInfoForClassLoader(@Nullable ClassLoader initiatingClassLoader); - - void setServiceInfoForClassLoader(@Nullable ClassLoader classLoader, ServiceInfo serviceInfo); - - ServiceInfo autoDetectedServiceInfo(); -} diff --git a/apm-opentracing/src/test/java/co/elastic/apm/opentracing/OpenTracingBridgeTest.java b/apm-opentracing/src/test/java/co/elastic/apm/opentracing/OpenTracingBridgeTest.java index 23d5831870..cdecbb5e94 100644 --- a/apm-opentracing/src/test/java/co/elastic/apm/opentracing/OpenTracingBridgeTest.java +++ b/apm-opentracing/src/test/java/co/elastic/apm/opentracing/OpenTracingBridgeTest.java @@ -21,10 +21,11 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; import co.elastic.apm.agent.impl.TracerInternalApiUtils; -import co.elastic.apm.agent.impl.context.Http; -import co.elastic.apm.agent.impl.transaction.Id; -import co.elastic.apm.agent.impl.transaction.TraceContext; -import co.elastic.apm.agent.impl.transaction.Transaction; +import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.util.ResultUtil; import io.opentracing.Scope; @@ -83,7 +84,7 @@ void testCreateNonActiveTransaction() { span.finish(TimeUnit.MILLISECONDS.toMicros(1)); assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getDuration()).isEqualTo(1000); assertThat(transaction.getNameAsString()).isEqualTo("test"); assertThat(transaction.getFrameworkName()).isEqualTo("OpenTracing"); @@ -142,7 +143,7 @@ void testContextAvailableAfterFinish() { final Span span = apmTracer.buildSpan("transaction").start(); span.finish(); assertThat(reporter.getTransactions()).hasSize(1); - final Transaction transaction = reporter.getFirstTransaction(); + final TransactionImpl transaction = reporter.getFirstTransaction(); String transactionId = transaction.getTraceContext().getId().toString(); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); @@ -152,7 +153,7 @@ void testContextAvailableAfterFinish() { childSpan.finish(); assertThat(reporter.getSpans()).hasSize(1); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getTraceContext().getParentId().toString()).isEqualTo(transactionId); assertThat(internalSpan.getOutcome()).isEqualTo(Outcome.SUCCESS); } @@ -162,7 +163,7 @@ void testScopeAfterFinish() { final Span span = apmTracer.buildSpan("transaction").start(); span.finish(); assertThat(reporter.getTransactions()).hasSize(1); - final Transaction transaction = reporter.getFirstTransaction(); + final TransactionImpl transaction = reporter.getFirstTransaction(); String transactionId = transaction.getTraceContext().getId().toString(); assertThat(transaction.getOutcome()).isEqualTo(Outcome.SUCCESS); @@ -173,7 +174,7 @@ void testScopeAfterFinish() { } assertThat(reporter.getSpans()).hasSize(1); - co.elastic.apm.agent.impl.transaction.Span internalSpan = reporter.getFirstSpan(); + SpanImpl internalSpan = reporter.getFirstSpan(); assertThat(internalSpan.getTraceContext().getParentId().toString()).isEqualTo(transactionId); assertThat(internalSpan.getOutcome()).isEqualTo(Outcome.SUCCESS); } @@ -231,9 +232,9 @@ void testLegacyCreateActiveTransactionAndSpans() { } assertThat(reporter.getTransactions()).hasSize(1); - final Transaction transaction = reporter.getFirstTransaction(); - final co.elastic.apm.agent.impl.transaction.Span span = reporter.getSpans().get(1); - final co.elastic.apm.agent.impl.transaction.Span nestedSpan = reporter.getSpans().get(0); + final TransactionImpl transaction = reporter.getFirstTransaction(); + final SpanImpl span = reporter.getSpans().get(1); + final SpanImpl nestedSpan = reporter.getSpans().get(0); assertThat(transaction.getDuration()).isGreaterThan(0); assertThat(transaction.getNameAsString()).isEqualTo("transaction"); assertThat(transaction.getFrameworkName()).isEqualTo("OpenTracing"); @@ -262,9 +263,9 @@ void testCreateActiveTransactionAndSpans() { otTransaction.finish(); assertThat(reporter.getTransactions()).hasSize(1); - final Transaction transaction = reporter.getFirstTransaction(); - final co.elastic.apm.agent.impl.transaction.Span span = reporter.getSpans().get(1); - final co.elastic.apm.agent.impl.transaction.Span nestedSpan = reporter.getSpans().get(0); + final TransactionImpl transaction = reporter.getFirstTransaction(); + final SpanImpl span = reporter.getSpans().get(1); + final SpanImpl nestedSpan = reporter.getSpans().get(0); assertThat(transaction.getDuration()).isGreaterThan(0); assertThat(transaction.getNameAsString()).isEqualTo("transaction"); assertThat(transaction.getFrameworkName()).isEqualTo("OpenTracing"); @@ -319,7 +320,7 @@ void testResolveClientType() { @Test void testTypeTags() { // New span model with type, subtype and action - co.elastic.apm.agent.impl.transaction.Span span = createSpanFromOtTags(Map.of( + SpanImpl span = createSpanFromOtTags(Map.of( "type", "template", "subtype", "jsf", "action", "render")); @@ -350,16 +351,16 @@ void testHttpMappingResultAndOutcome(int status) { String method = "GET"; String url = "http://localhost:8080"; - Transaction transaction = createTransactionFromOtTags(httpRequestMap("server", status)); + TransactionImpl transaction = createTransactionFromOtTags(httpRequestMap("server", status)); assertThat(transaction.getOutcome()).isEqualTo(ResultUtil.getOutcomeByHttpServerStatus(status)); assertThat(transaction.getResult()).isEqualTo(ResultUtil.getResultByHttpStatus(status)); assertThat(transaction.getContext().getResponse().getStatusCode()).isEqualTo(status); assertThat(transaction.getContext().getRequest().getMethod()).isEqualTo(method); assertThat(transaction.getContext().getRequest().getUrl().getFull().toString()).isEqualTo(url); - co.elastic.apm.agent.impl.transaction.Span span = createSpanFromOtTags(httpRequestMap("client", status)); + SpanImpl span = createSpanFromOtTags(httpRequestMap("client", status)); assertThat(span.getOutcome()).isEqualTo(ResultUtil.getOutcomeByHttpClientStatus(status)); - Http spanHttp = span.getContext().getHttp(); + HttpImpl spanHttp = span.getContext().getHttp(); assertThat(spanHttp.getStatusCode()).isEqualTo(status); assertThat(spanHttp.getUrl().toString()).isEqualTo(url); assertThat(spanHttp.getMethod()).isEqualTo(method); @@ -411,7 +412,7 @@ void testErrorLogging() { span.finish(); } assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getResult()).isEqualTo("error"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(reporter.getErrors()).hasSize(1); @@ -432,7 +433,7 @@ void testErrorLoggingWithTimestamp() { span.finish(); } assertThat(reporter.getTransactions()).hasSize(1); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction.getResult()).isEqualTo("error"); assertThat(transaction.getOutcome()).isEqualTo(Outcome.FAILURE); assertThat(reporter.getErrors()).hasSize(1); @@ -515,11 +516,11 @@ void testToId() { otSpan.finish(); } otTransaction.finish(); - Transaction transaction = reporter.getFirstTransaction(); + TransactionImpl transaction = reporter.getFirstTransaction(); assertThat(transaction).isNotNull(); assertThat(otTransaction.context().toSpanId()).isEqualTo(transaction.getTraceContext().getId().toString()); assertThat(otTransaction.context().toTraceId()).isEqualTo(transaction.getTraceContext().getTraceId().toString()); - co.elastic.apm.agent.impl.transaction.Span span = reporter.getFirstSpan(); + SpanImpl span = reporter.getFirstSpan(); assertThat(span).isNotNull(); assertThat(otSpan.context().toSpanId()).isEqualTo(span.getTraceContext().getId().toString()); assertThat(otSpan.context().toTraceId()).isEqualTo(span.getTraceContext().getTraceId().toString()); @@ -531,17 +532,17 @@ void testToIdOfExtractedContext() { final String parentIdString = "b9c7c989f97918e1"; // -------------------------------------------------------- - final Id traceId = Id.new128BitId(); + final IdImpl traceId = IdImpl.new128BitId(); traceId.fromHexString(traceIdString, 0); assertThat(traceId.toString()).isEqualTo(traceIdString); // -------------------------------------------------------- - final Id spanId = Id.new64BitId(); + final IdImpl spanId = IdImpl.new64BitId(); spanId.fromHexString(parentIdString, 0); assertThat(spanId.toString()).isEqualTo(parentIdString); // -------------------------------------------------------- TextMap textMapExtractAdapter = new TextMapAdapter(Map.of( - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-" + traceIdString + "-" + parentIdString + "-01", "User-Agent", "curl")); //ExternalProcessSpanContext @@ -560,11 +561,11 @@ void testInjectExtract() { Span otSpan = apmTracer.buildSpan("span") .asChildOf(apmTracer.extract(Format.Builtin.TEXT_MAP, new TextMapAdapter(Map.of( - TraceContext.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-" + traceId + "-" + parentId + "-01", + TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME, "00-" + traceId + "-" + parentId + "-01", "User-Agent", "curl")))) .start(); final Scope scope = apmTracer.activateSpan(otSpan); - Transaction transaction = tracer.currentTransaction(); + TransactionImpl transaction = tracer.currentTransaction(); assertThat(transaction).isNotNull(); assertThat(transaction.isSampled()).isTrue(); assertThat(transaction.getTraceContext().getTraceId().toString()).isEqualTo(traceId); @@ -575,7 +576,7 @@ void testInjectExtract() { final HashMap map = new HashMap<>(); apmTracer.inject(otSpan.context(), Format.Builtin.TEXT_MAP, new TextMapAdapter(map)); - final TraceContext injectedContext = TraceContext.with64BitId(tracer); + final TraceContextImpl injectedContext = TraceContextImpl.with64BitId(tracer); assertThat(injectedContext.asChildOf(map, TextHeaderMapAccessor.INSTANCE)).isTrue(); assertThat(injectedContext.getTraceId().toString()).isEqualTo(traceId); assertThat(injectedContext.getParentId()).isEqualTo(transaction.getTraceContext().getId()); @@ -632,12 +633,12 @@ void testSpanTags() { assertThat(reporter.getFirstSpan().getContext().getLabel("bar")).isEqualTo("baz"); } - private Transaction createTransactionFromOtTags(Map tags) { + private TransactionImpl createTransactionFromOtTags(Map tags) { final Tracer.SpanBuilder spanBuilder = apmTracer.buildSpan("transaction"); applyTags(tags, spanBuilder); spanBuilder.start().finish(); assertThat(reporter.getTransactions()).hasSize(1); - final Transaction transaction = reporter.getFirstTransaction(); + final TransactionImpl transaction = reporter.getFirstTransaction(); reporter.resetWithoutRecycling(); return transaction; } @@ -654,7 +655,7 @@ private void applyTags(Map tags, Tracer.SpanBuilder spanBuilder) { }); } - private co.elastic.apm.agent.impl.transaction.Span createSpanFromOtTags(Map tags) { + private SpanImpl createSpanFromOtTags(Map tags) { final Span transaction = apmTracer.buildSpan("transaction").start(); try (Scope transactionScope = apmTracer.activateSpan(transaction)) { final Tracer.SpanBuilder spanBuilder = apmTracer.buildSpan("transaction"); @@ -664,7 +665,7 @@ private co.elastic.apm.agent.impl.transaction.Span createSpanFromOtTags(Map Date: Mon, 17 Jun 2024 13:23:06 +0100 Subject: [PATCH 101/132] build: bump actions/attest-build-provenance in the github-actions group (#3685) Bumps the github-actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance). Updates `actions/attest-build-provenance` from 1.2.0 to 1.3.1 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](https://github.com/actions/attest-build-provenance/compare/49df96e17e918a15956db358890b08e61c704919...534b352d658f90498fd148d231fdbf88f3886a3a) --- updated-dependencies: - dependency-name: actions/attest-build-provenance dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release-step-3.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index 7b90e66a5e..a04a00addb 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -103,7 +103,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0 + uses: actions/attest-build-provenance@534b352d658f90498fd148d231fdbf88f3886a3a # v1.3.1 with: subject-path: "${{ github.workspace }}/**/target/*.jar" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index cc7ef381dc..9f09e760d3 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -69,7 +69,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0 + uses: actions/attest-build-provenance@534b352d658f90498fd148d231fdbf88f3886a3a # v1.3.1 with: subject-path: "${{ github.workspace }}/**/target/*.jar" From 1ddcc73072fa953ecb40c3a0113f49d45ca29561 Mon Sep 17 00:00:00 2001 From: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:52:04 +0800 Subject: [PATCH 102/132] Revert "Uses MockWebServer instead of a docker container for servlet integration tests (#3684)" (#3690) This reverts commit cd893419137fd80981505c754ecea5cce6fb0bbd. This breaks JBoss startup somehow in non-obvious ways --- .../pom.xml | 6 - ...stractServletContainerIntegrationTest.java | 121 +++++------------- 2 files changed, 33 insertions(+), 94 deletions(-) diff --git a/integration-tests/application-server-integration-tests/pom.xml b/integration-tests/application-server-integration-tests/pom.xml index 678cdf478c..56c97e94f5 100644 --- a/integration-tests/application-server-integration-tests/pom.xml +++ b/integration-tests/application-server-integration-tests/pom.xml @@ -118,12 +118,6 @@ logging-interceptor ${version.okhttp} - - com.squareup.okhttp3 - mockwebserver - ${version.okhttp} - test - org.testcontainers testcontainers diff --git a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java index a46f49ea4e..935a33ab44 100644 --- a/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java +++ b/integration-tests/application-server-integration-tests/src/test/java/co/elastic/apm/servlet/AbstractServletContainerIntegrationTest.java @@ -24,6 +24,7 @@ import co.elastic.apm.agent.test.AgentFileAccessor; import co.elastic.apm.agent.test.AgentTestContainer; import co.elastic.apm.agent.test.JavaExecutable; +import co.elastic.apm.agent.testutils.TestContainersUtils; import co.elastic.apm.servlet.tests.TestApp; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -33,15 +34,11 @@ import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.mockwebserver.Dispatcher; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import okio.Buffer; -import okio.InflaterSource; import org.junit.After; import org.junit.Test; -import org.testcontainers.Testcontainers; +import org.mockserver.model.ClearType; +import org.mockserver.model.HttpRequest; +import org.mockserver.model.HttpResponse; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.utility.MountableFile; @@ -49,7 +46,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; -import java.io.UncheckedIOException; import java.nio.file.Paths; import java.time.Duration; import java.util.ArrayList; @@ -59,16 +55,13 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.stream.Collectors; -import java.util.zip.Inflater; import static co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.INTAKE_V2_URL; -import static co.elastic.apm.agent.report.IntakeV2ReportingEventHandler.INTAKE_V2_FLUSH_URL; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockserver.model.HttpRequest.request; /** * When you want to execute the test in the IDE, execute {@code mvn clean package} before. @@ -91,14 +84,19 @@ public abstract class AbstractServletContainerIntegrationTest { @Nullable private static final String AGENT_VERSION_TO_DOWNLOAD_FROM_MAVEN = null; - private static final MockWebServer apmServer; - private static final Queue receivedIntakeEvents = new ConcurrentLinkedQueue<>(); + private static final MockServerContainer mockServerContainer; private static final OkHttpClient httpClient; static { - apmServer = new MockWebServer(); - apmServer.setDispatcher(new ApmDispatcher()); + mockServerContainer = new MockServerContainer() + .withNetworkAliases("apm-server") + .waitingFor(Wait.forHttp(MockServerContainer.HEALTH_ENDPOINT).forStatusCode(200)) + .withNetwork(Network.SHARED); + + if (JavaExecutable.isDebugging()) { + mockServerContainer.withLogConsumer(TestContainersUtils.createSlf4jLogConsumer(MockServerContainer.class)); + } final HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger::info); loggingInterceptor.setLevel(JavaExecutable.isDebugging() ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.BASIC); @@ -107,13 +105,9 @@ public abstract class AbstractServletContainerIntegrationTest { .readTimeout(JavaExecutable.isDebugging() ? 0 : 10, TimeUnit.SECONDS) .build(); - // Start the mock apm server and expose it to any container as host.testcontainers.internal:$port - try { - apmServer.start(); - Testcontainers.exposeHostPorts(apmServer.getPort()); - } catch (IOException e) { - throw new UncheckedIOException(e); - } + mockServerContainer.start(); + mockServerContainer.getClient().when(request(INTAKE_V2_URL)).respond(HttpResponse.response().withStatusCode(200)); + mockServerContainer.getClient().when(request("/")).respond(HttpResponse.response().withStatusCode(200)); } private final MockReporter mockReporter = new MockReporter(); @@ -156,7 +150,7 @@ protected AbstractServletContainerIntegrationTest(AgentTestContainer.AppServer c container .withNetwork(Network.SHARED) - .withEnv("ELASTIC_APM_SERVER_URL", "http://host.testcontainers.internal:" + apmServer.getPort()) + .withEnv("ELASTIC_APM_SERVER_URL", "http://apm-server:1080") .withEnv("ELASTIC_APM_IGNORE_URLS", ignoreUrlConfig) .withEnv("ELASTIC_APM_REPORT_SYNC", "true") .withEnv("ELASTIC_APM_LOG_LEVEL", "DEBUG") @@ -253,7 +247,7 @@ public void testAllScenarios() throws Exception { } public void clearMockServerLog() { - receivedIntakeEvents.clear(); + mockServerContainer.getClient().clear(HttpRequest.request(), ClearType.LOG); } public JsonNode assertTransactionReported(String pathToTest, int expectedResponseCode) { @@ -274,7 +268,7 @@ public JsonNode assertTransactionReported(String pathToTest, int expectedRespons } public void executeAndValidateRequest(String pathToTest, String expectedContent, Integer expectedResponseCode, - Map headersMap) throws IOException, InterruptedException { + Map headersMap) throws IOException, InterruptedException { final String responseString; try (Response response = executeRequest(pathToTest, headersMap)) { if (expectedResponseCode != null) { @@ -429,20 +423,23 @@ public List getEvents(String eventType) { try { final List events = new ArrayList<>(); final ObjectMapper objectMapper = new ObjectMapper(); - for (String bodyAsString : receivedIntakeEvents) { - final JsonNode ndJson = objectMapper.readTree(bodyAsString); - if (ndJson.get(eventType) != null) { - // as inferred spans are created only after the profiling session ends - // they can leak into another test - if (!isInferredSpan(ndJson.get(eventType))) { - validateEventMetadata(bodyAsString); + for (HttpRequest httpRequest : mockServerContainer.getClient().retrieveRecordedRequests(request(INTAKE_V2_URL))) { + final String bodyAsString = httpRequest.getBodyAsString(); + for (String ndJsonLine : bodyAsString.split("\n")) { + final JsonNode ndJson = objectMapper.readTree(ndJsonLine); + if (ndJson.get(eventType) != null) { + // as inferred spans are created only after the profiling session ends + // they can leak into another test + if (!isInferredSpan(ndJson.get(eventType))) { + validateEventMetadata(bodyAsString); + } + events.add(ndJson.get(eventType)); } - events.add(ndJson.get(eventType)); } } return events; } catch (IOException e) { - throw new UncheckedIOException(e); + throw new RuntimeException(e); } } @@ -461,7 +458,7 @@ private void validateEventMetadata(String bodyAsString) { } } } catch (IOException e) { - throw new UncheckedIOException(e); + throw new RuntimeException(e); } } @@ -512,56 +509,4 @@ private void waitFor(String path) { public OkHttpClient getHttpClient() { return httpClient; } - - /** - * This is modeled after {@code co.elastic.apm.awslambda.fakeserver.FakeApmServer}, except - * deflate instead of gzip and OkHttp instead of {@code com.sun.net.httpserver.HttpServer}. - */ - private static final class ApmDispatcher extends Dispatcher { - @Override - public MockResponse dispatch(RecordedRequest request) { - switch (request.getPath()) { - case "/": // health check - return new MockResponse().setBody("{\"version\": \"8.7.1\"}"); - case INTAKE_V2_URL: - case INTAKE_V2_FLUSH_URL: - try { - readIntakeEvents(request); - } catch (IOException e) { - logger.error("Encountered intake request error {}", e); - return new MockResponse().setResponseCode(500); - } - return new MockResponse().setResponseCode(202); - } - logger.error("Encountered unexpected request {}", request); - return new MockResponse().setResponseCode(404); - } - } - - private static void readIntakeEvents(RecordedRequest request) throws IOException { - // The request body is compressed with deflate - final Buffer body; - String encoding = request.getHeader("Content-Encoding"); - if (encoding == null) { - body = request.getBody().buffer(); - } else if (encoding.contains("deflate")) { - Buffer inflated = new Buffer(); - try (InflaterSource deflated = new InflaterSource(request.getBody(), new Inflater())) { - while (deflated.read(inflated, Integer.MAX_VALUE) != -1) ; - } - body = inflated; - } else { - throw new IOException("unsupported encoding: " + encoding); - } - - // read each Newline Delimited JSON event into the queue. - String event; - while ((event = body.readUtf8Line()) != null) { - if (!event.startsWith("{")) { - throw new IOException("not NDJSON " + request); - } else { - receivedIntakeEvents.add(event); - } - } - } } From 3e0368f7b04fd871875aca0ee0fcc9a84c4f86d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:49:19 +0100 Subject: [PATCH 103/132] build: bump org.jctools:jctools-core from 4.0.1 to 4.0.5 (#3687) * build: bump org.jctools:jctools-core from 4.0.1 to 4.0.5 Bumps [org.jctools:jctools-core](https://github.com/JCTools/JCTools) from 4.0.1 to 4.0.5. - [Release notes](https://github.com/JCTools/JCTools/releases) - [Changelog](https://github.com/JCTools/JCTools/blob/master/RELEASE-NOTES.md) - [Commits](https://github.com/JCTools/JCTools/compare/v4.0.1...v4.0.5) --- updated-dependencies: - dependency-name: org.jctools:jctools-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * 4.0.5 does support java 7 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jackshirazi --- apm-agent-core/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index 282b846b0e..f2c8680f14 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -56,9 +56,7 @@ org.jctools jctools-core - - 4.0.1 + 4.0.5 com.googlecode.concurrentlinkedhashmap From 057a40b56cb10577ca101f99d24ae6ccf4e556c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 19:46:28 +0100 Subject: [PATCH 104/132] build: bump io.micrometer:micrometer-core from 1.12.4 to 1.13.1 (#3688) Bumps [io.micrometer:micrometer-core](https://github.com/micrometer-metrics/micrometer) from 1.12.4 to 1.13.1. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.12.4...v1.13.1) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 11b00ad0bc..5a59fb5ab4 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -23,7 +23,7 @@ io.micrometer micrometer-core - 1.12.4 + 1.13.1 provided From d38a88cf087b5f1cb81df29c5eecffbc93350844 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 09:39:23 +0800 Subject: [PATCH 105/132] build: bump version.aws.sdk from 1.12.215 to 1.12.740 in /apm-agent-plugins (#3677) * build: bump version.aws.sdk in /apm-agent-plugins Bumps `version.aws.sdk` from 1.12.215 to 1.12.740. Updates `com.amazonaws:aws-java-sdk-s3` from 1.12.215 to 1.12.740 - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.12.215...1.12.740) Updates `com.amazonaws:aws-java-sdk-dynamodb` from 1.12.215 to 1.12.740 - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.12.215...1.12.740) Updates `com.amazonaws:aws-java-sdk-sqs` from 1.12.215 to 1.12.740 - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.12.215...1.12.740) --- updated-dependencies: - dependency-name: com.amazonaws:aws-java-sdk-s3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.amazonaws:aws-java-sdk-dynamodb dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.amazonaws:aws-java-sdk-sqs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * AWS changed the comms protocols, need latest localstack --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jack Shirazi --- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml | 2 +- .../co/elastic/apm/agent/awssdk/v1/AbstractAws1ClientIT.java | 2 +- .../co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml index 515adc32a9..188b278c93 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml @@ -12,7 +12,7 @@ ${project.basedir}/../../.. - 1.12.215 + 1.12.740 1.1.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/AbstractAws1ClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/AbstractAws1ClientIT.java index d7b30d82d2..b5e7db306d 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/AbstractAws1ClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/src/test/java/co/elastic/apm/agent/awssdk/v1/AbstractAws1ClientIT.java @@ -22,7 +22,7 @@ public abstract class AbstractAws1ClientIT extends AbstractAwsClientIT { - public static final String LOCALSTACK_VERSION = "0.14.2"; + public static final String LOCALSTACK_VERSION = "3.5.0"; public AbstractAws1ClientIT() { super(LOCALSTACK_VERSION); diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java index 91f632f562..41fe65546e 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/src/test/java/co/elastic/apm/agent/awssdk/common/AbstractAwsClientIT.java @@ -55,7 +55,7 @@ public abstract class AbstractAwsClientIT extends AbstractInstrumentationTest { public AbstractAwsClientIT(String localstackVersion) { DockerImageName localstackImage = DockerImageName.parse("localstack/localstack:" + localstackVersion); - localstack = new LocalStackContainer(localstackImage).withServices(localstackService()); + localstack = new LocalStackContainer(localstackImage).withServices(localstackService()).withEnv("SQS_ENDPOINT_STRATEGY", "dynamic"); } protected abstract String awsService(); From 7ec0c580f0620b5fb6a308a2ea1547f737428bff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 08:21:31 +0200 Subject: [PATCH 106/132] build: bump actions/attest-build-provenance from 1.3.1 to 1.3.2 in the github-actions group (#3693) Bumps the github-actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance). Updates `actions/attest-build-provenance` from 1.3.1 to 1.3.2 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) --- .github/workflows/release-step-3.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index a04a00addb..9491619bbe 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -103,7 +103,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@534b352d658f90498fd148d231fdbf88f3886a3a # v1.3.1 + uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 with: subject-path: "${{ github.workspace }}/**/target/*.jar" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 9f09e760d3..708f210046 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -69,7 +69,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@534b352d658f90498fd148d231fdbf88f3886a3a # v1.3.1 + uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 with: subject-path: "${{ github.workspace }}/**/target/*.jar" From b94121aedc8e32cec7a6555ef99b20c1fc3e03ff Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 17:27:34 +0200 Subject: [PATCH 107/132] Use elastic/oblt-actions/aws/auth@v1.10.0 action to authenticate with AWS (#3696) * Use elastic/oblt-actions/aws/auth@v1.10.0 action to authenticate with AWS * Fix input * Add necessary permissions * Add comment about filename --- .github/workflows/release-step-3.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index 9491619bbe..ab00ea7dce 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -1,5 +1,7 @@ --- # Releases the agent +# Renaming this file will break the AWS authentication. +# Contact the observablt-robots team if you need to rename this file. name: 'release-step-3' on: @@ -150,18 +152,14 @@ jobs: publish-aws-lambda: name: "Publish AWS Lambda" + permissions: + contents: read + id-token: write runs-on: ubuntu-latest needs: - await-maven-central-artifact outputs: arn_content: ${{ steps.arn_output.outputs.arn_content }} - env: - # Random region. This needs to be set in GH Actions or the usage of aws-cli will fail. - # The default region does not matter, since we are publishing in all regions. - AWS_DEFAULT_REGION: eu-west-1 - # TODO: use keyless - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - uses: actions/checkout@v4 with: @@ -170,7 +168,9 @@ jobs: uses: ./.github/workflows/maven-goal with: command: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer - + - uses: elastic/oblt-actions/aws/auth@v1.10.0 + with: + aws-account-id: '267093732750' - name: Publish if: ${{ ! inputs.dry_run }} run: | From 0f50c80a3fc70ca4af00f9bb1919b6e15a346c2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:22:52 +0200 Subject: [PATCH 108/132] build: bump org.springframework.boot:spring-boot-dependencies from 2.7.16 to 3.3.1 (#3694) * build: bump org.springframework.boot:spring-boot-dependencies Bumps [org.springframework.boot:spring-boot-dependencies](https://github.com/spring-projects/spring-boot) from 2.7.16 to 3.3.1. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.7.16...v3.3.1) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Revert spring 2 version * Update pom.xml * Update pom.xml --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Kunz --- .../apm-spring-resttemplate/apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index f4b1d073da..31258125e2 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.0 + 3.3.1 pom import diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index 7ded397ec8..ee6413b0a0 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -23,7 +23,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.0 + 3.3.1 pom import diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index bedbf509ef..e1b57ec8d9 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -18,7 +18,7 @@ 2.7.16 - 3.3.0 + 3.3.1 diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index 474977cee6..9a590b757b 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.0 + 3.3.1 pom import diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index 823566ad06..064ed0affe 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -29,7 +29,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.0 + 3.3.1 pom import diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 7e1ddecbb7..56e72f9b6b 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -30,7 +30,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.0 + 3.3.1 pom import From 402a41990ef2704e9fd486b2d74b1a72076e9395 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:23:07 +0200 Subject: [PATCH 109/132] build: bump version.jackson from 2.13.3 to 2.17.1 (#3676) * build: bump version.jackson from 2.13.3 to 2.17.1 Bumps `version.jackson` from 2.13.3 to 2.17.1. Updates `com.fasterxml.jackson.core:jackson-databind` from 2.13.3 to 2.17.1 - [Commits](https://github.com/FasterXML/jackson/commits) Updates `com.fasterxml.jackson.module:jackson-module-afterburner` from 2.14.2 to 2.17.1 - [Commits](https://github.com/FasterXML/jackson-modules-base/compare/jackson-modules-base-2.14.2...jackson-modules-base-2.17.1) Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-cbor` from 2.14.2 to 2.17.1 - [Commits](https://github.com/FasterXML/jackson-dataformats-binary/compare/jackson-dataformats-binary-2.14.2...jackson-dataformats-binary-2.17.1) Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-protobuf` from 2.14.2 to 2.17.1 - [Commits](https://github.com/FasterXML/jackson-dataformats-binary/compare/jackson-dataformats-binary-2.14.2...jackson-dataformats-binary-2.17.1) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.fasterxml.jackson.module:jackson-module-afterburner dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-cbor dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Revert finagle jackson bump, it only supports 2.13 * switch to BOM for jackson version management --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Kunz --- apm-agent-benchmarks/pom.xml | 4 ---- .../apm-finagle-httpclient-plugin/pom.xml | 22 ++++++++++++------- pom.xml | 9 ++++++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/apm-agent-benchmarks/pom.xml b/apm-agent-benchmarks/pom.xml index 0e34fe0235..5256be336d 100644 --- a/apm-agent-benchmarks/pom.xml +++ b/apm-agent-benchmarks/pom.xml @@ -97,22 +97,18 @@ com.fasterxml.jackson.core jackson-databind - ${version.jackson} com.fasterxml.jackson.module jackson-module-afterburner - ${version.jackson} com.fasterxml.jackson.dataformat jackson-dataformat-cbor - ${version.jackson} com.fasterxml.jackson.dataformat jackson-dataformat-protobuf - ${version.jackson} net.bytebuddy diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml index f5624f4124..f3b2cb45a3 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml @@ -15,6 +15,20 @@ ${project.basedir}/../.. + + + + + + com.fasterxml.jackson + jackson-bom + 2.13.3 + import + pom + + + + @@ -28,14 +42,6 @@ 22.7.0 provided - - - com.fasterxml.jackson.core - jackson-databind - 2.13.3 - test - - ${project.groupId} apm-httpclient-core diff --git a/pom.xml b/pom.xml index decfa218b1..16f199b7f6 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,6 @@ 2.2.0 1.4.196 - 2.14.2 5.9.1 4.13.2 4.12.0 @@ -665,6 +664,13 @@ pom import + + com.fasterxml.jackson + jackson-bom + 2.17.1 + import + pom + org.apache.ivy ivy @@ -791,7 +797,6 @@ com.fasterxml.jackson.core jackson-databind - ${version.jackson} test From 1594cc496d273631a086722d0d90b96ec3ec140f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:21:25 +0200 Subject: [PATCH 110/132] build: bump com.networknt:json-schema-validator from 1.4.0 to 1.4.3 (#3697) Bumps [com.networknt:json-schema-validator](https://github.com/networknt/json-schema-validator) from 1.4.0 to 1.4.3. - [Release notes](https://github.com/networknt/json-schema-validator/releases) - [Changelog](https://github.com/networknt/json-schema-validator/blob/master/CHANGELOG.md) - [Commits](https://github.com/networknt/json-schema-validator/compare/1.4.0...1.4.3) --- updated-dependencies: - dependency-name: com.networknt:json-schema-validator dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 16f199b7f6..4043746f6c 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ 1.6.0 5.0.15.RELEASE 9.4.11.v20180605 - 1.4.0 + 1.4.3 1.14.17 9.7 From 5519e4723193ae7a29bb3fa7547ad4b31a45046f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:54:13 +0200 Subject: [PATCH 111/132] build: bump version.aws.sdk in /apm-agent-plugins (#3703) Bumps `version.aws.sdk` from 2.25.64 to 2.26.12. Updates `software.amazon.awssdk:s3` from 2.25.64 to 2.26.12 Updates `software.amazon.awssdk:sqs` from 2.25.64 to 2.26.12 Updates `software.amazon.awssdk:dynamodb` from 2.25.64 to 2.26.12 --- updated-dependencies: - dependency-name: software.amazon.awssdk:s3 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: software.amazon.awssdk:sqs dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: software.amazon.awssdk:dynamodb dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index 90073a5292..d0c8a6171d 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -13,7 +13,7 @@ ${project.basedir}/../../.. - 2.25.64 + 2.26.12 2.0.0 8 From 8f1ae13b27f8eaf5bb0056468c13b9b4f16a5e50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:02:31 +0200 Subject: [PATCH 112/132] build: bump redis.clients:jedis from 1.4.0 to 5.1.3 (#3700) * build: bump redis.clients:jedis from 1.4.0 to 5.1.3 Bumps [redis.clients:jedis](https://github.com/redis/jedis) from 1.4.0 to 5.1.3. - [Release notes](https://github.com/redis/jedis/releases) - [Commits](https://github.com/redis/jedis/compare/jedis-1.4.0...v5.1.3) --- updated-dependencies: - dependency-name: redis.clients:jedis dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update pom.xml * Update pom.xml * Update pom.xml * Update pom.xml --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Kunz --- apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml index 9928508762..a887991291 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml @@ -46,7 +46,7 @@ redis.clients jedis - 5.1.2 + 5.1.3 test From 6f640e898f68248e4a234b27bc3d47894d438c1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:02:55 +0200 Subject: [PATCH 113/132] build: bump version.aws.sdk in /apm-agent-plugins (#3705) Bumps `version.aws.sdk` from 1.12.740 to 1.12.755. Updates `com.amazonaws:aws-java-sdk-s3` from 1.12.740 to 1.12.755 - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.12.740...1.12.755) Updates `com.amazonaws:aws-java-sdk-dynamodb` from 1.12.740 to 1.12.755 - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.12.740...1.12.755) Updates `com.amazonaws:aws-java-sdk-sqs` from 1.12.740 to 1.12.755 - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.12.740...1.12.755) --- updated-dependencies: - dependency-name: com.amazonaws:aws-java-sdk-s3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.amazonaws:aws-java-sdk-dynamodb dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.amazonaws:aws-java-sdk-sqs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml index 188b278c93..a20a31b858 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml @@ -12,7 +12,7 @@ ${project.basedir}/../../.. - 1.12.740 + 1.12.755 1.1.0 From 97e47dc8eedc6f211d8938ed06f762cee98a89ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:16:10 +0200 Subject: [PATCH 114/132] build: bump org.assertj:assertj-core from 3.25.3 to 3.26.0 (#3701) Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.25.3 to 3.26.0. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.25.3...assertj-build-3.26.0) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4043746f6c..9cc271a43a 100644 --- a/pom.xml +++ b/pom.xml @@ -754,7 +754,7 @@ org.assertj assertj-core - 3.25.3 + 3.26.0 test From f77a96b81a425161148833ae98d621a1a315cc54 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Fri, 5 Jul 2024 10:08:30 +0200 Subject: [PATCH 115/132] Add elastic-otel-java to weekly benchmarks (#3706) * Add elastic-otel-java to weekly benchmarks * Apply suggestions from code review Co-authored-by: jackshirazi * Fix wrong agent name * Shorten name to not mess up results table * Even shorter name --------- Co-authored-by: jackshirazi --- .buildkite/scripts/opentelemetry-benchmark.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/opentelemetry-benchmark.sh b/.buildkite/scripts/opentelemetry-benchmark.sh index c33395301a..7d0514ea99 100755 --- a/.buildkite/scripts/opentelemetry-benchmark.sh +++ b/.buildkite/scripts/opentelemetry-benchmark.sh @@ -26,6 +26,14 @@ BENCHMARKS_JAR=$(ls -1 benchmarks*.jar) BENCHMARKS_JAR_FILE="$(pwd)/$BENCHMARKS_JAR" echo "$BENCHMARKS_JAR_FILE has been downloaded." +echo "--- Download the latest elastic-otel-agent artifact" +distro_run_id=$(gh run list --repo elastic/elastic-otel-java --branch main --status success --workflow build.yml -L 1 --json databaseId --jq '.[].databaseId') +gh run download "$distro_run_id" --repo elastic/elastic-otel-java -n elastic-otel-javaagent +ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR=$(ls -1 elastic-otel-javaagent-*SNAPSHOT.jar) +ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR_FILE="$(pwd)/$ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR" +echo "$ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR_FILE has been downloaded." + + echo "--- Start APM Server mock" git clone https://github.com/elastic/apm-k8s-attacher.git pushd apm-k8s-attacher/test/mock @@ -41,11 +49,16 @@ pushd opentelemetry-java-instrumentation/ echo "--- Customise the elastic opentelemetry java instrumentation" pushd benchmark-overhead cp "$ELASTIC_SNAPSHOT_JAR_FILE" . -ELASTIC_SNAPSHOT_ENTRY="new Agent(\\\"elastic-snapshot\\\",\\\"latest available snapshot version from elastic main\\\",\\\"file://$PWD/$ELASTIC_SNAPSHOT_JAR\\\", java.util.List.of(\\\"-Delastic.apm.server_url=http://host.docker.internal:8027/\\\"))" +cp "$ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR_FILE" . ELASTIC_LATEST_VERSION=$(curl -s https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/ | perl -ne 's/<.*?>//g; if(s/^([\d\.]+).*$/$1/){print}' | sort -V | tail -1) +ELASTIC_OTEL_DISTRO_LATEST_VERSION=$(curl -s https://repo1.maven.org/maven2/co/elastic/otel/elastic-otel-javaagent/ | perl -ne 's/<.*?>//g; if(s/^([\d\.]+).*$/$1/){print}' | sort -V | tail -1) +ELASTIC_SNAPSHOT_ENTRY="new Agent(\\\"elastic-snapshot\\\",\\\"latest available snapshot version from elastic main\\\",\\\"file://$PWD/$ELASTIC_SNAPSHOT_JAR\\\", java.util.List.of(\\\"-Delastic.apm.server_url=http://host.docker.internal:8027/\\\"))" ELASTIC_LATEST_ENTRY="new Agent(\\\"elastic-latest\\\",\\\"latest available released version from elastic main\\\",\\\"https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/$ELASTIC_LATEST_VERSION/elastic-apm-agent-$ELASTIC_LATEST_VERSION.jar\\\", java.util.List.of(\\\"-Delastic.apm.server_url=http://host.docker.internal:8027/\\\"))" ELASTIC_LATEST_ENTRY2="new Agent(\\\"elastic-async\\\",\\\"latest available released version from elastic main\\\",\\\"https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/$ELASTIC_LATEST_VERSION/elastic-apm-agent-$ELASTIC_LATEST_VERSION.jar\\\", java.util.List.of(\\\"-Delastic.apm.delay_agent_premain_ms=15000\\\",\\\"-Delastic.apm.server_url=http://host.docker.internal:8027/\\\"))" -NEW_LINE=" .withAgents(Agent.NONE, Agent.LATEST_RELEASE, Agent.LATEST_SNAPSHOT, $ELASTIC_LATEST_ENTRY, $ELASTIC_LATEST_ENTRY2, $ELASTIC_SNAPSHOT_ENTRY)" +ELASTIC_OTEL_DISTRO_SNAPSHOT_ENTRY="new Agent(\\\"distro-snapshot\\\",\\\"latest available snapshot version from elastic-otel-java main\\\",\\\"file://$PWD/$ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR\\\")" +ELASTIC_OTEL_DISTRO_LATEST_ENTRY="new Agent(\\\"distro-latest\\\",\\\"latest available released version from elastic-otel-java\\\",\\\"https://repo1.maven.org/maven2/co/elastic/otel/elastic-otel-javaagent/$ELASTIC_OTEL_DISTRO_LATEST_VERSION/elastic-otel-javaagent-$ELASTIC_OTEL_DISTRO_LATEST_VERSION.jar\\\")" +ELASTIC_OTEL_DISTRO_LATEST_INFERRED_SPANS_ENTRY="new Agent(\\\"distro-infspans\\\",\\\"latest available released version from elastic-otel-java with inferred-spans enabled\\\",\\\"https://repo1.maven.org/maven2/co/elastic/otel/elastic-otel-javaagent/$ELASTIC_OTEL_DISTRO_LATEST_VERSION/elastic-otel-javaagent-$ELASTIC_OTEL_DISTRO_LATEST_VERSION.jar\\\", java.util.List.of(\\\"-Delastic.otel.inferred.spans.enabled=true\\\"))" +NEW_LINE=" .withAgents(Agent.NONE, Agent.LATEST_RELEASE, Agent.LATEST_SNAPSHOT, $ELASTIC_LATEST_ENTRY, $ELASTIC_LATEST_ENTRY2, $ELASTIC_SNAPSHOT_ENTRY, $ELASTIC_OTEL_DISTRO_SNAPSHOT_ENTRY, $ELASTIC_OTEL_DISTRO_LATEST_ENTRY, $ELASTIC_OTEL_DISTRO_LATEST_INFERRED_SPANS_ENTRY)" echo $NEW_LINE perl -i -ne "if (/withAgents/) {print \"$NEW_LINE\n\"}else{print}" src/test/java/io/opentelemetry/config/Configs.java From 1849960c44424972913da5e4144e1b68b26d59d5 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 5 Jul 2024 12:06:42 +0200 Subject: [PATCH 116/132] updatecli: use shared policy (#3707) --- .../updatecli.d/update-gherkin-specs.yml | 83 ------------------ .../updatecli.d/update-json-specs.yml | 83 ------------------ .ci/updatecli/updatecli.d/update-specs.yml | 85 ------------------- .ci/updatecli/values.d/apm-data-spec.yml | 2 + .ci/updatecli/values.d/apm-gherkin.yml | 2 + .ci/updatecli/values.d/apm-json-specs.yml | 2 + .ci/updatecli/values.d/scm.yml | 6 ++ .ci/updatecli/values.yml | 14 --- .github/workflows/updatecli.yml | 19 ++++- update-compose.yaml | 18 ++++ 10 files changed, 47 insertions(+), 267 deletions(-) delete mode 100644 .ci/updatecli/updatecli.d/update-gherkin-specs.yml delete mode 100644 .ci/updatecli/updatecli.d/update-json-specs.yml delete mode 100644 .ci/updatecli/updatecli.d/update-specs.yml create mode 100644 .ci/updatecli/values.d/apm-data-spec.yml create mode 100644 .ci/updatecli/values.d/apm-gherkin.yml create mode 100644 .ci/updatecli/values.d/apm-json-specs.yml create mode 100644 .ci/updatecli/values.d/scm.yml delete mode 100644 .ci/updatecli/values.yml create mode 100644 update-compose.yaml diff --git a/.ci/updatecli/updatecli.d/update-gherkin-specs.yml b/.ci/updatecli/updatecli.d/update-gherkin-specs.yml deleted file mode 100644 index 13f0617a9a..0000000000 --- a/.ci/updatecli/updatecli.d/update-gherkin-specs.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: update-gherkin-specs -pipelineid: update-gherkin-specs - -scms: - default: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: "{{ .github.owner }}" - repository: "{{ .github.repository }}" - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: "{{ .github.branch }}" - commitusingapi: true - apm: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: "{{ .github.owner }}" - repository: "{{ .github.apm_repository }}" - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: "{{ .github.branch }}" - -sources: - sha: - kind: file - spec: - file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ .github.branch }}.patch' - matchpattern: "^From\\s([0-9a-f]{40})\\s" - transformers: - - findsubmatch: - pattern: "[0-9a-f]{40}" - pull_request: - kind: shell - dependson: - - sha - spec: - command: gh api /repos/{{ .github.owner }}/{{ .github.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url' - environments: - - name: GITHUB_TOKEN - - name: PATH - agents-gherkin-specs-tarball: - kind: shell - scmid: apm - dependson: - - sha - spec: - command: tar cvzf {{ requiredEnv "GITHUB_WORKSPACE" }}/gherkin-specs.tgz . - environments: - - name: PATH - workdir: "{{ .specs.apm_gherkin_path }}" - -actions: - pr: - kind: "github/pullrequest" - scmid: default - spec: - automerge: false - draft: false - labels: - - "automation" - description: |- - ### What - APM agent Gherkin specs automatic sync - - ### Why - *Changeset* - * {{ source "pull_request" }} - * https://github.com/elastic/apm/commit/{{ source "sha" }} - title: '[Automation] Update Gherkin specs' - -targets: - agent-gherkin-specs: - name: APM agent gherkin specs {{ source "sha" }} - scmid: default - disablesourceinput: true - kind: shell - spec: - # git diff helps to print what it changed, If it is empty, then updatecli report a success with no changes applied. - # See https://www.updatecli.io/docs/plugins/resource/shell/#_shell_target - command: 'tar -xzf {{ requiredEnv "GITHUB_WORKSPACE" }}/gherkin-specs.tgz && git --no-pager diff' - workdir: "{{ .apm_agent.gherkin_specs_path }}" diff --git a/.ci/updatecli/updatecli.d/update-json-specs.yml b/.ci/updatecli/updatecli.d/update-json-specs.yml deleted file mode 100644 index ae98167759..0000000000 --- a/.ci/updatecli/updatecli.d/update-json-specs.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: update-json-specs -pipelineid: update-json-specs - -scms: - default: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: "{{ .github.owner }}" - repository: "{{ .github.repository }}" - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: "{{ .github.branch }}" - commitusingapi: true - apm: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: "{{ .github.owner }}" - repository: "{{ .github.apm_repository }}" - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: "{{ .github.branch }}" - -sources: - sha: - kind: file - spec: - file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ .github.branch }}.patch' - matchpattern: "^From\\s([0-9a-f]{40})\\s" - transformers: - - findsubmatch: - pattern: "[0-9a-f]{40}" - pull_request: - kind: shell - dependson: - - sha - spec: - command: gh api /repos/{{ .github.owner }}/{{ .github.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url' - environments: - - name: GITHUB_TOKEN - - name: PATH - agents-json-specs-tarball: - kind: shell - scmid: apm - dependson: - - sha - spec: - command: tar cvzf {{ requiredEnv "GITHUB_WORKSPACE" }}/json-specs.tgz . - environments: - - name: PATH - workdir: "{{ .specs.apm_json_path }}" - -actions: - pr: - kind: "github/pullrequest" - scmid: default - spec: - automerge: false - draft: false - labels: - - "automation" - description: |- - ### What - APM agent specs automatic sync - - ### Why - *Changeset* - * {{ source "pull_request" }} - * https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ source "sha" }} - title: '[Automation] Update JSON specs' - -targets: - agent-json-specs: - name: APM agent json specs {{ source "sha" }} - scmid: default - disablesourceinput: true - kind: shell - spec: - # git diff helps to print what it changed, If it is empty, then updatecli report a success with no changes applied. - # See https://www.updatecli.io/docs/plugins/resource/shell/#_shell_target - command: 'tar -xzf {{ requiredEnv "GITHUB_WORKSPACE" }}/json-specs.tgz && git --no-pager diff' - workdir: "{{ .apm_agent.json_specs_path }}" diff --git a/.ci/updatecli/updatecli.d/update-specs.yml b/.ci/updatecli/updatecli.d/update-specs.yml deleted file mode 100644 index e9bbaf945e..0000000000 --- a/.ci/updatecli/updatecli.d/update-specs.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: update-specs -pipelineid: update-schema-specs - -scms: - default: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: "{{ .github.owner }}" - repository: "{{ .github.repository }}" - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: "{{ .github.branch }}" - commitusingapi: true - - apm-data: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: "{{ .github.owner }}" - repository: "{{ .github.apm_data_repository }}" - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: "{{ .github.branch }}" - -sources: - sha: - kind: file - spec: - file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_data_repository }}/commit/{{ .github.branch }}.patch' - matchpattern: "^From\\s([0-9a-f]{40})\\s" - transformers: - - findsubmatch: - pattern: "[0-9a-f]{40}" - pull_request: - kind: shell - dependson: - - sha - spec: - command: gh api /repos/{{ .github.owner }}/{{ .github.apm_data_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url' - environments: - - name: GITHUB_TOKEN - - name: PATH - agent-specs-tarball: - kind: shell - scmid: apm-data - dependson: - - sha - spec: - command: tar cvzf {{ requiredEnv "GITHUB_WORKSPACE" }}/json-schema.tgz . - environments: - - name: PATH - workdir: "{{ .specs.apm_data_path }}" - -actions: - pr: - kind: "github/pullrequest" - scmid: default - sourceid: sha - spec: - automerge: false - draft: false - labels: - - "automation" - description: |- - ### What - APM agent json server schema automatic sync - - ### Why - *Changeset* - * {{ source "pull_request" }} - * https://github.com/{{ .github.owner }}/{{ .github.apm_data_repository }}/commit/{{ source "sha" }} - title: '[Automation] Update JSON server schema specs' - -targets: - agent-json-schema: - name: APM agent json server schema {{ source "sha" }} - scmid: default - disablesourceinput: true - kind: shell - spec: - # git diff helps to print what it changed, If it is empty, then updatecli report a success with no changes applied. - # See https://www.updatecli.io/docs/plugins/resource/shell/#_shell_target - command: 'tar -xzf {{ requiredEnv "GITHUB_WORKSPACE" }}/json-schema.tgz && git --no-pager diff' - workdir: "{{ .apm_agent.server_schema_specs_path }}" diff --git a/.ci/updatecli/values.d/apm-data-spec.yml b/.ci/updatecli/values.d/apm-data-spec.yml new file mode 100644 index 0000000000..fd8c9e37f7 --- /dev/null +++ b/.ci/updatecli/values.d/apm-data-spec.yml @@ -0,0 +1,2 @@ +apm_schema_specs_path: apm-agent-core/src/test/resources/apm-server-schema/current +signedcommit: true \ No newline at end of file diff --git a/.ci/updatecli/values.d/apm-gherkin.yml b/.ci/updatecli/values.d/apm-gherkin.yml new file mode 100644 index 0000000000..d676b58b2a --- /dev/null +++ b/.ci/updatecli/values.d/apm-gherkin.yml @@ -0,0 +1,2 @@ +apm_gherkin_specs_path: apm-agent-core/src/test/resources/specs +signedcommit: true \ No newline at end of file diff --git a/.ci/updatecli/values.d/apm-json-specs.yml b/.ci/updatecli/values.d/apm-json-specs.yml new file mode 100644 index 0000000000..b1b70a8e69 --- /dev/null +++ b/.ci/updatecli/values.d/apm-json-specs.yml @@ -0,0 +1,2 @@ +apm_json_specs_path: apm-agent-core/src/test/resources/json-specs +signedcommit: true \ No newline at end of file diff --git a/.ci/updatecli/values.d/scm.yml b/.ci/updatecli/values.d/scm.yml new file mode 100644 index 0000000000..8ad8f74fe1 --- /dev/null +++ b/.ci/updatecli/values.d/scm.yml @@ -0,0 +1,6 @@ +scm: + enabled: true + owner: elastic + repository: apm-agent-java + apm_repository: apm + branch: main \ No newline at end of file diff --git a/.ci/updatecli/values.yml b/.ci/updatecli/values.yml deleted file mode 100644 index 5d1e74685f..0000000000 --- a/.ci/updatecli/values.yml +++ /dev/null @@ -1,14 +0,0 @@ -github: - owner: "elastic" - repository: "apm-agent-java" - apm_repository: "apm" - apm_data_repository: "apm-data" - branch: "main" -specs: - apm_data_path: "input/elasticapm/docs/spec/v2" - apm_json_path: "tests/agents/json-specs" - apm_gherkin_path: "tests/agents/gherkin-specs" -apm_agent: - gherkin_specs_path: "apm-agent-core/src/test/resources/specs" - json_specs_path: "apm-agent-core/src/test/resources/json-specs" - server_schema_specs_path: "apm-agent-core/src/test/resources/apm-server-schema/current" \ No newline at end of file diff --git a/.github/workflows/updatecli.yml b/.github/workflows/updatecli.yml index 091ea3fe2b..99369c845d 100644 --- a/.github/workflows/updatecli.yml +++ b/.github/workflows/updatecli.yml @@ -9,14 +9,29 @@ permissions: contents: read jobs: - bump: + compose: runs-on: ubuntu-latest + permissions: + contents: read + packages: read steps: - uses: actions/checkout@v4 + - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: elastic/oblt-actions/updatecli/run@v1 + with: + command: --experimental compose diff + env: + GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }} + - uses: elastic/oblt-actions/updatecli/run@v1 with: - command: "--experimental apply --config .ci/updatecli/updatecli.d --values .ci/updatecli/values.yml" + command: --experimental compose apply env: GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }} diff --git a/update-compose.yaml b/update-compose.yaml new file mode 100644 index 0000000000..d40020933b --- /dev/null +++ b/update-compose.yaml @@ -0,0 +1,18 @@ +policies: + - name: Handle apm-data server specs + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-data-spec:0.2.0@sha256:7069c0773d44a74c4c8103b4d9957b468f66081ee9d677238072fe11c4d2197c + values: + - .ci/updatecli/values.d/scm.yml + - .ci/updatecli/values.d/apm-data-spec.yml + + - name: Handle apm gherkin specs + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-gherkin:0.2.0@sha256:26a30ad2b98a6e4cb17fb88a28fa3277ced8ca862d6388943afaafbf8ee96e7d + values: + - .ci/updatecli/values.d/scm.yml + - .ci/updatecli/values.d/apm-gherkin.yml + + - name: Handle apm json specs + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-json-specs:0.2.0@sha256:969a6d21eabd6ebea66cb29b35294a273d6dbc0f7da78589c416aedf08728e78 + values: + - .ci/updatecli/values.d/scm.yml + - .ci/updatecli/values.d/apm-json-specs.yml From ffdd4c99561afe605de5f3b460b63c6ea9c5fccc Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 9 Jul 2024 08:57:27 +0200 Subject: [PATCH 117/132] Run opentelemetry benchmarks for individual features (#3708) * Add benchmarks for individual distro features on snapshot * Fix argument generation --- .buildkite/scripts/opentelemetry-benchmark.sh | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/opentelemetry-benchmark.sh b/.buildkite/scripts/opentelemetry-benchmark.sh index 7d0514ea99..c1a35bf6cc 100755 --- a/.buildkite/scripts/opentelemetry-benchmark.sh +++ b/.buildkite/scripts/opentelemetry-benchmark.sh @@ -57,8 +57,29 @@ ELASTIC_LATEST_ENTRY="new Agent(\\\"elastic-latest\\\",\\\"latest available rele ELASTIC_LATEST_ENTRY2="new Agent(\\\"elastic-async\\\",\\\"latest available released version from elastic main\\\",\\\"https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/$ELASTIC_LATEST_VERSION/elastic-apm-agent-$ELASTIC_LATEST_VERSION.jar\\\", java.util.List.of(\\\"-Delastic.apm.delay_agent_premain_ms=15000\\\",\\\"-Delastic.apm.server_url=http://host.docker.internal:8027/\\\"))" ELASTIC_OTEL_DISTRO_SNAPSHOT_ENTRY="new Agent(\\\"distro-snapshot\\\",\\\"latest available snapshot version from elastic-otel-java main\\\",\\\"file://$PWD/$ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR\\\")" ELASTIC_OTEL_DISTRO_LATEST_ENTRY="new Agent(\\\"distro-latest\\\",\\\"latest available released version from elastic-otel-java\\\",\\\"https://repo1.maven.org/maven2/co/elastic/otel/elastic-otel-javaagent/$ELASTIC_OTEL_DISTRO_LATEST_VERSION/elastic-otel-javaagent-$ELASTIC_OTEL_DISTRO_LATEST_VERSION.jar\\\")" -ELASTIC_OTEL_DISTRO_LATEST_INFERRED_SPANS_ENTRY="new Agent(\\\"distro-infspans\\\",\\\"latest available released version from elastic-otel-java with inferred-spans enabled\\\",\\\"https://repo1.maven.org/maven2/co/elastic/otel/elastic-otel-javaagent/$ELASTIC_OTEL_DISTRO_LATEST_VERSION/elastic-otel-javaagent-$ELASTIC_OTEL_DISTRO_LATEST_VERSION.jar\\\", java.util.List.of(\\\"-Delastic.otel.inferred.spans.enabled=true\\\"))" -NEW_LINE=" .withAgents(Agent.NONE, Agent.LATEST_RELEASE, Agent.LATEST_SNAPSHOT, $ELASTIC_LATEST_ENTRY, $ELASTIC_LATEST_ENTRY2, $ELASTIC_SNAPSHOT_ENTRY, $ELASTIC_OTEL_DISTRO_SNAPSHOT_ENTRY, $ELASTIC_OTEL_DISTRO_LATEST_ENTRY, $ELASTIC_OTEL_DISTRO_LATEST_INFERRED_SPANS_ENTRY)" +ELASTIC_OTEL_DISTRO_FEATURE_ENTRIES="" +for FEATURE in "infspan" "cloudres" "up-integ" "spanstack" ; do + FEATURE_ARGS="" + if [ "$FEATURE" = "infspan" ]; then + FEATURE_ARGS="$FEATURE_ARGS, \\\"-Delastic.otel.inferred.spans.enabled=true\\\"" + fi + if [ "$FEATURE" != "cloudres" ]; then + FEATURE_ARGS="$FEATURE_ARGS, \\\"-Dotel.resource.providers.aws.enabled=false\\\", \\\"-Dotel.resource.providers.gcp.enabled=false\\\"" + fi + + if [ "$FEATURE" = "up-integ" ]; then + FEATURE_ARGS="$FEATURE_ARGS, \\\"-Delastic.otel.universal.profiling.integration.enabled=true\\\"" + else + FEATURE_ARGS="$FEATURE_ARGS, \\\"-Delastic.otel.universal.profiling.integration.enabled=false\\\"" + fi + if [ "$FEATURE" != "spanstack" ]; then + FEATURE_ARGS="$FEATURE_ARGS, \\\"-Delastic.otel.span.stack.trace.min.duration=-1\\\"" + fi + # Remove leading ", " + FEATURE_ARGS="${FEATURE_ARGS:2}" + ELASTIC_OTEL_DISTRO_FEATURE_ENTRIES="$ELASTIC_OTEL_DISTRO_FEATURE_ENTRIES, new Agent(\\\"distro-$FEATURE\\\",\\\"latest available snapshot version from elastic-otel-java main with only feature $FEATURE enabled\\\",\\\"file://$PWD/$ELASTIC_OTEL_DISTRO_SNAPSHOT_JAR\\\", java.util.List.of($FEATURE_ARGS))" +done +NEW_LINE=" .withAgents(Agent.NONE, Agent.LATEST_RELEASE, Agent.LATEST_SNAPSHOT, $ELASTIC_LATEST_ENTRY, $ELASTIC_LATEST_ENTRY2, $ELASTIC_SNAPSHOT_ENTRY, $ELASTIC_OTEL_DISTRO_SNAPSHOT_ENTRY, $ELASTIC_OTEL_DISTRO_LATEST_ENTRY $ELASTIC_OTEL_DISTRO_FEATURE_ENTRIES)" echo $NEW_LINE perl -i -ne "if (/withAgents/) {print \"$NEW_LINE\n\"}else{print}" src/test/java/io/opentelemetry/config/Configs.java From 485eb00abb1b4fb61650e35bbcc062b72a1be15f Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:23:17 +0200 Subject: [PATCH 118/132] runtime attach: prevent NPE with null value (#3712) * runtime attach: prevent NPE with null value --- CHANGELOG.asciidoc | 1 + .../java/co/elastic/apm/attach/ElasticApmAttacher.java | 9 ++++++++- .../src/main/java/co/elastic/apm/testapp/AppMain.java | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 0103c59e29..ca3c30bcd8 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -35,6 +35,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: ===== Bug fixes * Restore compatibility with Java 7 - {pull}3657[#3657] * Avoid `ClassCastException` and issue warning when trying to use otel span links - {pull}3672[#3672] +* Avoid `NullPointerException` with runtime attach API and invalid map entries - {pull}3712[#3712] [float] ===== Features diff --git a/apm-agent-attach/src/main/java/co/elastic/apm/attach/ElasticApmAttacher.java b/apm-agent-attach/src/main/java/co/elastic/apm/attach/ElasticApmAttacher.java index 7de283076f..c4f8137d33 100644 --- a/apm-agent-attach/src/main/java/co/elastic/apm/attach/ElasticApmAttacher.java +++ b/apm-agent-attach/src/main/java/co/elastic/apm/attach/ElasticApmAttacher.java @@ -150,7 +150,14 @@ public static void attach(String pid, Map configuration) { */ public static void attach(String pid, Map configuration, File agentJarFile) { // making a copy of provided configuration as user might have used an immutable map impl. - Map config = new HashMap<>(configuration); + // and guard against user-provided null keys and values + Map config = new HashMap<>(); + for (Map.Entry entry : configuration.entrySet()) { + if (entry.getKey() != null && entry.getValue() != null) { + config.put(entry.getKey(), entry.getValue()); + } + } + if (!config.containsKey("activation_method")) { config.put("activation_method", "PROGRAMMATIC_SELF_ATTACH"); } diff --git a/integration-tests/runtime-attach/runtime-attach-app/src/main/java/co/elastic/apm/testapp/AppMain.java b/integration-tests/runtime-attach/runtime-attach-app/src/main/java/co/elastic/apm/testapp/AppMain.java index 2e43ef010a..d02f1c776a 100644 --- a/integration-tests/runtime-attach/runtime-attach-app/src/main/java/co/elastic/apm/testapp/AppMain.java +++ b/integration-tests/runtime-attach/runtime-attach-app/src/main/java/co/elastic/apm/testapp/AppMain.java @@ -79,6 +79,10 @@ public static void main(String[] args) { Map config = new HashMap<>(); config.put("service_name", "self-attach-external-config"); config.put("config_file", agentConfig.getAbsolutePath()); + + // user-provided map might have null values and be un-modifiable + // thus we must test it to ensure it's working as expected + config.put("null_config_entry", null); ElasticApmAttacher.attach(Collections.unmodifiableMap(config)); } } From 90cded2f41058f20c818b9a3e67bd44e7f7db2fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 18:16:42 +0200 Subject: [PATCH 119/132] build: bump com.networknt:json-schema-validator from 1.4.3 to 1.5.0 (#3710) Bumps [com.networknt:json-schema-validator](https://github.com/networknt/json-schema-validator) from 1.4.3 to 1.5.0. - [Release notes](https://github.com/networknt/json-schema-validator/releases) - [Changelog](https://github.com/networknt/json-schema-validator/blob/master/CHANGELOG.md) - [Commits](https://github.com/networknt/json-schema-validator/compare/1.4.3...1.5.0) --- updated-dependencies: - dependency-name: com.networknt:json-schema-validator dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9cc271a43a..858e1e8015 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ 1.6.0 5.0.15.RELEASE 9.4.11.v20180605 - 1.4.3 + 1.5.0 1.14.17 9.7 From 7b6ba98e72dc79e197fe475f36c35ccbb6a1e911 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 10 Jul 2024 21:22:13 +0200 Subject: [PATCH 120/132] updatecli: bump policies too (#3714) --- .ci/updatecli/values.d/scm.yml | 6 +++++- .ci/updatecli/values.d/update-compose.yml | 3 +++ update-compose.yaml | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .ci/updatecli/values.d/update-compose.yml diff --git a/.ci/updatecli/values.d/scm.yml b/.ci/updatecli/values.d/scm.yml index 8ad8f74fe1..5cfcec7d2a 100644 --- a/.ci/updatecli/values.d/scm.yml +++ b/.ci/updatecli/values.d/scm.yml @@ -3,4 +3,8 @@ scm: owner: elastic repository: apm-agent-java apm_repository: apm - branch: main \ No newline at end of file + branch: main + # begin update-compose policy values + user: obltmachine + email: obltmachine@users.noreply.github.com + # end update-compose policy values diff --git a/.ci/updatecli/values.d/update-compose.yml b/.ci/updatecli/values.d/update-compose.yml new file mode 100644 index 0000000000..8804f96618 --- /dev/null +++ b/.ci/updatecli/values.d/update-compose.yml @@ -0,0 +1,3 @@ +spec: + files: + - "update-compose.yaml" \ No newline at end of file diff --git a/update-compose.yaml b/update-compose.yaml index d40020933b..b21e977fee 100644 --- a/update-compose.yaml +++ b/update-compose.yaml @@ -1,3 +1,5 @@ +# Config file for `updatecli compose ...`. +# https://www.updatecli.io/docs/core/compose/ policies: - name: Handle apm-data server specs policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-data-spec:0.2.0@sha256:7069c0773d44a74c4c8103b4d9957b468f66081ee9d677238072fe11c4d2197c @@ -16,3 +18,9 @@ policies: values: - .ci/updatecli/values.d/scm.yml - .ci/updatecli/values.d/apm-json-specs.yml + + - name: Update Updatecli policies + policy: ghcr.io/updatecli/policies/autodiscovery/updatecli:0.4.0@sha256:254367f5b1454fd6032b88b314450cd3b6d5e8d5b6c953eb242a6464105eb869 + values: + - .ci/updatecli/values.d/scm.yml + - .ci/updatecli/values.d/update-compose.yml From d2dace050ce0a92044af93aca8de768539718232 Mon Sep 17 00:00:00 2001 From: Luca Belluccini Date: Fri, 12 Jul 2024 17:42:34 +0200 Subject: [PATCH 121/132] [DOCS] Clarify error capturing (#3716) Clarify we collect the exceptions passed to a `logger.error`, not the message of the `logger.error`. --- docs/logs.asciidoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/logs.asciidoc b/docs/logs.asciidoc index 53c5564525..f0abf66468 100644 --- a/docs/logs.asciidoc +++ b/docs/logs.asciidoc @@ -77,6 +77,10 @@ As a result, when an exception is reported to the logger: - An `error.id` is generated and injected into logger MDC for the duration of the logger invocation - Logger output will contain the `error.id` if the log format allows it (plaintext still requires some configuration) +Please note we capture the exception, not the message passed to the `logger.error`. + +To collect the message passed to the `logger.error`, you would need to ingest the logs of the application (see {apm-guide-ref}/log-correlation.html[Log correlation]). + [float] [[log-sending]] === Log sending (experimental) From 7bae628e287793277151eb24664465e3ac032e42 Mon Sep 17 00:00:00 2001 From: obltmachine <150269514+obltmachine@users.noreply.github.com> Date: Mon, 15 Jul 2024 08:43:14 +0200 Subject: [PATCH 122/132] deps(updatecli): bump all policies (#3715) --- update-compose.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/update-compose.yaml b/update-compose.yaml index b21e977fee..372d29ed58 100644 --- a/update-compose.yaml +++ b/update-compose.yaml @@ -2,23 +2,20 @@ # https://www.updatecli.io/docs/core/compose/ policies: - name: Handle apm-data server specs - policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-data-spec:0.2.0@sha256:7069c0773d44a74c4c8103b4d9957b468f66081ee9d677238072fe11c4d2197c + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-data-spec:0.3.0@sha256:e7cdc38653afecaf9fad748356f545da6eb48bb9262665ff563cda974defb6f5 values: - .ci/updatecli/values.d/scm.yml - .ci/updatecli/values.d/apm-data-spec.yml - - name: Handle apm gherkin specs - policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-gherkin:0.2.0@sha256:26a30ad2b98a6e4cb17fb88a28fa3277ced8ca862d6388943afaafbf8ee96e7d + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-gherkin:0.3.0@sha256:b8fae37245a5fa99482b3700a53681196c4b42685153d93452f7103bbaf4a5f3 values: - .ci/updatecli/values.d/scm.yml - .ci/updatecli/values.d/apm-gherkin.yml - - name: Handle apm json specs - policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-json-specs:0.2.0@sha256:969a6d21eabd6ebea66cb29b35294a273d6dbc0f7da78589c416aedf08728e78 + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/apm-json-specs:0.3.0@sha256:f01667138f2a3a52aa23c556a174d6cdba1209f475d67a73e2aec2d3189b0bb9 values: - .ci/updatecli/values.d/scm.yml - .ci/updatecli/values.d/apm-json-specs.yml - - name: Update Updatecli policies policy: ghcr.io/updatecli/policies/autodiscovery/updatecli:0.4.0@sha256:254367f5b1454fd6032b88b314450cd3b6d5e8d5b6c953eb242a6464105eb869 values: From 995aa41fd6eb031c1fb5dd9dc24b1ef62f939008 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:21:20 +0100 Subject: [PATCH 123/132] build: bump actions/attest-build-provenance in the github-actions group (#3717) Bumps the github-actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance). Updates `actions/attest-build-provenance` from 1.3.2 to 1.3.3 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](https://github.com/actions/attest-build-provenance/compare/bdd51370e0416ac948727f861e03c2f05d32d78e...5e9cb68e95676991667494a6a4e59b8a2f13e1d0) --- updated-dependencies: - dependency-name: actions/attest-build-provenance dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release-step-3.yml | 2 +- .github/workflows/snapshot.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml index ab00ea7dce..b7dd6d3ac5 100644 --- a/.github/workflows/release-step-3.yml +++ b/.github/workflows/release-step-3.yml @@ -105,7 +105,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3 with: subject-path: "${{ github.workspace }}/**/target/*.jar" diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 708f210046..1b58ce6f6f 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -69,7 +69,7 @@ jobs: run: tar xvf ${{ env.TARBALL_FILE }} - name: generate build provenance - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3 with: subject-path: "${{ github.workspace }}/**/target/*.jar" From a6219bd1d078822e93c714e6258bdd9f8d5ca1fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:28:41 +0100 Subject: [PATCH 124/132] build: bump org.assertj:assertj-core from 3.26.0 to 3.26.3 (#3720) Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.26.0 to 3.26.3. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.26.0...assertj-build-3.26.3) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 858e1e8015..b9fb08eec9 100644 --- a/pom.xml +++ b/pom.xml @@ -754,7 +754,7 @@ org.assertj assertj-core - 3.26.0 + 3.26.3 test From 0a94d47b1eed9d10fb3474f35398c7b4edad2a88 Mon Sep 17 00:00:00 2001 From: jackshirazi Date: Wed, 17 Jul 2024 12:38:05 +0100 Subject: [PATCH 125/132] z/OS avoids using NOFOLLOW_LINKS (#3722) * z/OS avoids using NOFOLLOW_LINKS * add changelg entry for zos-no-follow-links --- CHANGELOG.asciidoc | 1 + .../co/elastic/apm/agent/common/JvmRuntimeInfo.java | 13 ++++++++++++- .../agent/common/util/ResourceExtractionUtil.java | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index ca3c30bcd8..24ccb16760 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -36,6 +36,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: * Restore compatibility with Java 7 - {pull}3657[#3657] * Avoid `ClassCastException` and issue warning when trying to use otel span links - {pull}3672[#3672] * Avoid `NullPointerException` with runtime attach API and invalid map entries - {pull}3712[#3712] +* Skips using NOFOLLOW_LINKS file open option when running on z/OS as it's unsupported there - {pull}3722[#3722] [float] ===== Features diff --git a/apm-agent-common/src/main/java/co/elastic/apm/agent/common/JvmRuntimeInfo.java b/apm-agent-common/src/main/java/co/elastic/apm/agent/common/JvmRuntimeInfo.java index 521659f9ce..d1b905b95a 100644 --- a/apm-agent-common/src/main/java/co/elastic/apm/agent/common/JvmRuntimeInfo.java +++ b/apm-agent-common/src/main/java/co/elastic/apm/agent/common/JvmRuntimeInfo.java @@ -25,7 +25,8 @@ public class JvmRuntimeInfo { private static final JvmRuntimeInfo CURRENT_VM = new JvmRuntimeInfo(System.getProperty("java.version"), - System.getProperty("java.vm.name"), System.getProperty("java.vendor"), System.getProperty("java.vm.version")); + System.getProperty("java.vm.name"), System.getProperty("java.vendor"), System.getProperty("java.vm.version"), + System.getProperty("os.name")); private final String javaVersion; private final String javaVmName; @@ -37,6 +38,7 @@ public class JvmRuntimeInfo { private final boolean isJ9; private final boolean isHpUx; private final boolean isCoretto; + private final boolean isZos; public static JvmRuntimeInfo ofCurrentVM() { return CURRENT_VM; @@ -52,6 +54,10 @@ public static JvmRuntimeInfo ofCurrentVM() { * @param vmVersion jvm version, from {@code System.getProperty("java.vm.version")} */ public JvmRuntimeInfo(String version, String vmName, String vendorName, @Nullable String vmVersion) { + this(version, vmName, vendorName, vmVersion, null); + } + + private JvmRuntimeInfo(String version, String vmName, String vendorName, @Nullable String vmVersion, @Nullable String osName) { javaVersion = version; javaVmName = vmName; javaVmVersion = vmVersion; @@ -61,6 +67,7 @@ public JvmRuntimeInfo(String version, String vmName, String vendorName, @Nullabl isJ9 = vmName.contains("J9"); isHpUx = version.endsWith("-hp-ux"); isCoretto = vendorName != null && vendorName.contains("Amazon"); + isZos = (osName != null) && osName.toLowerCase().contains("z/os"); if (isHpUx) { // remove extra hp-ux suffix for parsing @@ -162,6 +169,10 @@ public boolean isCoretto() { return isCoretto; } + public boolean isZos() { + return isZos; + } + @Override public String toString() { return String.format("%s %s %s", javaVersion, javaVmName, javaVmVersion); diff --git a/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/ResourceExtractionUtil.java b/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/ResourceExtractionUtil.java index 9cfec464ab..fcb4177ad3 100644 --- a/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/ResourceExtractionUtil.java +++ b/apm-agent-common/src/main/java/co/elastic/apm/agent/common/util/ResourceExtractionUtil.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.agent.common.util; +import co.elastic.apm.agent.common.JvmRuntimeInfo; + import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; @@ -99,7 +101,9 @@ public static synchronized Path extractResourceToDirectory(String resource, Stri } } } catch (FileAlreadyExistsException e) { - try (FileChannel channel = FileChannel.open(tempFile, READ, NOFOLLOW_LINKS)) { + try (FileChannel channel = JvmRuntimeInfo.ofCurrentVM().isZos() ? + FileChannel.open(tempFile, READ) : + FileChannel.open(tempFile, READ, NOFOLLOW_LINKS)) { // wait until other JVM instances have fully written the file // multiple JVMs can read the file at the same time try (FileLock readLock = channel.lock(0, Long.MAX_VALUE, true)) { From 54fee67e2a99cbba8af882e5c0e5900939b3a7dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:04:50 +0100 Subject: [PATCH 126/132] build: bump version.byte-buddy from 1.14.17 to 1.14.18 (#3718) * build: bump version.byte-buddy from 1.14.17 to 1.14.18 Bumps `version.byte-buddy` from 1.14.17 to 1.14.18. Updates `net.bytebuddy:byte-buddy` from 1.14.17 to 1.14.18 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.17...byte-buddy-1.14.18) Updates `net.bytebuddy:byte-buddy-agent` from 1.9.16 to 1.14.18 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.9.16...byte-buddy-1.14.18) Updates `net.bytebuddy:byte-buddy-dep` from 1.14.17 to 1.14.18 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.17...byte-buddy-1.14.18) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: net.bytebuddy:byte-buddy-agent dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: net.bytebuddy:byte-buddy-dep dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * old version stays --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jackshirazi --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b9fb08eec9..cee4c3c2ca 100644 --- a/pom.xml +++ b/pom.xml @@ -130,7 +130,7 @@ 9.4.11.v20180605 1.5.0 - 1.14.17 + 1.14.18 9.7 5.4.0 From cf3d0fcf83f180d5466ac4b32fa117b0e826f763 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 18 Jul 2024 10:13:10 +0200 Subject: [PATCH 127/132] Capture request body for Apache HttpClient 4.x (#3692) Co-authored-by: jackshirazi --- CHANGELOG.asciidoc | 1 + .../agent/impl/context/BodyCaptureImpl.java | 144 ++++++++++++++++++ .../apm/agent/impl/context/HttpImpl.java | 13 +- .../report/serialize/DslJsonSerializer.java | 64 +++++++- .../agent/impl/context/BodyCaptureTest.java | 56 +++++++ .../serialize/DslJsonSerializerTest.java | 23 ++- .../AbstractApacheHttpClientAdvice.java | 2 +- .../AbstractApacheHttpClientAsyncAdvice.java | 3 +- .../v4/ApacheHttpClientInstrumentation.java | 10 +- ...heHttpEntityGetContentInstrumentation.java | 94 ++++++++++++ ...pacheHttpEntityWriteToInstrumentation.java | 99 ++++++++++++ ...LegacyApacheHttpClientInstrumentation.java | 4 +- .../HttpAsyncRequestProducerWrapper.java | 1 + .../v4/helper/RequestBodyCaptureRegistry.java | 76 +++++++++ ...ic.apm.agent.sdk.ElasticApmInstrumentation | 2 + ...cheHttpAsyncClientInstrumentationTest.java | 37 ++++- .../ApacheHttpClientInstrumentationTest.java | 17 +++ ...ntBasicHttpRequestInstrumentationTest.java | 2 + ...ientHttpUriRequestInstrumentationTest.java | 24 ++- .../agent/httpclient/HttpClientHelper.java | 51 ++++++- .../RequestBodyRecordingInputStream.java | 104 +++++++++++++ .../RequestBodyRecordingOutputStream.java | 108 +++++++++++++ ...AbstractHttpClientInstrumentationTest.java | 53 ++++++- .../httpclient/HttpClientHelperTest.java | 13 ++ .../configuration/WebConfiguration.java | 19 +++ .../agent/tracer/metadata/BodyCapture.java | 47 ++++++ .../apm/agent/tracer/metadata/Http.java | 2 + 27 files changed, 1046 insertions(+), 23 deletions(-) create mode 100644 apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyCaptureImpl.java create mode 100644 apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyCaptureTest.java create mode 100644 apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityGetContentInstrumentation.java create mode 100644 apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityWriteToInstrumentation.java create mode 100644 apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/RequestBodyCaptureRegistry.java create mode 100644 apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingInputStream.java create mode 100644 apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingOutputStream.java create mode 100644 apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/BodyCapture.java diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 24ccb16760..a127095c53 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -41,6 +41,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: [float] ===== Features * Added option to make routing-key part of RabbitMQ transaction/span names - {pull}3636[#3636] +* Added internal option for capturing request bodies for apache httpclient v4 - {pull}3692[#3692] [[release-notes-1.x]] === Java Agent version 1.x diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyCaptureImpl.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyCaptureImpl.java new file mode 100644 index 0000000000..289a5f6fd2 --- /dev/null +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/BodyCaptureImpl.java @@ -0,0 +1,144 @@ +package co.elastic.apm.agent.impl.context; + +import co.elastic.apm.agent.objectpool.Resetter; +import co.elastic.apm.agent.objectpool.impl.QueueBasedObjectPool; +import co.elastic.apm.agent.tracer.configuration.WebConfiguration; +import co.elastic.apm.agent.tracer.metadata.BodyCapture; +import co.elastic.apm.agent.tracer.pooling.Allocator; +import co.elastic.apm.agent.tracer.pooling.ObjectPool; +import co.elastic.apm.agent.tracer.pooling.Recyclable; +import org.jctools.queues.atomic.MpmcAtomicArrayQueue; + +import javax.annotation.Nullable; +import java.nio.ByteBuffer; + +public class BodyCaptureImpl implements BodyCapture, Recyclable { + private static final ObjectPool BYTE_BUFFER_POOL = QueueBasedObjectPool.of(new MpmcAtomicArrayQueue(128), false, + new Allocator() { + @Override + public ByteBuffer createInstance() { + return ByteBuffer.allocate(WebConfiguration.MAX_BODY_CAPTURE_BYTES); + } + }, + new Resetter() { + @Override + public void recycle(ByteBuffer object) { + object.clear(); + } + }); + + private enum CaptureState { + NOT_ELIGIBLE, + ELIGIBLE, + STARTED + } + + private volatile CaptureState state; + + private final StringBuilder charset; + + /** + * The maximum number of bytes to capture, if the body is longer remaining bytes will be dropped. + */ + private int numBytesToCapture; + + @Nullable + private ByteBuffer bodyBuffer; + + BodyCaptureImpl() { + charset = new StringBuilder(); + resetState(); + } + + @Override + public void resetState() { + state = CaptureState.NOT_ELIGIBLE; + charset.setLength(0); + if (bodyBuffer != null) { + BYTE_BUFFER_POOL.recycle(bodyBuffer); + } + } + + @Override + public void markEligibleForCapturing() { + if (state == CaptureState.NOT_ELIGIBLE) { + synchronized (this) { + if (state == CaptureState.NOT_ELIGIBLE) { + state = CaptureState.ELIGIBLE; + } + } + } + } + + @Override + public boolean isEligibleForCapturing() { + return state != CaptureState.NOT_ELIGIBLE; + } + + @Override + public boolean startCapture(@Nullable String requestCharset, int numBytesToCapture) { + if (numBytesToCapture > WebConfiguration.MAX_BODY_CAPTURE_BYTES) { + throw new IllegalArgumentException("Capturing " + numBytesToCapture + " bytes is not supported, maximum is " + WebConfiguration.MAX_BODY_CAPTURE_BYTES + " bytes"); + } + if (state == CaptureState.ELIGIBLE) { + synchronized (this) { + if (state == CaptureState.ELIGIBLE) { + if (requestCharset != null) { + this.charset.append(requestCharset); + } + this.numBytesToCapture = numBytesToCapture; + state = CaptureState.STARTED; + return true; + } + } + } + return false; + } + + private void acquireBodyBufferIfRequired() { + if (state != CaptureState.STARTED) { + throw new IllegalStateException("Capturing has not been started!"); + } + if (bodyBuffer == null) { + bodyBuffer = BYTE_BUFFER_POOL.createInstance(); + } + } + + @Override + public void append(byte b) { + acquireBodyBufferIfRequired(); + if (!isFull()) { + bodyBuffer.put(b); + } + } + + @Override + public void append(byte[] b, int offset, int len) { + acquireBodyBufferIfRequired(); + int remaining = numBytesToCapture - bodyBuffer.position(); + if (remaining > 0) { + bodyBuffer.put(b, offset, Math.min(len, remaining)); + } + } + + @Override + public boolean isFull() { + if (bodyBuffer == null) { + return false; + } + return bodyBuffer.position() >= numBytesToCapture; + } + + @Nullable + public CharSequence getCharset() { + if (charset.length() == 0) { + return null; + } + return charset; + } + + @Nullable + public ByteBuffer getBody() { + return bodyBuffer; + } +} diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java index 4995e3ef51..67a7169682 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/context/HttpImpl.java @@ -30,6 +30,8 @@ public class HttpImpl implements Recyclable, Http { */ private final UrlImpl url = new UrlImpl(); + private final BodyCaptureImpl requestBody = new BodyCaptureImpl(); + /** * HTTP method used by this HTTP outgoing span */ @@ -65,6 +67,11 @@ public int getStatusCode() { return statusCode; } + @Override + public BodyCaptureImpl getRequestBody() { + return requestBody; + } + @Override public HttpImpl withUrl(@Nullable String url) { if (url != null) { @@ -88,6 +95,7 @@ public HttpImpl withStatusCode(int statusCode) { @Override public void resetState() { url.resetState(); + requestBody.resetState(); method = null; statusCode = 0; } @@ -98,9 +106,4 @@ public boolean hasContent() { statusCode > 0; } - public void copyFrom(HttpImpl other) { - url.copyFrom(other.url); - method = other.method; - statusCode = other.statusCode; - } } diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java index 89759bed42..141a987f6f 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonSerializer.java @@ -18,8 +18,23 @@ */ package co.elastic.apm.agent.report.serialize; -import co.elastic.apm.agent.impl.context.*; +import co.elastic.apm.agent.impl.context.AbstractContextImpl; +import co.elastic.apm.agent.impl.context.BodyCaptureImpl; +import co.elastic.apm.agent.impl.context.CloudOriginImpl; +import co.elastic.apm.agent.impl.context.DbImpl; +import co.elastic.apm.agent.impl.context.DestinationImpl; +import co.elastic.apm.agent.impl.context.Headers; import co.elastic.apm.agent.impl.context.HttpImpl; +import co.elastic.apm.agent.impl.context.MessageImpl; +import co.elastic.apm.agent.impl.context.RequestImpl; +import co.elastic.apm.agent.impl.context.ResponseImpl; +import co.elastic.apm.agent.impl.context.ServiceOriginImpl; +import co.elastic.apm.agent.impl.context.ServiceTargetImpl; +import co.elastic.apm.agent.impl.context.SocketImpl; +import co.elastic.apm.agent.impl.context.SpanContextImpl; +import co.elastic.apm.agent.impl.context.TransactionContextImpl; +import co.elastic.apm.agent.impl.context.UrlImpl; +import co.elastic.apm.agent.impl.context.UserImpl; import co.elastic.apm.agent.impl.error.ErrorCaptureImpl; import co.elastic.apm.agent.impl.metadata.Agent; import co.elastic.apm.agent.impl.metadata.CloudProviderInfo; @@ -33,16 +48,26 @@ import co.elastic.apm.agent.impl.metadata.ServiceImpl; import co.elastic.apm.agent.impl.metadata.SystemInfo; import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; -import co.elastic.apm.agent.impl.transaction.*; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.Composite; +import co.elastic.apm.agent.impl.transaction.DroppedSpanStats; +import co.elastic.apm.agent.impl.transaction.FaasImpl; +import co.elastic.apm.agent.impl.transaction.FaasTriggerImpl; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.OTelSpanKind; +import co.elastic.apm.agent.impl.transaction.SpanCount; import co.elastic.apm.agent.impl.transaction.SpanImpl; -import co.elastic.apm.agent.tracer.metrics.Labels; +import co.elastic.apm.agent.impl.transaction.StackFrame; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.sdk.internal.collections.LongList; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.tracer.metadata.PotentiallyMultiValuedMap; -import co.elastic.apm.agent.tracer.pooling.Recyclable; import co.elastic.apm.agent.tracer.metrics.DslJsonUtil; +import co.elastic.apm.agent.tracer.metrics.Labels; +import co.elastic.apm.agent.tracer.pooling.Recyclable; import com.dslplatform.json.BoolConverter; import com.dslplatform.json.DslJson; import com.dslplatform.json.JsonWriter; @@ -54,6 +79,7 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; +import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -1028,21 +1054,36 @@ private void serializeSpanLinks(List spanLinks) { } private void serializeOTel(SpanImpl span) { - serializeOtel(span, Collections.emptyList()); + serializeOtel(span, Collections.emptyList(), requestBodyToString(span.getContext().getHttp().getRequestBody())); + } + + @Nullable + private CharSequence requestBodyToString(BodyCaptureImpl requestBody) { + //TODO: perform proper, charset aware conversion to string + ByteBuffer buffer = requestBody.getBody(); + if (buffer == null || buffer.position() == 0) { + return null; + } + buffer.flip(); + StringBuilder result = new StringBuilder(); + while (buffer.hasRemaining()) { + result.append((char) buffer.get()); + } + return result; } private void serializeOTel(TransactionImpl transaction) { List profilingCorrelationStackTraceIds = transaction.getProfilingCorrelationStackTraceIds(); synchronized (profilingCorrelationStackTraceIds) { - serializeOtel(transaction, profilingCorrelationStackTraceIds); + serializeOtel(transaction, profilingCorrelationStackTraceIds, null); } } - private void serializeOtel(AbstractSpanImpl span, List profilingStackTraceIds) { + private void serializeOtel(AbstractSpanImpl span, List profilingStackTraceIds, @Nullable CharSequence httpRequestBody) { OTelSpanKind kind = span.getOtelKind(); Map attributes = span.getOtelAttributes(); - boolean hasAttributes = !attributes.isEmpty() || !profilingStackTraceIds.isEmpty(); + boolean hasAttributes = !attributes.isEmpty() || !profilingStackTraceIds.isEmpty() || httpRequestBody != null; boolean hasKind = kind != null; if (hasKind || hasAttributes) { writeFieldName("otel"); @@ -1092,6 +1133,13 @@ private void serializeOtel(AbstractSpanImpl span, List profilingStack } jw.writeByte(ARRAY_END); } + if (httpRequestBody != null) { + if (!isFirstAttrib) { + jw.writeByte(COMMA); + } + writeFieldName("http.request.body.content"); + jw.writeString(httpRequestBody); + } jw.writeByte(OBJECT_END); } diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyCaptureTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyCaptureTest.java new file mode 100644 index 0000000000..2c53ef665b --- /dev/null +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/BodyCaptureTest.java @@ -0,0 +1,56 @@ +package co.elastic.apm.agent.impl.context; + +import org.junit.jupiter.api.Test; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; + +import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class BodyCaptureTest { + + @Test + public void testAppendTruncation() { + BodyCaptureImpl capture = new BodyCaptureImpl(); + capture.markEligibleForCapturing(); + capture.startCapture("foobar", 10); + assertThat(capture.isFull()).isFalse(); + + capture.append("123Hello World!".getBytes(StandardCharsets.UTF_8), 3, 5); + assertThat(capture.isFull()).isFalse(); + + capture.append(" from the other side".getBytes(StandardCharsets.UTF_8), 0, 20); + assertThat(capture.isFull()).isTrue(); + + ByteBuffer content = capture.getBody(); + int size = content.position(); + byte[] contentBytes = new byte[size]; + content.position(0); + content.get(contentBytes); + + assertThat(contentBytes).isEqualTo("Hello from".getBytes(StandardCharsets.UTF_8)); + } + + @Test + public void testLifecycle() { + BodyCaptureImpl capture = new BodyCaptureImpl(); + + assertThat(capture.isEligibleForCapturing()).isFalse(); + assertThat(capture.startCapture("foobar", 42)) + .isFalse(); + assertThatThrownBy(() -> capture.append((byte) 42)).isInstanceOf(IllegalStateException.class); + + capture.markEligibleForCapturing(); + assertThat(capture.isEligibleForCapturing()).isTrue(); + assertThatThrownBy(() -> capture.append((byte) 42)).isInstanceOf(IllegalStateException.class); + + assertThat(capture.startCapture("foobar", 42)) + .isTrue(); + capture.append((byte) 42); //ensure no exception thrown + + // startCapture should return true only once + assertThat(capture.startCapture("foobar", 42)) + .isFalse(); + } +} diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java index 34caa3ba05..7006fd0fa8 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/serialize/DslJsonSerializerTest.java @@ -27,6 +27,7 @@ import co.elastic.apm.agent.impl.TextHeaderMapAccessor; import co.elastic.apm.agent.impl.baggage.BaggageImpl; import co.elastic.apm.agent.impl.context.AbstractContextImpl; +import co.elastic.apm.agent.impl.context.BodyCaptureImpl; import co.elastic.apm.agent.impl.context.DestinationImpl; import co.elastic.apm.agent.impl.context.Headers; import co.elastic.apm.agent.impl.context.RequestImpl; @@ -46,8 +47,13 @@ import co.elastic.apm.agent.impl.sampling.ConstantSampler; import co.elastic.apm.agent.impl.sampling.Sampler; import co.elastic.apm.agent.impl.stacktrace.StacktraceConfigurationImpl; -import co.elastic.apm.agent.impl.transaction.*; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; +import co.elastic.apm.agent.impl.transaction.IdImpl; +import co.elastic.apm.agent.impl.transaction.OTelSpanKind; import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.StackFrame; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.report.ApmServerClient; import co.elastic.apm.agent.sdk.internal.collections.LongList; import co.elastic.apm.agent.sdk.internal.util.IOUtils; @@ -425,6 +431,21 @@ void testSpanHttpContextSerialization() { assertThat(http.get("status_code").intValue()).isEqualTo(523); } + @Test + void testSpanHttpRequestBodySerialization() { + SpanImpl span = new SpanImpl(tracer); + + BodyCaptureImpl bodyCapture = span.getContext().getHttp().getRequestBody(); + bodyCapture.markEligibleForCapturing(); + bodyCapture.startCapture("utf-8", 50); + bodyCapture.append("foobar".getBytes(StandardCharsets.UTF_8), 0, 6); + + JsonNode spanJson = readJsonString(writer.toJsonString(span)); + JsonNode otel = spanJson.get("otel"); + JsonNode attribs = otel.get("attributes"); + assertThat(attribs.get("http.request.body.content").textValue()).isEqualTo("foobar"); + } + public static boolean[][] getContentCombinations() { return new boolean[][]{ {true, true, true, true}, diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java index 3a866b8aa9..1998180c3b 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAdvice.java @@ -34,7 +34,7 @@ public abstract class AbstractApacheHttpClientAdvice { public static & - TextHeaderGetter> Object startSpan(final Tracer tracer, + TextHeaderGetter> Span startSpan(final Tracer tracer, final ApacheHttpClientApiAdapter adapter, final WRAPPER request, @Nullable final HTTPHOST httpHost, diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java index f3b0f234f8..a4fd57dbff 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/src/main/java/co/elastic/apm/agent/httpclient/common/AbstractApacheHttpClientAsyncAdvice.java @@ -20,8 +20,8 @@ import co.elastic.apm.agent.httpclient.HttpClientHelper; -import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Tracer; public abstract class AbstractApacheHttpClientAsyncAdvice { @@ -40,6 +40,7 @@ public static activeContext = tracer.currentContext(); Span span = activeContext.createExitSpan(); if (span != null) { + span.getContext().getHttp().getRequestBody().markEligibleForCapturing(); span.withType(HttpClientHelper.EXTERNAL_TYPE) .withSubtype(HttpClientHelper.HTTP_SUBTYPE) .withSync(false) diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentation.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentation.java index 1d60900984..2bc725c95b 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentation.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentation.java @@ -20,7 +20,11 @@ import co.elastic.apm.agent.httpclient.common.AbstractApacheHttpClientAdvice; import co.elastic.apm.agent.httpclient.v4.helper.ApacheHttpClient4ApiAdapter; +import co.elastic.apm.agent.httpclient.v4.helper.RequestBodyCaptureRegistry; import co.elastic.apm.agent.httpclient.v4.helper.RequestHeaderAccessor; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Span; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.NamedElement; import net.bytebuddy.description.method.MethodDescription; @@ -47,13 +51,17 @@ public class ApacheHttpClientInstrumentation extends BaseApacheHttpClientInstrumentation { public static class ApacheHttpClient4Advice extends AbstractApacheHttpClientAdvice { + private static final Logger logger = LoggerFactory.getLogger(ApacheHttpClient4Advice.class); + private static final ApacheHttpClient4ApiAdapter adapter = ApacheHttpClient4ApiAdapter.get(); @Nullable @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) public static Object onBeforeExecute(@Advice.Argument(0) HttpRoute route, @Advice.Argument(1) HttpRequestWrapper request) throws URISyntaxException { - return startSpan(tracer, adapter, request, route.getTargetHost(), RequestHeaderAccessor.INSTANCE); + Span span = startSpan(tracer, adapter, request, route.getTargetHost(), RequestHeaderAccessor.INSTANCE); + RequestBodyCaptureRegistry.potentiallyCaptureRequestBody(request, tracer.getActive()); + return span; } @Advice.OnMethodExit(suppress = Throwable.class, onThrowable = Throwable.class, inline = false) diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityGetContentInstrumentation.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityGetContentInstrumentation.java new file mode 100644 index 0000000000..b08ea36da9 --- /dev/null +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityGetContentInstrumentation.java @@ -0,0 +1,94 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.httpclient.v4; + +import co.elastic.apm.agent.httpclient.RequestBodyRecordingInputStream; +import co.elastic.apm.agent.httpclient.RequestBodyRecordingOutputStream; +import co.elastic.apm.agent.httpclient.v4.helper.RequestBodyCaptureRegistry; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Span; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.NamedElement; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.http.HttpEntity; + +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URISyntaxException; + +import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.classLoaderCanLoadClass; +import static net.bytebuddy.matcher.ElementMatchers.hasSuperType; +import static net.bytebuddy.matcher.ElementMatchers.isBootstrapClassLoader; +import static net.bytebuddy.matcher.ElementMatchers.nameContains; +import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith; +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.takesArgument; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +public class ApacheHttpEntityGetContentInstrumentation extends BaseApacheHttpClientInstrumentation { + + public static class ApacheHttpEntityGetContentAdvice { + + private static final Logger logger = LoggerFactory.getLogger(ApacheHttpEntityGetContentAdvice.class); + + @Advice.OnMethodExit(suppress = Throwable.class, inline = false) + @Advice.AssignReturned.ToReturned + public static InputStream onExit(@Advice.This HttpEntity thiz, @Advice.Return InputStream content) throws URISyntaxException { + Span clientSpan = RequestBodyCaptureRegistry.removeSpanFor(thiz); + if (clientSpan != null) { + logger.debug("Wrapping input stream for request body capture for HttpEntity {} ({}) for span {}", thiz.getClass().getName(), System.identityHashCode(thiz), clientSpan); + return new RequestBodyRecordingInputStream(content, clientSpan); + } + return content; + } + } + + @Override + public String getAdviceClassName() { + return "co.elastic.apm.agent.httpclient.v4.ApacheHttpEntityGetContentInstrumentation$ApacheHttpEntityGetContentAdvice"; + } + + @Override + public ElementMatcher.Junction getClassLoaderMatcher() { + return not(isBootstrapClassLoader()) + .and(classLoaderCanLoadClass("org.apache.http.HttpEntity")); + } + + @Override + public ElementMatcher getTypeMatcherPreFilter() { + return nameStartsWith("org.apache.http").and(nameContains("Entity")); + } + + @Override + public ElementMatcher getTypeMatcher() { + return hasSuperType(named("org.apache.http.HttpEntity")); + } + + @Override + public ElementMatcher getMethodMatcher() { + return named("getContent") + .and(takesArguments(0)); + } + +} diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityWriteToInstrumentation.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityWriteToInstrumentation.java new file mode 100644 index 0000000000..0b06c8b9fc --- /dev/null +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpEntityWriteToInstrumentation.java @@ -0,0 +1,99 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.httpclient.v4; + +import co.elastic.apm.agent.httpclient.RequestBodyRecordingOutputStream; +import co.elastic.apm.agent.httpclient.v4.helper.RequestBodyCaptureRegistry; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.tracer.Span; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.NamedElement; +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.http.HttpEntity; + +import java.io.OutputStream; +import java.net.URISyntaxException; + +import static co.elastic.apm.agent.sdk.bytebuddy.CustomElementMatchers.classLoaderCanLoadClass; +import static net.bytebuddy.matcher.ElementMatchers.hasSuperType; +import static net.bytebuddy.matcher.ElementMatchers.isBootstrapClassLoader; +import static net.bytebuddy.matcher.ElementMatchers.nameContains; +import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.not; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +public class ApacheHttpEntityWriteToInstrumentation extends BaseApacheHttpClientInstrumentation { + + public static class ApacheHttpEntityWriteToAdvice { + + private static final Logger logger = LoggerFactory.getLogger(ApacheHttpEntityWriteToAdvice.class); + + @Advice.OnMethodEnter(suppress = Throwable.class, inline = false) + @Advice.AssignReturned.ToArguments(@Advice.AssignReturned.ToArguments.ToArgument(0)) + public static OutputStream onEnter(@Advice.This HttpEntity thiz, @Advice.Argument(0) OutputStream drain) throws URISyntaxException { + Span clientSpan = RequestBodyCaptureRegistry.removeSpanFor(thiz); + if (clientSpan != null) { + logger.debug("Wrapping output stream for request body capture for HttpEntity {} ({}) for span {}", thiz.getClass().getName(), System.identityHashCode(thiz), clientSpan); + return new RequestBodyRecordingOutputStream(drain, clientSpan); + } + return drain; + } + + @Advice.OnMethodExit(suppress = Throwable.class, inline = false) + public static void onExit(@Advice.Enter OutputStream potentiallyWrappedStream) throws URISyntaxException { + if (potentiallyWrappedStream instanceof RequestBodyRecordingOutputStream) { + ((RequestBodyRecordingOutputStream) potentiallyWrappedStream).releaseSpan(); + } + } + } + + @Override + public String getAdviceClassName() { + return "co.elastic.apm.agent.httpclient.v4.ApacheHttpEntityWriteToInstrumentation$ApacheHttpEntityWriteToAdvice"; + } + + @Override + public ElementMatcher.Junction getClassLoaderMatcher() { + return not(isBootstrapClassLoader()) + .and(classLoaderCanLoadClass("org.apache.http.HttpEntity")); + } + + @Override + public ElementMatcher getTypeMatcherPreFilter() { + return nameStartsWith("org.apache.http").and(nameContains("Entity")); + } + + @Override + public ElementMatcher getTypeMatcher() { + return hasSuperType(named("org.apache.http.HttpEntity")); + } + + @Override + public ElementMatcher getMethodMatcher() { + return named("writeTo") + .and(takesArguments(1)) + .and(takesArgument(0, OutputStream.class)); + } + +} diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java index 8097b84d1c..21fe4ad545 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientInstrumentation.java @@ -19,10 +19,11 @@ package co.elastic.apm.agent.httpclient.v4; import co.elastic.apm.agent.httpclient.HttpClientHelper; +import co.elastic.apm.agent.httpclient.v4.helper.RequestBodyCaptureRegistry; import co.elastic.apm.agent.httpclient.v4.helper.RequestHeaderAccessor; -import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Outcome; import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.configuration.CoreConfiguration; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.NamedElement; @@ -105,6 +106,7 @@ public static Object onBeforeExecute(@Advice.Argument(0) @Nullable HttpHost host } } + RequestBodyCaptureRegistry.potentiallyCaptureRequestBody(request, tracer.getActive()); tracer.currentContext().propagateContext(request, RequestHeaderAccessor.INSTANCE, RequestHeaderAccessor.INSTANCE); return span; } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java index 6d874c13fc..a8648894ba 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/HttpAsyncRequestProducerWrapper.java @@ -85,6 +85,7 @@ public HttpRequest generateRequest() throws IOException, HttpException { // trace context propagation if (request != null) { if (span != null) { + RequestBodyCaptureRegistry.potentiallyCaptureRequestBody(request, span); RequestLine requestLine = request.getRequestLine(); if (requestLine != null) { String method = requestLine.getMethod(); diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/RequestBodyCaptureRegistry.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/RequestBodyCaptureRegistry.java new file mode 100644 index 0000000000..009cc1fe9b --- /dev/null +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/java/co/elastic/apm/agent/httpclient/v4/helper/RequestBodyCaptureRegistry.java @@ -0,0 +1,76 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.httpclient.v4.helper; + +import co.elastic.apm.agent.httpclient.HttpClientHelper; +import co.elastic.apm.agent.sdk.logging.Logger; +import co.elastic.apm.agent.sdk.logging.LoggerFactory; +import co.elastic.apm.agent.sdk.state.GlobalState; +import co.elastic.apm.agent.tracer.AbstractSpan; +import co.elastic.apm.agent.tracer.GlobalTracer; +import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.reference.ReferenceCountedMap; +import org.apache.http.HttpEntity; +import org.apache.http.HttpEntityEnclosingRequest; +import org.apache.http.HttpRequest; + +import javax.annotation.Nullable; + +public class RequestBodyCaptureRegistry { + + private static final Logger logger = LoggerFactory.getLogger(RequestBodyCaptureRegistry.class); + + @GlobalState + public static class MapHolder { + private static final ReferenceCountedMap> entityToClientSpan = GlobalTracer.get().newReferenceCountedMap(); + + + public static void captureBodyFor(Object entity, Span httpClientSpan) { + entityToClientSpan.put(entity, httpClientSpan); + } + + @Nullable + public static Span removeSpanFor(Object entity) { + return entityToClientSpan.remove(entity); + } + } + + + public static void potentiallyCaptureRequestBody(HttpRequest request, @Nullable AbstractSpan span) { + if (HttpClientHelper.startRequestBodyCapture(span, request, RequestHeaderAccessor.INSTANCE)) { + if (request instanceof HttpEntityEnclosingRequest) { + HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity(); + if (entity != null) { + logger.debug("Enabling request capture for entity {}() for span {}", entity.getClass().getName(), System.identityHashCode(entity), span); + MapHolder.captureBodyFor(entity, (Span) span); + } else { + logger.debug("HttpEntity is null for span {}", span); + } + } else { + logger.debug("Not capturing request body because {} is not an HttpEntityEnclosingRequest", request.getClass().getName()); + } + } + } + + @Nullable + public static Span removeSpanFor(HttpEntity entity) { + return MapHolder.removeSpanFor(entity); + } + +} diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.ElasticApmInstrumentation b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.ElasticApmInstrumentation index 753c7c4605..8d04c1a373 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.ElasticApmInstrumentation +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/main/resources/META-INF/services/co.elastic.apm.agent.sdk.ElasticApmInstrumentation @@ -2,3 +2,5 @@ co.elastic.apm.agent.httpclient.v4.ApacheHttpClientInstrumentation co.elastic.apm.agent.httpclient.v4.ApacheHttpAsyncClientInstrumentation co.elastic.apm.agent.httpclient.v4.ApacheHttpAsyncClientRedirectInstrumentation co.elastic.apm.agent.httpclient.v4.LegacyApacheHttpClientInstrumentation +co.elastic.apm.agent.httpclient.v4.ApacheHttpEntityWriteToInstrumentation +co.elastic.apm.agent.httpclient.v4.ApacheHttpEntityGetContentInstrumentation diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java index 20543c1073..b2698ebc2e 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpAsyncClientInstrumentationTest.java @@ -24,9 +24,11 @@ import org.apache.http.HttpResponse; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.concurrent.FutureCallback; import org.apache.http.conn.UnsupportedSchemeException; +import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; import org.apache.http.impl.nio.client.HttpAsyncClients; import org.assertj.core.api.Assertions; @@ -34,6 +36,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -89,6 +92,39 @@ public void cancelled() { responseFuture.get(); } + @Override + protected boolean isBodyCapturingSupported() { + return true; + } + + @Override + protected void performPost(String path, byte[] data, String contentTypeHeader) throws Exception { + final CompletableFuture responseFuture = new CompletableFuture<>(); + + HttpClientContext httpClientContext = HttpClientContext.create(); + HttpPost request = new HttpPost(path); + request.setEntity(new InputStreamEntity(new ByteArrayInputStream(data))); + request.setHeader("Content-Type", contentTypeHeader); + client.execute(request, httpClientContext, new FutureCallback<>() { + @Override + public void completed(HttpResponse result) { + responseFuture.complete(result); + } + + @Override + public void failed(Exception ex) { + responseFuture.completeExceptionally(ex); + } + + @Override + public void cancelled() { + responseFuture.cancel(true); + } + }); + + responseFuture.get(); + } + @Test public void testSpanFinishOnEarlyException() throws Exception { @@ -125,5 +161,4 @@ public void testSpanWithIllegalProtocol() throws Exception { Assertions.assertThat(reporter.getSpans()).hasSize(1); } - } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentationTest.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentationTest.java index 91189c295d..cfa20bd6a0 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/ApacheHttpClientInstrumentationTest.java @@ -21,11 +21,14 @@ import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.junit.AfterClass; import org.junit.BeforeClass; +import java.io.ByteArrayInputStream; import java.io.IOException; public class ApacheHttpClientInstrumentationTest extends AbstractHttpClientInstrumentationTest { @@ -49,4 +52,18 @@ protected void performGet(String path) throws Exception { response.close(); } + @Override + protected boolean isBodyCapturingSupported() { + return true; + } + + @Override + protected void performPost(String path, byte[] content, String contentTypeHeader) throws Exception { + HttpPost request = new HttpPost(path); + request.setEntity(new InputStreamEntity(new ByteArrayInputStream(content))); + request.setHeader("Content-Type", contentTypeHeader); + + client.execute(request); + } + } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientBasicHttpRequestInstrumentationTest.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientBasicHttpRequestInstrumentationTest.java index 72a3828ac3..62e8088ce7 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientBasicHttpRequestInstrumentationTest.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientBasicHttpRequestInstrumentationTest.java @@ -59,4 +59,6 @@ protected void performGet(String path) throws Exception { throw (Exception) e.getTargetException(); } } + + } diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientHttpUriRequestInstrumentationTest.java b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientHttpUriRequestInstrumentationTest.java index 499f1d9032..16c56da974 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientHttpUriRequestInstrumentationTest.java +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/src/test/java/co/elastic/apm/agent/httpclient/v4/LegacyApacheHttpClientHttpUriRequestInstrumentationTest.java @@ -19,14 +19,18 @@ package co.elastic.apm.agent.httpclient.v4; import co.elastic.apm.agent.httpclient.AbstractHttpClientInstrumentationTest; +import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.junit.AfterClass; import org.junit.BeforeClass; +import java.io.ByteArrayInputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -48,12 +52,30 @@ public static void close() { @Override protected void performGet(String path) throws Exception { + HttpGet request = new HttpGet(path); + performRequest(request); + } + + private static void performRequest(HttpRequest request) throws Exception { Method execute = client.getClass().getMethod("execute", HttpUriRequest.class); try { - HttpResponse response = (HttpResponse) execute.invoke(client, new HttpGet(path)); + HttpResponse response = (HttpResponse) execute.invoke(client, request); EntityUtils.consume(response.getEntity()); } catch (InvocationTargetException e) { throw (Exception) e.getTargetException(); } } + + @Override + protected boolean isBodyCapturingSupported() { + return true; + } + + @Override + protected void performPost(String path, byte[] content, String contentTypeHeader) throws Exception { + HttpPost request = new HttpPost(path); + request.setEntity(new InputStreamEntity(new ByteArrayInputStream(content))); + request.setHeader("Content-Type", contentTypeHeader); + performRequest(request); + } } diff --git a/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java index 2d62702437..61bb7e7e66 100644 --- a/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java +++ b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/HttpClientHelper.java @@ -18,16 +18,26 @@ */ package co.elastic.apm.agent.httpclient; +import co.elastic.apm.agent.common.util.WildcardMatcher; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; -import co.elastic.apm.agent.tracer.TraceState; +import co.elastic.apm.agent.tracer.AbstractSpan; +import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.TraceState; +import co.elastic.apm.agent.tracer.configuration.WebConfiguration; +import co.elastic.apm.agent.tracer.dispatch.TextHeaderGetter; import javax.annotation.Nullable; import java.net.URI; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class HttpClientHelper { + private static final Pattern CHARSET_EXTRACTOR = Pattern.compile(";\\s*charset\\s*=\\s*((\"[^\"]+)|([^;\\s]+))"); + private static final Logger logger = LoggerFactory.getLogger(HttpClientHelper.class); public static final String EXTERNAL_TYPE = "external"; @@ -54,6 +64,9 @@ public static Span startHttpClientSpan(TraceState activeContext, String me @Nullable String scheme, @Nullable CharSequence hostName, int port) { Span span = activeContext.createExitSpan(); if (span != null) { + if (span.isSampled()) { + span.getContext().getHttp().getRequestBody().markEligibleForCapturing(); + } updateHttpSpanNameAndContext(span, method, uri, scheme, hostName, port); } if (logger.isTraceEnabled()) { @@ -62,6 +75,42 @@ public static Span startHttpClientSpan(TraceState activeContext, String me return span; } + public static boolean startRequestBodyCapture(@Nullable AbstractSpan abstractSpan, R request, TextHeaderGetter headerGetter) { + if (!(abstractSpan instanceof Span)) { + return false; + } + Span span = (Span) abstractSpan; + if (!span.getContext().getHttp().getRequestBody().isEligibleForCapturing()) { + return false; + } + WebConfiguration webConfig = GlobalTracer.get().getConfig(WebConfiguration.class); + int byteCount = webConfig.getCaptureClientRequestBytes(); + if (byteCount == 0) { + return false; + } + List contentTypes = webConfig.getCaptureContentTypes(); + String contentTypeHeader = headerGetter.getFirstHeader("Content-Type", request); + if (contentTypeHeader == null) { + contentTypeHeader = ""; + } + if (WildcardMatcher.anyMatch(contentTypes, contentTypeHeader) == null) { + return false; + } + String charset = extractCharsetFromContentType(contentTypeHeader); + return span.getContext().getHttp().getRequestBody().startCapture(charset, byteCount); + } + + //Visible for testing + @Nullable + static String extractCharsetFromContentType(String contentTypeHeader) { + Matcher matcher = CHARSET_EXTRACTOR.matcher(contentTypeHeader); + if (matcher.find()) { + String potentiallyQuotedCharset = matcher.group(1); + return potentiallyQuotedCharset.replace("\"", ""); + } + return null; + } + public static void updateHttpSpanNameAndContext(Span span, String method, @Nullable String uri, String scheme, CharSequence hostName, int port) { span.withType(EXTERNAL_TYPE) .withSubtype(HTTP_SUBTYPE) diff --git a/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingInputStream.java b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingInputStream.java new file mode 100644 index 0000000000..f8e228eaf8 --- /dev/null +++ b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingInputStream.java @@ -0,0 +1,104 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.httpclient; + +import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.metadata.BodyCapture; + +import javax.annotation.Nullable; +import java.io.IOException; +import java.io.InputStream; + +public class RequestBodyRecordingInputStream extends InputStream { + + private final InputStream delegate; + + @Nullable + private Span clientSpan; + + public RequestBodyRecordingInputStream(InputStream delegate, Span clientSpan) { + this.delegate = delegate; + clientSpan.incrementReferences(); + this.clientSpan = clientSpan; + } + + + protected void appendToBody(byte b) { + if (clientSpan != null) { + BodyCapture requestBody = clientSpan.getContext().getHttp().getRequestBody(); + requestBody.append(b); + if (requestBody.isFull()) { + releaseSpan(); + } + } + } + + protected void appendToBody(byte[] b, int off, int len) { + if (clientSpan != null) { + BodyCapture requestBody = clientSpan.getContext().getHttp().getRequestBody(); + requestBody.append(b, off, len); + if (requestBody.isFull()) { + releaseSpan(); + } + } + } + + public void releaseSpan() { + if (clientSpan != null) { + clientSpan.decrementReferences(); + clientSpan = null; + } + } + + @Override + public int read() throws IOException { + int character = delegate.read(); + if (character == -1) { + releaseSpan(); + } else { + appendToBody((byte) character); + } + return character; + } + + @Override + public int read(byte[] b, int off, int len) throws IOException { + int readBytes = delegate.read(b, off, len); + if (readBytes == -1) { + releaseSpan(); + } else { + appendToBody(b, off, readBytes); + } + return readBytes; + } + + @Override + public int available() throws IOException { + return delegate.available(); + } + + @Override + public void close() throws IOException { + try { + releaseSpan(); + } finally { + delegate.close(); + } + } +} diff --git a/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingOutputStream.java b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingOutputStream.java new file mode 100644 index 0000000000..aaf640c1d3 --- /dev/null +++ b/apm-agent-plugins/apm-httpclient-core/src/main/java/co/elastic/apm/agent/httpclient/RequestBodyRecordingOutputStream.java @@ -0,0 +1,108 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package co.elastic.apm.agent.httpclient; + +import co.elastic.apm.agent.tracer.Span; +import co.elastic.apm.agent.tracer.metadata.BodyCapture; + +import javax.annotation.Nullable; +import java.io.IOException; +import java.io.OutputStream; + +public class RequestBodyRecordingOutputStream extends OutputStream { + + private final OutputStream delegate; + + @Nullable + private Span clientSpan; + + public RequestBodyRecordingOutputStream(OutputStream delegate, Span clientSpan) { + this.delegate = delegate; + clientSpan.incrementReferences(); + this.clientSpan = clientSpan; + } + + @Override + public void write(int b) throws IOException { + try { + appendToBody((byte) b); + } finally { + delegate.write(b); + } + } + + protected void appendToBody(byte b) { + if (clientSpan != null) { + BodyCapture body = clientSpan.getContext().getHttp().getRequestBody(); + body.append(b); + if (body.isFull()) { + releaseSpan(); + } + } + } + + @Override + public void write(byte[] b) throws IOException { + try { + appendToBody(b, 0, b.length); + } finally { + delegate.write(b); + } + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + try { + appendToBody(b, off, len); + } finally { + delegate.write(b, off, len); + } + } + + protected void appendToBody(byte[] b, int off, int len) { + if (clientSpan != null) { + BodyCapture body = clientSpan.getContext().getHttp().getRequestBody(); + body.append(b, off, len); + if (body.isFull()) { + releaseSpan(); + } + } + } + + public void releaseSpan() { + if (clientSpan != null) { + clientSpan.decrementReferences(); + clientSpan = null; + } + } + + @Override + public void close() throws IOException { + try { + releaseSpan(); + } finally { + delegate.close(); + } + } + + @Override + public void flush() throws IOException { + delegate.flush(); + } +} diff --git a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java index 7d0f33372f..788757662f 100644 --- a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java +++ b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/AbstractHttpClientInstrumentationTest.java @@ -21,16 +21,18 @@ import co.elastic.apm.agent.AbstractInstrumentationTest; import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.TextHeaderMapAccessor; +import co.elastic.apm.agent.impl.context.BodyCaptureImpl; import co.elastic.apm.agent.impl.context.DestinationImpl; import co.elastic.apm.agent.impl.context.HttpImpl; import co.elastic.apm.agent.impl.transaction.SpanImpl; import co.elastic.apm.agent.impl.transaction.TraceContextImpl; import co.elastic.apm.agent.impl.transaction.TransactionImpl; -import co.elastic.apm.agent.tracer.util.ResultUtil; import co.elastic.apm.agent.tracer.Outcome; -import co.elastic.apm.agent.tracer.TraceState; import co.elastic.apm.agent.tracer.Scope; +import co.elastic.apm.agent.tracer.TraceState; +import co.elastic.apm.agent.tracer.configuration.WebConfiguration; import co.elastic.apm.agent.tracer.dispatch.TextHeaderGetter; +import co.elastic.apm.agent.tracer.util.ResultUtil; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import com.github.tomakehurst.wiremock.http.HttpHeader; @@ -45,6 +47,8 @@ import org.junit.Test; import javax.annotation.Nullable; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,6 +56,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; import static co.elastic.apm.agent.impl.transaction.TraceContextImpl.W3C_TRACE_PARENT_TEXTUAL_HEADER_NAME; import static co.elastic.apm.agent.testutils.assertions.Assertions.assertThat; @@ -114,6 +119,29 @@ public void testHttpCall() { expectSpan(path).verify(); } + @Test + public void testPostBodyCapture() throws Exception { + if (!isBodyCapturingSupported()) { + return; + } + doReturn(5).when(config.getConfig(WebConfiguration.class)).getCaptureClientRequestBytes(); + byte[] content = "Hello World!".getBytes(StandardCharsets.UTF_8); + String path = "/"; + performPost(getBaseUrl() + path, content, "text/plain; charset=utf-8"); + expectSpan(path) + .withRequestBodySatisfying(body -> { + ByteBuffer buffer = body.getBody(); + assertThat(buffer).isNotNull(); + int numBytes = buffer.position(); + buffer.position(0); + byte[] contentBytes = new byte[numBytes]; + buffer.get(contentBytes); + assertThat(contentBytes).isEqualTo("Hello".getBytes(StandardCharsets.UTF_8)); + assertThat(Objects.toString(body.getCharset())).isEqualTo("utf-8"); + }) + .verify(); + } + @Test public void testDisabledOutgoingHeaders() { doReturn(true).when(config.getConfig(CoreConfigurationImpl.class)).isOutgoingTraceContextHeadersInjectionDisabled(); @@ -247,6 +275,11 @@ protected boolean isRedirectFollowingSupported() { return true; } + // assumption + protected boolean isBodyCapturingSupported() { + return false; + } + // assumption protected boolean isErrorOnCircularRedirectSupported() { return isRedirectFollowingSupported(); @@ -280,6 +313,10 @@ public boolean isAsync() { protected abstract void performGet(String path) throws Exception; + protected void performPost(String path, byte[] content, String contentTypeHeader) throws Exception { + throw new UnsupportedOperationException(); + } + protected VerifyBuilder expectSpan(String path) { return new VerifyBuilder(path); } @@ -292,6 +329,8 @@ protected class VerifyBuilder { private boolean traceContextHeaders = true; private boolean requestExecuted = true; + private Consumer requestBodyVerification = null; + private VerifyBuilder(String path) { this.path = path; } @@ -323,6 +362,11 @@ public VerifyBuilder withoutRequestExecuted() { return this; } + public VerifyBuilder withRequestBodySatisfying(Consumer requestBodyVerification) { + this.requestBodyVerification = requestBodyVerification; + return this; + } + public SpanImpl verify() { assertThat(reporter.getFirstSpan(500)).isNotNull(); assertThat(reporter.getSpans()).hasSize(1); @@ -351,6 +395,11 @@ public SpanImpl verify() { assertThat(span).hasOutcome(Outcome.FAILURE); } + BodyCaptureImpl reqBody = span.getContext().getHttp().getRequestBody(); + if (requestBodyVerification != null) { + requestBodyVerification.accept(reqBody); + } + if (isAsync()) { assertThat(span).isAsync(); } diff --git a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java index e40199c27f..9242d167ed 100644 --- a/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java +++ b/apm-agent-plugins/apm-httpclient-core/src/test/java/co/elastic/apm/agent/httpclient/HttpClientHelperTest.java @@ -123,4 +123,17 @@ private void createSpanWithUrl(String s) throws URISyntaxException { HttpClientHelper.startHttpClientSpan(tracer.getActive(), "GET", new URI(s), null) .end(); } + + @Test + void testContentTypeCharsetExtraction() { + assertThat(HttpClientHelper.extractCharsetFromContentType("multipart/form-data; boundary=---------------------------974767299852498929531610575")) + .isNull(); + assertThat(HttpClientHelper.extractCharsetFromContentType("Content-Type: text/html; charset=utf-8")) + .isEqualTo("utf-8"); + assertThat(HttpClientHelper.extractCharsetFromContentType("Content-Type: text/html; charset = foobar;baz")) + .isEqualTo("foobar"); + assertThat(HttpClientHelper.extractCharsetFromContentType("Content-Type: application/json; charset = \"foo bar\";baz")) + .isEqualTo("foo bar"); + + } } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/WebConfiguration.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/WebConfiguration.java index d7fdb00f91..2a35facaf5 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/WebConfiguration.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/configuration/WebConfiguration.java @@ -27,8 +27,12 @@ import java.util.Collections; import java.util.List; +import static co.elastic.apm.agent.tracer.configuration.RangeValidator.isInRange; + public class WebConfiguration extends ConfigurationOptionProvider { + public static final int MAX_BODY_CAPTURE_BYTES = 1024; + private static final String HTTP_CATEGORY = "HTTP"; private final ConfigurationOption> captureContentTypes = ConfigurationOption @@ -121,6 +125,17 @@ public class WebConfiguration extends ConfigurationOptionProvider { .dynamic(true) .buildWithDefault(Collections.emptyList()); + private final ConfigurationOption captureClientRequestBytes = ConfigurationOption.integerOption() + .addValidator(isInRange(0, MAX_BODY_CAPTURE_BYTES)) + .key("capture_http_client_request_body_size") + .configurationCategory(HTTP_CATEGORY) + .tags("added[1.50.0]", "internal") + .description("Configures how many bytes of http-client request bodies shall be captured. " + + "Note that only request bodies will be captured for content types matching the capture_body_content_types configuration. " + + " The maximum allowed value is " + MAX_BODY_CAPTURE_BYTES + " , a value of 0 disables body capturing") + .dynamic(true) + .buildWithDefault(0); + public List getIgnoreUrls() { return ignoreUrls.get(); } @@ -141,4 +156,8 @@ public List getCaptureContentTypes() { return captureContentTypes.get(); } + public int getCaptureClientRequestBytes() { + return captureClientRequestBytes.get(); + } + } diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/BodyCapture.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/BodyCapture.java new file mode 100644 index 0000000000..ef8df98de0 --- /dev/null +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/BodyCapture.java @@ -0,0 +1,47 @@ +package co.elastic.apm.agent.tracer.metadata; + +import javax.annotation.Nullable; + +public interface BodyCapture { + + /** + * Requests that the body for this span may be captured. + * Whether it is actually captured may depend on further details not known yet when this method is called + * (e.g. the Content-Type header). + */ + void markEligibleForCapturing(); + + /** + * @return true, if {@link #markEligibleForCapturing()} was called for this span. + */ + boolean isEligibleForCapturing(); + + /** + * This method acts as a protection mechanism so that only one instrumentation tries to capture the body. + * It returns true, if the calling instrumentation shall start adding body byte via {@link #append(byte)}. + *

      + * For this to happen, {@link #markEligibleForCapturing()} must have been called first. + *

      + * After {@link #startCapture(String, int)} has returned true once, subsequent calls will return false. + * So for example if instrumentation A and B are active for the same span, only the first one will actually be capturing the body, + * because {@link #startCapture(String, int)} only returns true once. + * + * @param charset the charset (if available) with which the request-body is encoded. + * @param numBytesToCapture the number of bytes to capture, to configure the limit of the internal buffer + * + * @return true, if the calling instrumentation should be capturing the body (by calling {@link #append(byte)} + */ + boolean startCapture(@Nullable String charset, int numBytesToCapture); + + void append(byte b); + + void append(byte[] b, int offset, int len); + + /** + * Checks if the limit number of bytes to capture has been reached. In this case future append calls would be a no-op. + * If this is the case, the caller can consider releasing the reference to the span to prevent potential memory leaks. + * + * @return true, if the maximum number of bytes supported has already been captured + */ + boolean isFull(); +} diff --git a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Http.java b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Http.java index d4d614c039..aad5ad3d85 100644 --- a/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Http.java +++ b/apm-agent-tracer/src/main/java/co/elastic/apm/agent/tracer/metadata/Http.java @@ -39,4 +39,6 @@ public interface Http { @Nullable String getMethod(); + + BodyCapture getRequestBody(); } From 6dde355383ddee23cec45ae9be0ab31b9b515d42 Mon Sep 17 00:00:00 2001 From: SylvainJuge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:03:49 +0200 Subject: [PATCH 128/132] jmx-metrics-fix (#3713) * properly handle missing metrics with non-wildcards * update changelog --------- Co-authored-by: jackshirazi --- CHANGELOG.asciidoc | 1 + .../apm/agent/jmx/JmxMetricTracker.java | 48 +++++++++++-------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a127095c53..4c9fed2f6f 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -36,6 +36,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: * Restore compatibility with Java 7 - {pull}3657[#3657] * Avoid `ClassCastException` and issue warning when trying to use otel span links - {pull}3672[#3672] * Avoid `NullPointerException` with runtime attach API and invalid map entries - {pull}3712[#3712] +* Enhance invalid state JMX metrics handling - {pull}3713[#3713] * Skips using NOFOLLOW_LINKS file open option when running on z/OS as it's unsupported there - {pull}3722[#3722] [float] diff --git a/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java b/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java index 5c3733a639..6518f4f03e 100644 --- a/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java +++ b/apm-agent-plugins/apm-jmx-plugin/src/main/java/co/elastic/apm/agent/jmx/JmxMetricTracker.java @@ -46,6 +46,8 @@ import javax.management.ObjectInstance; import javax.management.ObjectName; import javax.management.RuntimeMBeanException; +import javax.management.MBeanException; +import javax.management.ReflectionException; import javax.management.openmbean.CompositeData; import javax.management.relation.MBeanServerNotificationFilter; import java.lang.management.ManagementFactory; @@ -367,31 +369,39 @@ private void addJmxMetricRegistration(final JmxMetric jmxMetric, List registrations, + MBeanServer server, + JmxMetric.Attribute attribute, + ObjectName objectName, + String attributeName, + @Nullable String metricPrepend) throws MBeanException, InstanceNotFoundException, ReflectionException { + + try { + Object value = server.getAttribute(objectName, attributeName); + addJmxMetricRegistration(jmxMetric, registrations, objectName, value, attribute, attributeName, metricPrepend); + } catch (AttributeNotFoundException e) { + logger.warn("Can't create metric '{}' because attribute '{}' could not be found", jmxMetric, attributeName); + } catch (RuntimeMBeanException e) { + if (e.getCause() instanceof UnsupportedOperationException) { + // silently ignore this attribute, won't retry as it's not a transient runtime exception + } else { + throw e; + } + } + } + private static boolean isWildcard(JmxMetric.Attribute attribute) { return "*".equals(attribute.getJmxAttributeName()); } @@ -486,7 +496,7 @@ public double get() { value = ((Number) ((CompositeData) server.getAttribute(objectName, jmxAttribute)).get(compositeDataKey)).doubleValue(); } return value; - } catch (InstanceNotFoundException | AttributeNotFoundException e) { + } catch (InstanceNotFoundException | AttributeNotFoundException | RuntimeMBeanException e) { if (unsubscribeOnError) { unregister(tracer); } From 2bb60c7490b8cc2b7cedc234faa68b5d3854e9fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:15:22 +0100 Subject: [PATCH 129/132] build: bump io.micrometer:micrometer-core from 1.13.1 to 1.13.2 (#3729) Bumps [io.micrometer:micrometer-core](https://github.com/micrometer-metrics/micrometer) from 1.13.1 to 1.13.2. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.13.1...v1.13.2) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index 5a59fb5ab4..f0c40dcfb5 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -23,7 +23,7 @@ io.micrometer micrometer-core - 1.13.1 + 1.13.2 provided From 66b46154b18801e97bc2b74cb8626af7e49038e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:23:28 +0100 Subject: [PATCH 130/132] build: bump org.springframework.boot:spring-boot-dependencies from 2.7.16 to 3.3.2 (#3727) * build: bump org.springframework.boot:spring-boot-dependencies Bumps [org.springframework.boot:spring-boot-dependencies](https://github.com/spring-projects/spring-boot) from 2.7.16 to 3.3.2. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.7.16...v3.3.2) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update pom.xml * Update pom.xml * Update pom.xml --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jackshirazi --- .../apm-spring-resttemplate/apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index 31258125e2..46c1048d7d 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.1 + 3.3.2 pom import diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index ee6413b0a0..af329ab525 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -23,7 +23,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.1 + 3.3.2 pom import diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index e1b57ec8d9..2fc545de37 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -18,7 +18,7 @@ 2.7.16 - 3.3.1 + 3.3.2 diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index 9a590b757b..4dd197ee9b 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.1 + 3.3.2 pom import diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index 064ed0affe..28ed036a4e 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -29,7 +29,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.1 + 3.3.2 pom import diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 56e72f9b6b..43e4834e4c 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -30,7 +30,7 @@ org.springframework.boot spring-boot-dependencies - 3.3.1 + 3.3.2 pom import From 0c05c6014b9979f3ece6a7dfa4a4a8697bbe4ca6 Mon Sep 17 00:00:00 2001 From: obltmachine <150269514+obltmachine@users.noreply.github.com> Date: Wed, 24 Jul 2024 11:55:33 +0200 Subject: [PATCH 131/132] pre release: elastic-apm-agent v1.51.0 (#3731) Co-authored-by: obltmachine --- CHANGELOG.asciidoc | 9 ++++++--- apm-agent-api/pom.xml | 2 +- apm-agent-attach-cli/pom.xml | 2 +- apm-agent-attach/pom.xml | 2 +- apm-agent-benchmarks/pom.xml | 2 +- apm-agent-bootstrap/pom.xml | 2 +- apm-agent-builds/apm-agent-java8/pom.xml | 2 +- apm-agent-builds/apm-agent/pom.xml | 2 +- apm-agent-builds/pom.xml | 2 +- apm-agent-cached-lookup-key/pom.xml | 2 +- apm-agent-common/pom.xml | 2 +- apm-agent-core/pom.xml | 2 +- apm-agent-lambda-layer/pom.xml | 2 +- apm-agent-plugin-sdk/pom.xml | 2 +- .../apm-apache-httpclient-common/pom.xml | 2 +- .../apm-apache-httpclient3-plugin/pom.xml | 2 +- .../apm-apache-httpclient4-plugin/pom.xml | 2 +- .../apm-apache-httpclient5-plugin/pom.xml | 2 +- apm-agent-plugins/apm-apache-httpclient/pom.xml | 2 +- apm-agent-plugins/apm-api-plugin/pom.xml | 2 +- apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml | 2 +- .../apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml | 2 +- .../apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml | 2 +- apm-agent-plugins/apm-aws-sdk/pom.xml | 2 +- apm-agent-plugins/apm-awslambda-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra-core-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra3-plugin/pom.xml | 2 +- .../apm-cassandra/apm-cassandra4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-cassandra/pom.xml | 2 +- apm-agent-plugins/apm-dubbo-plugin/pom.xml | 2 +- apm-agent-plugins/apm-ecs-logging-plugin/pom.xml | 2 +- .../apm-es-restclient-plugin-5_6/pom.xml | 2 +- .../apm-es-restclient-plugin-6_4/pom.xml | 2 +- .../apm-es-restclient-plugin-7_x/pom.xml | 2 +- .../apm-es-restclient-plugin-8_x/pom.xml | 2 +- .../apm-es-restclient-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-es-restclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grails-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml | 2 +- apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-grpc/pom.xml | 2 +- .../apm-hibernate-search-plugin-5_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-6_x/pom.xml | 2 +- .../apm-hibernate-search-plugin-common/pom.xml | 2 +- apm-agent-plugins/apm-hibernate-search-plugin/pom.xml | 2 +- apm-agent-plugins/apm-httpclient-core/pom.xml | 2 +- apm-agent-plugins/apm-httpserver-core/pom.xml | 2 +- apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-concurrent-plugin/pom.xml | 2 +- apm-agent-plugins/apm-java-ldap-plugin/pom.xml | 2 +- apm-agent-plugins/apm-javalin-plugin/pom.xml | 2 +- .../apm-jaxrs-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxrs-plugin/pom.xml | 2 +- .../apm-jaxws-plugin-jakartaee-test/pom.xml | 2 +- apm-agent-plugins/apm-jaxws-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdbc-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml | 2 +- .../apm-jms-plugin/apm-jms-plugin-base/pom.xml | 2 +- .../apm-jms-plugin/apm-jms-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jms-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jmx-plugin/pom.xml | 2 +- apm-agent-plugins/apm-jsf-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-base-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml | 2 +- .../apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml | 2 +- apm-agent-plugins/apm-kafka-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-jboss-logging-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-jul-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-log4j1-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-log4j2-plugin/pom.xml | 2 +- .../apm-logback-plugin/apm-logback-plugin-impl/pom.xml | 2 +- .../apm-logback-plugin-legacy-tests/pom.xml | 2 +- .../apm-logging-plugin/apm-logback-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-logging-plugin-common/pom.xml | 2 +- .../apm-logging-plugin/apm-slf4j-plugin/pom.xml | 2 +- .../apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-logging-plugin/pom.xml | 2 +- apm-agent-plugins/apm-micrometer-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml | 2 +- .../apm-mongodb/apm-mongodb3-plugin/pom.xml | 2 +- .../apm-mongodb/apm-mongodb4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-mongodb/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-plugin/pom.xml | 2 +- apm-agent-plugins/apm-okhttp-test/pom.xml | 2 +- .../apm-opentelemetry-embedded-metrics-sdk/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-common/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-latest/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-v1_14/pom.xml | 2 +- .../apm-opentelemetry-metrics-bridge-parent/pom.xml | 2 +- .../apm-opentelemetry-metricsdk-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-plugin/pom.xml | 2 +- .../apm-opentelemetry/apm-opentelemetry-test/pom.xml | 2 +- apm-agent-plugins/apm-opentelemetry/pom.xml | 2 +- apm-agent-plugins/apm-opentracing-plugin/pom.xml | 2 +- apm-agent-plugins/apm-process-plugin/pom.xml | 2 +- apm-agent-plugins/apm-profiling-plugin/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml | 2 +- apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml | 2 +- apm-agent-plugins/apm-quartz/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-plugin/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-spring/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-test-3/pom.xml | 2 +- .../apm-rabbitmq/apm-rabbitmq-test-4/pom.xml | 2 +- apm-agent-plugins/apm-rabbitmq/pom.xml | 2 +- apm-agent-plugins/apm-reactor-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-2-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-3-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-4-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-5-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-jedis-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-lettuce-3-tests/pom.xml | 2 +- .../apm-redis-plugin/apm-lettuce-plugin/pom.xml | 2 +- .../apm-redis-plugin/apm-redis-common/pom.xml | 2 +- .../apm-redis-plugin/apm-redisson-plugin/pom.xml | 2 +- apm-agent-plugins/apm-redis-plugin/pom.xml | 2 +- apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../apm-scheduled-annotation-plugin/pom.xml | 2 +- apm-agent-plugins/apm-servlet-jakarta-test/pom.xml | 2 +- apm-agent-plugins/apm-servlet-plugin/pom.xml | 2 +- apm-agent-plugins/apm-sparkjava-plugin/pom.xml | 2 +- .../apm-spring-restclient-test/pom.xml | 2 +- .../apm-spring-resttemplate-plugin/pom.xml | 2 +- .../apm-spring-resttemplate-test/pom.xml | 2 +- apm-agent-plugins/apm-spring-resttemplate/pom.xml | 2 +- .../apm-spring-webclient-plugin/pom.xml | 2 +- .../apm-spring-webflux-common-spring5/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-common/pom.xml | 2 +- .../apm-spring-webflux/apm-spring-webflux-plugin/pom.xml | 2 +- .../apm-spring-webflux-spring5/pom.xml | 2 +- .../apm-spring-webflux-testapp/pom.xml | 2 +- apm-agent-plugins/apm-spring-webflux/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml | 2 +- .../apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml | 2 +- apm-agent-plugins/apm-spring-webmvc/pom.xml | 2 +- apm-agent-plugins/apm-struts-plugin/pom.xml | 2 +- apm-agent-plugins/apm-urlconnection-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml | 2 +- .../apm-vertx/apm-vertx3-test-latest/pom.xml | 2 +- apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml | 2 +- apm-agent-plugins/apm-vertx/pom.xml | 2 +- apm-agent-plugins/pom.xml | 2 +- apm-agent-tracer/pom.xml | 2 +- apm-opentracing/pom.xml | 2 +- elastic-apm-agent-java8/pom.xml | 2 +- elastic-apm-agent-premain/pom.xml | 2 +- elastic-apm-agent/pom.xml | 2 +- .../application-server-integration-tests/pom.xml | 2 +- integration-tests/aws-lambda-test/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-dependent/pom.xml | 2 +- integration-tests/cdi-app/cdi-app-standalone/pom.xml | 2 +- integration-tests/cdi-app/pom.xml | 2 +- .../cdi-jakartaee-app-dependent/pom.xml | 2 +- .../cdi-jakartaee-app-standalone/pom.xml | 2 +- integration-tests/cdi-jakartaee-app/pom.xml | 2 +- .../external-plugin-otel-test-app/pom.xml | 2 +- .../external-plugin-otel-test-plugin1/pom.xml | 2 +- .../external-plugin-otel-test-plugin2/pom.xml | 2 +- integration-tests/external-plugin-otel-test/pom.xml | 2 +- .../external-plugin-test/external-plugin-app/pom.xml | 2 +- .../external-plugin-jakarta-app/pom.xml | 2 +- .../external-plugin-test/external-plugin/pom.xml | 2 +- .../plugin-instrumentation-target/pom.xml | 2 +- integration-tests/external-plugin-test/pom.xml | 2 +- .../jakartaee-jsf-app-dependent/pom.xml | 2 +- .../jakartaee-jsf-app-standalone/pom.xml | 2 +- integration-tests/jakartaee-jsf-app/pom.xml | 2 +- integration-tests/jakartaee-simple-webapp/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-dependent/pom.xml | 2 +- integration-tests/jsf-app/jsf-app-standalone/pom.xml | 2 +- integration-tests/jsf-app/pom.xml | 2 +- integration-tests/main-app-test/pom.xml | 2 +- integration-tests/pom.xml | 2 +- integration-tests/quarkus/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-base/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml | 2 +- integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml | 2 +- integration-tests/runtime-attach/pom.xml | 2 +- .../runtime-attach/runtime-attach-app/pom.xml | 2 +- .../runtime-attach/runtime-attach-test/pom.xml | 2 +- integration-tests/simple-webapp/pom.xml | 2 +- integration-tests/soap-test/pom.xml | 2 +- integration-tests/spring-boot-1-5/pom.xml | 2 +- integration-tests/spring-boot-2/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-base/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-jetty/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-tomcat/pom.xml | 2 +- .../spring-boot-2/spring-boot-2-undertow/pom.xml | 2 +- integration-tests/spring-boot-3/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-jetty/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-tomcat/pom.xml | 2 +- .../spring-boot-3/spring-boot-3-undertow/pom.xml | 2 +- pom.xml | 2 +- 201 files changed, 206 insertions(+), 203 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4c9fed2f6f..1133b4fcb7 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,12 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +[[release-notes-1.x]] +=== Java Agent version 1.x + +[[release-notes-1.51.0]] +==== 1.51.0 - 2024/07/24 + [float] ===== Bug fixes * Restore compatibility with Java 7 - {pull}3657[#3657] @@ -44,9 +50,6 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: * Added option to make routing-key part of RabbitMQ transaction/span names - {pull}3636[#3636] * Added internal option for capturing request bodies for apache httpclient v4 - {pull}3692[#3692] -[[release-notes-1.x]] -=== Java Agent version 1.x - [[release-notes-1.50.0]] ==== 1.50.0 - 2024/05/28 diff --git a/apm-agent-api/pom.xml b/apm-agent-api/pom.xml index 83cda00651..d427230e91 100644 --- a/apm-agent-api/pom.xml +++ b/apm-agent-api/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-api diff --git a/apm-agent-attach-cli/pom.xml b/apm-agent-attach-cli/pom.xml index d5d96eb294..065db587e5 100644 --- a/apm-agent-attach-cli/pom.xml +++ b/apm-agent-attach-cli/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-attach/pom.xml b/apm-agent-attach/pom.xml index e452eb4f10..5b2c32d9b6 100644 --- a/apm-agent-attach/pom.xml +++ b/apm-agent-attach/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-attach diff --git a/apm-agent-benchmarks/pom.xml b/apm-agent-benchmarks/pom.xml index 5256be336d..08222ecfc4 100644 --- a/apm-agent-benchmarks/pom.xml +++ b/apm-agent-benchmarks/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-benchmarks diff --git a/apm-agent-bootstrap/pom.xml b/apm-agent-bootstrap/pom.xml index 011dabfe29..ecc5bcec1e 100644 --- a/apm-agent-bootstrap/pom.xml +++ b/apm-agent-bootstrap/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-bootstrap diff --git a/apm-agent-builds/apm-agent-java8/pom.xml b/apm-agent-builds/apm-agent-java8/pom.xml index 1eace505d3..59a1a5fc3f 100644 --- a/apm-agent-builds/apm-agent-java8/pom.xml +++ b/apm-agent-builds/apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-java8 diff --git a/apm-agent-builds/apm-agent/pom.xml b/apm-agent-builds/apm-agent/pom.xml index d666929992..0b7dd8d4b2 100644 --- a/apm-agent-builds/apm-agent/pom.xml +++ b/apm-agent-builds/apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-builds - 1.50.1-SNAPSHOT + 1.51.0 apm-agent diff --git a/apm-agent-builds/pom.xml b/apm-agent-builds/pom.xml index 27b1d655c9..0029da24a6 100644 --- a/apm-agent-builds/pom.xml +++ b/apm-agent-builds/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-cached-lookup-key/pom.xml b/apm-agent-cached-lookup-key/pom.xml index 2cc16764c3..ae1c75e499 100644 --- a/apm-agent-cached-lookup-key/pom.xml +++ b/apm-agent-cached-lookup-key/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-common/pom.xml b/apm-agent-common/pom.xml index 17513b9382..57cfb78bd2 100644 --- a/apm-agent-common/pom.xml +++ b/apm-agent-common/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index f2c8680f14..db09a71f45 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-core diff --git a/apm-agent-lambda-layer/pom.xml b/apm-agent-lambda-layer/pom.xml index ac45f829b8..efd720b954 100644 --- a/apm-agent-lambda-layer/pom.xml +++ b/apm-agent-lambda-layer/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugin-sdk/pom.xml b/apm-agent-plugin-sdk/pom.xml index 0ededf6f9c..7217eddb6f 100644 --- a/apm-agent-plugin-sdk/pom.xml +++ b/apm-agent-plugin-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml index 69f207984f..6439fadad8 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient-common/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-apache-httpclient-common diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml index 9194e4002d..ff116aeeb6 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-apache-httpclient3-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml index 038995961d..53336fe3ab 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-apache-httpclient co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-apache-httpclient4-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml index be12b94b0a..4d3590271f 100644 --- a/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/apm-apache-httpclient5-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-apache-httpclient - 1.50.1-SNAPSHOT + 1.51.0 apm-apache-httpclient5-plugin diff --git a/apm-agent-plugins/apm-apache-httpclient/pom.xml b/apm-agent-plugins/apm-apache-httpclient/pom.xml index d47b7b8f37..a8374d09fc 100644 --- a/apm-agent-plugins/apm-apache-httpclient/pom.xml +++ b/apm-agent-plugins/apm-apache-httpclient/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-apache-httpclient diff --git a/apm-agent-plugins/apm-api-plugin/pom.xml b/apm-agent-plugins/apm-api-plugin/pom.xml index 1df6e23ac5..9f3cbf2225 100644 --- a/apm-agent-plugins/apm-api-plugin/pom.xml +++ b/apm-agent-plugins/apm-api-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 diff --git a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml index 269390ac95..66e6229ccc 100644 --- a/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-asynchttpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-asynchttpclient-plugin diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml index a20a31b858..7f915e089f 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-1-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml index d0c8a6171d..c1ff02d58e 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml index 359476b7f2..3dc2c1668b 100644 --- a/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-common/pom.xml @@ -3,7 +3,7 @@ apm-aws-sdk co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-aws-sdk/pom.xml b/apm-agent-plugins/apm-aws-sdk/pom.xml index d7bbf16e65..61dd193c09 100644 --- a/apm-agent-plugins/apm-aws-sdk/pom.xml +++ b/apm-agent-plugins/apm-aws-sdk/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-awslambda-plugin/pom.xml b/apm-agent-plugins/apm-awslambda-plugin/pom.xml index b7047243bd..8b4eca780b 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/pom.xml +++ b/apm-agent-plugins/apm-awslambda-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml index 619fec3b33..9cd920e9a2 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra-core-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml index 85598270a2..4cc7446cab 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml index e51218a7ab..f7dbbbf480 100644 --- a/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml +++ b/apm-agent-plugins/apm-cassandra/apm-cassandra4-plugin/pom.xml @@ -3,7 +3,7 @@ apm-cassandra co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-cassandra/pom.xml b/apm-agent-plugins/apm-cassandra/pom.xml index 61079611e2..fab826204d 100644 --- a/apm-agent-plugins/apm-cassandra/pom.xml +++ b/apm-agent-plugins/apm-cassandra/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-dubbo-plugin/pom.xml b/apm-agent-plugins/apm-dubbo-plugin/pom.xml index 4dac65b77a..a707d06b56 100644 --- a/apm-agent-plugins/apm-dubbo-plugin/pom.xml +++ b/apm-agent-plugins/apm-dubbo-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml index f385ea5758..ffc9e4033d 100644 --- a/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-ecs-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-ecs-logging-plugin diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml index c866491e5c..758569046c 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-5_6/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-es-restclient-plugin-5_6 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml index 5d0f18fae8..300ccab1b1 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-es-restclient-plugin-6_4 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml index 284e76233c..7660076c6f 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_x/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-es-restclient-plugin-7_x diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml index 79856324a5..7a4a7b46fd 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-8_x/pom.xml @@ -3,7 +3,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml index e4907be109..2778da0d9f 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-es-restclient-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-es-restclient-plugin-common diff --git a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml index 5592b11132..09250d1596 100644 --- a/apm-agent-plugins/apm-es-restclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-es-restclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-es-restclient-plugin diff --git a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml index f3b2cb45a3..d25f5d4319 100644 --- a/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-finagle-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-finagle-httpclient-plugin diff --git a/apm-agent-plugins/apm-grails-plugin/pom.xml b/apm-agent-plugins/apm-grails-plugin/pom.xml index 6284f511f0..4017aadf9a 100644 --- a/apm-agent-plugins/apm-grails-plugin/pom.xml +++ b/apm-agent-plugins/apm-grails-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-grails-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml index 73dba11ff9..f1fde89f83 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.50.1-SNAPSHOT + 1.51.0 apm-grpc-plugin diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml index 6fc3f896f1..1655b678aa 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-1.6.1/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.50.1-SNAPSHOT + 1.51.0 apm-grpc-test-1.6.1 diff --git a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml index 439c6ecc96..a5bb1f5e22 100644 --- a/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml +++ b/apm-agent-plugins/apm-grpc/apm-grpc-test-latest/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-grpc - 1.50.1-SNAPSHOT + 1.51.0 apm-grpc-test-latest diff --git a/apm-agent-plugins/apm-grpc/pom.xml b/apm-agent-plugins/apm-grpc/pom.xml index abacbbdda7..6d38a3cc0e 100644 --- a/apm-agent-plugins/apm-grpc/pom.xml +++ b/apm-agent-plugins/apm-grpc/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.50.1-SNAPSHOT + 1.51.0 apm-grpc diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml index 2e7341f243..ef65db9947 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-5_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-hibernate-search-plugin-5_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml index 3483e88913..7bc19091d6 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-6_x/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-hibernate-search-plugin-6_x diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml index 57bbeaa38e..1a47414528 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/apm-hibernate-search-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-hibernate-search-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-hibernate-search-plugin-common diff --git a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml index 85cbeb43cf..757f11b5f7 100644 --- a/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml +++ b/apm-agent-plugins/apm-hibernate-search-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-hibernate-search-plugin diff --git a/apm-agent-plugins/apm-httpclient-core/pom.xml b/apm-agent-plugins/apm-httpclient-core/pom.xml index 6786581b1f..eaf24bebbb 100644 --- a/apm-agent-plugins/apm-httpclient-core/pom.xml +++ b/apm-agent-plugins/apm-httpclient-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-httpclient-core diff --git a/apm-agent-plugins/apm-httpserver-core/pom.xml b/apm-agent-plugins/apm-httpserver-core/pom.xml index 3bab818cfb..163510ffa3 100644 --- a/apm-agent-plugins/apm-httpserver-core/pom.xml +++ b/apm-agent-plugins/apm-httpserver-core/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-httpserver-core diff --git a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml index e639e3ea5f..fc0f37632e 100644 --- a/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml +++ b/apm-agent-plugins/apm-jakarta-websocket-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jakarta-websocket-plugin diff --git a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml index 1419674034..69f19dcb5d 100644 --- a/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-java-concurrent-plugin diff --git a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml index 6fa4362284..70de83e3c4 100644 --- a/apm-agent-plugins/apm-java-ldap-plugin/pom.xml +++ b/apm-agent-plugins/apm-java-ldap-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-java-ldap-plugin diff --git a/apm-agent-plugins/apm-javalin-plugin/pom.xml b/apm-agent-plugins/apm-javalin-plugin/pom.xml index 520e60a2a2..555be4c392 100644 --- a/apm-agent-plugins/apm-javalin-plugin/pom.xml +++ b/apm-agent-plugins/apm-javalin-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-javalin-plugin diff --git a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml index 873c59846e..684ec3a081 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml index 76592120ac..d520542507 100644 --- a/apm-agent-plugins/apm-jaxrs-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxrs-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jaxrs-plugin diff --git a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml index 70f61c048a..da66ac50f6 100644 --- a/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-jaxws-plugin/pom.xml b/apm-agent-plugins/apm-jaxws-plugin/pom.xml index a1538c1f20..36d0d5a2ba 100644 --- a/apm-agent-plugins/apm-jaxws-plugin/pom.xml +++ b/apm-agent-plugins/apm-jaxws-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jaxws-plugin diff --git a/apm-agent-plugins/apm-jdbc-plugin/pom.xml b/apm-agent-plugins/apm-jdbc-plugin/pom.xml index 91995538d6..1e7a3bddc6 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdbc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jdbc-plugin diff --git a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml index 9df236bfbe..bd7a2a381e 100644 --- a/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpclient-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jdk-httpclient-plugin diff --git a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml index f115738b5c..13fc68cde5 100644 --- a/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml +++ b/apm-agent-plugins/apm-jdk-httpserver-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jdk-httpserver-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml index c38c4860ec..b87eb8bed6 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-jakarta/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml index bba1ca823b..ab9b2b298c 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-javax/pom.xml @@ -3,7 +3,7 @@ apm-jms-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml index 162409354b..ea785a8871 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-plugin-base/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jms-plugin-base diff --git a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml index 108350f07e..f45ee0fa4d 100644 --- a/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/apm-jms-spring-plugin/pom.xml @@ -5,7 +5,7 @@ apm-jms-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jms-spring-plugin diff --git a/apm-agent-plugins/apm-jms-plugin/pom.xml b/apm-agent-plugins/apm-jms-plugin/pom.xml index a42e4484fa..4ca39439d7 100644 --- a/apm-agent-plugins/apm-jms-plugin/pom.xml +++ b/apm-agent-plugins/apm-jms-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jms-plugin diff --git a/apm-agent-plugins/apm-jmx-plugin/pom.xml b/apm-agent-plugins/apm-jmx-plugin/pom.xml index 5801c63a99..20b22ae2d2 100644 --- a/apm-agent-plugins/apm-jmx-plugin/pom.xml +++ b/apm-agent-plugins/apm-jmx-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jmx-plugin diff --git a/apm-agent-plugins/apm-jsf-plugin/pom.xml b/apm-agent-plugins/apm-jsf-plugin/pom.xml index 8cb6381d1d..1148fe925a 100644 --- a/apm-agent-plugins/apm-jsf-plugin/pom.xml +++ b/apm-agent-plugins/apm-jsf-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jsf-plugin diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml index 9225ba7989..b9fdc06b5e 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-base-plugin/pom.xml @@ -3,7 +3,7 @@ apm-kafka-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml index 5059d3e26f..b968cfd1d7 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-headers-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml index 76109140d6..de89a04e68 100644 --- a/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/apm-kafka-spring-plugin/pom.xml @@ -4,7 +4,7 @@ apm-kafka-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-kafka-plugin/pom.xml b/apm-agent-plugins/apm-kafka-plugin/pom.xml index 5c5866be4e..5a97ca94bd 100644 --- a/apm-agent-plugins/apm-kafka-plugin/pom.xml +++ b/apm-agent-plugins/apm-kafka-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml index 238b2e101f..b42612dc96 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jboss-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jboss-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml index 391a9f3b79..db37c7ad82 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-jul-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jul-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml index dda1b5ff76..c16057dc69 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j1-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-log4j1-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml index ae06771cc8..e783ce77ae 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-log4j2-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-log4j2-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml index 60a280095d..f7bbb07d4f 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-impl/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-logback-plugin-impl diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml index fc71895de1..4fd0893477 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/apm-logback-plugin-legacy-tests/pom.xml @@ -5,7 +5,7 @@ apm-logback-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-logback-plugin-legacy-tests diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml index 3cbef2871d..c1bb26be24 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logback-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-logback-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml index 64427bb61b..aa15887e3d 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-logging-plugin-common/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-logging-plugin-common diff --git a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml index 451c58364c..ef68a3977c 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-slf4j-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-slf4j-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml index 7c5d9a7e56..6ab4ccfb14 100644 --- a/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/apm-tomcat-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-logging-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-tomcat-logging-plugin diff --git a/apm-agent-plugins/apm-logging-plugin/pom.xml b/apm-agent-plugins/apm-logging-plugin/pom.xml index 2d943b1b4f..6cded057a0 100644 --- a/apm-agent-plugins/apm-logging-plugin/pom.xml +++ b/apm-agent-plugins/apm-logging-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-logging-plugin diff --git a/apm-agent-plugins/apm-micrometer-plugin/pom.xml b/apm-agent-plugins/apm-micrometer-plugin/pom.xml index f0c40dcfb5..e30162460a 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/pom.xml +++ b/apm-agent-plugins/apm-micrometer-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml index 0f7710e73c..349cb74464 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb-common/pom.xml @@ -4,7 +4,7 @@ apm-mongodb co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml index 40dac6392c..7f23b23c74 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb3-plugin/pom.xml @@ -3,7 +3,7 @@ apm-mongodb co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml index b22a5d54e1..fd0b75ed2f 100644 --- a/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml +++ b/apm-agent-plugins/apm-mongodb/apm-mongodb4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-mongodb co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-mongodb4-plugin diff --git a/apm-agent-plugins/apm-mongodb/pom.xml b/apm-agent-plugins/apm-mongodb/pom.xml index ddbaf0fec9..87fa2da510 100644 --- a/apm-agent-plugins/apm-mongodb/pom.xml +++ b/apm-agent-plugins/apm-mongodb/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-mongodb diff --git a/apm-agent-plugins/apm-okhttp-plugin/pom.xml b/apm-agent-plugins/apm-okhttp-plugin/pom.xml index f2e6f9426e..752edab5f8 100644 --- a/apm-agent-plugins/apm-okhttp-plugin/pom.xml +++ b/apm-agent-plugins/apm-okhttp-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-okhttp-plugin diff --git a/apm-agent-plugins/apm-okhttp-test/pom.xml b/apm-agent-plugins/apm-okhttp-test/pom.xml index 95eb083a69..7a78147ab3 100644 --- a/apm-agent-plugins/apm-okhttp-test/pom.xml +++ b/apm-agent-plugins/apm-okhttp-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml index a3f86f9ca9..69d5af0b44 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-embedded-metrics-sdk/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.50.1-SNAPSHOT + 1.51.0 apm-opentelemetry-embedded-metrics-sdk diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml index e8cf9f5dcd..b2a0ebe0f7 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-common/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml index e501c8dd06..bdd3d6c2d3 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-latest/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml index 4bcfc67849..c259be6795 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/apm-opentelemetry-metrics-bridge-v1_14/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry-metrics-bridge-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml index da7bf33b3f..a4a0ff3907 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metrics-bridge-parent/pom.xml @@ -3,7 +3,7 @@ apm-opentelemetry co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml index 066dcf27b0..04712e4f46 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-metricsdk-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.50.1-SNAPSHOT + 1.51.0 apm-opentelemetry-metricsdk-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml index 29d7924873..e049ee0caa 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.50.1-SNAPSHOT + 1.51.0 apm-opentelemetry-plugin diff --git a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml index 7ba9279686..f1ed785e52 100644 --- a/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-opentelemetry - 1.50.1-SNAPSHOT + 1.51.0 ${project.groupId}:${project.artifactId} diff --git a/apm-agent-plugins/apm-opentelemetry/pom.xml b/apm-agent-plugins/apm-opentelemetry/pom.xml index 4130599fa6..b1643fd8e5 100644 --- a/apm-agent-plugins/apm-opentelemetry/pom.xml +++ b/apm-agent-plugins/apm-opentelemetry/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.50.1-SNAPSHOT + 1.51.0 apm-opentelemetry diff --git a/apm-agent-plugins/apm-opentracing-plugin/pom.xml b/apm-agent-plugins/apm-opentracing-plugin/pom.xml index fdeee8763a..d497b04a43 100644 --- a/apm-agent-plugins/apm-opentracing-plugin/pom.xml +++ b/apm-agent-plugins/apm-opentracing-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-opentracing-plugin diff --git a/apm-agent-plugins/apm-process-plugin/pom.xml b/apm-agent-plugins/apm-process-plugin/pom.xml index 35cd844eda..44830d677a 100644 --- a/apm-agent-plugins/apm-process-plugin/pom.xml +++ b/apm-agent-plugins/apm-process-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-profiling-plugin/pom.xml b/apm-agent-plugins/apm-profiling-plugin/pom.xml index 26b9099251..1110191a05 100644 --- a/apm-agent-plugins/apm-profiling-plugin/pom.xml +++ b/apm-agent-plugins/apm-profiling-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-profiling-plugin diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml index e1bef54d12..38c1c1f67c 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-common/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml index a543660287..4f1c20260c 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-1/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml index 1e93901446..c9e49dcbfc 100644 --- a/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml +++ b/apm-agent-plugins/apm-quartz/apm-quartz-plugin-2/pom.xml @@ -3,7 +3,7 @@ apm-quartz co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-quartz/pom.xml b/apm-agent-plugins/apm-quartz/pom.xml index 2dfc225937..d1abbaa31f 100644 --- a/apm-agent-plugins/apm-quartz/pom.xml +++ b/apm-agent-plugins/apm-quartz/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-quartz diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml index b3a9a1b410..f8065e3f8b 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-plugin/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-rabbitmq-plugin diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml index 79d385f100..11278f1746 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-spring/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-rabbitmq-spring diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml index 50842d5e7e..277a893018 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-3/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-rabbitmq-test-3 diff --git a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml index 9cb32cfebc..a96df80934 100644 --- a/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/apm-rabbitmq-test-4/pom.xml @@ -5,7 +5,7 @@ apm-rabbitmq co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-rabbitmq-test-4 diff --git a/apm-agent-plugins/apm-rabbitmq/pom.xml b/apm-agent-plugins/apm-rabbitmq/pom.xml index 98d5cacb1e..7ee5a9bce2 100644 --- a/apm-agent-plugins/apm-rabbitmq/pom.xml +++ b/apm-agent-plugins/apm-rabbitmq/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-rabbitmq diff --git a/apm-agent-plugins/apm-reactor-plugin/pom.xml b/apm-agent-plugins/apm-reactor-plugin/pom.xml index 7ae750d298..a5ba1e858a 100644 --- a/apm-agent-plugins/apm-reactor-plugin/pom.xml +++ b/apm-agent-plugins/apm-reactor-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.50.1-SNAPSHOT + 1.51.0 apm-reactor-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml index ea04f103f5..a18f749aea 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-2-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jedis-2-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml index ae53bddb92..884abcd4bb 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-3-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jedis-3-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml index 230cd342bd..1a254e62b8 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jedis-4-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml index a887991291..1a2b55695f 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jedis-5-tests diff --git a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml index b6e27efb3a..011369298f 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-jedis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-jedis-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml index 2ac955eaa1..3222af65d1 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-3-tests/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml index 71e763cdc4..09e489d14d 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-lettuce-plugin/pom.xml @@ -3,7 +3,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml index 99d7405ac5..162b49ce34 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redis-common/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-redis-common diff --git a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml index 5123541027..3affe7abf0 100644 --- a/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/apm-redisson-plugin/pom.xml @@ -5,7 +5,7 @@ apm-redis-plugin co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-redisson-plugin diff --git a/apm-agent-plugins/apm-redis-plugin/pom.xml b/apm-agent-plugins/apm-redis-plugin/pom.xml index 2dc1718372..d0ddda2d60 100644 --- a/apm-agent-plugins/apm-redis-plugin/pom.xml +++ b/apm-agent-plugins/apm-redis-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-redis-plugin diff --git a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml index a87e592b51..5082c7b807 100644 --- a/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml +++ b/apm-agent-plugins/apm-scala-concurrent-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-scala-concurrent-plugin diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml index 6b9f7fa5f9..518805891c 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin-jakartaee-test/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml index 60f83631f9..33aee9d478 100644 --- a/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml +++ b/apm-agent-plugins/apm-scheduled-annotation-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-scheduled-annotation-plugin diff --git a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml index 05f3c1c2e2..8d9f648693 100644 --- a/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml +++ b/apm-agent-plugins/apm-servlet-jakarta-test/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-servlet-jakarta-test diff --git a/apm-agent-plugins/apm-servlet-plugin/pom.xml b/apm-agent-plugins/apm-servlet-plugin/pom.xml index 216b5d6f80..951f02fc31 100644 --- a/apm-agent-plugins/apm-servlet-plugin/pom.xml +++ b/apm-agent-plugins/apm-servlet-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-servlet-plugin diff --git a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml index ea858535b4..d153339d75 100644 --- a/apm-agent-plugins/apm-sparkjava-plugin/pom.xml +++ b/apm-agent-plugins/apm-sparkjava-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml index 46c1048d7d..913eaa4f1a 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-restclient-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-restclient-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml index af329ab525..8cad64b281 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-resttemplate-plugin diff --git a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml index 047980de75..01d9ddd8bb 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/apm-spring-resttemplate-test/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-resttemplate - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-resttemplate-test diff --git a/apm-agent-plugins/apm-spring-resttemplate/pom.xml b/apm-agent-plugins/apm-spring-resttemplate/pom.xml index 1119499261..e4fca8d718 100644 --- a/apm-agent-plugins/apm-spring-resttemplate/pom.xml +++ b/apm-agent-plugins/apm-spring-resttemplate/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-resttemplate diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml index f5680ff05f..e0b395c222 100755 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webclient-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webclient-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml index 8f6d6e9b8d..709fab3dec 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common-spring5/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webflux-common-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml index d0dcbc384d..c74d903e43 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-common/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-spring-webflux - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webflux-common diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml index 98aaf1ec0f..84d32fc284 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-plugin/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webflux-plugin diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml index b3f58284b1..b67b4f557f 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-spring5/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webflux-spring5 diff --git a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml index 5014a846c3..3ee5822e47 100644 --- a/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-spring-webflux - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webflux-testapp diff --git a/apm-agent-plugins/apm-spring-webflux/pom.xml b/apm-agent-plugins/apm-spring-webflux/pom.xml index 2fc545de37..1adb5c4be6 100644 --- a/apm-agent-plugins/apm-spring-webflux/pom.xml +++ b/apm-agent-plugins/apm-spring-webflux/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-plugins - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webflux diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml index 4dd197ee9b..60b3f76d98 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-plugin/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webmvc-plugin diff --git a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml index b7ad17ec62..222383f9bc 100644 --- a/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/apm-spring-webmvc-spring5/pom.xml @@ -5,7 +5,7 @@ apm-spring-webmvc co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-spring-webmvc-spring5 diff --git a/apm-agent-plugins/apm-spring-webmvc/pom.xml b/apm-agent-plugins/apm-spring-webmvc/pom.xml index 28ed036a4e..f9e77d6ec7 100644 --- a/apm-agent-plugins/apm-spring-webmvc/pom.xml +++ b/apm-agent-plugins/apm-spring-webmvc/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-struts-plugin/pom.xml b/apm-agent-plugins/apm-struts-plugin/pom.xml index e9a56c7657..980c347b79 100644 --- a/apm-agent-plugins/apm-struts-plugin/pom.xml +++ b/apm-agent-plugins/apm-struts-plugin/pom.xml @@ -3,7 +3,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml index 857daeccc6..94ddfc5991 100644 --- a/apm-agent-plugins/apm-urlconnection-plugin/pom.xml +++ b/apm-agent-plugins/apm-urlconnection-plugin/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-urlconnection-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml index d5f6e7a609..22a47b31e2 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx-common/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-vertx-common diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml index 2823ec73eb..e9db76719b 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-vertx3-plugin diff --git a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml index 7a334e0b5e..1792484614 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx3-test-latest/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-vertx3-test-latest diff --git a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml index bcaa536690..05e2c35acd 100644 --- a/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml +++ b/apm-agent-plugins/apm-vertx/apm-vertx4-plugin/pom.xml @@ -5,7 +5,7 @@ apm-vertx co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-vertx4-plugin diff --git a/apm-agent-plugins/apm-vertx/pom.xml b/apm-agent-plugins/apm-vertx/pom.xml index 7c21ea2c7a..b448af06bd 100644 --- a/apm-agent-plugins/apm-vertx/pom.xml +++ b/apm-agent-plugins/apm-vertx/pom.xml @@ -5,7 +5,7 @@ apm-agent-plugins co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-vertx diff --git a/apm-agent-plugins/pom.xml b/apm-agent-plugins/pom.xml index c6d92ec4c4..a1e1c95e9a 100644 --- a/apm-agent-plugins/pom.xml +++ b/apm-agent-plugins/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-plugins diff --git a/apm-agent-tracer/pom.xml b/apm-agent-tracer/pom.xml index 877898eb0a..dd1249acf9 100644 --- a/apm-agent-tracer/pom.xml +++ b/apm-agent-tracer/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.50.1-SNAPSHOT + 1.51.0 apm-agent-tracer diff --git a/apm-opentracing/pom.xml b/apm-opentracing/pom.xml index 07cd039334..f40310b6d5 100644 --- a/apm-opentracing/pom.xml +++ b/apm-opentracing/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 apm-opentracing diff --git a/elastic-apm-agent-java8/pom.xml b/elastic-apm-agent-java8/pom.xml index 84febf2c84..83da3b41c0 100644 --- a/elastic-apm-agent-java8/pom.xml +++ b/elastic-apm-agent-java8/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.50.1-SNAPSHOT + 1.51.0 elastic-apm-agent-java8 diff --git a/elastic-apm-agent-premain/pom.xml b/elastic-apm-agent-premain/pom.xml index f6e6c77ae4..c6c8572bbe 100644 --- a/elastic-apm-agent-premain/pom.xml +++ b/elastic-apm-agent-premain/pom.xml @@ -3,7 +3,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/elastic-apm-agent/pom.xml b/elastic-apm-agent/pom.xml index b99417924d..134ee08197 100644 --- a/elastic-apm-agent/pom.xml +++ b/elastic-apm-agent/pom.xml @@ -5,7 +5,7 @@ co.elastic.apm apm-agent-parent - 1.50.1-SNAPSHOT + 1.51.0 elastic-apm-agent diff --git a/integration-tests/application-server-integration-tests/pom.xml b/integration-tests/application-server-integration-tests/pom.xml index 56c97e94f5..70bbb32a9e 100644 --- a/integration-tests/application-server-integration-tests/pom.xml +++ b/integration-tests/application-server-integration-tests/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 application-server-integration-tests diff --git a/integration-tests/aws-lambda-test/pom.xml b/integration-tests/aws-lambda-test/pom.xml index 3a613026f1..b1728f2948 100644 --- a/integration-tests/aws-lambda-test/pom.xml +++ b/integration-tests/aws-lambda-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-dependent/pom.xml b/integration-tests/cdi-app/cdi-app-dependent/pom.xml index 95ae01a882..4842df8962 100644 --- a/integration-tests/cdi-app/cdi-app-dependent/pom.xml +++ b/integration-tests/cdi-app/cdi-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/cdi-app/cdi-app-standalone/pom.xml b/integration-tests/cdi-app/cdi-app-standalone/pom.xml index f7e2f2456c..2f415ee34d 100644 --- a/integration-tests/cdi-app/cdi-app-standalone/pom.xml +++ b/integration-tests/cdi-app/cdi-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/cdi-app/pom.xml b/integration-tests/cdi-app/pom.xml index 473b5d569c..c245dbf868 100644 --- a/integration-tests/cdi-app/pom.xml +++ b/integration-tests/cdi-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml index baaf081561..b790110f6f 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-dependent/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml index 614684bc02..b1baffd663 100644 --- a/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml +++ b/integration-tests/cdi-jakartaee-app/cdi-jakartaee-app-standalone/pom.xml @@ -4,7 +4,7 @@ cdi-jakartaee-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/cdi-jakartaee-app/pom.xml b/integration-tests/cdi-jakartaee-app/pom.xml index e418b25c32..695b9b2b01 100644 --- a/integration-tests/cdi-jakartaee-app/pom.xml +++ b/integration-tests/cdi-jakartaee-app/pom.xml @@ -4,7 +4,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml index 9bc0a7b382..b1fac537a6 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-app/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.50.1-SNAPSHOT + 1.51.0 external-plugin-otel-test-app diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml index 190f8a2f84..4fc925fe5a 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin1/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.50.1-SNAPSHOT + 1.51.0 external-plugin-otel-test-plugin1 diff --git a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml index 414e996774..c5177b8175 100644 --- a/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml +++ b/integration-tests/external-plugin-otel-test/external-plugin-otel-test-plugin2/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm external-plugin-otel-test - 1.50.1-SNAPSHOT + 1.51.0 external-plugin-otel-test-plugin2 diff --git a/integration-tests/external-plugin-otel-test/pom.xml b/integration-tests/external-plugin-otel-test/pom.xml index b7003e1139..de48233231 100644 --- a/integration-tests/external-plugin-otel-test/pom.xml +++ b/integration-tests/external-plugin-otel-test/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm integration-tests - 1.50.1-SNAPSHOT + 1.51.0 external-plugin-otel-test diff --git a/integration-tests/external-plugin-test/external-plugin-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-app/pom.xml index e671a0e40d..ccc7bcc592 100644 --- a/integration-tests/external-plugin-test/external-plugin-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 external-plugin-app diff --git a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml index 56b30e871f..e950b44bf6 100644 --- a/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin-jakarta-app/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 external-plugin-jakarta-app diff --git a/integration-tests/external-plugin-test/external-plugin/pom.xml b/integration-tests/external-plugin-test/external-plugin/pom.xml index ce92710d0c..dd8b212dfb 100644 --- a/integration-tests/external-plugin-test/external-plugin/pom.xml +++ b/integration-tests/external-plugin-test/external-plugin/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 external-plugin diff --git a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml index b8cee80c00..9d55c90014 100644 --- a/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml +++ b/integration-tests/external-plugin-test/plugin-instrumentation-target/pom.xml @@ -6,7 +6,7 @@ external-plugin-test co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 plugin-instrumentation-target diff --git a/integration-tests/external-plugin-test/pom.xml b/integration-tests/external-plugin-test/pom.xml index ba6262125e..9e581dc055 100644 --- a/integration-tests/external-plugin-test/pom.xml +++ b/integration-tests/external-plugin-test/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml index d68674f31b..b5d834c068 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-dependent/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml index 376d214d77..f29235947f 100644 --- a/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml +++ b/integration-tests/jakartaee-jsf-app/jakartaee-jsf-app-standalone/pom.xml @@ -3,7 +3,7 @@ jakartaee-jsf-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/jakartaee-jsf-app/pom.xml b/integration-tests/jakartaee-jsf-app/pom.xml index 3f2f3d8843..62c48fa9d4 100644 --- a/integration-tests/jakartaee-jsf-app/pom.xml +++ b/integration-tests/jakartaee-jsf-app/pom.xml @@ -3,7 +3,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 pom diff --git a/integration-tests/jakartaee-simple-webapp/pom.xml b/integration-tests/jakartaee-simple-webapp/pom.xml index 6216a2525f..6ccd877da9 100644 --- a/integration-tests/jakartaee-simple-webapp/pom.xml +++ b/integration-tests/jakartaee-simple-webapp/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 jakartaee-simple-webapp diff --git a/integration-tests/jsf-app/jsf-app-dependent/pom.xml b/integration-tests/jsf-app/jsf-app-dependent/pom.xml index e34b9fcd75..32ce0be4c5 100644 --- a/integration-tests/jsf-app/jsf-app-dependent/pom.xml +++ b/integration-tests/jsf-app/jsf-app-dependent/pom.xml @@ -4,7 +4,7 @@ jsf-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/jsf-app/jsf-app-standalone/pom.xml b/integration-tests/jsf-app/jsf-app-standalone/pom.xml index af158efdd8..4a7d0b9d5b 100644 --- a/integration-tests/jsf-app/jsf-app-standalone/pom.xml +++ b/integration-tests/jsf-app/jsf-app-standalone/pom.xml @@ -6,7 +6,7 @@ jsf-app co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 jsf-app-standalone diff --git a/integration-tests/jsf-app/pom.xml b/integration-tests/jsf-app/pom.xml index 386e587835..d1f0f11220 100644 --- a/integration-tests/jsf-app/pom.xml +++ b/integration-tests/jsf-app/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 jsf-app diff --git a/integration-tests/main-app-test/pom.xml b/integration-tests/main-app-test/pom.xml index 4114757898..8963bd8dc7 100644 --- a/integration-tests/main-app-test/pom.xml +++ b/integration-tests/main-app-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 main-app-test diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 15aace45f2..82becf7ec0 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,7 +5,7 @@ apm-agent-parent co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 integration-tests diff --git a/integration-tests/quarkus/pom.xml b/integration-tests/quarkus/pom.xml index 4149ada9a0..f99d81e2a4 100644 --- a/integration-tests/quarkus/pom.xml +++ b/integration-tests/quarkus/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 quarkus diff --git a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml index 43921dd008..fb85b6e8b3 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-base/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 quarkus-jaxrs-base diff --git a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml index 8d2a6fa859..b8b1e84594 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-undertow/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 quarkus-jaxrs-undertow diff --git a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml index be5c0ae315..84a96c200e 100644 --- a/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml +++ b/integration-tests/quarkus/quarkus-jaxrs-vertx/pom.xml @@ -5,7 +5,7 @@ quarkus co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 quarkus-jaxrs-vertx diff --git a/integration-tests/runtime-attach/pom.xml b/integration-tests/runtime-attach/pom.xml index f7957a89f7..500df790f8 100644 --- a/integration-tests/runtime-attach/pom.xml +++ b/integration-tests/runtime-attach/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 runtime-attach diff --git a/integration-tests/runtime-attach/runtime-attach-app/pom.xml b/integration-tests/runtime-attach/runtime-attach-app/pom.xml index 9276e73e77..936f4738c5 100644 --- a/integration-tests/runtime-attach/runtime-attach-app/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-app/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/runtime-attach/runtime-attach-test/pom.xml b/integration-tests/runtime-attach/runtime-attach-test/pom.xml index b92b4cf08a..e14cd7b2ef 100644 --- a/integration-tests/runtime-attach/runtime-attach-test/pom.xml +++ b/integration-tests/runtime-attach/runtime-attach-test/pom.xml @@ -3,7 +3,7 @@ runtime-attach co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/simple-webapp/pom.xml b/integration-tests/simple-webapp/pom.xml index 340a37d519..99490c2647 100644 --- a/integration-tests/simple-webapp/pom.xml +++ b/integration-tests/simple-webapp/pom.xml @@ -6,7 +6,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 simple-webapp diff --git a/integration-tests/soap-test/pom.xml b/integration-tests/soap-test/pom.xml index 01fda602aa..a87746df9a 100644 --- a/integration-tests/soap-test/pom.xml +++ b/integration-tests/soap-test/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 soap-test diff --git a/integration-tests/spring-boot-1-5/pom.xml b/integration-tests/spring-boot-1-5/pom.xml index 1b9f68225a..ead5000301 100644 --- a/integration-tests/spring-boot-1-5/pom.xml +++ b/integration-tests/spring-boot-1-5/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-1-5 diff --git a/integration-tests/spring-boot-2/pom.xml b/integration-tests/spring-boot-2/pom.xml index c3c9438672..d2359485cf 100644 --- a/integration-tests/spring-boot-2/pom.xml +++ b/integration-tests/spring-boot-2/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-2 diff --git a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml index 01aec4174e..986614268d 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-base/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-2-base diff --git a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml index 8589042a4e..b74c5aed23 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-jetty/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-2-jetty diff --git a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml index 6d0548589f..256f073736 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-tomcat/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-2-tomcat diff --git a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml index 66a9057b65..954641719b 100644 --- a/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml +++ b/integration-tests/spring-boot-2/spring-boot-2-undertow/pom.xml @@ -5,7 +5,7 @@ spring-boot-2 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-2-undertow diff --git a/integration-tests/spring-boot-3/pom.xml b/integration-tests/spring-boot-3/pom.xml index 43e4834e4c..273fbb2f71 100644 --- a/integration-tests/spring-boot-3/pom.xml +++ b/integration-tests/spring-boot-3/pom.xml @@ -5,7 +5,7 @@ integration-tests co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 spring-boot-3 diff --git a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml index cebe737e63..757a5a2761 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-jetty/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml index bb6ee96bc8..d54d220f5d 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-tomcat/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml index 6f8374f18a..db37828256 100644 --- a/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml +++ b/integration-tests/spring-boot-3/spring-boot-3-undertow/pom.xml @@ -3,7 +3,7 @@ spring-boot-3 co.elastic.apm - 1.50.1-SNAPSHOT + 1.51.0 4.0.0 diff --git a/pom.xml b/pom.xml index cee4c3c2ca..8d039d00c3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ co.elastic.apm apm-agent-parent - 1.50.1-SNAPSHOT + 1.51.0 pom ${project.groupId}:${project.artifactId} From 63603d546a684b262ed3123cdfb70e1aa8bcaeec Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 25 Jul 2024 12:07:44 +0200 Subject: [PATCH 132/132] Use 1.5.5 lambda layer for tests because 1.5.6 seems to be broken (#3735) --- .../src/test/java/co/elastic/apm/awslambda/AwsLambdaIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/aws-lambda-test/src/test/java/co/elastic/apm/awslambda/AwsLambdaIT.java b/integration-tests/aws-lambda-test/src/test/java/co/elastic/apm/awslambda/AwsLambdaIT.java index 15f41099ed..53a72c7a02 100644 --- a/integration-tests/aws-lambda-test/src/test/java/co/elastic/apm/awslambda/AwsLambdaIT.java +++ b/integration-tests/aws-lambda-test/src/test/java/co/elastic/apm/awslambda/AwsLambdaIT.java @@ -187,7 +187,7 @@ private static String createLambdaImage() throws IOException { ImageFromDockerfile imageBuilder = new ImageFromDockerfile().withDockerfileFromBuilder(builder -> { builder - .withStatement(raw("FROM docker.elastic.co/observability/apm-lambda-extension-x86_64:latest AS lambda-extension")) + .withStatement(raw("FROM docker.elastic.co/observability/apm-lambda-extension-x86_64:1.5.5 AS lambda-extension")) .withStatement(raw("FROM --platform=linux/amd64 public.ecr.aws/lambda/java:11")) .withStatement(raw("COPY --from=lambda-extension /opt/elastic-apm-extension /opt/extensions/elastic-apm-extension")) .copy("aws-lambda-test.jar", "${LAMBDA_TASK_ROOT}/lib/aws-lambda-test.jar")