Skip to content

Commit

Permalink
Rename the MetricsServiceTrait to MetricsServiceExporter
Browse files Browse the repository at this point in the history
  • Loading branch information
sfauvel committed Oct 11, 2024
1 parent 570f3e3 commit 09cf2b3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions internal/mithril-metric/src/commons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ macro_rules! build_metrics_service {
)*
}

impl MetricsServiceTrait for $service {
impl MetricsServiceExporter for $service {
fn export_metrics(&self) -> StdResult<String> {
metrics_tools::export_metrics(&self.registry)
}
Expand Down Expand Up @@ -261,7 +261,7 @@ pub mod test_tools {
mod tests {
use std::collections::BTreeMap;

use crate::MetricsServiceTrait;
use crate::MetricsServiceExporter;

use super::*;
use prometheus::Registry;
Expand Down Expand Up @@ -373,7 +373,7 @@ mod tests {
}
}

impl MetricsServiceTrait for MetricsServiceExample {
impl MetricsServiceExporter for MetricsServiceExample {
fn export_metrics(&self) -> StdResult<String> {
metrics_tools::export_metrics(&self.registry)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/mithril-metric/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ mod server;

pub use commons::*;
pub use server::MetricsServer;
pub use server::MetricsServiceTrait;
pub use server::MetricsServiceExporter;
10 changes: 5 additions & 5 deletions internal/mithril-metric/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tokio::sync::oneshot::Receiver;
use mithril_common::logging::LoggerExtensions;
use mithril_common::StdResult;

pub trait MetricsServiceTrait {
pub trait MetricsServiceExporter {
fn export_metrics(&self) -> StdResult<String>;
}

Expand All @@ -36,19 +36,19 @@ impl IntoResponse for MetricsServerError {
}

/// The MetricsServer is responsible for exposing the metrics of the signer.
pub struct MetricsServer<T: MetricsServiceTrait + Send + Sync> {
pub struct MetricsServer<T: MetricsServiceExporter + Send + Sync> {
server_port: u16,
server_ip: String,
metrics_service: Arc<T>,
logger: Logger,
}

struct RouterState<T: MetricsServiceTrait + Send + Sync> {
struct RouterState<T: MetricsServiceExporter + Send + Sync> {
metrics_service: Arc<T>,
logger: Logger,
}

impl<T: MetricsServiceTrait + Send + Sync + 'static> MetricsServer<T> {
impl<T: MetricsServiceExporter + Send + Sync + 'static> MetricsServer<T> {
/// Create a new MetricsServer instance.
pub fn new(server_ip: &str, server_port: u16, metrics_service: Arc<T>, logger: Logger) -> Self {
Self {
Expand Down Expand Up @@ -123,7 +123,7 @@ mod tests {
}
}

impl MetricsServiceTrait for PseudoMetricsService {
impl MetricsServiceExporter for PseudoMetricsService {
fn export_metrics(&self) -> StdResult<String> {
Ok("pseudo metrics".to_string())
}
Expand Down
2 changes: 1 addition & 1 deletion mithril-signer/src/metrics/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use mithril_metric::{build_metrics_service, metrics_tools, MetricsServiceTrait};
use mithril_metric::{build_metrics_service, metrics_tools, MetricsServiceExporter};
use prometheus::Registry;
use slog::Logger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]
use anyhow::anyhow;
use mithril_metric::{MetricsServiceTrait, MithrilMetric};
use mithril_metric::{MetricsServiceExporter, MithrilMetric};
use prometheus_parse::Value;
use slog::Drain;
use slog_scope::debug;
Expand Down

0 comments on commit 09cf2b3

Please sign in to comment.