File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -438,8 +438,10 @@ func mainWithExitCode() flags.ExitCode {
438438 go readTracePipe (mainCtx )
439439 }
440440
441- if err := exporter .Start (context .Background ()); err != nil {
442- return flags .Failure ("Failed to start OTLP exporter: %v" , err )
441+ if exporter != nil {
442+ if err := exporter .Start (context .Background ()); err != nil {
443+ return flags .Failure ("Failed to start OTLP exporter: %v" , err )
444+ }
443445 }
444446
445447 // Block waiting for a signal to indicate the program should terminate
@@ -453,11 +455,13 @@ func mainWithExitCode() flags.ExitCode {
453455 }
454456 }
455457
456- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
457- defer cancel ()
458+ if exporter != nil {
459+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
460+ defer cancel ()
458461
459- if err := exporter .Shutdown (ctx ); err != nil {
460- log .Infof ("Failed to stop exporter: %v" , err )
462+ if err := exporter .Shutdown (ctx ); err != nil {
463+ log .Infof ("Failed to stop exporter: %v" , err )
464+ }
461465 }
462466
463467 log .Info ("Exiting ..." )
You can’t perform that action at this time.
0 commit comments