Skip to content

Commit

Permalink
Add internal endpoint for http_sd_configs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Oct 21, 2024
1 parent e0907c5 commit 405d314
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ class InternalWebServer(val m: LorittaBot) {
call.respond(LorittaMetrics.appMicrometerRegistry.scrape())
}

get("/prom-sd") {
call.respondJson(
buildJsonArray {
for (cluster in m.config.loritta.clusters.instances) {
addJsonObject {
val targetUrl = cluster.rpcUrl + "metrics"

putJsonArray("targets") {
add(targetUrl)
}

putJsonObject("labels") {
put("loritta_cluster", "cluster-${cluster.id.toString()}")
}
}
}
}
)
}

// Dumps all pending messages on the event queue
get("/pending-messages") {
val coroutinesInfo = DebugProbes.dumpCoroutinesInfo()
Expand Down Expand Up @@ -311,7 +331,7 @@ class InternalWebServer(val m: LorittaBot) {
trackedTwitchAccount[TrackedTwitchAccounts.message],
guild,
TwitchStreamOnlineMessagePlaceholders,
{
{
when (it) {
TwitchStreamOnlineMessagePlaceholders.GuildIconUrlPlaceholder -> guild.iconUrl ?: ""
TwitchStreamOnlineMessagePlaceholders.GuildNamePlaceholder -> guild.name
Expand Down

0 comments on commit 405d314

Please sign in to comment.