mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 17:50:13 +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 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,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _metrics_default() -> bool {
|
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 {
|
for idx in 0..cfg.expected_gateway_count {
|
||||||
let res = client
|
let res = client
|
||||||
.get(format!("http://cluster{idx}.{}/stats", cfg.gateway_url))
|
.get(format!("http://pluralkit-gateway-{idx}.{}/stats", cfg.gateway_url))
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
@ -163,6 +163,11 @@ pub async fn update_stats_api(ctx: AppCtx) -> anyhow::Result<()> {
|
||||||
.build()
|
.build()
|
||||||
.expect("error making client");
|
.expect("error making client");
|
||||||
|
|
||||||
|
let cfg = config
|
||||||
|
.scheduled_tasks
|
||||||
|
.as_ref()
|
||||||
|
.expect("missing scheduled_tasks config");
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Debug)]
|
#[derive(serde::Deserialize, Debug)]
|
||||||
struct PrometheusResult {
|
struct PrometheusResult {
|
||||||
data: PrometheusResultData,
|
data: PrometheusResultData,
|
||||||
|
|
@ -178,9 +183,11 @@ pub async fn update_stats_api(ctx: AppCtx) -> anyhow::Result<()> {
|
||||||
|
|
||||||
macro_rules! prom_instant_query {
|
macro_rules! prom_instant_query {
|
||||||
($t:ty, $q:expr) => {{
|
($t:ty, $q:expr) => {{
|
||||||
|
tracing::info!("Query: {}", $q);
|
||||||
let resp = client
|
let resp = client
|
||||||
.get(format!(
|
.get(format!(
|
||||||
"http://vm.svc.pluralkit.net/select/0/prometheus/api/v1/query?query={}",
|
"{}/api/v1/query?query={}",
|
||||||
|
cfg.vm_url,
|
||||||
$q
|
$q
|
||||||
))
|
))
|
||||||
.send()
|
.send()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue