Skip to content

Commit 3d352d8

Browse files
lalitbcijothomas
andauthored
[Logs SDK] Deprecate LogData struct (#2325)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
1 parent 2ba2e7f commit 3d352d8

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

opentelemetry-sdk/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.with_resource(Resource::empty())
1818
.build();
1919
```
20+
- `logs::LogData` struct is deprecated, and scheduled to be removed from public API in `v0.28.0`.
2021

2122
## 0.27.0
2223

opentelemetry-sdk/src/logs/log_processor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ const OTEL_BLRP_MAX_EXPORT_BATCH_SIZE_DEFAULT: usize = 512;
4545
pub trait LogProcessor: Send + Sync + Debug {
4646
/// Called when a log record is ready to processed and exported.
4747
///
48-
/// This method receives a mutable reference to `LogData`. If the processor
48+
/// This method receives a mutable reference to `LogRecord`. If the processor
4949
/// needs to handle the export asynchronously, it should clone the data to
5050
/// ensure it can be safely processed without lifetime issues. Any changes
5151
/// made to the log data in this method will be reflected in the next log
5252
/// processor in the chain.
5353
///
5454
/// # Parameters
55-
/// - `record`: A mutable reference to `LogData` representing the log record.
55+
/// - `record`: A mutable reference to `LogRecord` representing the log record.
5656
/// - `instrumentation`: The instrumentation scope associated with the log record.
5757
fn emit(&self, data: &mut LogRecord, instrumentation: &InstrumentationScope);
5858
/// Force the logs lying in the cache to be exported.

opentelemetry-sdk/src/logs/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ pub use log_processor::{
1313
use opentelemetry::InstrumentationScope;
1414
pub use record::{LogRecord, TraceContext};
1515

16+
#[deprecated(
17+
since = "0.27.1",
18+
note = "The struct is not used anywhere in the SDK and will be removed in the next major release."
19+
)]
1620
/// `LogData` represents a single log event without resource context.
1721
#[derive(Clone, Debug)]
1822
pub struct LogData {

opentelemetry-sdk/src/testing/logs/in_memory_exporter.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::sync::{Arc, Mutex};
1010
/// An in-memory logs exporter that stores logs data in memory..
1111
///
1212
/// This exporter is useful for testing and debugging purposes.
13-
/// It stores logs in a `Vec<LogData>`. Logs can be retrieved using
13+
/// It stores logs in a `Vec<OwnedLogData>`. Logs can be retrieved using
1414
/// `get_emitted_logs` method.
1515
///
1616
/// # Example
@@ -65,9 +65,9 @@ pub struct OwnedLogData {
6565
pub struct LogDataWithResource {
6666
/// Log record
6767
pub record: LogRecord,
68-
/// Instrumentation details for the emitter who produced this `LogData`.
68+
/// Instrumentation details for the emitter who produced this `LogRecord`.
6969
pub instrumentation: InstrumentationScope,
70-
/// Resource for the emitter who produced this `LogData`.
70+
/// Resource for the emitter who produced this `LogRecord`.
7171
pub resource: Cow<'static, Resource>,
7272
}
7373

@@ -137,7 +137,7 @@ impl InMemoryLogExporterBuilder {
137137
}
138138

139139
impl InMemoryLogExporter {
140-
/// Returns the logs emitted via Logger as a vector of `LogData`.
140+
/// Returns the logs emitted via Logger as a vector of `LogDataWithResource`.
141141
///
142142
/// # Example
143143
///

0 commit comments

Comments
 (0)