-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support TCP filter to send periodical reports. #971
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
Support TCP filter to send periodical reports. #971
Conversation
src/envoy/mixer/mixer_control.cc
Outdated
|
||
controller_ = ::istio::mixer_control::tcp::Controller::Create(options_); | ||
|
||
if (mixer_config.tcp_config.report_interval().seconds() < 0 || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use has_report_interval() It is a message. If it is not set, has_ will fail
src/envoy/mixer/tcp_filter.cc
Outdated
@@ -175,7 +188,8 @@ class TcpInstance : public Network::Filter, | |||
if (event == Network::ConnectionEvent::RemoteClose || | |||
event == Network::ConnectionEvent::LocalClose) { | |||
if (state_ != State::Closed && handler_) { | |||
handler_->Report(this); | |||
report_timer_->Stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could remote_timer be nullptr?
src/envoy/mixer/tcp_filter.cc
Outdated
@@ -159,6 +169,9 @@ class TcpInstance : public Network::Filter, | |||
if (!calling_check_) { | |||
filter_callbacks_->continueReading(); | |||
} | |||
report_timer_ = mixer_control_.options().env.timer_create_func( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this inside Envoy code, it is prefer to use Envoy timer instead of mixerclient timer.
src/envoy/mixer/mixer_control.cc
Outdated
mixer_config.tcp_config.report_interval().nanos() / 1000000); | ||
// If configured time interval is less than 1 millisecond, then set report | ||
// interval to default value. | ||
if (report_interval_ms_ == std::chrono::milliseconds::zero()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may not want to sent more frequent than 0.5 second per report, or even 1 second. 0.5 is good for testing.
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiwzhang The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
this is awesome. thanks for doing this. any plans for an e2e test to exercise? we should update the docs to reflect this capabiility. |
I will add integration tests into istio/mixer/test/client, and update docs once this behavior is verified by tests. |
Integration test is added istio/istio#3446 |
What this PR does / why we need it: Support TCP filter to send periodical reports for long TCP connections. The periodical reports contain delta information such as bytes received and sent during the recent period.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #539Special notes for your reviewer:
Release note: