Skip to content

Commit

Permalink
feat(chotel): retry export
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Dec 4, 2023
1 parent 7c83595 commit 51a1f91
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/chotel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/ClickHouse/ch-go"
"github.com/ClickHouse/ch-go/proto"
"github.com/cenkalti/backoff/v4"
"github.com/go-faster/errors"
"github.com/go-faster/sdk/app"
"github.com/go-faster/sdk/zctx"
Expand Down Expand Up @@ -264,7 +265,13 @@ func (a *App) send(ctx context.Context, now time.Time) error {
}); err != nil {
return errors.Wrap(err, "query")
}
if err := a.traceExporter.ExportSpans(ctx, batch); err != nil {
eb := backoff.NewExponentialBackOff()
if err := backoff.Retry(func() error {
if err := a.traceExporter.ExportSpans(ctx, batch); err != nil {
return errors.Wrap(err, "export")
}
return nil
}, eb); err != nil {
return errors.Wrap(err, "export")
}
if err := db.Do(ctx, ch.Query{
Expand Down

0 comments on commit 51a1f91

Please sign in to comment.