Skip to content

Commit

Permalink
refactor: make PushMetricsExporter non-plural
Browse files Browse the repository at this point in the history
  • Loading branch information
pitoniak32 committed Oct 26, 2024
1 parent 3e1dc85 commit 18d0b2d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions opentelemetry-otlp/src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use opentelemetry::metrics::MetricResult;

use opentelemetry_sdk::metrics::{
data::{ResourceMetrics, Temporality},
exporter::PushMetricsExporter,
exporter::PushMetricExporter,
};
use std::fmt::{Debug, Formatter};

Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/metrics/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions opentelemetry-sdk/src/metrics/periodic_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use opentelemetry::{

use crate::runtime::Runtime;
use crate::{
metrics::{exporter::PushMetricsExporter, reader::SdkProducer},
metrics::{exporter::PushMetricExporter, reader::SdkProducer},
Resource,
};

Expand Down Expand Up @@ -54,7 +54,7 @@ pub struct PeriodicReaderBuilder<E, RT> {

impl<E, RT> PeriodicReaderBuilder<E, RT>
where
E: PushMetricsExporter,
E: PushMetricExporter,
RT: Runtime,
{
fn new(exporter: E, runtime: RT) -> Self {
Expand Down Expand Up @@ -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
Expand All @@ -168,7 +168,7 @@ where
/// use opentelemetry_sdk::metrics::PeriodicReader;
/// # fn example<E, R>(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,
/// # {
///
Expand All @@ -181,15 +181,15 @@ where
/// ```
#[derive(Clone)]
pub struct PeriodicReader {
exporter: Arc<dyn PushMetricsExporter>,
exporter: Arc<dyn PushMetricExporter>,
inner: Arc<Mutex<PeriodicReaderInner>>,
}

impl PeriodicReader {
/// Configuration options for a periodic reader
pub fn builder<E, RT>(exporter: E, runtime: RT) -> PeriodicReaderBuilder<E, RT>
where
E: PushMetricsExporter,
E: PushMetricExporter,
RT: Runtime,
{
PeriodicReaderBuilder::new(exporter, runtime)
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-stdout/src/metrics/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 18d0b2d

Please sign in to comment.