Skip to content
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

[Logs SDK] Deprecate LogData struct #2325

Merged
merged 5 commits into from
Nov 23, 2024
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
1 change: 1 addition & 0 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.with_resource(Resource::empty())
.build();
```
- `logs::LogData` struct is deprecated, and scheduled to be removed from public API in `v0.28.0`.

## 0.27.0

Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/logs/log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ const OTEL_BLRP_MAX_EXPORT_BATCH_SIZE_DEFAULT: usize = 512;
pub trait LogProcessor: Send + Sync + Debug {
/// Called when a log record is ready to processed and exported.
///
/// This method receives a mutable reference to `LogData`. If the processor
/// This method receives a mutable reference to `LogRecord`. If the processor
/// needs to handle the export asynchronously, it should clone the data to
/// ensure it can be safely processed without lifetime issues. Any changes
/// made to the log data in this method will be reflected in the next log
/// processor in the chain.
///
/// # Parameters
/// - `record`: A mutable reference to `LogData` representing the log record.
/// - `record`: A mutable reference to `LogRecord` representing the log record.
/// - `instrumentation`: The instrumentation scope associated with the log record.
fn emit(&self, data: &mut LogRecord, instrumentation: &InstrumentationScope);
/// Force the logs lying in the cache to be exported.
Expand Down
4 changes: 4 additions & 0 deletions opentelemetry-sdk/src/logs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ pub use log_processor::{
use opentelemetry::InstrumentationScope;
pub use record::{LogRecord, TraceContext};

#[deprecated(
Copy link
Member

Choose a reason for hiding this comment

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

💯 nice!

since = "0.27.1",
note = "The struct is not used anywhere in the SDK and will be removed in the next major release."
)]
/// `LogData` represents a single log event without resource context.
#[derive(Clone, Debug)]
pub struct LogData {
Expand Down
8 changes: 4 additions & 4 deletions opentelemetry-sdk/src/testing/logs/in_memory_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::{Arc, Mutex};
/// An in-memory logs exporter that stores logs data in memory..
///
/// This exporter is useful for testing and debugging purposes.
/// It stores logs in a `Vec<LogData>`. Logs can be retrieved using
/// It stores logs in a `Vec<OwnedLogData>`. Logs can be retrieved using
/// `get_emitted_logs` method.
///
/// # Example
Expand Down Expand Up @@ -65,9 +65,9 @@ pub struct OwnedLogData {
pub struct LogDataWithResource {
/// Log record
pub record: LogRecord,
/// Instrumentation details for the emitter who produced this `LogData`.
/// Instrumentation details for the emitter who produced this `LogRecord`.
pub instrumentation: InstrumentationScope,
/// Resource for the emitter who produced this `LogData`.
/// Resource for the emitter who produced this `LogRecord`.
pub resource: Cow<'static, Resource>,
}

Expand Down Expand Up @@ -137,7 +137,7 @@ impl InMemoryLogExporterBuilder {
}

impl InMemoryLogExporter {
/// Returns the logs emitted via Logger as a vector of `LogData`.
/// Returns the logs emitted via Logger as a vector of `LogDataWithResource`.
///
/// # Example
///
Expand Down
Loading