Skip to content

Commit

Permalink
Merge branch 'develop' into fix_attempt_2
Browse files Browse the repository at this point in the history
  • Loading branch information
etaques authored Feb 16, 2023
2 parents fb38904 + 3b72413 commit f54f08e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sinker/otel/bridgeservice/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (bs *SinkerOtelBridgeService) NotifyActiveSink(ctx context.Context, mfOwner
bs.logger.Error("unable to retrieve the sink config", zap.Error(err))
return err
}

// only updates sink state if status Idle or Unknown
if cfgRepo.State == config.Idle || cfgRepo.State == config.Unknown {
cfgRepo.LastRemoteWrite = time.Now()
Expand All @@ -60,17 +61,18 @@ func (bs *SinkerOtelBridgeService) NotifyActiveSink(ctx context.Context, mfOwner
bs.logger.Error("error during update sink cache", zap.String("sinkId", sinkId), zap.Error(err))
return err
}
if cfgRepo.State == config.Active {
cfgRepo.LastRemoteWrite = time.Now()
bs.logger.Info("sink is already active, skipping")
err = bs.sinkerCache.AddActivity(mfOwnerId, sinkId)
if err != nil {
bs.logger.Error("error during update last remote write", zap.String("sinkId", sinkId), zap.Error(err))
return err
}
}
bs.logger.Info("notified active sink", zap.String("sinkID", sinkId), zap.String("newState", newState))
} else if cfgRepo.State == config.Error {
cfgRepo.Msg = message
} else if cfgRepo.State == config.Active {
cfgRepo.LastRemoteWrite = time.Now()
bs.logger.Info("sink is already active, skipping")
err = bs.sinkerCache.AddActivity(mfOwnerId, sinkId)
if err != nil {
bs.logger.Error("error during update last remote write", zap.String("sinkId", sinkId), zap.Error(err))
return err
}
}

return nil
Expand Down

0 comments on commit f54f08e

Please sign in to comment.