Skip to content

Commit

Permalink
🐛 Fixed attempted Jaeger connection when tracing disabled (#654)
Browse files Browse the repository at this point in the history
Signed-off-by: JonahSussman <[email protected]>
  • Loading branch information
JonahSussman authored Feb 13, 2025
1 parent 55245f6 commit cca1671
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions kai_analyzer_rpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,20 @@ func main() {
}
l.Info("Maven is installed")

// Set up OpenTelemetry.
otelShutdown, err := tracing.SetupOTelSDK(context.Background())
if err != nil {
return
// Check if ENABLE_TRACING is set in the environment.
if _, enable_tracing := os.LookupEnv("ENABLE_TRACING"); enable_tracing {
// Set up OpenTelemetry.
otelShutdown, err := tracing.SetupOTelSDK(context.Background())
if err != nil {
return
}

// Handle shutdown properly so nothing leaks.
defer func() {
err = errors.Join(err, otelShutdown(context.Background()))
}()
}
// Handle shutdown properly so nothing leaks.
defer func() {
err = errors.Join(err, otelShutdown(context.Background()))
}()

l.Info("Starting Analyzer", "source-dir", *sourceDirectory, "rules-dir", *rules, "lspServerPath", *lspServerPath, "bundles", *bundles, "depOpenSourceLabelsFile", *depOpenSourceLabelsFile)
// We need to start up the JSON RPC server and start listening for messages
analyzerService, err := service.NewAnalyzer(
Expand Down

0 comments on commit cca1671

Please sign in to comment.