File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,11 @@ Options:
287
287
288
288
[env: JSON_OUTPUT=]
289
289
290
+ --disable-spans
291
+ Disables the span logging trace
292
+
293
+ [env: DISABLE_SPANS=]
294
+
290
295
--otlp-endpoint <OTLP_ENDPOINT>
291
296
The grpc endpoint for opentelemetry. Telemetry is sent to this endpoint as OTLP over gRPC. e.g. `http://localhost:4317`
292
297
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 @@ -145,6 +145,10 @@ struct Args {
145
145
#[ clap( long, env) ]
146
146
json_output : bool ,
147
147
148
+ // Whether or not to include the log trace through spans
149
+ #[ clap( long, env) ]
150
+ disable_spans : bool ,
151
+
148
152
/// The grpc endpoint for opentelemetry. Telemetry is sent to this endpoint as OTLP over gRPC.
149
153
/// e.g. `http://localhost:4317`
150
154
#[ clap( long, env) ]
@@ -170,6 +174,7 @@ async fn main() -> Result<()> {
170
174
args. otlp_endpoint . as_ref ( ) ,
171
175
args. otlp_service_name . clone ( ) ,
172
176
args. json_output ,
177
+ args. disable_spans ,
173
178
) ;
174
179
175
180
tracing:: info!( "{args:?}" ) ;
You can’t perform that action at this time.
0 commit comments