Skip to content

Commit fce54f9

Browse files
authored
feat: Logs push failure information (#2835)
* feat: Logs push failure information * switch to debug * set error on opentracing * Fixes tests
1 parent e3eec1a commit fce54f9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/distributor/distributor.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
ring_client "github.com/grafana/dskit/ring/client"
2424
"github.com/grafana/dskit/services"
2525
"github.com/opentracing/opentracing-go"
26+
"github.com/opentracing/opentracing-go/ext"
2627
"github.com/pkg/errors"
2728
"github.com/prometheus/client_golang/prometheus"
2829
"github.com/prometheus/client_golang/prometheus/promauto"
@@ -231,8 +232,15 @@ func (d *Distributor) Push(ctx context.Context, grpcReq *connect.Request[pushv1.
231232
}
232233
req.Series = append(req.Series, series)
233234
}
234-
235-
return d.PushParsed(ctx, req)
235+
resp, err := d.PushParsed(ctx, req)
236+
if err != nil && validation.ReasonOf(err) != validation.Unknown {
237+
if sp := opentracing.SpanFromContext(ctx); sp != nil {
238+
ext.LogError(sp, err)
239+
}
240+
level.Debug(util.LoggerWithContext(ctx, d.logger)).Log("msg", "failed to validate profile", "err", err)
241+
return resp, err
242+
}
243+
return resp, err
236244
}
237245

238246
func (d *Distributor) GetProfileLanguage(series *distributormodel.ProfileSeries) string {

0 commit comments

Comments
 (0)