Skip to content

Commit

Permalink
Merge pull request #42144 from cescoffier/prometheus-dev-ui-add-raw-o…
Browse files Browse the repository at this point in the history
…utput

Dev UI / Prometheus - add a link to the scraped URL
  • Loading branch information
phillip-kruger authored Jul 25, 2024
2 parents b547f76 + 1737169 commit 62cdd67
Showing 1 changed file with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,24 @@ ReflectiveClassBuildItem createReflectiveBuildItem(DotName sourceAnnotation, Ind
public CardPageBuildItem createCard(List<RegistryBuildItem> registries) {
var card = new CardPageBuildItem();

var json = registries.stream().filter(r -> "JSON".equals(r.name())).map(RegistryBuildItem::path).findFirst();
var prom = registries.stream().filter(r -> "Prometheus".equals(r.name())).map(RegistryBuildItem::path).findFirst();

prom.ifPresent(s -> card.addPage(Page.externalPageBuilder("Prometheus")
.icon("font-awesome-solid:chart-line")
.url(s)));
registries.stream().filter(r -> "JSON".equalsIgnoreCase(r.name())).findFirst().ifPresent(r -> {
card.addPage(Page.externalPageBuilder("JSON")
.icon("font-awesome-solid:chart-line")
.url(r.path())
.isJsonContent());
});

json.ifPresent(s -> card.addPage(Page.externalPageBuilder("JSON")
.icon("font-awesome-solid:chart-line")
.url(s)
.isJsonContent()));
registries.stream().filter(r -> "Prometheus".equalsIgnoreCase(r.name())).findFirst().ifPresent(r -> {
card.addPage(Page.externalPageBuilder("Prometheus")
.icon("font-awesome-solid:chart-line")
.url(r.path())
.isJsonContent());
card.addPage(Page.externalPageBuilder("Prometheus (raw output)")
.doNotEmbed()
.icon("font-awesome-solid:up-right-from-square")
.url(r.path())
.mimeType("text/plain"));
});

return card;
}
Expand Down

0 comments on commit 62cdd67

Please sign in to comment.