Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Aug 8, 2024
1 parent da5a5ab commit f3b63fb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions opentelemetry-sdk/src/logs/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{borrow::Cow, time::SystemTime};
const PREALLOCATED_ATTRIBUTE_CAPACITY: usize = 5;

/// A vector of `Option<(Key, AnyValue)>` with default capacity.
pub(crate) type AttributesGrowableArray =
pub(crate) type LogRecordAttributes =
GrowableArray<Option<(Key, AnyValue)>, PREALLOCATED_ATTRIBUTE_CAPACITY>;

#[derive(Debug, Default, Clone, PartialEq)]
Expand Down Expand Up @@ -43,7 +43,7 @@ pub struct LogRecord {
pub body: Option<AnyValue>,

/// Additional attributes associated with this record
pub(crate) attributes: AttributesGrowableArray,
pub(crate) attributes: LogRecordAttributes,
}

impl opentelemetry::logs::LogRecord for LogRecord {
Expand Down Expand Up @@ -250,25 +250,22 @@ mod tests {

#[test]
fn compare_log_record() {
let log_record = LogRecord {
let mut log_record = LogRecord {
event_name: Some(Cow::Borrowed("test_event")),
target: Some(Cow::Borrowed("foo::bar")),
timestamp: Some(SystemTime::now()),
observed_timestamp: Some(SystemTime::now()),
severity_text: Some(Cow::Borrowed("ERROR")),
severity_number: Some(Severity::Error),
body: Some(AnyValue::String("Test body".into())),
attributes: {
let mut hybrid_vec = AttributesGrowableArray::new();
hybrid_vec.push(Some((Key::new("key"), AnyValue::String("value".into()))));
hybrid_vec
},
attributes: LogRecordAttributes::new(),
trace_context: Some(TraceContext {
trace_id: TraceId::from_u128(1),
span_id: SpanId::from_u64(1),
trace_flags: Some(TraceFlags::default()),
}),
};
log_record.add_attribute(Key::new("key"), AnyValue::String("value".into()));

let log_record_cloned = log_record.clone();

Expand Down

0 comments on commit f3b63fb

Please sign in to comment.