Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions internal/collector/otel_collector_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,16 @@ func (oc *Collector) processReceivers(ctx context.Context, receivers []config.Ot
}
}

// nolint: revive, cyclop
func (oc *Collector) bootup(ctx context.Context) error {
slog.InfoContext(ctx, "Starting OTel collector")
errChan := make(chan error)

go func() {
if oc.service == nil {
errChan <- fmt.Errorf("unable to start OTel collector: service is nil")
}

appErr := oc.service.Run(ctx)
if appErr != nil {
errChan <- appErr
Expand Down Expand Up @@ -212,9 +217,9 @@ func (oc *Collector) Close(ctx context.Context) error {
oc.service.Shutdown()
oc.cancel()

settings := oc.config.Client.Backoff
settings := *oc.config.Client.Backoff
settings.MaxElapsedTime = maxTimeToWaitForShutdown
err := backoff.WaitUntil(ctx, settings, func() error {
err := backoff.WaitUntil(ctx, &settings, func() error {
if oc.service.GetState() == otelcol.StateClosed {
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion internal/file/file_manager_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ func (fms *FileManagerService) UpdateOverview(
return response, nil
}

backoffSettings := fms.agentConfig.Client.Backoff
response, err := backoff.RetryWithData(
sendUpdateOverview,
backoffHelpers.Context(backOffCtx, fms.agentConfig.Client.Backoff),
backoffHelpers.Context(backOffCtx, backoffSettings),
)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions internal/watcher/instance/instance_watcher_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ func (iw *InstanceWatcherService) checkForUpdates(
iw.sendNginxConfigContextUpdate(newCtx, nginxConfigContext)
iw.nginxConfigCache[nginxConfigContext.InstanceID] = nginxConfigContext
proto.UpdateNginxInstanceRuntime(newInstance, nginxConfigContext)
iw.cacheMutex.Lock()
iw.instanceCache[newInstance.GetInstanceMeta().GetInstanceId()] = newInstance
iw.cacheMutex.Unlock()
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions internal/watcher/process/process_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (
"context"
"strings"

"github.com/shirou/gopsutil/v4/process"

"github.com/nginx/agent/v3/pkg/nginxprocess"
"github.com/shirou/gopsutil/v4/process"
)

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6@v6.8.1 -generate
Expand Down