use of io.opentelemetry.sdk.trace.data.SpanData in project quarkus by quarkusio.
the class VertxClientOpenTelemetryTest method path.
@Test
void path() throws Exception {
HttpResponse<Buffer> response = WebClient.create(vertx).get(uri.getPort(), uri.getHost(), "/hello/naruto").send().toCompletionStage().toCompletableFuture().get();
assertEquals(HTTP_OK, response.statusCode());
List<SpanData> spans = spanExporter.getFinishedSpanItems(2);
SpanData server = spans.get(0);
assertEquals(SERVER, server.getKind());
assertEquals("/hello/:name", server.getName());
assertEquals(HTTP_OK, server.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, server.getAttributes().get(HTTP_METHOD));
assertEquals("/hello/:name", server.getAttributes().get(HTTP_ROUTE));
assertEquals(uri.getHost() + ":" + uri.getPort(), server.getAttributes().get(HTTP_HOST));
assertEquals(uri.getPath() + "hello/naruto", server.getAttributes().get(HTTP_TARGET));
SpanData client = spans.get(1);
assertEquals(CLIENT, client.getKind());
assertEquals("HTTP GET", client.getName());
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello/naruto", client.getAttributes().get(HTTP_URL));
assertEquals(client.getTraceId(), server.getTraceId());
assertEquals(server.getParentSpanId(), client.getSpanId());
}
use of io.opentelemetry.sdk.trace.data.SpanData in project quarkus by quarkusio.
the class VertxClientOpenTelemetryTest method client.
@Test
void client() throws Exception {
HttpResponse<Buffer> response = WebClient.create(vertx).get(uri.getPort(), uri.getHost(), "/hello").send().toCompletionStage().toCompletableFuture().get();
assertEquals(HTTP_OK, response.statusCode());
List<SpanData> spans = spanExporter.getFinishedSpanItems(2);
SpanData server = spans.get(0);
assertEquals(SERVER, server.getKind());
assertEquals("/hello", server.getName());
assertEquals(HTTP_OK, server.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, server.getAttributes().get(HTTP_METHOD));
assertEquals("/hello", server.getAttributes().get(HTTP_ROUTE));
assertEquals(uri.getHost() + ":" + uri.getPort(), server.getAttributes().get(HTTP_HOST));
assertEquals(uri.getPath() + "hello", server.getAttributes().get(HTTP_TARGET));
SpanData client = spans.get(1);
assertEquals(CLIENT, client.getKind());
assertEquals("HTTP GET", client.getName());
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello", client.getAttributes().get(HTTP_URL));
assertEquals(client.getTraceId(), server.getTraceId());
assertEquals(server.getParentSpanId(), client.getSpanId());
}
use of io.opentelemetry.sdk.trace.data.SpanData in project quarkus by quarkusio.
the class RestClientOpenTelemetryTest method path.
@Test
void path() {
Response response = client.path("another");
assertEquals(response.getStatus(), HTTP_OK);
List<SpanData> spans = spanExporter.getFinishedSpanItems(2);
SpanData server = spans.get(0);
assertEquals(SERVER, server.getKind());
assertEquals("/hello/{path}", server.getName());
assertEquals(HTTP_OK, server.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, server.getAttributes().get(HTTP_METHOD));
assertEquals("/hello/{path}", server.getAttributes().get(HTTP_ROUTE));
assertEquals(uri.getHost() + ":" + uri.getPort(), server.getAttributes().get(HTTP_HOST));
assertEquals(uri.getPath() + "hello/another", server.getAttributes().get(HTTP_TARGET));
SpanData client = spans.get(1);
assertEquals(CLIENT, client.getKind());
assertEquals("/hello/{path}", client.getName());
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello/another", client.getAttributes().get(HTTP_URL));
assertEquals(client.getTraceId(), server.getTraceId());
assertEquals(server.getParentSpanId(), client.getSpanId());
}
use of io.opentelemetry.sdk.trace.data.SpanData in project quarkus by quarkusio.
the class RestClientOpenTelemetryTest method urlWithoutAuthentication.
@Test
void urlWithoutAuthentication() {
WebTarget target = ClientBuilder.newClient().target(UriBuilder.fromUri(uri).userInfo("username:password").path("hello").queryParam("query", "1"));
Response response = target.request().get();
assertEquals(response.getStatus(), HTTP_OK);
List<SpanData> spans = spanExporter.getFinishedSpanItems(2);
SpanData client = spans.get(1);
assertEquals(CLIENT, client.getKind());
assertEquals("/hello", client.getName());
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello?query=1", client.getAttributes().get(HTTP_URL));
assertEquals(client.getTraceId(), spans.get(0).getTraceId());
assertEquals(spans.get(0).getParentSpanId(), client.getSpanId());
}
use of io.opentelemetry.sdk.trace.data.SpanData in project quarkus by quarkusio.
the class RestClientOpenTelemetryTest method spanNameWithoutQueryString.
@Test
void spanNameWithoutQueryString() {
Response response = client.hello("1");
assertEquals(response.getStatus(), HTTP_OK);
List<SpanData> spans = spanExporter.getFinishedSpanItems(2);
SpanData client = spans.get(1);
assertEquals(CLIENT, client.getKind());
assertEquals("/hello", client.getName());
assertEquals(HTTP_OK, client.getAttributes().get(HTTP_STATUS_CODE));
assertEquals(HttpMethod.GET, client.getAttributes().get(HTTP_METHOD));
assertEquals(uri.toString() + "hello?query=1", client.getAttributes().get(HTTP_URL));
assertEquals(client.getTraceId(), spans.get(0).getTraceId());
assertEquals(spans.get(0).getParentSpanId(), client.getSpanId());
}
Aggregations