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 ID.
world: Option<String>, world: Option<String>,
/// Custom name for the instance. /// Custom name for the instance.
#[serde(skip)]
name: Option<String> name: Option<String>
} }
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
struct VrcInstanceData { struct VrcInstanceData {
capacity: Option<f64>, #[serde(rename = "userCount")]
n_users: Option<f64>, user_count: Option<f64>,
userCount: Option<f64>,
} }
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
@ -173,7 +173,7 @@ async fn metrics(config: Config) -> Result<Vec<u8>, WsError> {
let req = client let req = client
.get(url) .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) .header("Cookie", &auth_cookie)
.send() .send()
.await?; .await?;
@ -182,7 +182,7 @@ async fn metrics(config: Config) -> Result<Vec<u8>, WsError> {
let name = instance.name.unwrap_or(instance_id.clone()); let name = instance.name.unwrap_or(instance_id.clone());
PLAYER_COUNT PLAYER_COUNT
.with_label_values(&[&world_id, &instance_id, &name]) .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!( let vrcdn_url = format!(