Skip to content

Commit 252c9e7

Browse files
committed
add changelog
1 parent af35d3b commit 252c9e7

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

opentelemetry-sdk/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
- Add "metrics", "logs" to default features. With this, default feature list is
66
"trace", "metrics" and "logs".
77

8+
- **Breaking** [1726](https://github.com/open-telemetry/opentelemetry-rust/pull/1726)
9+
Update `LogProcessor::emit() method to take mutable reference to LogData. This is breaking
10+
change for LogProcessor developers. If the processor needs to invoke the exporter
11+
asynchronously, it should clone the data to ensure it can be safely processed without
12+
lifetime issues. Any changes made to the log data in this method will be reflected in
13+
the next log processor in the chain, as well as to the exporter.
14+
15+
- **Breaking** [1726](https://github.com/open-telemetry/opentelemetry-rust/pull/1726)
16+
Update `LogExporter::export() method to accepts a batch of log data, which can be either a
17+
reference or owned `LogData`. If the exporter needs to process the log data
18+
asynchronously, it should clone the log data to ensure it can be safely processed without
19+
lifetime issues.
20+
821
## v0.23.0
922

1023
- Fix SimpleSpanProcessor to be consistent with log counterpart. Also removed

opentelemetry-sdk/benches/log.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! run with `$ cargo bench --bench log --features=logs -- --exact <test_name>` to run specific test for logs
2+
//! So to run test named "full-log-with-attributes/with-context" you would run `$ cargo bench --bench log --features=logs -- --exact full-log-with-attributes/with-context`
3+
//! To run all tests for logs you would run `$ cargo bench --bench log --features=logs`
4+
//!
5+
16
use std::collections::HashMap;
27
use std::time::SystemTime;
38

opentelemetry-sdk/src/logs/log_processor.rs

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ const OTEL_BLRP_MAX_EXPORT_BATCH_SIZE_DEFAULT: usize = 512;
4646
/// [`Logger`]: crate::logs::Logger
4747
pub trait LogProcessor: Send + Sync + Debug {
4848
/// Called when a log record is ready to processed and exported.
49+
///
50+
/// This method receives a mutable reference to `LogData`. If the processor
51+
/// needs to handle the export asynchronously, it should clone the data to
52+
/// ensure it can be safely processed without lifetime issues. Any changes
53+
/// made to the log data in this method will be reflected in the next log
54+
/// processor in the chain.
55+
///
56+
/// # Parameters
57+
/// - `data`: A mutable reference to `LogData` representing the log record.
4958
fn emit(&self, data: &mut LogData);
5059
/// Force the logs lying in the cache to be exported.
5160
fn force_flush(&self) -> LogResult<()>;

0 commit comments

Comments
 (0)