Skip to content

Reduce various info logs to debug #2700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,21 @@

- **Breaking** The SpanExporter::export() method no longer requires a mutable reference to self.
Before:

```rust
async fn export(&mut self, batch: Vec<SpanData>) -> OTelSdkResult
async fn export(&mut self, batch: Vec<SpanData>) -> OTelSdkResult
```

After:

```rust
async fn export(&self, batch: Vec<SpanData>) -> OTelSdkResult
async fn export(&self, batch: Vec<SpanData>) -> OTelSdkResult
```

Custom exporters will need to internally synchronize any mutable state, if applicable.

- Bug Fix: `BatchLogProcessor` now correctly calls `shutdown` on the exporter
when its `shutdown` is invoked.

- Reduced some info level logs to debug

## 0.28.0

Released 2025-Feb-10
Expand Down Expand Up @@ -93,7 +92,7 @@ field as metadata, a feature introduced in version 0.1.40.
- `Resource::{new,empty,from_detectors,new_with_defaults,from_schema_url,merge,default}`.
To create Resources you should only use `Resource::builder()` or `Resource::builder_empty()`. See
[#2322](https://github.com/open-telemetry/opentelemetry-rust/pull/2322) for a migration guide.

Example Usage:

```rust
Expand Down Expand Up @@ -181,7 +180,7 @@ field as metadata, a feature introduced in version 0.1.40.
- Does not support `hyper`, `reqwest` HTTP Clients
- Does not support multiple concurrent exports (`with_max_concurrent_exports`
is not supported). This existed only for traces.

If this applies to you, you can get the old behavior back by following steps
below:
- Enable one or more of the feature flag from below
Expand Down Expand Up @@ -249,7 +248,7 @@ limit.
- *Breaking*: Rename namespaces for InMemoryExporters. (The module is still
under "testing" feature flag)
before:

```rust
opentelemetry_sdk::testing::logs::{InMemoryLogExporter,
InMemoryLogExporterBuilder};
Expand All @@ -260,7 +259,7 @@ limit.
```

now:

```rust
opentelemetry_sdk::logs::{InMemoryLogExporter, InMemoryLogExporterBuilder};
opentelemetry_sdk::trace::{InMemorySpanExporter,
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-sdk/src/logs/batch_log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
};
use std::sync::mpsc::{self, RecvTimeoutError, SyncSender};

use opentelemetry::{otel_debug, otel_error, otel_info, otel_warn, InstrumentationScope};
use opentelemetry::{otel_debug, otel_error, otel_warn, InstrumentationScope};

use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::{cmp::min, env, sync::Mutex};
Expand Down Expand Up @@ -342,7 +342,7 @@ impl BatchLogProcessor {
let handle = thread::Builder::new()
.name("OpenTelemetry.Logs.BatchProcessor".to_string())
.spawn(move || {
otel_info!(
otel_debug!(
name: "BatchLogProcessor.ThreadStarted",
interval_in_millisecs = config.scheduled_delay.as_millis(),
max_export_batch_size = config.max_export_batch_size,
Expand Down Expand Up @@ -476,7 +476,7 @@ impl BatchLogProcessor {
}
}
}
otel_info!(
otel_debug!(
name: "BatchLogProcessor.ThreadStopped"
);
})
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-sdk/src/metrics/meter_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl SdkMeterProvider {
/// There is no guaranteed that all telemetry be flushed or all resources have
/// been released on error.
pub fn shutdown(&self) -> OTelSdkResult {
otel_info!(
otel_debug!(
name: "MeterProvider.Shutdown",
message = "User initiated shutdown of MeterProvider."
);
Expand Down Expand Up @@ -164,7 +164,7 @@ impl Drop for SdkMeterProviderInner {
reason = format!("{}", err)
);
} else {
otel_info!(
otel_debug!(
name: "MeterProvider.Drop.ShutdownCompleted",
);
}
Expand Down Expand Up @@ -310,7 +310,7 @@ impl MeterProviderBuilder {
}),
};

otel_info!(
otel_debug!(
name: "MeterProvider.Built",
);
meter_provider
Expand Down
20 changes: 10 additions & 10 deletions opentelemetry-sdk/src/metrics/periodic_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
.spawn(move || {
let mut interval_start = Instant::now();
let mut remaining_interval = interval;
otel_info!(
otel_debug!(
name: "PeriodReaderThreadStarted",
interval_in_millisecs = interval.as_millis(),
);
Expand Down Expand Up @@ -190,16 +190,16 @@

if export_result.is_err() {
if response_sender.send(false).is_err() {
otel_info!(
otel_debug!(

Check warning on line 193 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L193

Added line #L193 was not covered by tests
name: "PeriodReader.Flush.ResponseSendError",
message = "PeriodicReader's flush has failed, but unable to send this info back to caller.
message = "PeriodicReader's flush has failed, but unable to send this info back to caller.

Check warning on line 195 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L195

Added line #L195 was not covered by tests
This occurs when the caller has timed out waiting for the response. If you see this occuring frequently, consider increasing the flush timeout."
);
}
} else if response_sender.send(true).is_err() {
otel_info!(
otel_debug!(

Check warning on line 200 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L200

Added line #L200 was not covered by tests
name: "PeriodReader.Flush.ResponseSendError",
message = "PeriodicReader's flush has completed successfully, but unable to send this info back to caller.
message = "PeriodicReader's flush has completed successfully, but unable to send this info back to caller.

Check warning on line 202 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L202

Added line #L202 was not covered by tests
This occurs when the caller has timed out waiting for the response. If you see this occuring frequently, consider increasing the flush timeout."
);
}
Expand Down Expand Up @@ -253,14 +253,14 @@
if response_sender.send(false).is_err() {
otel_info!(
name: "PeriodReaderThreadShutdown.ResponseSendError",
message = "PeriodicReader's shutdown has failed, but unable to send this info back to caller.
message = "PeriodicReader's shutdown has failed, but unable to send this info back to caller.

Check warning on line 256 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L256

Added line #L256 was not covered by tests
This occurs when the caller has timed out waiting for the response. If you see this occuring frequently, consider increasing the shutdown timeout."
);
}
} else if response_sender.send(true).is_err() {
otel_info!(
otel_debug!(

Check warning on line 261 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L261

Added line #L261 was not covered by tests
name: "PeriodReaderThreadShutdown.ResponseSendError",
message = "PeriodicReader completed its shutdown, but unable to send this info back to caller.
message = "PeriodicReader completed its shutdown, but unable to send this info back to caller.

Check warning on line 263 in opentelemetry-sdk/src/metrics/periodic_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/periodic_reader.rs#L263

Added line #L263 was not covered by tests
This occurs when the caller has timed out waiting for the response. If you see this occuring frequently, consider increasing the shutdown timeout."
);
}
Expand Down Expand Up @@ -312,7 +312,7 @@
}
}
}
otel_info!(
otel_debug!(
name: "PeriodReaderThreadStopped"
);
});
Expand Down Expand Up @@ -499,7 +499,7 @@
/// This function SHOULD be obtained from the exporter.
///
/// If not configured, the Cumulative temporality SHOULD be used.
///
///
/// [metric-reader]: https://github.com/open-telemetry/opentelemetry-specification/blob/0a78571045ca1dca48621c9648ec3c832c3c541c/specification/metrics/sdk.md#metricreader
fn temporality(&self, kind: InstrumentKind) -> Temporality {
kind.temporality_preference(self.inner.temporality(kind))
Expand Down
7 changes: 3 additions & 4 deletions opentelemetry-sdk/src/trace/span_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ use crate::resource::Resource;
use crate::trace::Span;
use crate::trace::{SpanData, SpanExporter};
use opentelemetry::Context;
use opentelemetry::{otel_debug, otel_warn};
use opentelemetry::{otel_error, otel_info};
use opentelemetry::{otel_debug, otel_error, otel_warn};
use std::cmp::min;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -317,7 +316,7 @@ impl BatchSpanProcessor {
let handle = thread::Builder::new()
.name("OpenTelemetry.Traces.BatchProcessor".to_string())
.spawn(move || {
otel_info!(
otel_debug!(
name: "BatchSpanProcessor.ThreadStarted",
interval_in_millisecs = config.scheduled_delay.as_millis(),
max_export_batch_size = config.max_export_batch_size,
Expand Down Expand Up @@ -413,7 +412,7 @@ impl BatchSpanProcessor {
}
}
}
otel_info!(
otel_debug!(
name: "BatchSpanProcessor.ThreadStopped"
);
})
Expand Down