Skip to content
17 changes: 12 additions & 5 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,22 @@ also modified to suppress telemetry before invoking exporters.
- Fixed the overflow attribute to correctly use the boolean value `true`
instead of the string `"true"`.
[#2878](https://github.com/open-telemetry/opentelemetry-rust/issues/2878)

- *Breaking* change for custom `MetricReader` authors.
The `shutdown_with_timeout` method is added to `MetricReader` trait.
`collect` method on `MetricReader` modified to return `OTelSdkResult`.
[#2905](https://github.com/open-telemetry/opentelemetry-rust/pull/2905)
- *Breaking* `MetricError`, `MetricResult` no longer public (except when
`spec_unstable_metrics_views` feature flag is enabled). `OTelSdkResult` should
be used instead, wherever applicable.
- *Breaking* change, affecting custom MetricReader authors: The
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- *Breaking* change, affecting custom MetricReader authors: The
- *Breaking* change, affecting custom `MetricReader` authors: The

`shutdown_with_timeout` method is added to `MetricReader` trait. `collect`
method on `MetricReader` modified to return `OTelSdkResult`.
[#2905](https://github.com/open-telemetry/opentelemetry-rust/pull/2905)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR link is added twice.

[#2905](https://github.com/open-telemetry/opentelemetry-rust/pull/2905)
- *Breaking* change, affecting custom MetricReader authors: `MetricReader`
trait, `ManualReader` struct, `Pipeline` struct, `InstrumentKind` enum moved
behind feature flag "experimental_metrics_custom_reader". These were only
required for writing custom readers.
[2928](https://github.com/open-telemetry/opentelemetry-rust/pull/2928)
- *Breaking* `Aggregation` enum moved behind feature flag
"spec_unstable_metrics_views". This was only required when using Views.
[2928](https://github.com/open-telemetry/opentelemetry-rust/pull/2928)

## 0.29.0

Expand Down
3 changes: 2 additions & 1 deletion opentelemetry-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ rt-tokio-current-thread = ["tokio", "tokio-stream", "experimental_async_runtime"
internal-logs = ["opentelemetry/internal-logs"]
experimental_metrics_periodicreader_with_async_runtime = ["metrics", "experimental_async_runtime"]
spec_unstable_metrics_views = ["metrics"]
experimental_metrics_custom_reader = ["metrics"]
experimental_logs_batch_log_processor_with_async_runtime = ["logs", "experimental_async_runtime"]
experimental_logs_concurrent_log_processor = ["logs"]
experimental_trace_batch_span_processor_with_async_runtime = ["trace", "experimental_async_runtime"]
Expand Down Expand Up @@ -107,7 +108,7 @@ required-features = ["testing"]
[[bench]]
name = "metric"
harness = false
required-features = ["metrics", "spec_unstable_metrics_views"]
required-features = ["metrics", "spec_unstable_metrics_views", "experimental_metrics_custom_reader"]

[[bench]]
name = "log"
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/metrics/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ where
mod tests {
use std::borrow::Cow;

use crate::metrics::MetricError;
use crate::metrics::error::MetricError;

use super::{
validate_instrument_name, validate_instrument_unit, INSTRUMENT_NAME_EMPTY,
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/metrics/meter_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use crate::error::OTelSdkResult;
use crate::Resource;

use super::{
exporter::PushMetricExporter, meter::SdkMeter, noop::NoopMeter, pipeline::Pipelines,
reader::MetricReader, view::View, PeriodicReader,
exporter::PushMetricExporter, meter::SdkMeter, noop::NoopMeter,
periodic_reader::PeriodicReader, pipeline::Pipelines, reader::MetricReader, view::View,
};

/// Handles the creation and coordination of [Meter]s.
Expand Down
10 changes: 10 additions & 0 deletions opentelemetry-sdk/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@
//!
//! [Resource]: crate::Resource

#[allow(unreachable_pub)]
#[allow(unused)]
pub(crate) mod aggregation;
pub mod data;
mod error;
pub mod exporter;
pub(crate) mod instrument;
pub(crate) mod internal;
#[cfg(feature = "experimental_metrics_custom_reader")]
pub(crate) mod manual_reader;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably just delete manual_reader.rs file instead of providing it under a feature. There doesn't seem to be any use case for it.

pub(crate) mod meter;
mod meter_provider;
Expand All @@ -54,7 +57,10 @@ pub(crate) mod periodic_reader;
/// Module for periodic reader with async runtime.
pub mod periodic_reader_with_async_runtime;
pub(crate) mod pipeline;
#[cfg(feature = "experimental_metrics_custom_reader")]
pub mod reader;
#[cfg(not(feature = "experimental_metrics_custom_reader"))]
pub(crate) mod reader;
pub(crate) mod view;

/// In-Memory metric exporter for testing purpose.
Expand All @@ -65,14 +71,18 @@ pub mod in_memory_exporter;
#[cfg_attr(docsrs, doc(cfg(any(feature = "testing", test))))]
pub use in_memory_exporter::{InMemoryMetricExporter, InMemoryMetricExporterBuilder};

#[cfg(feature = "spec_unstable_metrics_views")]
pub use aggregation::*;
#[cfg(feature = "spec_unstable_metrics_views")]
pub use error::{MetricError, MetricResult};
#[cfg(feature = "experimental_metrics_custom_reader")]
pub use manual_reader::*;
pub use meter_provider::*;
pub use periodic_reader::*;
#[cfg(feature = "experimental_metrics_custom_reader")]
pub use pipeline::Pipeline;

#[cfg(feature = "experimental_metrics_custom_reader")]
pub use instrument::InstrumentKind;

#[cfg(feature = "spec_unstable_metrics_views")]
Expand Down
3 changes: 2 additions & 1 deletion opentelemetry-sdk/src/metrics/periodic_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use crate::{
};

use super::{
data::ResourceMetrics, instrument::InstrumentKind, reader::MetricReader, Pipeline, Temporality,
data::ResourceMetrics, instrument::InstrumentKind, pipeline::Pipeline, reader::MetricReader,
Temporality,
};

const DEFAULT_INTERVAL: Duration = Duration::from_secs(60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use crate::{
Resource,
};

use super::{data::ResourceMetrics, reader::MetricReader, InstrumentKind, Pipeline};
use super::{
data::ResourceMetrics, instrument::InstrumentKind, pipeline::Pipeline, reader::MetricReader,
};

const DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);
const DEFAULT_INTERVAL: Duration = Duration::from_secs(60);
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/metrics/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{

use self::internal::AggregateFns;

use super::{Aggregation, Temporality};
use super::{aggregation::Aggregation, Temporality};

/// Connects all of the instruments created by a meter provider to a [MetricReader].
///
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/metrics/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::error::OTelSdkResult;
use std::time::Duration;
use std::{fmt, sync::Weak};

use super::{data::ResourceMetrics, pipeline::Pipeline, InstrumentKind, Temporality};
use super::{data::ResourceMetrics, instrument::InstrumentKind, pipeline::Pipeline, Temporality};

/// The interface used between the SDK and an exporter.
///
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/testing/metrics/metric_reader.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::{OTelSdkError, OTelSdkResult};
use crate::metrics::Temporality;
use crate::metrics::{
data::ResourceMetrics, pipeline::Pipeline, reader::MetricReader, InstrumentKind,
data::ResourceMetrics, instrument::InstrumentKind, pipeline::Pipeline, reader::MetricReader,
};
use std::sync::{Arc, Mutex, Weak};
use std::time::Duration;
Expand Down
2 changes: 1 addition & 1 deletion stress/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ctrlc = { workspace = true }
lazy_static = { workspace = true }
num_cpus = { workspace = true }
opentelemetry = { path = "../opentelemetry", features = ["metrics", "logs", "trace", "spec_unstable_logs_enabled"] }
opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["metrics", "logs", "trace", "spec_unstable_logs_enabled", "experimental_logs_concurrent_log_processor"] }
opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["metrics", "logs", "trace", "spec_unstable_logs_enabled", "experimental_logs_concurrent_log_processor", "experimental_metrics_custom_reader"] }
opentelemetry-appender-tracing = { workspace = true, features = ["spec_unstable_logs_enabled"] }
rand = { workspace = true, features = ["small_rng", "os_rng"] }
tracing = { workspace = true, features = ["std"]}
Expand Down