grpc: Update tracing error tags for grpc status code#19603
grpc: Update tracing error tags for grpc status code#19603bryanwux wants to merge 5 commits intoenvoyproxy:mainfrom bryanwux:main
Conversation
|
Hi @bryanwux, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
|
Could you please fix DCO and check formatting? CONTRIBUTING.md contains some useful info about it. |
There was a problem hiding this comment.
Nit: I think it is better that we have a local variable stores the value upfront instead of calling value() repeatedly, both from performance and readability perspective. e.g., :
const auto& status = grpc_status_code.value();
There was a problem hiding this comment.
Even though MaximumKnown = Unauthenticated in terms of enum value, MaximumKnown is used to represent the boundary of the grpc status code. for example you can do for (uint32_t i = 0; i <= Status::WellKnownGrpcStatus::MaximumKnown; ++i)
I think we should use Unauthenticated here.
There was a problem hiding this comment.
I don't think we should include this as error code. InvalidCode means status code in gRPC headers was invalid that we can not use grpc_status_code.
There was a problem hiding this comment.
We should check grpc_status_code.value() != Grpc::Status::WellKnownGrpcStatus::InvalidCode) here rather than !ok
NOT_OK is redundant once you added those new checks in this PR
There was a problem hiding this comment.
Not your code, we need to be careful about the implicit conversion to bool especially when we are dealing with absl::optional. Detailed reading of this open source version of Google coding guide can be found here https://abseil.io/tips/141
I would suggest to change it to grpc_status_code.has_value().
|
/assign @tyxia |
|
/wait |
Signed-off-by: Jiayu Wu <jiayu1.wu@intel.com>
|
Thank you for your @tyxia review. I have updated the code accordingly. |
Done. |
There was a problem hiding this comment.
nit, for consistency you may want to move stauts assignment up
if (grpc_status_code.has_value()) {
const auto& status = grpc_status_code.value();
if (status != Grpc::Status::WellKnownGrpcStatus::InvalidCode &&
( ... == unkown || ...== DeadlineExceed ||... == Unimplemented
......)) {
span.setTag(Tracing::Tags::get().Error, Tracing::Tags::get().True);
}
}
There was a problem hiding this comment.
The line 91 seems to be redundant: status is checked for equality with Grpc::Status::WellKnownGrpcStatus::InvalidCode below. Can we drop the line?
Signed-off-by: Jiayu Wu <jiayu1.wu@intel.com>
rojkov
left a comment
There was a problem hiding this comment.
Thanks! Added one comment.
Please don't use git force-push. It makes reviewing new changes more difficult.
There was a problem hiding this comment.
The line 91 seems to be redundant: status is checked for equality with Grpc::Status::WellKnownGrpcStatus::InvalidCode below. Can we drop the line?
|
/wait |
Signed-off-by: Jiayu Wu <jiayu1.wu@intel.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
/assign-from @envoyproxy/senior-maintainers |
|
@envoyproxy/senior-maintainers assignee is @alyssawilk |
alyssawilk
left a comment
There was a problem hiding this comment.
Code looks good but two requests.
One can you edit your original table in the linked bug with a bit more detail as to why each error is considered a server error and non-error is a user error (or other) and two, can you add an entry to the docs for the current release (docs/root/version_history/current.rst) to cover the change in behavior? Thanks!
/wait
|
still waiting on the issue update I think |
Signed-off-by: Jiayu Wu <jiayu1.wu@intel.com>
|
Misclicked... |
Done. Apologies for the delay. |
|
Pr is still closed - I think you have to reopen |
|
ah, nm, I see you opened as a new PR. |
Signed-off-by: Jiayu Wu jiayu1.wu@intel.com
Commit Message: Change tracing error tag behaviour for grpc codes #18877
Additional Description:
Below is the proposed change for tracing error tag behaviour. A brief description about whether it is an error for each response code has also been listed.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]: #18877
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]