Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump opentelemetryJavaagent from 1.32.0 to 2.0.0 #96

Merged
merged 10 commits into from
Feb 12, 2024
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ opentelemetrySdk = "1.34.1"
opentelemetryProto = "1.1.0-alpha"

# otel agent, those two should be updated together
opentelemetryJavaagent = "1.32.0"
opentelemetryJavaagentAlpha = "1.32.0-alpha"
opentelemetryJavaagent = "2.0.0"
opentelemetryJavaagentAlpha = "2.0.0-alpha"

# otel semconv java generated bindings, needs to be kept in sync with version in otel agent
opentelemetrySemconv = "1.21.0-alpha"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class AgentFeaturesSmokeTest extends TestAppSmokeTest {

@BeforeAll
public static void start() {
startTestApp((container) -> {});
startTestApp((container) -> {
});
}

@AfterAll
Expand All @@ -47,11 +48,10 @@ public void healthcheck() throws InterruptedException {
List<ExportTraceServiceRequest> traces = waitForTraces();
List<Span> spans = getSpans(traces).toList();
assertThat(spans)
.hasSize(2)
.hasSize(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant change from the otel 2.0.0 changelog:

Controller spans are now disabled by default. You can enable them using OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED=true or -Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I should probably have read the release notes in more detail !

Here I'll leave it in the most simple form as we just need to assert that we have at least one span, and there is no need to verify that the controller span is created.

.extracting("name", "kind")
.containsOnly(
tuple("GET /health", Span.SpanKind.SPAN_KIND_SERVER),
tuple("HealthController.healthcheck", Span.SpanKind.SPAN_KIND_INTERNAL));
tuple("GET /health", Span.SpanKind.SPAN_KIND_SERVER));

spans.forEach(
span -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ abstract class SmokeTest {
static void setupSpec() {
backend =
new GenericContainer<>(
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20221127.3559314891")
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend:20221127.3559314891")
.withExposedPorts(8080)
.waitingFor(Wait.forHttp("/health").forPort(8080))
.withNetwork(network)
Expand Down Expand Up @@ -118,6 +118,7 @@ protected static GenericContainer<?> startTarget(
.withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
// batch span processor: very short delay for testing
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
.withEnv("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc")
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
.withEnv("OTEL_PROPAGATORS", "tracecontext,baggage")
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://backend:8080");

Expand Down Expand Up @@ -167,7 +168,8 @@ void beforeEach() throws IOException, InterruptedException {
}

protected static GenericContainer<?> startMockServer() {
return startMockServer((container) -> {});
return startMockServer((container) -> {
});
}

protected static GenericContainer<?> startMockServer(
Expand Down
Loading