Skip to content

Commit

Permalink
Update to latest agent (#18)
Browse files Browse the repository at this point in the history
* Update to latest agent

* Spotless

* Fix
  • Loading branch information
Anuraag Agrawal authored Sep 29, 2020
1 parent df652d1 commit 1a25d8d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
5 changes: 0 additions & 5 deletions awsagentprovider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ plugins {
id("com.github.johnrengelman.shadow") version "5.2.0"
}

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

base {
archivesBaseName = "aws-opentelemetry-agent-customizer"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.assertj.core.api.Assertions.assertThat;

import com.google.common.primitives.Ints;
import io.opentelemetry.trace.TraceId;
import io.opentelemetry.trace.TracerProvider;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.RepeatedTest;
Expand All @@ -32,8 +31,7 @@ class AwsTracerProviderFactoryTest {
void providerGeneratesXrayIds() {
int startTimeSecs = (int) TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
var span = TRACER_PROVIDER.get("test").spanBuilder("test").startSpan();
byte[] traceId = new byte[TraceId.getSize()];
span.getContext().getTraceId().copyBytesTo(traceId, 0);
byte[] traceId = span.getContext().getTraceIdBytes();
int epoch = Ints.fromBytes(traceId[0], traceId[1], traceId[2], traceId[3]);
assertThat(epoch).isGreaterThanOrEqualTo(startTimeSecs);
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ allprojects {

plugins.withId("java") {
java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
Expand Down
8 changes: 4 additions & 4 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ val DEPENDENCY_SETS = listOf(
),
DependencySet(
"io.opentelemetry.instrumentation.auto",
"0.9.0-20200914.041229-7",
"0.9.0-20200927.201622-41",
listOf(
"opentelemetry-javaagent"
)
),
DependencySet(
"io.opentelemetry",
"0.8.0",
"0.9.0-20200925.025016-49",
listOf(
"opentelemetry-api",
"opentelemetry-exporters-logging",
Expand All @@ -59,7 +59,7 @@ val DEPENDENCY_SETS = listOf(
),
DependencySet(
"io.opentelemetry",
"0.8.0",
"0.9.0-20200925.025016-49",
listOf(
"opentelemetry-context-prop",
"opentelemetry-extension-trace-propagators",
Expand All @@ -70,7 +70,7 @@ val DEPENDENCY_SETS = listOf(
),
DependencySet(
"io.opentelemetry",
"0.8.0",
"0.9.0-20200925.025016-49",
listOf(
"opentelemetry-sdk-common",
"opentelemetry-sdk-correlation-context",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
class SpringBootSmokeTest {

private static final Logger logger = LoggerFactory.getLogger(SpringBootSmokeTest.class);
private static final Logger backendLogger = LoggerFactory.getLogger("backend");
private static final Logger applicationLogger = LoggerFactory.getLogger("application");

private static final String AGENT_PATH =
System.getProperty("io.awsobservability.instrumentation.smoketests.runner.agentPath");
Expand Down Expand Up @@ -99,23 +101,23 @@ public ExportTraceServiceRequest deserialize(
new GenericContainer<>("ghcr.io/anuraaga/smoke-tests-fake-backend")
.withExposedPorts(8080)
.waitingFor(Wait.forHttp("/health").forPort(8080))
.withLogConsumer(new Slf4jLogConsumer(backendLogger))
.withNetwork(network)
.withNetworkAliases("backend")
.withLogConsumer(new Slf4jLogConsumer(logger));
.withNetworkAliases("backend");

@Container
private static final GenericContainer<?> application =
new GenericContainer<>("ghcr.io/anuraaga/smoke-tests-spring-boot")
.dependsOn(backend)
.withExposedPorts(8080)
.withNetwork(network)
.withLogConsumer(new Slf4jLogConsumer(logger))
.withLogConsumer(new Slf4jLogConsumer(applicationLogger))
.withCopyFileToContainer(
MountableFile.forHostPath(AGENT_PATH), "/opentelemetry-javaagent-all.jar")
.withEnv("JAVA_TOOL_OPTIONS", "-javaagent:/opentelemetry-javaagent-all.jar")
.withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
.withEnv("OTEL_OTLP_ENDPOINT", "backend:8080");
.withEnv("OTEL_EXPORTER_OTLP_SPAN_ENDPOINT", "backend:8080");

private static final TypeReference<List<ExportTraceServiceRequest>>
EXPORT_TRACE_SERVICE_REQUEST_LIST = new TypeReference<>() {};
Expand Down Expand Up @@ -182,7 +184,7 @@ void hello() {

private List<Span> getExported() {
List<ExportTraceServiceRequest> exported = ImmutableList.of();
for (int i = 0; i < 20; i++) {
for (int i = 0; i < 100; i++) {
try (var content =
backendClient
.get("/get-requests")
Expand Down

0 comments on commit 1a25d8d

Please sign in to comment.