@@ -34,18 +34,31 @@ struct Arguments {
34
34
35
35
#[ tokio:: main]
36
36
async fn main ( ) -> Result < ( ) > {
37
+ let args = Arguments :: parse ( ) ;
38
+
39
+ if !args. config . as_path ( ) . exists ( ) {
40
+ return Err ( anyhow ! ( "No config found under {:?}" , args. config. to_str( ) ) ) ;
41
+ }
42
+
43
+ println ! ( "Loading config from {:?}" , args. config. display( ) ) ;
44
+
45
+ // Parse config early for logging channel capacity
46
+ let config = Config :: new ( args. config ) . context ( "Could not parse config" ) ?;
47
+
37
48
// Initialize a Tracing Subscriber
38
49
let fmt_layer = tracing_subscriber:: fmt:: layer ( )
39
50
. with_file ( false )
40
51
. with_line_number ( true )
41
52
. with_thread_ids ( true )
42
- . with_target ( true )
43
53
. with_ansi ( std:: io:: stderr ( ) . is_terminal ( ) ) ;
44
54
45
55
// Set up the OpenTelemetry exporter, defaults to 127.0.0.1:4317
46
56
let otlp_exporter = opentelemetry_otlp:: new_exporter ( )
47
57
. tonic ( )
48
- . with_timeout ( Duration :: from_secs ( 3 ) ) ;
58
+ . with_endpoint ( & config. opentelemetry . exporter_endpoint )
59
+ . with_timeout ( Duration :: from_secs (
60
+ config. opentelemetry . exporter_timeout_secs ,
61
+ ) ) ;
49
62
50
63
// Set up the OpenTelemetry tracer
51
64
let tracer = opentelemetry_otlp:: new_pipeline ( )
@@ -69,17 +82,6 @@ async fn main() -> Result<()> {
69
82
registry. with ( fmt_layer. json ( ) ) . init ( ) ;
70
83
}
71
84
72
- let args = Arguments :: parse ( ) ;
73
-
74
- if !args. config . as_path ( ) . exists ( ) {
75
- return Err ( anyhow ! ( "No config found under {:?}" , args. config. to_str( ) ) ) ;
76
- }
77
-
78
- println ! ( "Loading config from {:?}" , args. config. display( ) ) ;
79
-
80
- // Parse config early for logging channel capacity
81
- let config = Config :: new ( args. config ) . context ( "Could not parse config" ) ?;
82
-
83
85
// Launch the application. If it fails, print the full backtrace and exit. RUST_BACKTRACE
84
86
// should be set to 1 for this otherwise it will only print the top-level error.
85
87
if let Err ( err) = start ( config) . await {
0 commit comments