Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue 221: grpc error reporting #317

Merged
merged 3 commits into from May 29, 2021
Merged

fix issue 221: grpc error reporting #317

merged 3 commits into from May 29, 2021

Conversation

nr-swilloughby
Copy link
Contributor

Adds error reporting to the nrgrpc integration. An error value returned from an instrumented unary or stream server call now creates an error span in the current transaction which contains the error message. Previously it only set an error status code.

@nr-swilloughby nr-swilloughby added this to the May Go Agent Release milestone May 25, 2021
@nr-swilloughby nr-swilloughby self-assigned this May 25, 2021
@nr-swilloughby nr-swilloughby added this to Triage in Go Engineering Board via automation May 25, 2021
@nr-swilloughby
Copy link
Contributor Author

This includes module version number updates in the integration's go.mod file which happened automatically when running the code. Should those updated version numbers be included in this change or should we leave that file as it was?

// protobuf v1.3.0 is the earliest version using modules, we use v1.3.1
// because all dependencies were removed in this version.
github.com/golang/protobuf v1.3.1
github.com/golang/protobuf v1.3.3
github.com/kisielk/gotool v1.0.0 // indirect
github.com/newrelic/go-agent/v3 v3.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't have a "replace" directive in the go.mod file, the tests will break on customers' systems. Let's put the Go Agent requirements up to 3.12.0. We'll have better luck in the GitHub Actions CI with that, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll make the change and clean up a couple of things and try the pull request again.

@@ -69,7 +69,7 @@ func startTransaction(ctx context.Context, app *newrelic.Application, fullMethod
// https://github.com/newrelic/go-agent/blob/master/v3/integrations/nrgrpc/example/server/server.go
//
func UnaryServerInterceptor(app *newrelic.Application) grpc.UnaryServerInterceptor {
if nil == app {
if app == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the new non-Yoda conditions!

@@ -82,6 +82,9 @@ func UnaryServerInterceptor(app *newrelic.Application) grpc.UnaryServerIntercept
ctx = newrelic.NewContext(ctx, txn)
resp, err = handler(ctx, req)
txn.SetWebResponse(nil).WriteHeader(int(status.Code(err)))
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the right thing to do! Do we have an example of this in the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll add it to the original issue's conversation.

// protobuf v1.3.0 is the earliest version using modules, we use v1.3.1
// because all dependencies were removed in this version.
github.com/golang/protobuf v1.3.1
github.com/golang/protobuf v1.3.3
github.com/kisielk/gotool v1.0.0 // indirect
github.com/newrelic/go-agent/v3 v3.0.0
// v1.15.0 is the earliest version of grpc using modules.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should remove or change this comment.

@RichVanderwal
Copy link
Contributor

We'll want a CHANGELOG.md entry with this, I think.

@nr-swilloughby
Copy link
Contributor Author

ChangeLog

Fixes

  • Fixes issue #221: grpc errors reported in code watched by UnaryServerInterceptor or StreamServerInterceptor now create error events which are reported to the UI with the error message string included.

@nr-swilloughby nr-swilloughby merged commit 428af9a into newrelic:develop May 29, 2021
Go Engineering Board automation moved this from Triage to Done May 29, 2021
@nr-swilloughby nr-swilloughby deleted the grpc_error_msg branch July 22, 2021 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

v3/integrations/nrgrpc: Error message not found and Stack trace is incorrect
2 participants