diff --git a/opentelemetry-otlp/tests/integration_test/expected/serialized_traces.json b/opentelemetry-otlp/tests/integration_test/expected/serialized_traces.json deleted file mode 100644 index 849e66dd7b..0000000000 --- a/opentelemetry-otlp/tests/integration_test/expected/serialized_traces.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "resourceSpans": [ - { - "resource": { - "attributes": [ - { - "key": "service.name", - "value": { - "stringValue": "basic-otlp-tracing-example" - } - } - ], - "droppedAttributesCount": 0 - }, - "scopeSpans": [ - { - "scope": { - "name": "ex.com/basic", - "version": "", - "attributes": [], - "droppedAttributesCount": 0 - }, - "spans": [ - { - "traceId": "9b458af7378cba65253d7042d34fc72e", - "spanId": "cd7cf7bf939930b7", - "traceState": "", - "parentSpanId": "d58cf2d702a061e0", - "flags": 0, - "name": "Sub operation...", - "kind": 1, - "startTimeUnixNano": "1703985537070566698", - "endTimeUnixNano": "1703985537070572718", - "attributes": [ - { - "key": "lemons", - "value": { - "stringValue": "five" - } - } - ], - "droppedAttributesCount": 0, - "events": [ - { - "timeUnixNano": "1703985537070567697", - "name": "Sub span event", - "attributes": [], - "droppedAttributesCount": 0 - } - ], - "droppedEventsCount": 0, - "links": [], - "droppedLinksCount": 0, - "status": { - "message": "", - "code": 0 - } - } - ], - "schemaUrl": "" - } - ], - "schemaUrl": "" - }, - { - "resource": { - "attributes": [ - { - "key": "service.name", - "value": { - "stringValue": "basic-otlp-tracing-example" - } - } - ], - "droppedAttributesCount": 0 - }, - "scopeSpans": [ - { - "scope": { - "name": "ex.com/basic", - "version": "", - "attributes": [], - "droppedAttributesCount": 0 - }, - "spans": [ - { - "traceId": "9b458af7378cba65253d7042d34fc72e", - "spanId": "d58cf2d702a061e0", - "traceState": "", - "parentSpanId": "", - "flags": 0, - "name": "operation", - "kind": 1, - "startTimeUnixNano": "1703985537070558635", - "endTimeUnixNano": "1703985537070580454", - "attributes": [ - { - "key": "ex.com/another", - "value": { - "stringValue": "yes" - } - } - ], - "droppedAttributesCount": 0, - "events": [ - { - "timeUnixNano": "1703985537070563326", - "name": "Nice operation!", - "attributes": [ - { - "key": "bogons", - "value": { - "intValue": "100" - } - } - ], - "droppedAttributesCount": 0 - } - ], - "droppedEventsCount": 0, - "links": [], - "droppedLinksCount": 0, - "status": { - "message": "", - "code": 0 - } - } - ], - "schemaUrl": "" - } - ], - "schemaUrl": "" - } - ] -} \ No newline at end of file diff --git a/opentelemetry-otlp/tests/integration_test/tests/traces.rs b/opentelemetry-otlp/tests/integration_test/tests/traces.rs index f7f3a132fc..a6a3980e01 100644 --- a/opentelemetry-otlp/tests/integration_test/tests/traces.rs +++ b/opentelemetry-otlp/tests/integration_test/tests/traces.rs @@ -88,15 +88,25 @@ pub fn test_assert_span_eq() { #[test] pub fn test_serde() { - let spans = read_spans_from_json(File::open("./expected/traces.json").expect("Failed to read traces.json")); - let json = serde_json::to_string_pretty(&TracesData { resource_spans: spans }).expect("Failed to serialize spans to json"); + let spans = read_spans_from_json( + File::open("./expected/traces.json").expect("Failed to read traces.json"), + ); + let json = serde_json::to_string_pretty(&TracesData { + resource_spans: spans, + }) + .expect("Failed to serialize spans to json"); // Write to file. let mut file = File::create("./expected/serialized_traces.json").unwrap(); file.write_all(json.as_bytes()).unwrap(); - let left = read_spans_from_json(File::open("./expected/traces.json").expect("Failed to read traces.json")); - let right = read_spans_from_json(File::open("./expected/serialized_traces.json").expect("Failed to read serialized_traces.json")); + let left = read_spans_from_json( + File::open("./expected/traces.json").expect("Failed to read traces.json"), + ); + let right = read_spans_from_json( + File::open("./expected/serialized_traces.json") + .expect("Failed to read serialized_traces.json"), + ); TraceAsserter::new(left, right).assert(); -} \ No newline at end of file +}