lint
This commit is contained in:
parent
fc9c1671b6
commit
3b52df7cba
@ -31,7 +31,7 @@ var (
|
|||||||
Help: "Batch size for database submissions",
|
Help: "Batch size for database submissions",
|
||||||
Buckets: []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000},
|
Buckets: []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000},
|
||||||
})
|
})
|
||||||
promShipperMongoSentError = promauto.NewCounterVec(prom.CounterOpts{
|
promShipperDbSendError = promauto.NewCounterVec(prom.CounterOpts{
|
||||||
Namespace: PrometheusPrefix,
|
Namespace: PrometheusPrefix,
|
||||||
// Subsystem: "shipper",
|
// Subsystem: "shipper",
|
||||||
Name: "insertion_error", // "errors",
|
Name: "insertion_error", // "errors",
|
||||||
@ -88,6 +88,7 @@ func (s *submitter) sender(name string, sendQueue <-chan mLog) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
promShipperBatchSizeResult.Observe(float64(len(batch)))
|
||||||
|
|
||||||
promShipperSynced.WithLabelValues(baseName).Set(0)
|
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)
|
result, err := s.db.InsertMany(mongoTimeoutCtx(context.Background()), batchBson, nil)
|
||||||
if err != 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
|
s.l.Error("submission to database", zap.Error(err)) // TODO: add some selective retry here or something
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ func (s *submitter) shipFile(ctx context.Context, name string, recordLimitBytes
|
|||||||
go s.sender(name, sendChan)
|
go s.sender(name, sendChan)
|
||||||
|
|
||||||
// TODO: better way to kill or wait for sendQueue before retrying (or duplicates?)
|
// 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)
|
err := s.shipFileRoutine(ctx, name, lineChan)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user