Skip to content

Commit 6e77504

Browse files
committed
cargo fmt
1 parent 22ea118 commit 6e77504

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

examples/stress_test.rs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
use opentelemetry::{global, trace::{FutureExt, SpanKind, TraceContextExt, Tracer}, Context, KeyValue};
1+
use opentelemetry::{
2+
global,
3+
trace::{FutureExt, SpanKind, TraceContextExt, Tracer},
4+
Context, KeyValue,
5+
};
26
use std::env;
37
use std::error::Error;
48
use std::ops::Add;
@@ -8,22 +12,29 @@ async fn mock_sql_call(n: u64, duration: u64) {
812
let tracer = global::tracer("run_in_child_process_new");
913
let now = SystemTime::now();
1014
let end_time = now.add(Duration::from_millis(duration));
11-
tracer.span_builder("test_db")
15+
tracer
16+
.span_builder("test_db")
1217
.with_kind(opentelemetry::trace::SpanKind::Client)
1318
.with_attributes(vec![
1419
KeyValue::new("service.name", "test-database"),
1520
KeyValue::new("db.system", "SQL"),
16-
KeyValue::new("db.statement", format!("SELECT * FROM test WHERE test_id = {}", n)),
21+
KeyValue::new(
22+
"db.statement",
23+
format!("SELECT * FROM test WHERE test_id = {}", n),
24+
),
1725
])
18-
.with_start_time(now).with_end_time(end_time).start(&tracer);
26+
.with_start_time(now)
27+
.with_end_time(end_time)
28+
.start(&tracer);
1929
}
2030

2131
async fn mock_serve_http_request(n: u64) {
2232
let tracer = global::tracer("named tracer");
2333
let now = SystemTime::now();
2434
let duration = 10 + (n % 50);
2535
let end_time = now.add(Duration::from_millis(duration));
26-
let span = tracer.span_builder("localhost")
36+
let span = tracer
37+
.span_builder("localhost")
2738
.with_attributes(vec![
2839
KeyValue::new("http.status_code", 200),
2940
KeyValue::new("http.client_id", "127.0.0.1"),
@@ -36,7 +47,8 @@ async fn mock_serve_http_request(n: u64) {
3647
KeyValue::new("http.host", "localhost:80"),
3748
KeyValue::new("service.name", "test-http-server"),
3849
])
39-
.with_start_time(now).with_end_time(end_time)
50+
.with_start_time(now)
51+
.with_end_time(end_time)
4052
.with_kind(SpanKind::Server)
4153
.start(&tracer);
4254

@@ -51,8 +63,8 @@ async fn mock_serve_http_request(n: u64) {
5163
async fn main() -> Result<(), Box<dyn Error>> {
5264
env_logger::init();
5365

54-
let instrumentation_key = env::var("INSTRUMENTATION_KEY")
55-
.expect("env var INSTRUMENTATION_KEY should exist");
66+
let instrumentation_key =
67+
env::var("INSTRUMENTATION_KEY").expect("env var INSTRUMENTATION_KEY should exist");
5668

5769
// Please note with large NUM_ROOT_SPANS settings the batch span processor might start falling behind
5870
// You can mitigate this by configuring the batch span processor using the standard SDK environment variables
@@ -84,7 +96,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
8496

8597
let duration = timer.elapsed();
8698

87-
println!("Finished uploading {} root spans in: {:?}", num_root_spans, duration);
99+
println!(
100+
"Finished uploading {} root spans in: {:?}",
101+
num_root_spans, duration
102+
);
88103

89104
Ok(())
90-
}
105+
}

0 commit comments

Comments
 (0)