Skip to content

Commit 699dcb8

Browse files
committed
fix test
1 parent f0a5efa commit 699dcb8

File tree

1 file changed

+8
-13
lines changed
  • opentelemetry-appender-tracing/src

1 file changed

+8
-13
lines changed

opentelemetry-appender-tracing/src/layer.rs

+8-13
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ where
169169
log_record.set_event_name(meta.name());
170170
log_record.set_severity_number(severity_of_level(meta.level()));
171171
log_record.set_severity_text(meta.level().to_string().into());
172-
#[cfg(feature = "experimental_metadata_attributes")]
173172
let mut visitor = EventVisitor::new(&mut log_record);
174173
#[cfg(feature = "experimental_metadata_attributes")]
175174
visitor.visit_experimental_metadata(meta);
@@ -259,10 +258,9 @@ mod tests {
259258
.clone()
260259
.expect("Attributes are expected");
261260
#[cfg(not(feature = "experimental_metadata_attributes"))]
262-
assert_eq!(attributes.len(), 4);
261+
assert_eq!(attributes.len(), 3);
263262
#[cfg(feature = "experimental_metadata_attributes")]
264-
assert_eq!(attributes.len(), 9);
265-
assert!(attributes.contains(&(Key::new("name"), "my-event-name".into())));
263+
assert_eq!(attributes.len(), 8);
266264
assert!(attributes.contains(&(Key::new("event_id"), 20.into())));
267265
assert!(attributes.contains(&(Key::new("user_name"), "otel".into())));
268266
assert!(attributes.contains(&(Key::new("user_email"), "otel@opentelemetry.io".into())));
@@ -356,10 +354,9 @@ mod tests {
356354
.clone()
357355
.expect("Attributes are expected");
358356
#[cfg(not(feature = "experimental_metadata_attributes"))]
359-
assert_eq!(attributes.len(), 4);
357+
assert_eq!(attributes.len(), 3);
360358
#[cfg(feature = "experimental_metadata_attributes")]
361-
assert_eq!(attributes.len(), 9);
362-
assert!(attributes.contains(&(Key::new("name"), "my-event-name".into())));
359+
assert_eq!(attributes.len(), 8);
363360
assert!(attributes.contains(&(Key::new("event_id"), 20.into())));
364361
assert!(attributes.contains(&(Key::new("user_name"), "otel".into())));
365362
assert!(attributes.contains(&(Key::new("user_email"), "otel@opentelemetry.io".into())));
@@ -417,6 +414,7 @@ mod tests {
417414
assert!(log.record.trace_context.is_none());
418415

419416
// Validate attributes
417+
#[cfg(feature = "experimental_metadata_attributes")]
420418
let attributes: Vec<(Key, AnyValue)> = log
421419
.record
422420
.attributes
@@ -425,9 +423,7 @@ mod tests {
425423

426424
// Attributes can be polluted when we don't use this feature.
427425
#[cfg(feature = "experimental_metadata_attributes")]
428-
assert_eq!(attributes.len(), 6);
429-
430-
assert!(attributes.contains(&(Key::new("name"), "log event".into())));
426+
assert_eq!(attributes.len(), 5);
431427

432428
#[cfg(feature = "experimental_metadata_attributes")]
433429
{
@@ -514,6 +510,7 @@ mod tests {
514510
);
515511

516512
// validate attributes.
513+
#[cfg(feature = "experimental_metadata_attributes")]
517514
let attributes: Vec<(Key, AnyValue)> = log
518515
.record
519516
.attributes
@@ -522,9 +519,7 @@ mod tests {
522519

523520
// Attributes can be polluted when we don't use this feature.
524521
#[cfg(feature = "experimental_metadata_attributes")]
525-
assert_eq!(attributes.len(), 6);
526-
527-
assert!(attributes.contains(&(Key::new("name"), "log event".into())));
522+
assert_eq!(attributes.len(), 5);
528523

529524
#[cfg(feature = "experimental_metadata_attributes")]
530525
{

0 commit comments

Comments
 (0)