Commit 91e5743 1 parent aad5b02 commit 91e5743 Copy full SHA for 91e5743
File tree 1 file changed +8
-3
lines changed
opentelemetry-otlp/tests/integration_test/src
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
use anyhow:: Result ;
2
2
use opentelemetry_proto:: tonic:: logs:: v1:: { LogRecord , LogsData , ResourceLogs } ;
3
- use std:: fs:: File ;
3
+ use tracing:: info;
4
+ use std:: { fs:: File , io:: Read } ;
4
5
5
6
// Given two ResourceLogs, assert that they are equal except for the timestamps
6
7
pub struct LogsAsserter {
@@ -98,8 +99,12 @@ impl std::fmt::Debug for LogRecordWrapper {
98
99
99
100
// read a file contains ResourceSpans in json format
100
101
pub fn read_logs_from_json ( file : File ) -> Result < Vec < ResourceLogs > > {
101
- let reader = std:: io:: BufReader :: new ( file) ;
102
+ // print file contents
103
+ let mut contents = String :: new ( ) ;
104
+ let mut reader = std:: io:: BufReader :: new ( & file) ;
105
+ reader. read_to_string ( & mut contents) ?;
106
+ info ! ( file_contents=contents) ;
102
107
103
- let log_data: LogsData = serde_json:: from_reader ( reader ) ?;
108
+ let log_data: LogsData = serde_json:: from_str ( & contents ) ?;
104
109
Ok ( log_data. resource_logs )
105
110
}
You can’t perform that action at this time.
0 commit comments