Skip to content

Commit 07efe62

Browse files
committed
Fix integration test failing if experimental_metadata_attributes feature is passed
1 parent 81c9de0 commit 07efe62

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

opentelemetry-otlp/tests/integration_test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ reqwest-client = ["opentelemetry-otlp/reqwest-client", "opentelemetry-otlp/http-
2929
reqwest-blocking-client = ["opentelemetry-otlp/reqwest-blocking-client", "opentelemetry-otlp/http-proto", "opentelemetry-otlp/trace","opentelemetry-otlp/logs", "opentelemetry-otlp/metrics", "internal-logs"]
3030
tonic-client = ["opentelemetry-otlp/grpc-tonic", "opentelemetry-otlp/trace", "opentelemetry-otlp/logs", "opentelemetry-otlp/metrics", "internal-logs"]
3131
internal-logs = ["opentelemetry-otlp/internal-logs"]
32+
experimental_metadata_attributes = ["opentelemetry-appender-tracing/experimental_metadata_attributes"]
3233

3334
# Keep tonic as the default client
3435
default = ["tonic-client", "internal-logs"]

opentelemetry-otlp/tests/integration_test/src/logs_asserter.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use anyhow::Result;
2-
use opentelemetry_proto::tonic::logs::v1::{LogRecord, LogsData, ResourceLogs};
2+
use opentelemetry_proto::tonic::{
3+
common::v1::KeyValue,
4+
logs::v1::{LogRecord, LogsData, ResourceLogs},
5+
};
36
use std::fs::File;
47

58
// Given two ResourceLogs, assert that they are equal except for the timestamps
@@ -75,8 +78,22 @@ impl PartialEq for LogRecordWrapper {
7578
a.severity_text, b.severity_text,
7679
"severity_text does not match"
7780
);
81+
let a_attrs = a.attributes.clone();
82+
#[cfg(feature = "experimental_metadata_attributes")]
83+
let a_attrs: Vec<_> = a_attrs
84+
.into_iter()
85+
.filter(|KeyValue { key, .. }| !key.as_str().starts_with("code."))
86+
.collect();
87+
88+
let b_attrs = b.attributes.clone();
89+
#[cfg(feature = "experimental_metadata_attributes")]
90+
let b_attrs: Vec<_> = b_attrs
91+
.into_iter()
92+
.filter(|KeyValue { key, .. }| !key.as_str().starts_with("code."))
93+
.collect();
94+
7895
assert_eq!(a.body, b.body, "body does not match");
79-
assert_eq!(a.attributes, b.attributes, "attributes do not match");
96+
assert_eq!(a_attrs, b_attrs, "attributes do not match");
8097
assert_eq!(
8198
a.dropped_attributes_count, b.dropped_attributes_count,
8299
"dropped_attributes_count does not match"

opentelemetry-otlp/tests/integration_test/tests/logs_serialize_deserialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub async fn test_logs() -> Result<()> {
3737
info!(target: "my-target", "hello from {}. My price is {}.", "banana", 2.99);
3838
}
3939

40-
let _ = logger_provider.shutdown();
40+
logger_provider.shutdown().unwrap();
4141
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
4242
assert_logs_results(test_utils::LOGS_FILE, "expected/logs.json")?;
4343
Ok(())

0 commit comments

Comments
 (0)