Merge pull request #738 from lanzafame/feat/add-trace-error-status

add error status to trace
This commit is contained in:
Łukasz Magiera 2019-12-05 00:39:32 +01:00 committed by GitHub
commit 835e9dd1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -446,11 +446,19 @@ func (syncer *Syncer) Sync(ctx context.Context, maybeHead *types.TipSet) error {
if err := syncer.collectChain(ctx, maybeHead); err != nil {
span.AddAttributes(trace.StringAttribute("col_error", err.Error()))
span.SetStatus(trace.Status{
Code: 13,
Message: err.Error(),
})
return xerrors.Errorf("collectChain failed: %w", err)
}
if err := syncer.store.PutTipSet(ctx, maybeHead); err != nil {
span.AddAttributes(trace.StringAttribute("put_error", err.Error()))
span.SetStatus(trace.Status{
Code: 13,
Message: err.Error(),
})
return xerrors.Errorf("failed to put synced tipset to chainstore: %w", err)
}