metrics capture
This commit is contained in:
parent
2faa23b9ad
commit
e3a39d9a47
|
@ -34,6 +34,7 @@ pub struct LiteBridge {
|
|||
pub tx_sender: TxSender,
|
||||
pub finalized_block_listenser: BlockListener,
|
||||
pub confirmed_block_listenser: BlockListener,
|
||||
pub metrics_capture: MetricsCapture,
|
||||
}
|
||||
|
||||
impl LiteBridge {
|
||||
|
@ -146,13 +147,8 @@ impl LiteBridge {
|
|||
|
||||
#[jsonrpsee::core::async_trait]
|
||||
impl LiteRpcServer for LiteBridge {
|
||||
#[allow(unreachable_code)]
|
||||
async fn get_metrics(&self) -> crate::rpc::Result<Metrics> {
|
||||
#[cfg(feature = "metrics")]
|
||||
{
|
||||
return Ok(self.metrics.read().await.to_owned());
|
||||
}
|
||||
panic!("server not compiled with metrics support")
|
||||
return Ok(self.metrics_capture.get_metrics().await);
|
||||
}
|
||||
|
||||
async fn send_transaction(
|
||||
|
|
|
@ -32,6 +32,10 @@ impl MetricsCapture {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn get_metrics(&self) -> Metrics {
|
||||
self.metrics.read().await.to_owned()
|
||||
}
|
||||
|
||||
pub fn capture(self) -> JoinHandle<anyhow::Result<()>> {
|
||||
let mut one_second = tokio::time::interval(std::time::Duration::from_secs(1));
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
mod block_listenser;
|
||||
mod cleaner;
|
||||
mod metrics;
|
||||
mod metrics_capture;
|
||||
mod tx_sender;
|
||||
|
||||
pub use block_listenser::*;
|
||||
pub use cleaner::*;
|
||||
pub use metrics::*;
|
||||
pub use metrics_capture::*;
|
||||
pub use tx_sender::*;
|
||||
|
|
Loading…
Reference in New Issue