Repository navigation
ext_proc http bytes tracking support - #37297
Conversation
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
|
/assign @tyxia @yanavlasov |
|
/retest |
|
Kind Ping! |
|
Kind ping! |
| void Filter::logStreamInfo() { | ||
| if (!config().grpcService().has_value()) { | ||
| // HTTP service | ||
| logStreamInfoBase(stream_info_http_); |
There was a problem hiding this comment.
Do we need to cache stream_info_http_ and setStreamInfo function?
Can we get access to this through existing members and active_requests_, similar to gRPC below?
There was a problem hiding this comment.
Sure. We can add a new interface: client->getStreamInfo() to retrieve streamInfo() from active_request_.
| if (active_request_ != nullptr) { | ||
| Buffer::OwnedImpl body(req_in_json.value()); | ||
| active_request_->sendData(body, true); | ||
| callbacks_->setStreamInfo(&active_request_->streamInfo()); |
There was a problem hiding this comment.
This PR is missing setting the upstreamClusterInfo() in logging_info
There was a problem hiding this comment.
Good catch! done
|
/wait |
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Yanjun Xiang <[email protected]>
|
/retest |
1 similar comment
|
/retest |
| } | ||
|
|
||
| void ExtProcHttpClient::onError() { | ||
| // Cancel if the request is active. |
There was a problem hiding this comment.
Looks like there is behavior change in this revision. Can you elaborate why we are removing this line? but still keeping cancel() in the code base.
There was a problem hiding this comment.
That's a good question.
However, there is no logic change here. The cancel() call is dead code here as from the context, the onError() is always called after active_request_ is set to nullptr. And with active_request_ == nullptr, cancel() is no-op.
BTW, cancel() call is only needed in the context when the ext_proc filter is destroyed:
Another thing is that this PR is trying to move the "active_request_ = nullptr" to after callbacks_->onComplete() and callbacks_->onError() call finished, as these calls will use active_request_ to get the stream_info.
There was a problem hiding this comment.
OK then original ext_proc http code has redundancy that is cleaned up here
| callbacks_->onError(); | ||
| callbacks_ = nullptr; | ||
| } | ||
| active_request_ = nullptr; |
There was a problem hiding this comment.
Compared with previous code, it seems that you are missing active_request_->cancel();?
why cancel() is removed from this function
There was a problem hiding this comment.
Please check comments above.
This is a follow up PR of: #35740.
This PR added the bytes tracking support for ext_proc http service, which basically is counting how many bytes are sent to and received from ext_proc HTTP service.
It takes the stream_info from the active HTTP request, and saved in the ext_proc filter. When the external processing completes, the bytes counters from the stream_info are retrieved and stored into the filter state.
The existing logging test filter is leveraged to test the byte counters in the filter state are correctly updated.