question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow gRPC error code config similar to HTTP

See original GitHub issue

The dd.http.client.error.statuses config allows you to set a range of status codes that won’t be reported as errors and, by default, 4xx errors aren’t reported. A similar config for gRPC so codes like Canceled, NotFound, etc. don’t report as errors should be generally helpful. dd-trace-go added support in March, '19, https://github.com/DataDog/dd-trace-go/pull/414.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Jan 15, 2020

The Scala code we ended up with,

class StatusInterceptor() extends TraceInterceptor {
  private val nonErrors = Set(CANCELLED, INVALID_ARGUMENT, NOT_FOUND).map(_.getCode.name)

  override def onTraceComplete(trace: util.Collection[_ <: MutableSpan]): util.Collection[_ <: MutableSpan] =
    trace.asScala
      .map(s =>
        if (s.isError && s.getTags.asScala
              .exists(t => t._1 == "status.code" && nonErrors.contains(t._2.toString)))
          s.setError(false)
        else s
      )
      .asJavaCollection

  override def priority(): Int = 10
}
1reaction
ghostcommented, Jan 15, 2020

Another response,

After submitting your feature request to the Engineering team they provided a way you accomplish this in the meantime. You could attempt setting up a Trace Interceptor with Mutable Span changing this to error or not an error with some kind of if statement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GRPC Core: Status codes and their use in gRPC
Code Number Description OK 0 Not an error; returned on success. FAILED_PRECONDITION 9 OUT_OF_RANGE 11
Read more >
Advanced gRPC Error Usage - Johan Brandhorst
These errors translate the code and message to the grpc-message and grpc-status trailers respectively in the gRPC HTTP2 protocol spec. Extracting the message ......
Read more >
Authentication - gRPC
Using client-side SSL/TLS. Now let's look at how Credentials work with one of our supported auth mechanisms. This is the simplest authentication ...
Read more >
Troubleshooting Response Errors | Cloud Endpoints with gRPC
If you receive an error code 13 and the message transport is closing , this indicates that ESP is unreachable. Check the ESP...
Read more >
Setting status code in grpc server method call - Stack Overflow
You can return a gRPC error using the google.golang.org/grpc/status package as follows: return nil, status.Error(codes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found