From 18d0b2dab38665cd1bb4a3342d808e247b1323f4 Mon Sep 17 00:00:00 2001 From: David Pitoniak Date: Sat, 26 Oct 2024 10:10:33 -0400 Subject: [PATCH] refactor: make PushMetricsExporter non-plural --- opentelemetry-otlp/src/metric.rs | 4 ++-- opentelemetry-sdk/src/metrics/exporter.rs | 2 +- opentelemetry-sdk/src/metrics/periodic_reader.rs | 12 ++++++------ .../src/testing/metrics/in_memory_exporter.rs | 4 ++-- opentelemetry-stdout/src/metrics/exporter.rs | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/opentelemetry-otlp/src/metric.rs b/opentelemetry-otlp/src/metric.rs index 252948395b..e2b3408174 100644 --- a/opentelemetry-otlp/src/metric.rs +++ b/opentelemetry-otlp/src/metric.rs @@ -20,7 +20,7 @@ use opentelemetry::metrics::MetricResult; use opentelemetry_sdk::metrics::{ data::{ResourceMetrics, Temporality}, - exporter::PushMetricsExporter, + exporter::PushMetricExporter, }; use std::fmt::{Debug, Formatter}; @@ -139,7 +139,7 @@ impl Debug for MetricExporter { } #[async_trait] -impl PushMetricsExporter for MetricExporter { +impl PushMetricExporter for MetricExporter { async fn export(&self, metrics: &mut ResourceMetrics) -> MetricResult<()> { self.client.export(metrics).await } diff --git a/opentelemetry-sdk/src/metrics/exporter.rs b/opentelemetry-sdk/src/metrics/exporter.rs index e77380d7e6..f30685be76 100644 --- a/opentelemetry-sdk/src/metrics/exporter.rs +++ b/opentelemetry-sdk/src/metrics/exporter.rs @@ -11,7 +11,7 @@ use super::data::Temporality; /// /// This is the final component in the metric push pipeline. #[async_trait] -pub trait PushMetricsExporter: Send + Sync + 'static { +pub trait PushMetricExporter: Send + Sync + 'static { /// Export serializes and transmits metric data to a receiver. /// /// All retry logic must be contained in this function. The SDK does not diff --git a/opentelemetry-sdk/src/metrics/periodic_reader.rs b/opentelemetry-sdk/src/metrics/periodic_reader.rs index 490185b12e..03a10a54ee 100644 --- a/opentelemetry-sdk/src/metrics/periodic_reader.rs +++ b/opentelemetry-sdk/src/metrics/periodic_reader.rs @@ -18,7 +18,7 @@ use opentelemetry::{ use crate::runtime::Runtime; use crate::{ - metrics::{exporter::PushMetricsExporter, reader::SdkProducer}, + metrics::{exporter::PushMetricExporter, reader::SdkProducer}, Resource, }; @@ -54,7 +54,7 @@ pub struct PeriodicReaderBuilder { impl PeriodicReaderBuilder where - E: PushMetricsExporter, + E: PushMetricExporter, RT: Runtime, { fn new(exporter: E, runtime: RT) -> Self { @@ -155,7 +155,7 @@ where /// /// The [runtime] can be selected based on feature flags set for this crate. /// -/// The exporter can be any exporter that implements [PushMetricsExporter] such +/// The exporter can be any exporter that implements [PushMetricExporter] such /// as [opentelemetry-otlp]. /// /// [collect]: MetricReader::collect @@ -168,7 +168,7 @@ where /// use opentelemetry_sdk::metrics::PeriodicReader; /// # fn example(get_exporter: impl Fn() -> E, get_runtime: impl Fn() -> R) /// # where -/// # E: opentelemetry_sdk::metrics::exporter::PushMetricsExporter, +/// # E: opentelemetry_sdk::metrics::exporter::PushMetricExporter, /// # R: opentelemetry_sdk::runtime::Runtime, /// # { /// @@ -181,7 +181,7 @@ where /// ``` #[derive(Clone)] pub struct PeriodicReader { - exporter: Arc, + exporter: Arc, inner: Arc>, } @@ -189,7 +189,7 @@ impl PeriodicReader { /// Configuration options for a periodic reader pub fn builder(exporter: E, runtime: RT) -> PeriodicReaderBuilder where - E: PushMetricsExporter, + E: PushMetricExporter, RT: Runtime, { PeriodicReaderBuilder::new(exporter, runtime) diff --git a/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs b/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs index 6dbfecea24..d5c8a7494c 100644 --- a/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs +++ b/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs @@ -1,6 +1,6 @@ use crate::metrics::data; use crate::metrics::data::{Histogram, Metric, ResourceMetrics, ScopeMetrics, Temporality}; -use crate::metrics::exporter::PushMetricsExporter; +use crate::metrics::exporter::PushMetricExporter; use async_trait::async_trait; use opentelemetry::metrics::MetricError; use opentelemetry::metrics::MetricResult; @@ -244,7 +244,7 @@ impl InMemoryMetricExporter { } #[async_trait] -impl PushMetricsExporter for InMemoryMetricExporter { +impl PushMetricExporter for InMemoryMetricExporter { async fn export(&self, metrics: &mut ResourceMetrics) -> MetricResult<()> { self.metrics .lock() diff --git a/opentelemetry-stdout/src/metrics/exporter.rs b/opentelemetry-stdout/src/metrics/exporter.rs index df6ff6f916..b2b078a51b 100644 --- a/opentelemetry-stdout/src/metrics/exporter.rs +++ b/opentelemetry-stdout/src/metrics/exporter.rs @@ -4,7 +4,7 @@ use core::{f64, fmt}; use opentelemetry::metrics::{MetricError, MetricResult}; use opentelemetry_sdk::metrics::{ data::{self, ScopeMetrics, Temporality}, - exporter::PushMetricsExporter, + exporter::PushMetricExporter, }; use std::fmt::Debug; use std::sync::atomic; @@ -34,7 +34,7 @@ impl fmt::Debug for MetricExporter { } #[async_trait] -impl PushMetricsExporter for MetricExporter { +impl PushMetricExporter for MetricExporter { /// Write Metrics to stdout async fn export(&self, metrics: &mut data::ResourceMetrics) -> MetricResult<()> { if self.is_shutdown.load(atomic::Ordering::SeqCst) {