-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use prometheus_client::metrics::counter::Counter; | ||
|
||
#[derive(Default, Clone)] | ||
pub struct AIMetrics { | ||
total_stream_count: Counter, | ||
failed_stream_count: Counter, | ||
stream_image_count: Counter, | ||
} | ||
|
||
impl AIMetrics { | ||
pub fn register(registry: &mut prometheus_client::registry::Registry) -> Self { | ||
let metrics = Self::default(); | ||
let realtime_registry = registry.sub_registry_with_prefix("ai"); | ||
|
||
// Register each metric with the Prometheus registry | ||
realtime_registry.register( | ||
"total_stream_count", | ||
"Total count of streams processed", | ||
metrics.total_stream_count.clone(), | ||
); | ||
realtime_registry.register( | ||
"failed_stream_count", | ||
"Total count of failed streams", | ||
metrics.failed_stream_count.clone(), | ||
); | ||
realtime_registry.register( | ||
"image_stream_count", | ||
"Total count of image streams processed", | ||
metrics.stream_image_count.clone(), | ||
); | ||
|
||
metrics | ||
} | ||
|
||
pub fn record_total_stream_count(&self, count: u64) { | ||
self.total_stream_count.inc_by(count); | ||
} | ||
|
||
pub fn record_failed_stream_count(&self, count: u64) { | ||
self.failed_stream_count.inc_by(count); | ||
} | ||
|
||
pub fn record_stream_image_count(&self, count: u64) { | ||
self.stream_image_count.inc_by(count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod metrics; | ||
pub mod ops; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters