This commit is contained in:
rasmus 2022-11-07 01:23:20 +02:00
parent fc9c1671b6
commit 3b52df7cba
2 changed files with 4 additions and 2 deletions

View File

@ -31,7 +31,7 @@ var (
Help: "Batch size for database submissions",
Buckets: []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000},
})
promShipperMongoSentError = promauto.NewCounterVec(prom.CounterOpts{
promShipperDbSendError = promauto.NewCounterVec(prom.CounterOpts{
Namespace: PrometheusPrefix,
// Subsystem: "shipper",
Name: "insertion_error", // "errors",
@ -88,6 +88,7 @@ func (s *submitter) sender(name string, sendQueue <-chan mLog) {
if !ok {
return
}
promShipperBatchSizeResult.Observe(float64(len(batch)))
promShipperSynced.WithLabelValues(baseName).Set(0)
@ -98,6 +99,7 @@ func (s *submitter) sender(name string, sendQueue <-chan mLog) {
result, err := s.db.InsertMany(mongoTimeoutCtx(context.Background()), batchBson, nil)
if err != nil {
promShipperDbSendError.WithLabelValues(baseName).Add(1)
s.l.Error("submission to database", zap.Error(err)) // TODO: add some selective retry here or something
continue
}

View File

@ -75,7 +75,7 @@ func (s *submitter) shipFile(ctx context.Context, name string, recordLimitBytes
go s.sender(name, sendChan)
// TODO: better way to kill or wait for sendQueue before retrying (or duplicates?)
wait.ManagedExponentialBackoffWithContext(ctx, defaultBackoff(), func() (done bool, _ error) {
_ = wait.ManagedExponentialBackoffWithContext(ctx, defaultBackoff(), func() (done bool, _ error) {
//
err := s.shipFileRoutine(ctx, name, lineChan)
if err == nil {