-
Notifications
You must be signed in to change notification settings - Fork 83
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
Adaptive Load library for calling Nighthawk Service #493
Adaptive Load library for calling Nighthawk Service #493
Conversation
update from master
merge from upstream
merge from upstream
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
…double Signed-off-by: eric846 <[email protected]>
…variable_setter Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
merge from upstream
…ent.Output turns out not to include the status Signed-off-by: eric846 <[email protected]>
…plugin names, log thresholds only once per session Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
@dubious90 please review and merge once ready. |
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
/** | ||
* An interface for interacting with a Nighthawk Service gRPC stub. | ||
*/ | ||
class NighthawkServiceClient { |
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.
Curious what you think of this train of thought:
At first I was going to ask if you could rename this to be Adaptive Load specific, since NighthawkServiceClient is the kind of name that could be used by a future class in Nighthawk, for creating a generic client for the NighthawkService.
Then I looked at the code, and I don't think there's anything adaptive-load specific about this class or the impl
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.
You're right, moved it to common/
.
namespace Nighthawk { | ||
|
||
/** | ||
* An interface for interacting with a Nighthawk Service gRPC stub. |
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.
Can you add a line here indicating whether or not this class is thread-safe?
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.
Added a comment to the impl.
* error status. | ||
*/ | ||
virtual absl::StatusOr<nighthawk::client::ExecutionResponse> PerformNighthawkBenchmark( | ||
nighthawk::client::NighthawkService::StubInterface* nighthawk_service_stub, |
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.
Not a request for change, but I wanted to hear your rationale: why have this as an argument on the function, rather than an argument to the class constructor?
It's interesting to me that neither this nor the impl version seem to hold any state at all, which leads to a question of why they need to be classes at all.
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.
This used to be a bare function because it had no need to track state across calls. But in order to mock out this functionality for testing, with gtest it's much simpler to make a library export an interface rather than plain functions.
Leaving it stateless seems simpler than storing the stub and taking on responsibility for its lifetime. The intent here is definitely not to introduce a new layer into the system architecture, only to wrap a stateless helper function in a class for unit test purposes.
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.
Makes sense. Thanks for explaining.
NighthawkServiceClientImpl::PerformNighthawkBenchmark( | ||
nighthawk::client::NighthawkService::StubInterface* nighthawk_service_stub, | ||
const nighthawk::client::CommandLineOptions& command_line_options, | ||
const Envoy::Protobuf::Duration& duration) { |
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.
This seems like an odd api to me. Accepting a const command_line_options reference and then immediately copying it into a new object feels counterproductive.
There also doesn't seem to me to be a good reason to have duration as its own parameter as opposed to set on the command_line_options here, since the first and only thing you do with duration is set it in options. Could you accept a const reference to command line options, with the duration properly included, and then use that in ExecutionRequest?
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.
This API has always bothered me a bit. It made more sense when it was a private helper and I was trying to save lines at the call sites. Changing this as you suggest.
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
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.
Hi Eric, mostly looks good. Just a couple comments.
got_response = true; | ||
} | ||
if (!got_response) { | ||
return absl::UnknownError("Nighthawk Service did not send a gRPC response."); |
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.
This one doesn't seem like an Unknown Error. Can we say this is an internal error? As currently, this is something that shouldn't happen and is entirely internal to the codebase
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.
After looking at the docs, I found there is also Unavailable, meaning you to retry the request as-is. Unavailable might apply if the original Write fails since the Nighthawk Service might just have been down. But if you managed to Write but then got an error from WritesDone, Read, or Finish, those could all be Internal since they shouldn't happen. Does that make sense?
const int kExpectedRps = 456; | ||
ExecutionRequest request; | ||
nighthawk::client::MockNighthawkServiceStub mock_nighthawk_service_stub; | ||
EXPECT_CALL(mock_nighthawk_service_stub, ExecutionStreamRaw) |
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.
Two small asks, but on each of these tests.
-
Can you add a linebreak between this EXPECT_CALL and the CommandLineOptions below (or in other tests, whatever is following it)? Just helps the eyes parse this a little as one block.
-
Can we comment at the top of the EXPECT_CALL statement roughly what this block is mocking? Or if that seems like a bad way to document this, something else that helps clarify for future readers what is happening.
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.
Done
Signed-off-by: eric846 <[email protected]>
Signed-off-by: eric846 <[email protected]>
A library that calls a Nighthawk Service gRPC stub with the given `CommandLineOptions`, translating all possible gRPC errors into `absl::StatusOr`. Will need to be updated when Nighthawk Service starts returning more than one message over the stream. Part 4 of splitting PR envoyproxy#483.
A library that calls a Nighthawk Service gRPC stub with the given
CommandLineOptions
, translating all possible gRPC errors intoabsl::StatusOr
.Will need to be updated when Nighthawk Service starts returning more than one message over the stream.
Part 4 of splitting PR #483.