File tree Expand file tree Collapse file tree 4 files changed +9
-11
lines changed
opentelemetry-appender-tracing
opentelemetry-sdk/src/logs Expand file tree Collapse file tree 4 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ when conversion is feasible. Otherwise stored as
4747` opentelemetry::logs::AnyValue::String ` . This avoids unnecessary string
4848allocation when values can be represented in their original types.
4949
50+ - perf - small perf improvement by avoiding string allocation of ` target `
51+
5052## 0.28.1
5153
5254Released 2025-Feb-12
Original file line number Diff line number Diff line change 1010 | noop_layer_disabled | 12 ns |
1111 | noop_layer_enabled | 25 ns |
1212 | ot_layer_disabled | 19 ns |
13- | ot_layer_enabled | 167 ns |
13+ | ot_layer_enabled | 155 ns |
1414
1515 Hardware: Apple M4 Pro
1616 Total Number of Cores: 14 (10 performance and 4 efficiency)
2020 | noop_layer_disabled | 8 ns |
2121 | noop_layer_enabled | 14 ns |
2222 | ot_layer_disabled | 12 ns |
23- | ot_layer_enabled | 186 ns |
23+ | ot_layer_enabled | 130 ns |
2424*/
2525
2626use criterion:: { criterion_group, criterion_main, Criterion } ;
Original file line number Diff line number Diff line change @@ -189,8 +189,7 @@ where
189189
190190 let mut log_record = self . logger . create_log_record ( ) ;
191191
192- // TODO: Fix heap allocation
193- log_record. set_target ( target. to_string ( ) ) ;
192+ log_record. set_target ( target) ;
194193 log_record. set_event_name ( name) ;
195194 log_record. set_severity_number ( severity) ;
196195 log_record. set_severity_text ( metadata. level ( ) . as_str ( ) ) ;
Original file line number Diff line number Diff line change @@ -34,14 +34,11 @@ impl opentelemetry::logs::Logger for SdkLogger {
3434
3535 //let mut log_record = record;
3636 if record. trace_context . is_none ( ) {
37- let trace_context = Context :: map_current ( |cx| {
38- cx. has_active_span ( )
39- . then ( || TraceContext :: from ( cx. span ( ) . span_context ( ) ) )
37+ Context :: map_current ( |cx| {
38+ cx. has_active_span ( ) . then ( || {
39+ record. trace_context = Some ( TraceContext :: from ( cx. span ( ) . span_context ( ) ) )
40+ } )
4041 } ) ;
41-
42- if let Some ( ref trace_context) = trace_context {
43- record. trace_context = Some ( trace_context. clone ( ) ) ;
44- }
4542 }
4643 if record. observed_timestamp . is_none ( ) {
4744 record. observed_timestamp = Some ( now ( ) ) ;
You can’t perform that action at this time.
0 commit comments