Skip to content

Commit

Permalink
refactor: Update retry policy settings and remove unnecessary metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Apr 5, 2024
1 parent 1d8e0c9 commit 3f1f170
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pkg/output/xatu/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ var (
retryPolicy = `{
"methodConfig": [{
"name": [{"service": "xatu.EventIngester"}],
"waitForReady": true,
"waitForReady": false,
"retryPolicy": {
"MaxAttempts": 5,
"InitialBackoff": ".01s",
"InitialBackoff": "1s",
"MaxBackoff": "15s",
"BackoffMultiplier": 1.0,
"RetryableStatusCodes": [ "UNAVAILABLE", "UNKNOWN" ]
"BackoffMultiplier": 1.5,
"RetryableStatusCodes": [ "UNAVAILABLE", "UNKNOWN", "INTERNAL" ]
}
}]}
`
Expand Down
6 changes: 2 additions & 4 deletions pkg/processor/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ func (bvp *BatchItemProcessor[T]) ImmediatelyExportItems(ctx context.Context, it
err := bvp.exportWithTimeout(ctx, itemsBatch)

if err != nil {
bvp.metrics.IncItemsFailedBy(bvp.name, float64(len(itemsBatch)))

return err
}
}
Expand All @@ -248,15 +246,15 @@ func (bvp *BatchItemProcessor[T]) exportWithTimeout(ctx context.Context, itemsBa
defer cancel()
}

bvp.metrics.IncItemsExportedBy(bvp.name, float64(len(itemsBatch)))

err := bvp.e.ExportItems(ctx, itemsBatch)
if err != nil {
bvp.metrics.IncItemsFailedBy(bvp.name, float64(len(itemsBatch)))

return err
}

bvp.metrics.IncItemsExportedBy(bvp.name, float64(len(itemsBatch)))

return nil
}

Expand Down

0 comments on commit 3f1f170

Please sign in to comment.