-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
grpc: adding limits to outbound buffered data for google-gRPC access logs #11072
Changes from 5 commits
f6f90b1
19a5f32
4c3aa4d
dbfa775
5ebbb5b
eac439f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,10 @@ | |
#include "test/mocks/ssl/mocks.h" | ||
#include "test/mocks/stream_info/mocks.h" | ||
#include "test/mocks/thread_local/mocks.h" | ||
#include "test/test_common/test_runtime.h" | ||
|
||
using testing::_; | ||
using testing::AnyNumber; | ||
using testing::InSequence; | ||
using testing::Invoke; | ||
using testing::NiceMock; | ||
|
@@ -198,6 +200,46 @@ TEST_F(GrpcAccessLoggerImplTest, WatermarksOverrun) { | |
TestUtility::findCounter(stats_store_, "access_logs.grpc_access_log.logs_dropped")->value()); | ||
} | ||
|
||
TEST_F(GrpcAccessLoggerImplTest, WatermarksLegacy) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this called legacy? Can you add a one liner |
||
TestScopedRuntime scoped_runtime; | ||
Runtime::LoaderSingleton::getExisting()->mergeValues( | ||
{{"envoy.reloadable_features.disallow_unbounded_access_logs", "false"}}); | ||
|
||
InSequence s; | ||
initLogger(FlushInterval, 1); | ||
|
||
// Start a stream for the first log. | ||
MockAccessLogStream stream; | ||
AccessLogCallbacks* callbacks; | ||
expectStreamStart(stream, &callbacks); | ||
EXPECT_CALL(local_info_, node()); | ||
|
||
EXPECT_CALL(stream, isAboveWriteBufferHighWatermark()) | ||
.Times(AnyNumber()) | ||
.WillRepeatedly(Return(true)); | ||
|
||
// Fail to flush, so the log stays buffered up. | ||
envoy::data::accesslog::v3::HTTPAccessLogEntry entry; | ||
entry.mutable_request()->set_path("/test/path1"); | ||
EXPECT_CALL(stream, sendMessageRaw_(_, false)).Times(0); | ||
logger_->log(envoy::data::accesslog::v3::HTTPAccessLogEntry(entry)); | ||
EXPECT_EQ( | ||
1, | ||
TestUtility::findCounter(stats_store_, "access_logs.grpc_access_log.logs_written")->value()); | ||
EXPECT_EQ( | ||
0, | ||
TestUtility::findCounter(stats_store_, "access_logs.grpc_access_log.logs_dropped")->value()); | ||
|
||
// As with the above test, try to log more. The log will not be dropped. | ||
EXPECT_CALL(stream, sendMessageRaw_(_, _)).Times(0); | ||
logger_->log(envoy::data::accesslog::v3::HTTPAccessLogEntry(entry)); | ||
EXPECT_EQ( | ||
2, | ||
TestUtility::findCounter(stats_store_, "access_logs.grpc_access_log.logs_written")->value()); | ||
EXPECT_EQ( | ||
0, | ||
TestUtility::findCounter(stats_store_, "access_logs.grpc_access_log.logs_dropped")->value()); | ||
} | ||
// Test that stream failure is handled correctly. | ||
TEST_F(GrpcAccessLoggerImplTest, StreamFailure) { | ||
InSequence s; | ||
|
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.
Nit: s/steam/stream/g