Reset world occupants, register metrics function
This commit is contained in:
parent
0298508f45
commit
2297da8e73
17
src/main.rs
17
src/main.rs
|
@ -119,12 +119,7 @@ struct VrcWorldData {
|
|||
instances: Vec<(String, f64)>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), ()> {
|
||||
let content = fs::read_to_string("config.toml").unwrap();
|
||||
let mut config: Config = toml::from_str(&content).unwrap();
|
||||
config.vrchat_token = Some(env::var("VRCHAT_AUTH_TOKEN").unwrap());
|
||||
|
||||
fn register_metrics() {
|
||||
let _ = PLAYER_COUNT.set(
|
||||
register_gauge_vec!(
|
||||
"vrchat_playercount",
|
||||
|
@ -165,6 +160,14 @@ async fn main() -> Result<(), ()> {
|
|||
)
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), ()> {
|
||||
let content = fs::read_to_string("config.toml").unwrap();
|
||||
let mut config: Config = toml::from_str(&content).unwrap();
|
||||
config.vrchat_token = Some(env::var("VRCHAT_AUTH_TOKEN").unwrap());
|
||||
register_metrics();
|
||||
|
||||
let app = Router::new()
|
||||
.route("/", get(homepage))
|
||||
|
@ -195,7 +198,7 @@ async fn homepage() -> &'static str {
|
|||
async fn metrics(config: Config) -> Result<Vec<u8>, WsError> {
|
||||
PLAYER_COUNT.get().unwrap().reset();
|
||||
VRCDN_VIEWERS.get().unwrap().reset();
|
||||
WORLD_VISITS.get().unwrap().reset();
|
||||
WORLD_OCCUPANTS.get().unwrap().reset();
|
||||
let encoder = TextEncoder::new();
|
||||
let client = reqwest::Client::new();
|
||||
let auth_cookie = format!("auth={}", &config.vrchat_token.unwrap());
|
||||
|
|
Loading…
Reference in a new issue