Skip to content

Commit

Permalink
feat: enable opentelemetry for worker (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina authored Aug 28, 2024
1 parent d947041 commit 417f10e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cli/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import (
"github.com/goto/entropy/core"
"github.com/goto/entropy/core/module"
"github.com/goto/entropy/pkg/logger"
"github.com/goto/entropy/pkg/telemetry"
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/spf13/cobra"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
)

Expand All @@ -35,7 +38,18 @@ func cmdWorker() *cobra.Command {
return err
}

return StartWorkers(cmd.Context(), cfg)
ctx := cmd.Context()

telemetry.Init(ctx, cfg.Telemetry)
_, err = newrelic.NewApplication(
newrelic.ConfigAppName(cfg.Telemetry.ServiceName),
newrelic.ConfigLicense(cfg.Telemetry.NewRelicAPIKey),
)
if err != nil {
zap.L().Error("error initializing opentelemetry", zap.Error(err))
}

return StartWorkers(ctx, cfg)
})

return cmd
Expand Down

0 comments on commit 417f10e

Please sign in to comment.