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

GraalVM native support for the OpenTelemetry annotations #11757

Merged
merged 10 commits into from
Jul 10, 2024
Prev Previous commit
Next Next commit
reuse assertion code
jeanbisutti committed Jul 10, 2024
commit ede7c798e59fcfb2a53548a3335e146c8baac3d6
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

import static org.assertj.core.api.Assertions.assertThat;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.sdk.testing.assertj.TraceAssert;
import io.opentelemetry.semconv.HttpAttributes;
@@ -54,8 +53,6 @@ private static void assertClient(TraceAssert traceAssert) {
traceAssert.hasSpansSatisfyingExactly(
span -> AbstractOtelSpringStarterSmokeTest.assertClientSpan(span, "/ping"),
span -> span.hasKind(SpanKind.SERVER).hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"),
span ->
span.hasName("SpringComponent.withSpanMethod")
.hasAttribute(AttributeKey.stringKey("paramName"), "from-controller"));
span -> withSpanAssert(span));
}
}
Original file line number Diff line number Diff line change
@@ -202,11 +202,6 @@ void shouldSendTelemetry() {
}
}

private static SpanDataAssert withSpanAssert(SpanDataAssert span) {
return span.hasName("SpringComponent.withSpanMethod")
.hasAttribute(AttributeKey.stringKey("paramName"), "from-controller");
}

@Test
void databaseQuery() {
testing.clearAllExportedData();
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@
import io.opentelemetry.api.OpenTelemetry;
import java.util.Arrays;
import java.util.List;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.sdk.testing.assertj.SpanDataAssert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@@ -61,4 +63,9 @@ void checkSpringLogs(CapturedOutput output) {
}
});
}

static SpanDataAssert withSpanAssert(SpanDataAssert span) {
return span.hasName("SpringComponent.withSpanMethod")
.hasAttribute(AttributeKey.stringKey("paramName"), "from-controller");
}
}