Skip to content

Commit

Permalink
use error.Is
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax committed May 31, 2021
1 parent 45d180a commit fbff122
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion exporter/exporterhelper/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package exporterhelper

import (
"context"
"errors"

"go.uber.org/zap"

Expand Down Expand Up @@ -94,7 +95,7 @@ func NewLogsExporter(
lc, err := consumerhelper.NewLogs(func(ctx context.Context, ld pdata.Logs) error {
req := newLogsRequest(ctx, ld, pusher)
err := be.sender.send(req)
if err == errSendingQueueIsFull {
if errors.Is(err, errSendingQueueIsFull) {
be.obsrep.RecordLogsEnqueueFailure(req.context(), req.count())
}
return err
Expand Down
3 changes: 2 additions & 1 deletion exporter/exporterhelper/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package exporterhelper

import (
"context"
"errors"

"go.uber.org/zap"

Expand Down Expand Up @@ -98,7 +99,7 @@ func NewMetricsExporter(
}
req := newMetricsRequest(ctx, md, pusher)
err := be.sender.send(req)
if err == errSendingQueueIsFull {
if errors.Is(err, errSendingQueueIsFull) {
be.obsrep.RecordMetricsEnqueueFailure(req.context(), req.count())
}
return err
Expand Down
3 changes: 2 additions & 1 deletion exporter/exporterhelper/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package exporterhelper

import (
"context"
"errors"

"go.uber.org/zap"

Expand Down Expand Up @@ -95,7 +96,7 @@ func NewTracesExporter(
tc, err := consumerhelper.NewTraces(func(ctx context.Context, td pdata.Traces) error {
req := newTracesRequest(ctx, td, pusher)
err := be.sender.send(req)
if err == errSendingQueueIsFull {
if errors.Is(err, errSendingQueueIsFull) {
be.obsrep.RecordTracesEnqueueFailure(req.context(), req.count())
}
return err
Expand Down

0 comments on commit fbff122

Please sign in to comment.