mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
fix(scheduled_tasks): update for k8s
This commit is contained in:
parent
94a3276979
commit
859785bf05
2 changed files with 10 additions and 2 deletions
|
|
@ -88,6 +88,7 @@ pub struct ScheduledTasksConfig {
|
|||
pub set_guild_count: bool,
|
||||
pub expected_gateway_count: usize,
|
||||
pub gateway_url: String,
|
||||
pub vm_url: String,
|
||||
}
|
||||
|
||||
fn _metrics_default() -> bool {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ pub async fn update_discord_stats(ctx: AppCtx) -> anyhow::Result<()> {
|
|||
|
||||
for idx in 0..cfg.expected_gateway_count {
|
||||
let res = client
|
||||
.get(format!("http://cluster{idx}.{}/stats", cfg.gateway_url))
|
||||
.get(format!("http://pluralkit-gateway-{idx}.{}/stats", cfg.gateway_url))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
|
|
@ -163,6 +163,11 @@ pub async fn update_stats_api(ctx: AppCtx) -> anyhow::Result<()> {
|
|||
.build()
|
||||
.expect("error making client");
|
||||
|
||||
let cfg = config
|
||||
.scheduled_tasks
|
||||
.as_ref()
|
||||
.expect("missing scheduled_tasks config");
|
||||
|
||||
#[derive(serde::Deserialize, Debug)]
|
||||
struct PrometheusResult {
|
||||
data: PrometheusResultData,
|
||||
|
|
@ -178,9 +183,11 @@ pub async fn update_stats_api(ctx: AppCtx) -> anyhow::Result<()> {
|
|||
|
||||
macro_rules! prom_instant_query {
|
||||
($t:ty, $q:expr) => {{
|
||||
tracing::info!("Query: {}", $q);
|
||||
let resp = client
|
||||
.get(format!(
|
||||
"http://vm.svc.pluralkit.net/select/0/prometheus/api/v1/query?query={}",
|
||||
"{}/api/v1/query?query={}",
|
||||
cfg.vm_url,
|
||||
$q
|
||||
))
|
||||
.send()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue