Make failure reasons to be flags.#274
Conversation
include/envoy/http/access_log.h
Outdated
| * FailureReason enum values. | ||
| */ | ||
| virtual FailureReason failureReason() const PURE; | ||
| virtual uint64_t failureReason() const PURE; |
There was a problem hiding this comment.
This name doesn't make sense anymore. I would do the following:
- Rename FailureReason -> ResponseFlag
- void setResponseFlag(ResponseFlag flag);
- bool getResponseFlag(ResponseFlag flag);
This way it is clear what you are adding flags together and can test if a flag is set. In the future we could add a clearResponseFlag() method if we need it.
There was a problem hiding this comment.
i assume that if we change FailureReason -> ResponseFlag we'll also need to change access log formatting to allow specifying %RESPONSE_FLAG% instead of %FAILURE_REASON% which will not be backward compatible. Any concerns around this at this point? (If not then I'll go for ReponseFlag).
There was a problem hiding this comment.
Yeah I guess so, which makes it a larger change, but I would probably do the right thing here. I'm open to other name ideas also.
There was a problem hiding this comment.
For the access log I would do %RESPONSE_FLAGS% (plural) if that is the name.
There was a problem hiding this comment.
Well, that's not too much work anyway, main concern around not to be backward compatible. This is def no problem for us, for others it's a simple config change as well, prob not too much to worry about.
There was a problem hiding this comment.
I think it's probably OK right now. I don't think there are too many people using yet and probably even fewer specifying a custom access log config.
|
@mattklein123 addressed comments. |
include/envoy/http/access_log.h
Outdated
| /** | ||
| * filter can trigger this callback on failed response to provide more details about | ||
| * failure. | ||
| * filter can set response flags. |
There was a problem hiding this comment.
fixed in the next iteration
include/envoy/http/access_log.h
Outdated
|
|
||
| /** | ||
| * @return the failure reason for richer log experience. | ||
| * @return response flags to enrich access log with details around response code. Response flag |
There was a problem hiding this comment.
fixed in the next iteration
include/envoy/http/access_log.h
Outdated
| * code and add details to it. | ||
| */ | ||
| virtual FailureReason failureReason() const PURE; | ||
| virtual bool isSetResponseFlag(ResponseFlag response_flag) const PURE; |
There was a problem hiding this comment.
getResponseFlag() or isResponseFlagSet()
There was a problem hiding this comment.
here i was following convention used in thrift for optional fields, getResponseFlag() should be ok as well.
| } | ||
|
|
||
| const std::string FilterReasonUtils::toShortString(const RequestInfo& request_info) { | ||
| std::string result = ""; |
| const std::string FilterReasonUtils::UPSTREAM_OVERFLOW = "UO"; | ||
| const std::string FilterReasonUtils::NO_ROUTE_FOUND = "NR"; | ||
| const std::string FilterReasonUtils::FAULT_INJECTED = "FI"; | ||
| const std::string FilterReasonUtils::DELAY_INJECTED = "DI"; |
There was a problem hiding this comment.
Delete until this is actually used in the code, or use it in the code, and also add to docs.
There was a problem hiding this comment.
Can we keep this, because the subsequent PR (from me) is be using it? Or would you like to introduce this as another PR?
There was a problem hiding this comment.
We could either have all of the changes in one PR (that's harder to review, too many changes)
or have one change for refactoring (this change, and remove DI) and one change with fully DI support.
I'd like to have two clean changes. Let me know if any concerns.
There was a problem hiding this comment.
And then a third one that uses all the two codes. I am fine with that as well.
include/envoy/http/access_log.h
Outdated
| enum ResponseFlag { | ||
| // No failure. | ||
| None, | ||
| None = 0x0, |
There was a problem hiding this comment.
Delete. None is implied by no flags.
There was a problem hiding this comment.
this way caller can check if no flags are set otherwise we'd need to have separate method isAnyResponseFlagSet or something along these lines.
Open to remove None if there are better ways of handling situation above.
There was a problem hiding this comment.
Where do you actually need to check if None is set. That location is probably now a bug in the face of something like DI.
| .WillByDefault(Return(true)); | ||
| ON_CALL(request_info, isSetResponseFlag(ResponseFlag::FaultInjected)) | ||
| .WillByDefault(Return(true)); | ||
| EXPECT_EQ("UT,FI,DI", FilterReasonUtils::toShortString(request_info)); |
There was a problem hiding this comment.
Nit. FI and UT cannot occur together. Whenever a request is aborted (with HTTP codes or connection termination), it does not go through the rest of the processing pipeline.
The only combination of FI and DI that will make sense in a single request is DI,FI (in order). [Delays followed by aborting a request].
There was a problem hiding this comment.
this was mostly to test basic functionality for multiple flags, i can place comment that it's not real use case but to test functionality
Conflicts: source/common/router/router.cc test/common/router/router_test.cc
…gs_for_access_log
include/envoy/http/access_log.h
Outdated
| /** | ||
| * filter can trigger this callback on failed response to provide more details about | ||
| * failure. | ||
| * each filter can set independent response flag, flags are accumulated. |
There was a problem hiding this comment.
nit: Start with capital letter
| NOT_IMPLEMENTED; | ||
| } | ||
|
|
||
| bool ConnectionManagerUtility::isTraceableFailure( |
There was a problem hiding this comment.
I'm concerned this might get out of date. Should we put in ResponseFlagUtils? I could go either way.
There was a problem hiding this comment.
between ConnectionManagerUtility and ResponseFlagUtils i think second one is preferable, will move.
| Http::AccessLog::FailureReason failureReason() const override { return failure_reason_; } | ||
| void onFailedResponse(FailureReason failure_reason) override { failure_reason_ = failure_reason; } | ||
| bool getResponseFlag(ResponseFlag response_flag) const override { | ||
| return response_flags_ == response_flag; |
There was a problem hiding this comment.
can do that, just kept simple it here, same with set functionality.
Signed-off-by: John Plevyak <jplevyak@gmail.com>
update opencensus
update minimal go version to 1.21
**Commit Message** Addressed warnings observed during `make test-extproc`, except for the `reuse_port` warning, which is platform-dependent and cannot be fixed on non-Linux systems. - Updated `json_format` to be nested under `log_format` to align with Envoy's expected configuration. - Added `overload_manager` configuration to manage downstream connection limits. - The warning related to `reuse_port` being force disabled on non-Linux platforms was **not** fixed, as it is platform-dependent. Signed-off-by: Sébastien Han <seb@redhat.com> **Related Issues/PRs (if applicable)** #274 **Special notes for reviewers (if applicable)** The warning related to `reuse_port` being force disabled on non-Linux platforms was **not** fixed, as it is platform-dependent. Any suggestions for a fix are welcome. Signed-off-by: Sébastien Han <seb@redhat.com>
No description provided.