File tree 4 files changed +25
-4
lines changed
4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,11 @@ Options:
290
290
291
291
[env: JSON_OUTPUT=]
292
292
293
+ --disable-spans
294
+ Disables the span logging trace
295
+
296
+ [env: DISABLE_SPANS=]
297
+
293
298
--otlp-endpoint <OTLP_ENDPOINT>
294
299
The grpc endpoint for opentelemetry. Telemetry is sent to this endpoint as OTLP over gRPC. e.g. `http://localhost:4317`
295
300
Original file line number Diff line number Diff line change @@ -182,6 +182,11 @@ Options:
182
182
183
183
[env: JSON_OUTPUT=]
184
184
185
+ --disable-spans
186
+ Disables the span logging trace
187
+
188
+ [env: DISABLE_SPANS=]
189
+
185
190
--otlp-endpoint <OTLP_ENDPOINT>
186
191
The grpc endpoint for opentelemetry. Telemetry is sent to this endpoint as OTLP over gRPC. e.g. `http://localhost:4317`
187
192
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ pub fn init_logging(
14
14
otlp_endpoint : Option < & String > ,
15
15
otlp_service_name : String ,
16
16
json_output : bool ,
17
+ disable_spans : bool ,
17
18
) -> bool {
18
19
let mut layers = Vec :: new ( ) ;
19
20
@@ -22,10 +23,15 @@ pub fn init_logging(
22
23
. with_file ( true )
23
24
. with_line_number ( true ) ;
24
25
25
- let fmt_layer = match json_output {
26
- true => fmt_layer. json ( ) . flatten_event ( true ) . boxed ( ) ,
27
- false => fmt_layer. boxed ( ) ,
28
- } ;
26
+ let fmt_layer = match json_output {
27
+ true => fmt_layer
28
+ . json ( )
29
+ . flatten_event ( true )
30
+ . with_current_span ( !disable_spans)
31
+ . with_span_list ( !disable_spans)
32
+ . boxed ( ) ,
33
+ false => fmt_layer. boxed ( ) ,
34
+ } ;
29
35
layers. push ( fmt_layer) ;
30
36
31
37
// OpenTelemetry tracing layer
Original file line number Diff line number Diff line change @@ -150,6 +150,10 @@ struct Args {
150
150
#[ clap( long, env) ]
151
151
json_output : bool ,
152
152
153
+ // Whether or not to include the log trace through spans
154
+ #[ clap( long, env) ]
155
+ disable_spans : bool ,
156
+
153
157
/// The grpc endpoint for opentelemetry. Telemetry is sent to this endpoint as OTLP over gRPC.
154
158
/// e.g. `http://localhost:4317`
155
159
#[ clap( long, env) ]
@@ -175,6 +179,7 @@ async fn main() -> Result<()> {
175
179
args. otlp_endpoint . as_ref ( ) ,
176
180
args. otlp_service_name . clone ( ) ,
177
181
args. json_output ,
182
+ args. disable_spans ,
178
183
) ;
179
184
180
185
tracing:: info!( "{args:?}" ) ;
You can’t perform that action at this time.
0 commit comments