fix: make prometheus base url configurable

This commit is contained in:
sam 2025-04-11 14:58:21 +02:00
parent a4a6fb5d31
commit 9f3dfc74d6
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
3 changed files with 7 additions and 2 deletions

View file

@ -218,7 +218,7 @@ public class MetaCommands(
await channelApi.EditMessageAsync(msg.ChannelID, msg.ID, content: "", embeds: embeds);
}
// TODO: add more checks around response format, configurable prometheus endpoint
// TODO: add more checks around response format
private async Task<double?> MessagesRate()
{
if (!config.Logging.EnableMetrics)
@ -227,7 +227,8 @@ public class MetaCommands(
try
{
var query = HttpUtility.UrlEncode("increase(catalogger_received_messages[5m])");
var resp = await _client.GetAsync($"http://localhost:9090/api/v1/query?query={query}");
var prometheusUrl = config.Logging.PrometheusUrl ?? "http://localhost:9090";
var resp = await _client.GetAsync($"{prometheusUrl}/api/v1/query?query={query}");
resp.EnsureSuccessStatusCode();
var data = await resp.Content.ReadFromJsonAsync<PrometheusResponse>();