Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 9ade36b

Browse files
committed
Do not log gRPC NotFound and Cancelled status code
1 parent 584c4a1 commit 9ade36b

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ We use the following categories for changes:
2323
### Fixed
2424
- Fix broken cache eviction in clockcache [#1603]
2525
- Possible goroutine leak due to unbuffered channel in select block [#1604]
26+
- Stop logging as an error grpc NotFound and Canceled status codes [#1645]
2627

2728
## [0.14.0] - 2022-08-30
2829

pkg/jaeger/store/store.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"context"
99
"time"
1010

11+
"github.com/pkg/errors"
1112
"github.com/prometheus/client_golang/prometheus"
1213

1314
"github.com/jaegertracing/jaeger/model"
@@ -76,9 +77,14 @@ func (p *Store) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Tra
7677
metrics.QueryDuration.With(prometheus.Labels{"type": "trace", "handler": "Get_Trace", "code": code}).Observe(time.Since(start).Seconds())
7778
}()
7879
res, err := getTrace(ctx, p.builder, p.conn, traceID)
80+
7981
if err != nil {
80-
return nil, logError(err)
82+
if !errors.Is(err, spanstore.ErrTraceNotFound) {
83+
_ = logError(err)
84+
}
85+
return nil, err
8186
}
87+
8288
code = "2xx"
8389
traceRequestsExec.Add(1)
8490
return res, nil

pkg/runner/runner.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import (
2323
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
2424
"go.opentelemetry.io/otel"
2525
"google.golang.org/grpc"
26+
"google.golang.org/grpc/codes"
2627
"google.golang.org/grpc/credentials"
28+
"google.golang.org/grpc/status"
2729

2830
"github.com/google/uuid"
2931
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
@@ -66,9 +68,16 @@ func loggingUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.Un
6668

6769
func loggingStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
6870
err := handler(srv, ss)
69-
if err != nil && !errors.Is(err, context.Canceled) {
70-
log.Error("msg", "error in GRPC call", "err", err)
71+
if err == nil {
72+
return nil
7173
}
74+
75+
st, ok := status.FromError(err)
76+
if ok && (st.Code() == codes.NotFound || st.Code() == codes.Canceled) {
77+
return err
78+
}
79+
80+
log.Error("msg", "error in GRPC call", "err", err)
7281
return err
7382
}
7483

0 commit comments

Comments
 (0)