Skip to content

Commit

Permalink
Add LGTM traces test / check
Browse files Browse the repository at this point in the history
(cherry picked from commit e92d99f)
  • Loading branch information
alesj authored and gsmet committed Sep 3, 2024
1 parent 1ed1fd1 commit 35c53b6
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ quarkus.micrometer.export.otlp.enabled=true
quarkus.micrometer.export.otlp.publish=true
quarkus.micrometer.export.otlp.step=PT5S
quarkus.micrometer.export.otlp.default-registry=true
%dev.quarkus.micrometer.export.otlp.url=http://${quarkus.otel-collector.url}/v1/metrics
%prod.quarkus.micrometer.export.otlp.url=http://localhost:4318/v1/metrics

#opentelemetry
quarkus.otel.exporter.otlp.traces.protocol=http/protobuf
%dev.quarkus.otel.exporter.otlp.traces.endpoint=http://${quarkus.otel-collector.url}
%prod.quarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4318

#quarkus.observability.lgtm.image-name=grafana/otel-lgtm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public void testTracing() {
Awaitility.await().atMost(61, TimeUnit.SECONDS).until(
() -> client.query("xvalue_X"),
result -> !result.data.result.isEmpty());
Awaitility.await().atMost(61, TimeUnit.SECONDS).until(
() -> client.traces("quarkus-integration-test-observability-lgtm", 20, 3),
result -> !result.traces.isEmpty());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,23 @@ public QueryResult query(String query) {
});
return ref.get();
}

public TempoResult traces(String service, int limit, int spss) {
AtomicReference<TempoResult> ref = new AtomicReference<>();
String path = "/api/datasources/proxy/uid/tempo/api/search?q=%7Bresource.service.name%3D%22"
+ service + "%22%7D&limit=" + limit + "&spss=" + spss;
handle(
path,
HttpRequest.Builder::GET,
HttpResponse.BodyHandlers.ofString(),
(r, b) -> {
try {
TempoResult result = MAPPER.readValue(b, TempoResult.class);
ref.set(result);
} catch (JsonProcessingException e) {
throw new UncheckedIOException(e);
}
});
return ref.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.quarkus.observability.test.support;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class TempoResult {
public List<Map<Object, Object>> traces;
public Metrics metrics;

// getters and setters

@Override
public String toString() {
return "TempoResult{" +
"traces=" + traces +
", metrics=" + metrics +
'}';
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static class Metrics {
public int inspectedBytes;
public int completedJobs;
public int totalJobs;

@Override
public String toString() {
return "Metrics{" +
"inspectedBytes=" + inspectedBytes +
", completedJobs=" + completedJobs +
", totalJobs=" + totalJobs +
'}';
}
}
}

0 comments on commit 35c53b6

Please sign in to comment.