@@ -9,7 +9,6 @@ use std::{
99use  alloy:: dyn_abi:: Eip712Domain ; 
1010use  alloy:: sol_types:: eip712_domain; 
1111use  anyhow; 
12- use  autometrics:: prometheus_exporter; 
1312use  axum:: extract:: MatchedPath ; 
1413use  axum:: extract:: Request  as  ExtractRequest ; 
1514use  axum:: http:: { Method ,  Request } ; 
@@ -22,6 +21,7 @@ use axum::{
2221use  axum:: { serve,  ServiceExt } ; 
2322use  build_info:: BuildInfo ; 
2423use  eventuals:: Eventual ; 
24+ use  prometheus:: TextEncoder ; 
2525use  reqwest:: StatusCode ; 
2626use  serde:: { de:: DeserializeOwned ,  Serialize } ; 
2727use  sqlx:: postgres:: PgPoolOptions ; 
@@ -32,6 +32,7 @@ use tokio::net::TcpListener;
3232use  tokio:: signal; 
3333use  tower_governor:: { governor:: GovernorConfigBuilder ,  GovernorLayer } ; 
3434use  tower_http:: { cors,  cors:: CorsLayer ,  normalize_path:: NormalizePath ,  trace:: TraceLayer } ; 
35+ use  tracing:: error; 
3536use  tracing:: { info,  info_span} ; 
3637
3738use  crate :: escrow_accounts:: EscrowAccounts ; 
@@ -465,7 +466,21 @@ impl IndexerService {
465466        tokio:: spawn ( async  move  { 
466467            let  router = Router :: new ( ) . route ( 
467468                "/metrics" , 
468-                 get ( || async  {  prometheus_exporter:: encode_http_response ( )  } ) , 
469+                 get ( || async  { 
470+                     let  metric_families = prometheus:: gather ( ) ; 
471+                     let  encoder = TextEncoder :: new ( ) ; 
472+ 
473+                     match  encoder. encode_to_string ( & metric_families)  { 
474+                         Ok ( s)  => ( StatusCode :: OK ,  s) , 
475+                         Err ( e)  => { 
476+                             error ! ( "Error encoding metrics: {}" ,  e) ; 
477+                             ( 
478+                                 StatusCode :: INTERNAL_SERVER_ERROR , 
479+                                 format ! ( "Error encoding metrics: {}" ,  e) , 
480+                             ) 
481+                         } 
482+                     } 
483+                 } ) , 
469484            ) ; 
470485
471486            serve ( 
0 commit comments