Skip to content

Conversation

JimmyCYJ
Copy link
Member

@JimmyCYJ JimmyCYJ commented Jan 31, 2018

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 #539

Special notes for your reviewer:

Release note:

NONE

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Jan 31, 2018
@JimmyCYJ JimmyCYJ requested a review from qiwzhang January 31, 2018 21:41

controller_ = ::istio::mixer_control::tcp::Controller::Create(options_);

if (mixer_config.tcp_config.report_interval().seconds() < 0 ||
Copy link
Contributor

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

@@ -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();
Copy link
Contributor

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?

@@ -159,6 +169,9 @@ class TcpInstance : public Network::Filter,
if (!calling_check_) {
filter_callbacks_->continueReading();
}
report_timer_ = mixer_control_.options().env.timer_create_func(
Copy link
Contributor

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.

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()) {
Copy link
Contributor

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.

@qiwzhang
Copy link
Contributor

qiwzhang commented Feb 1, 2018

/lgtm
/approve

@istio-merge-robot
Copy link

/lgtm cancel //PR changed after LGTM, removing LGTM. @JimmyCYJ @qiwzhang

@qiwzhang
Copy link
Contributor

qiwzhang commented Feb 1, 2018

/lgtm
/approve

@istio-merge-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@istio-merge-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@istio-merge-robot
Copy link

Automatic merge from submit-queue.

@istio-merge-robot istio-merge-robot merged commit 9aa69b3 into istio:master Feb 1, 2018
@douglas-reid
Copy link
Contributor

this is awesome. thanks for doing this. any plans for an e2e test to exercise? we should update the docs to reflect this capabiility.

@JimmyCYJ JimmyCYJ deleted the add-tcpfilter-periodical-delta-report branch February 1, 2018 18:53
@JimmyCYJ
Copy link
Member Author

JimmyCYJ commented Feb 1, 2018

I will add integration tests into istio/mixer/test/client, and update docs once this behavior is verified by tests.

@JimmyCYJ
Copy link
Member Author

Integration test is added istio/istio#3446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send periodical Report for TCP filter
6 participants