-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): add store histogram metrics to storage and sync (#1200)
- Loading branch information
1 parent
ee2e54b
commit cd525a5
Showing
12 changed files
with
101 additions
and
3 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
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 metrics_exporter_prometheus::PrometheusBuilder; | ||
use papyrus_proc_macros::latency_histogram; | ||
use prometheus_parse::Value::Untyped; | ||
use test_utils::prometheus_is_contained; | ||
|
||
#[test] | ||
fn latency_histogram_test() { | ||
#[latency_histogram("foo_histogram")] | ||
fn foo() -> usize { | ||
#[allow(clippy::let_and_return)] | ||
let start_function_time = 1000; | ||
start_function_time | ||
} | ||
|
||
let handle = PrometheusBuilder::new().install_recorder().unwrap(); | ||
|
||
assert!(handle.render().is_empty()); | ||
assert_eq!(foo(), 1000); | ||
assert_eq!( | ||
prometheus_is_contained(handle.render(), "foo_histogram_count", &[]), | ||
Some(Untyped(1f64)) | ||
); | ||
// Test that the "start_function_time" variable from the macro is not shadowed. | ||
assert_ne!( | ||
prometheus_is_contained(handle.render(), "foo_histogram_sum", &[]), | ||
Some(Untyped(1000f64)) | ||
); | ||
} |
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
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