@@ -11,34 +11,34 @@ lazy_static! {
1111 pub static ref INCOMING_REQUESTS : IntCounterVec = IntCounterVec :: new(
1212 Opts :: new( "incoming_requests" , "The number of HTTP requests received" ) ,
1313 & [ "http_method" , "path" ]
14- ) . expect( "Prometheus metric initialization failed " ) ;
14+ ) . expect( "Prometheus metric options should be valid " ) ;
1515 // Request counter by status code
1616 pub static ref RESPONSE_CODE_COLLECTOR : IntCounterVec = IntCounterVec :: new(
1717 Opts :: new( "outgoing_response" , "The number of responses sent" ) ,
1818 & [ "status_code" , "http_method" , "path" ]
19- ) . expect( "Prometheus metric initialization failed " ) ;
19+ ) . expect( "Prometheus metric options should be valid " ) ;
2020 // Response histogram by response time
2121 pub static ref RESPONSE_TIME_COLLECTOR : HistogramVec = HistogramVec :: new(
2222 HistogramOpts {
2323 common_opts: Opts :: new( "response_time" , "The time taken to respond to each request" ) ,
2424 buckets: prometheus:: DEFAULT_BUCKETS . to_vec( ) , // Change buckets here if desired
2525 } ,
2626 & [ "status_code" , "http_method" , "path" ] ,
27- ) . expect( "Prometheus metric initialization failed " ) ;
27+ ) . expect( "Prometheus metric options should be valid " ) ;
2828}
2929
3030/// Registers various prometheus metrics with the global registry
3131pub fn register_metrics ( ) {
3232 let registry = prometheus:: default_registry ( ) ;
3333 registry
3434 . register ( Box :: new ( INCOMING_REQUESTS . clone ( ) ) )
35- . expect ( "registering prometheus metrics during initialization failed " ) ;
35+ . expect ( "Prometheus metrics registration should not fail during initialization" ) ;
3636 registry
3737 . register ( Box :: new ( RESPONSE_CODE_COLLECTOR . clone ( ) ) )
38- . expect ( "registering prometheus metrics during initialization failed " ) ;
38+ . expect ( "Prometheus metrics registration should not fail during initialization" ) ;
3939 registry
4040 . register ( Box :: new ( RESPONSE_TIME_COLLECTOR . clone ( ) ) )
41- . expect ( "registering prometheus metrics during initialization failed " ) ;
41+ . expect ( "Prometheus metrics registration should not fail during initialization" ) ;
4242}
4343
4444/// Returns currently gathered prometheus metrics
0 commit comments