feature/prometheus-metrics #13
10
src/main.rs
10
src/main.rs
@@ -7,7 +7,7 @@ use actix_web_prom::PrometheusMetrics;
|
|||||||
use database::{DbError, DbErrorKind, FavoriteDao, SqliteFavoriteDao, SqliteUserDao, UserDao};
|
use database::{DbError, DbErrorKind, FavoriteDao, SqliteFavoriteDao, SqliteUserDao, UserDao};
|
||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use prometheus::{self, Gauge};
|
use prometheus::{self, IntGauge};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -43,12 +43,12 @@ mod files;
|
|||||||
mod video;
|
mod video;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref IMAGE_GAUGE: Gauge = Gauge::new(
|
static ref IMAGE_GAUGE: IntGauge = IntGauge::new(
|
||||||
"imageserver_image_total",
|
"imageserver_image_total",
|
||||||
"Count of the images on the server"
|
"Count of the images on the server"
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
static ref VIDEO_GAUGE: Gauge = Gauge::new(
|
static ref VIDEO_GAUGE: IntGauge = IntGauge::new(
|
||||||
"imageserver_video_total",
|
"imageserver_video_total",
|
||||||
"Count of the videos on the server"
|
"Count of the videos on the server"
|
||||||
)
|
)
|
||||||
@@ -381,8 +381,8 @@ fn update_media_counts(media_dir: &PathBuf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMAGE_GAUGE.set(image_count as f64);
|
IMAGE_GAUGE.set(image_count);
|
||||||
VIDEO_GAUGE.set(video_count as f64);
|
VIDEO_GAUGE.set(video_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_image(entry: &DirEntry) -> bool {
|
fn is_image(entry: &DirEntry) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user