From 7924b26ff4f6252d5a9e233037a242b3c325b5a2 Mon Sep 17 00:00:00 2001 From: MrCroxx Date: Wed, 27 Nov 2024 15:39:16 +0800 Subject: [PATCH] refactor: export metrics exporters in mod level To avoid conflict on multiple features enabled. Signed-off-by: MrCroxx --- examples/export_metrics_prometheus_hyper.rs | 2 +- foyer-bench/src/main.rs | 6 +++--- foyer/src/prelude.rs | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/export_metrics_prometheus_hyper.rs b/examples/export_metrics_prometheus_hyper.rs index 56af8aa9..b5770301 100644 --- a/examples/export_metrics_prometheus_hyper.rs +++ b/examples/export_metrics_prometheus_hyper.rs @@ -15,7 +15,7 @@ use std::{future::Future, net::SocketAddr, pin::Pin}; use anyhow::Ok; -use foyer::{Cache, CacheBuilder, PrometheusMetricsRegistry}; +use foyer::{prometheus::PrometheusMetricsRegistry, Cache, CacheBuilder}; use http_body_util::Full; use hyper::{ body::{Bytes, Incoming}, diff --git a/foyer-bench/src/main.rs b/foyer-bench/src/main.rs index 9a6d5ba4..0ed18eba 100644 --- a/foyer-bench/src/main.rs +++ b/foyer-bench/src/main.rs @@ -38,9 +38,9 @@ use bytesize::ByteSize; use clap::{builder::PossibleValuesParser, ArgGroup, Parser}; use exporter::PrometheusExporter; use foyer::{ - Compression, DirectFileDeviceOptions, DirectFsDeviceOptions, Engine, FifoConfig, FifoPicker, HybridCache, - HybridCacheBuilder, InvalidRatioPicker, LargeEngineOptions, LfuConfig, LruConfig, PrometheusMetricsRegistry, - RateLimitPicker, RecoverMode, RuntimeOptions, S3FifoConfig, SmallEngineOptions, TokioRuntimeOptions, + prometheus::PrometheusMetricsRegistry, Compression, DirectFileDeviceOptions, DirectFsDeviceOptions, Engine, + FifoConfig, FifoPicker, HybridCache, HybridCacheBuilder, InvalidRatioPicker, LargeEngineOptions, LfuConfig, + LruConfig, RateLimitPicker, RecoverMode, RuntimeOptions, S3FifoConfig, SmallEngineOptions, TokioRuntimeOptions, TracingOptions, }; use futures::future::join_all; diff --git a/foyer/src/prelude.rs b/foyer/src/prelude.rs index e6a878fa..c85ab6d2 100644 --- a/foyer/src/prelude.rs +++ b/foyer/src/prelude.rs @@ -13,9 +13,13 @@ // limitations under the License. #[cfg(feature = "opentelemetry")] -pub use crate::common::metrics::registry::opentelemetry::OpenTelemetryMetricsRegistry; +pub use crate::common::metrics::registry::opentelemetry; +#[cfg(feature = "opentelemetry_0_26")] +pub use crate::common::metrics::registry::opentelemetry_0_26; +#[cfg(feature = "opentelemetry_0_27")] +pub use crate::common::metrics::registry::opentelemetry_0_27; #[cfg(feature = "prometheus")] -pub use crate::common::metrics::registry::prometheus::PrometheusMetricsRegistry; +pub use crate::common::metrics::registry::prometheus; pub use crate::{ common::{ buf::{BufExt, BufMutExt},