-
Notifications
You must be signed in to change notification settings - Fork 645
Prometheus stuff #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Prometheus stuff #301
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,119 +1,55 @@ | ||
| use crate::util::typed_prometheus::metrics_group; | ||
| use once_cell::sync::Lazy; | ||
| use prometheus::{Histogram, HistogramOpts, HistogramVec, Registry}; | ||
| use prometheus::{Histogram, HistogramVec}; | ||
|
|
||
| #[non_exhaustive] | ||
| pub struct DbMetrics { | ||
| pub registry: Registry, | ||
| pub tdb_insert_time: Histogram, | ||
| pub tdb_delete_time: Histogram, | ||
| pub tdb_seek_time: Histogram, | ||
| pub tdb_scan_time: Histogram, | ||
| pub tdb_commit_time: Histogram, | ||
| pub rdb_create_table_time: HistogramVec, | ||
| pub rdb_drop_table_time: HistogramVec, | ||
| pub rdb_iter_time: HistogramVec, | ||
| pub rdb_insert_row_time: HistogramVec, | ||
| pub rdb_delete_by_rel_time: HistogramVec, | ||
| } | ||
| metrics_group!( | ||
| #[non_exhaustive] | ||
| pub struct DbMetrics { | ||
| #[name = spacetime_tdb_insert_time] | ||
| #[help = "Time time it takes for the transactional store to perform an insert"] | ||
| pub tdb_insert_time: Histogram, | ||
|
|
||
| pub static DB_METRICS: Lazy<DbMetrics> = Lazy::new(DbMetrics::new); | ||
| #[name = spacetime_tdb_delete_time] | ||
| #[help = "Time time it takes for the transactional store to perform a delete"] | ||
| pub tdb_delete_time: Histogram, | ||
|
|
||
| impl DbMetrics { | ||
| fn new() -> Self { | ||
| DbMetrics { | ||
| registry: Registry::new(), | ||
| tdb_insert_time: Histogram::with_opts(HistogramOpts::new( | ||
| "spacetime_tdb_insert_time", | ||
| "Time time it takes for the transactional store to perform an insert", | ||
| )) | ||
| .unwrap(), | ||
| tdb_delete_time: Histogram::with_opts(HistogramOpts::new( | ||
| "spacetime_tdb_delete_time", | ||
| "Time time it takes for the transactional store to perform a delete", | ||
| )) | ||
| .unwrap(), | ||
| tdb_seek_time: Histogram::with_opts(HistogramOpts::new( | ||
| "spacetime_tdb_seek_time", | ||
| "Time time it takes for the transactional store to perform a seek", | ||
| )) | ||
| .unwrap(), | ||
| tdb_scan_time: Histogram::with_opts(HistogramOpts::new( | ||
| "spacetime_tdb_scan_time", | ||
| "Time time it takes for the transactional store to perform a scan", | ||
| )) | ||
| .unwrap(), | ||
| tdb_commit_time: Histogram::with_opts(HistogramOpts::new( | ||
| "spacetime_tdb_commit_time", | ||
| "Time time it takes for the transactional store to perform a Tx commit", | ||
| )) | ||
| .unwrap(), | ||
| rdb_create_table_time: HistogramVec::new( | ||
| HistogramOpts::new("spacetime_rdb_create_table_time", "The time it takes to create a table"), | ||
| &["table_name"], | ||
| ) | ||
| .unwrap(), | ||
| rdb_drop_table_time: HistogramVec::new( | ||
| HistogramOpts::new("spacetime_rdb_drop_table_time", "The time spent dropping a table"), | ||
| &["table_id"], | ||
| ) | ||
| .unwrap(), | ||
| rdb_iter_time: HistogramVec::new( | ||
| HistogramOpts::new("spacetime_rdb_iter_time", "The time spent iterating a table"), | ||
| &["table_id"], | ||
| ) | ||
| .unwrap(), | ||
| rdb_insert_row_time: HistogramVec::new( | ||
| HistogramOpts::new("spacetime_rdb_insert_row_time", "The time spent inserting into a table"), | ||
| &["table_id"], | ||
| ) | ||
| .unwrap(), | ||
| rdb_delete_by_rel_time: HistogramVec::new( | ||
| HistogramOpts::new( | ||
| "spacetime_rdb_delete_in_time", | ||
| "The time spent deleting values in a set from a table", | ||
| ), | ||
| &["table_id"], | ||
| ) | ||
| .unwrap(), | ||
| } | ||
| } | ||
| #[name = spacetime_tdb_seek_time] | ||
| #[help = "Time time it takes for the transactional store to perform a seek"] | ||
| pub tdb_seek_time: Histogram, | ||
|
|
||
| pub fn register_custom_metrics(&self) { | ||
| self.registry.register(Box::new(self.tdb_insert_time.clone())).unwrap(); | ||
| self.registry.register(Box::new(self.tdb_delete_time.clone())).unwrap(); | ||
| self.registry.register(Box::new(self.tdb_seek_time.clone())).unwrap(); | ||
| self.registry.register(Box::new(self.tdb_scan_time.clone())).unwrap(); | ||
| self.registry.register(Box::new(self.tdb_commit_time.clone())).unwrap(); | ||
| #[name = spacetime_tdb_scan_time] | ||
| #[help = "Time time it takes for the transactional store to perform a scan"] | ||
| pub tdb_scan_time: Histogram, | ||
|
|
||
| self.registry | ||
| .register(Box::new(self.rdb_create_table_time.clone())) | ||
| .unwrap(); | ||
| self.registry | ||
| .register(Box::new(self.rdb_drop_table_time.clone())) | ||
| .unwrap(); | ||
| self.registry.register(Box::new(self.rdb_iter_time.clone())).unwrap(); | ||
| self.registry | ||
| .register(Box::new(self.rdb_insert_row_time.clone())) | ||
| .unwrap(); | ||
| self.registry | ||
| .register(Box::new(self.rdb_delete_by_rel_time.clone())) | ||
| .unwrap(); | ||
| } | ||
| } | ||
| #[name = spacetime_tdb_commit_time] | ||
| #[help = "Time time it takes for the transactional store to perform a Tx commit"] | ||
| pub tdb_commit_time: Histogram, | ||
|
|
||
| #[name = spacetime_rdb_create_table_time] | ||
| #[help = "The time it takes to create a table"] | ||
| #[labels(table_name: str)] | ||
| pub rdb_create_table_time: HistogramVec, | ||
|
|
||
| #[name = spacetime_rdb_drop_table_time] | ||
| #[help = "The time spent dropping a table"] | ||
| #[labels(table_id: u32)] | ||
| pub rdb_drop_table_time: HistogramVec, | ||
|
|
||
| use DB_METRICS as METRICS; | ||
| metrics_delegator!(REGISTRY, registry: Registry); | ||
| metrics_delegator!(TDB_INSERT_TIME, tdb_insert_time: Histogram); | ||
| metrics_delegator!(TDB_DELETE_TIME, tdb_delete_time: Histogram); | ||
| metrics_delegator!(TDB_SEEK_TIME, tdb_seek_time: Histogram); | ||
| metrics_delegator!(TDB_SCAN_TIME, tdb_scan_time: Histogram); | ||
| metrics_delegator!(TDB_COMMIT_TIME, tdb_commit_time: Histogram); | ||
| metrics_delegator!(RDB_CREATE_TABLE_TIME, rdb_create_table_time: HistogramVec); | ||
| metrics_delegator!(RDB_DROP_TABLE_TIME, rdb_drop_table_time: HistogramVec); | ||
| metrics_delegator!(RDB_ITER_TIME, rdb_iter_time: HistogramVec); | ||
| metrics_delegator!(RDB_INSERT_TIME, rdb_insert_row_time: HistogramVec); | ||
| metrics_delegator!(RDB_DELETE_BY_REL_TIME, rdb_delete_by_rel_time: HistogramVec); | ||
| #[name = spacetime_rdb_iter_time] | ||
| #[help = "The time spent iterating a table"] | ||
| #[labels(table_id: u32)] | ||
| pub rdb_iter_time: HistogramVec, | ||
|
|
||
| pub fn register_custom_metrics() { | ||
| DB_METRICS.register_custom_metrics() | ||
| } | ||
| #[name = spacetime_rdb_insert_row_time] | ||
| #[help = "The time spent inserting into a table"] | ||
| #[labels(table_id: u32)] | ||
| pub rdb_insert_row_time: HistogramVec, | ||
|
|
||
| #[name = spacetime_rdb_delete_in_time] | ||
| #[help = "The time spent deleting values in a set from a table"] | ||
| #[labels(table_id: u32)] | ||
| pub rdb_delete_by_rel_time: HistogramVec, | ||
| } | ||
| ); | ||
|
|
||
| pub static DB_METRICS: Lazy<DbMetrics> = Lazy::new(DbMetrics::new); |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.