Minor cleanup

This commit is contained in:
Gabriel Simmer 2023-10-21 02:17:44 +01:00
parent 4ad878a954
commit 3ac0d13780
Signed by: arch
SSH key fingerprint: SHA256:m3OEcdtrnBpMX+2BDGh/byv3hrCekCLzDYMdvGEKPPQ

View file

@ -81,14 +81,14 @@ struct VrcInstance {
/// World ID.
world: Option<String>,
/// Custom name for the instance.
#[serde(skip)]
name: Option<String>
}
#[derive(Clone, Debug, Deserialize)]
struct VrcInstanceData {
capacity: Option<f64>,
n_users: Option<f64>,
userCount: Option<f64>,
#[serde(rename = "userCount")]
user_count: Option<f64>,
}
#[derive(Clone, Debug, Deserialize)]
@ -173,7 +173,7 @@ async fn metrics(config: Config) -> Result<Vec<u8>, WsError> {
let req = client
.get(url)
.header(USER_AGENT, "vr-event-tracker")
.header(USER_AGENT, "vr-event-tracker(git.gmem.ca/arch/vr-event-tracker)")
.header("Cookie", &auth_cookie)
.send()
.await?;
@ -182,7 +182,7 @@ async fn metrics(config: Config) -> Result<Vec<u8>, WsError> {
let name = instance.name.unwrap_or(instance_id.clone());
PLAYER_COUNT
.with_label_values(&[&world_id, &instance_id, &name])
.set(data.userCount.unwrap_or(0 as f64));
.set(data.user_count.unwrap_or(0 as f64));
}
let vrcdn_url = format!(