mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 01:00:12 +00:00
fix(scheduled_tasks): update format of gateway_url, rename prom url
This commit is contained in:
parent
9c8d4583b9
commit
ecb849f7fa
2 changed files with 8 additions and 9 deletions
|
|
@ -88,7 +88,7 @@ pub struct ScheduledTasksConfig {
|
||||||
pub set_guild_count: bool,
|
pub set_guild_count: bool,
|
||||||
pub expected_gateway_count: usize,
|
pub expected_gateway_count: usize,
|
||||||
pub gateway_url: String,
|
pub gateway_url: String,
|
||||||
pub vm_url: String,
|
pub prometheus_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _metrics_default() -> bool {
|
fn _metrics_default() -> bool {
|
||||||
|
|
|
||||||
|
|
@ -92,15 +92,14 @@ pub async fn update_discord_stats(ctx: AppCtx) -> anyhow::Result<()> {
|
||||||
|
|
||||||
let mut guild_count = 0;
|
let mut guild_count = 0;
|
||||||
let mut channel_count = 0;
|
let mut channel_count = 0;
|
||||||
|
let mut url = cfg.gateway_url.clone();
|
||||||
|
|
||||||
for idx in 0..cfg.expected_gateway_count {
|
for idx in 0..cfg.expected_gateway_count {
|
||||||
let res = client
|
if url.contains("{clusterid}") {
|
||||||
.get(format!(
|
url = url.replace("{clusterid}", &idx.to_string());
|
||||||
"http://pluralkit-gateway-{idx}.{}/stats",
|
}
|
||||||
cfg.gateway_url
|
|
||||||
))
|
let res = client.get(&url).send().await?;
|
||||||
.send()
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let stat: GatewayStatus = res.json().await?;
|
let stat: GatewayStatus = res.json().await?;
|
||||||
|
|
||||||
|
|
@ -188,7 +187,7 @@ pub async fn update_stats_api(ctx: AppCtx) -> anyhow::Result<()> {
|
||||||
($t:ty, $q:expr) => {{
|
($t:ty, $q:expr) => {{
|
||||||
tracing::info!("Query: {}", $q);
|
tracing::info!("Query: {}", $q);
|
||||||
let resp = client
|
let resp = client
|
||||||
.get(format!("{}/api/v1/query?query={}", cfg.vm_url, $q))
|
.get(format!("{}/api/v1/query?query={}", cfg.prometheus_url, $q))
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue