Skip to content

Commit

Permalink
For Delta Temporarlity, avoid exporting when no new measurements are …
Browse files Browse the repository at this point in the history
…made (#2153)
  • Loading branch information
cijothomas authored Sep 30, 2024
1 parent 6ed2b43 commit 8bdd189
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
external sources to be sent through OpenTelemetry.
[#2105](https://github.com/open-telemetry/opentelemetry-rust/pull/2105)
- Feature: `SimpleSpanProcessor::new` is now public [#2119](https://github.com/open-telemetry/opentelemetry-rust/pull/2119)
- For Delta Temporality, exporters are not invoked unless there were new
measurements since the last collect/export.
[#2153](https://github.com/open-telemetry/opentelemetry-rust/pull/2153)

## v0.25.0

Expand Down
1 change: 0 additions & 1 deletion opentelemetry-sdk/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,6 @@ mod tests {
}

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
#[ignore = "Known bug: https://github.com/open-telemetry/opentelemetry-rust/issues/1598"]
async fn delta_memory_efficiency_test() {
// Run this test with stdout enabled to see output.
// cargo test delta_memory_efficiency_test --features=testing -- --nocapture
Expand Down
4 changes: 4 additions & 0 deletions opentelemetry-sdk/src/metrics/periodic_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ struct PeriodicReaderWorker<RT: Runtime> {
impl<RT: Runtime> PeriodicReaderWorker<RT> {
async fn collect_and_export(&mut self) -> Result<()> {
self.reader.collect(&mut self.rm)?;
if self.rm.scope_metrics.is_empty() {
// No metrics to export.
return Ok(());
}

let export = self.reader.exporter.export(&mut self.rm);
let timeout = self.runtime.delay(self.timeout);
Expand Down

0 comments on commit 8bdd189

Please sign in to comment.