-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1116 from AppFlowy-IO/collab-stream-metrics
chore: add metrics to redis collab stream
- Loading branch information
Showing
11 changed files
with
154 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,28 @@ | ||
use prometheus_client::metrics::counter::Counter; | ||
use prometheus_client::registry::Registry; | ||
|
||
#[derive(Default)] | ||
pub struct CollabStreamMetrics { | ||
/// Incremented each time a new collab stream read task is set (including recurring tasks). | ||
pub reads_enqueued: Counter, | ||
/// Incremented each time an existing task is consumed (including recurring tasks). | ||
pub reads_dequeued: Counter, | ||
} | ||
|
||
impl CollabStreamMetrics { | ||
pub fn register(registry: &mut Registry) -> Self { | ||
let metrics = Self::default(); | ||
let realtime_registry = registry.sub_registry_with_prefix("collab_stream"); | ||
realtime_registry.register( | ||
"reads_enqueued", | ||
"Incremented each time a new collab stream read task is set (including recurring tasks).", | ||
metrics.reads_enqueued.clone(), | ||
); | ||
realtime_registry.register( | ||
"reads_dequeued", | ||
"Incremented each time an existing task is consumed (including recurring tasks).", | ||
metrics.reads_dequeued.clone(), | ||
); | ||
metrics | ||
} | ||
} |
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
Oops, something went wrong.