Skip to content

Commit

Permalink
Merge pull request #523 from mirackara/grpcnaming
Browse files Browse the repository at this point in the history
gRPC attributes rename
  • Loading branch information
nr-swilloughby committed Jun 29, 2022
2 parents 136f6b0 + fd44db5 commit e6316bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions v3/integrations/nrgrpc/nrgrpc_server.go
Expand Up @@ -198,9 +198,9 @@ func ErrorInterceptorStatusHandler(ctx context.Context, txn *newrelic.Transactio
Message: s.Message(),
Class: "gRPC Status: " + s.Code().String(),
})
txn.AddAttribute("GrpcStatusLevel", "error")
txn.AddAttribute("GrpcStatusMessage", s.Message())
txn.AddAttribute("GrpcStatusCode", s.Code().String())
txn.AddAttribute("grpcStatusLevel", "error")
txn.AddAttribute("grpcStatusMessage", s.Message())
txn.AddAttribute("grpcStatusCode", s.Code().String())
}

//
Expand All @@ -212,9 +212,9 @@ func ErrorInterceptorStatusHandler(ctx context.Context, txn *newrelic.Transactio
//
func WarningInterceptorStatusHandler(ctx context.Context, txn *newrelic.Transaction, s *status.Status) {
txn.SetWebResponse(nil).WriteHeader(int(codes.OK))
txn.AddAttribute("GrpcStatusLevel", "warning")
txn.AddAttribute("GrpcStatusMessage", s.Message())
txn.AddAttribute("GrpcStatusCode", s.Code().String())
txn.AddAttribute("grpcStatusLevel", "warning")
txn.AddAttribute("grpcStatusMessage", s.Message())
txn.AddAttribute("grpcStatusCode", s.Code().String())
}

//
Expand All @@ -226,9 +226,9 @@ func WarningInterceptorStatusHandler(ctx context.Context, txn *newrelic.Transact
//
func InfoInterceptorStatusHandler(ctx context.Context, txn *newrelic.Transaction, s *status.Status) {
txn.SetWebResponse(nil).WriteHeader(int(codes.OK))
txn.AddAttribute("GrpcStatusLevel", "info")
txn.AddAttribute("GrpcStatusMessage", s.Message())
txn.AddAttribute("GrpcStatusCode", s.Code().String())
txn.AddAttribute("grpcStatusLevel", "info")
txn.AddAttribute("grpcStatusMessage", s.Message())
txn.AddAttribute("grpcStatusCode", s.Code().String())
}

//
Expand Down
24 changes: 12 additions & 12 deletions v3/integrations/nrgrpc/nrgrpc_server_test.go
Expand Up @@ -182,9 +182,9 @@ func TestUnaryServerInterceptorError(t *testing.T) {
"traceId": internal.MatchAnything,
},
UserAttributes: map[string]interface{}{
"GrpcStatusMessage": "oooooops!",
"GrpcStatusCode": "DataLoss",
"GrpcStatusLevel": "error",
"grpcStatusMessage": "oooooops!",
"grpcStatusCode": "DataLoss",
"grpcStatusLevel": "error",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 0,
Expand Down Expand Up @@ -215,9 +215,9 @@ func TestUnaryServerInterceptorError(t *testing.T) {
"request.uri": "grpc://bufnet/TestApplication/DoUnaryUnaryError",
},
UserAttributes: map[string]interface{}{
"GrpcStatusMessage": "oooooops!",
"GrpcStatusCode": "DataLoss",
"GrpcStatusLevel": "error",
"grpcStatusMessage": "oooooops!",
"grpcStatusCode": "DataLoss",
"grpcStatusLevel": "error",
},
}})
}
Expand Down Expand Up @@ -592,9 +592,9 @@ func TestStreamServerInterceptorError(t *testing.T) {
"traceId": internal.MatchAnything,
},
UserAttributes: map[string]interface{}{
"GrpcStatusLevel": "error",
"GrpcStatusMessage": "oooooops!",
"GrpcStatusCode": "DataLoss",
"grpcStatusLevel": "error",
"grpcStatusMessage": "oooooops!",
"grpcStatusCode": "DataLoss",
},
AgentAttributes: map[string]interface{}{
"httpResponseCode": 0,
Expand Down Expand Up @@ -625,9 +625,9 @@ func TestStreamServerInterceptorError(t *testing.T) {
"request.uri": "grpc://bufnet/TestApplication/DoUnaryStreamError",
},
UserAttributes: map[string]interface{}{
"GrpcStatusLevel": "error",
"GrpcStatusMessage": "oooooops!",
"GrpcStatusCode": "DataLoss",
"grpcStatusLevel": "error",
"grpcStatusMessage": "oooooops!",
"grpcStatusCode": "DataLoss",
},
}})
}
Expand Down

0 comments on commit e6316bc

Please sign in to comment.