@@ -769,42 +769,44 @@ impl ProviderEthRpcMetrics {
769769
770770#[ derive( Clone ) ]
771771pub struct SubgraphEthRpcMetrics {
772- request_duration : Box < GaugeVec > ,
773- errors : Box < CounterVec > ,
772+ request_duration : GaugeVec ,
773+ errors : CounterVec ,
774+ deployment : String ,
774775}
775776
776777impl SubgraphEthRpcMetrics {
777778 pub fn new ( registry : Arc < dyn MetricsRegistry > , subgraph_hash : & str ) -> Self {
778779 let request_duration = registry
779- . new_deployment_gauge_vec (
780+ . global_gauge_vec (
780781 "deployment_eth_rpc_request_duration" ,
781782 "Measures eth rpc request duration for a subgraph deployment" ,
782- & subgraph_hash,
783- vec ! [ String :: from( "method" ) , String :: from( "provider" ) ] ,
783+ vec ! [ "deployment" , "method" , "provider" ] . as_slice ( ) ,
784784 )
785785 . unwrap ( ) ;
786786 let errors = registry
787- . new_deployment_counter_vec (
787+ . global_counter_vec (
788788 "deployment_eth_rpc_errors" ,
789789 "Counts eth rpc request errors for a subgraph deployment" ,
790- & subgraph_hash,
791- vec ! [ String :: from( "method" ) , String :: from( "provider" ) ] ,
790+ vec ! [ "deployment" , "method" , "provider" ] . as_slice ( ) ,
792791 )
793792 . unwrap ( ) ;
794793 Self {
795794 request_duration,
796795 errors,
796+ deployment : subgraph_hash. into ( ) ,
797797 }
798798 }
799799
800800 pub fn observe_request ( & self , duration : f64 , method : & str , provider : & str ) {
801801 self . request_duration
802- . with_label_values ( & [ method, provider] )
802+ . with_label_values ( & [ & self . deployment , method, provider] )
803803 . set ( duration) ;
804804 }
805805
806806 pub fn add_error ( & self , method : & str , provider : & str ) {
807- self . errors . with_label_values ( & [ method, provider] ) . inc ( ) ;
807+ self . errors
808+ . with_label_values ( & [ & self . deployment , method, provider] )
809+ . inc ( ) ;
808810 }
809811}
810812
0 commit comments