Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f3dfc74d6 |
3 changed files with 7 additions and 2 deletions
|
|
@ -218,7 +218,7 @@ public class MetaCommands(
|
||||||
await channelApi.EditMessageAsync(msg.ChannelID, msg.ID, content: "", embeds: embeds);
|
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()
|
private async Task<double?> MessagesRate()
|
||||||
{
|
{
|
||||||
if (!config.Logging.EnableMetrics)
|
if (!config.Logging.EnableMetrics)
|
||||||
|
|
@ -227,7 +227,8 @@ public class MetaCommands(
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var query = HttpUtility.UrlEncode("increase(catalogger_received_messages[5m])");
|
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();
|
resp.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
var data = await resp.Content.ReadFromJsonAsync<PrometheusResponse>();
|
var data = await resp.Content.ReadFromJsonAsync<PrometheusResponse>();
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ public class Config
|
||||||
public bool EnableMetrics { get; init; } = true;
|
public bool EnableMetrics { get; init; } = true;
|
||||||
|
|
||||||
public string? SeqLogUrl { get; init; }
|
public string? SeqLogUrl { get; init; }
|
||||||
|
public string? PrometheusUrl { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DatabaseConfig
|
public class DatabaseConfig
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ LogQueries = false
|
||||||
SeqLogUrl = http://localhost:5341
|
SeqLogUrl = http://localhost:5341
|
||||||
# Whether to enable Prometheus metrics. If disabled, Catalogger will update metrics manually every so often.
|
# Whether to enable Prometheus metrics. If disabled, Catalogger will update metrics manually every so often.
|
||||||
EnableMetrics = false
|
EnableMetrics = false
|
||||||
|
# The URL for the Prometheus server. Used for message rate if metrics are enabled.
|
||||||
|
# Defaults to http://localhost:9090, should be changed if Prometheus is on another server.
|
||||||
|
PrometheusUrl = http://localhost:9090
|
||||||
|
|
||||||
[Database]
|
[Database]
|
||||||
Url = Host=localhost;Database=postgres;Username=postgres;Password=postgres
|
Url = Host=localhost;Database=postgres;Username=postgres;Password=postgres
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue