Skip to content

Commit 594bbbe

Browse files
committed
Review feedback: option rename
Signed-off-by: Otto van der Schaaf <[email protected]>
1 parent 74f9717 commit 594bbbe

File tree

10 files changed

+25
-25
lines changed

10 files changed

+25
-25
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bazel build -c opt //:nighthawk
4343
```
4444
USAGE:
4545
46-
bazel-bin/nighthawk_client [--response-latency-header-name <string>]
46+
bazel-bin/nighthawk_client [--latency-response-header-name <string>]
4747
[--stats-flush-interval <uint32_t>]
4848
[--stats-sinks <string>] ...
4949
[--no-duration] [--simple-warmup]
@@ -81,7 +81,7 @@ format>
8181
8282
Where:
8383
84-
--response-latency-header-name <string>
84+
--latency-response-header-name <string>
8585
Set an optional header name that will be returned in responses, whose
8686
values will be tracked in a latency histogram if set. Can be used in
8787
tandem with the test server's response option

api/client/options.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,5 @@ message CommandLineOptions {
206206
// a latency histogram if set. Can be used in tandem with the test server's response option
207207
// "emit_previous_request_delta_in_response_header" to record elapsed time between request
208208
// arrivals.
209-
google.protobuf.StringValue response_latency_header_name = 36;
209+
google.protobuf.StringValue latency_response_header_name = 36;
210210
}

source/client/benchmark_client_impl.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ BenchmarkClientHttpImpl::BenchmarkClientHttpImpl(
8484
Envoy::Upstream::ClusterManagerPtr& cluster_manager,
8585
Envoy::Tracing::HttpTracerSharedPtr& http_tracer, absl::string_view cluster_name,
8686
RequestGenerator request_generator, const bool provide_resource_backpressure,
87-
absl::string_view response_latency_header_name)
87+
absl::string_view latency_response_header_name)
8888
: api_(api), dispatcher_(dispatcher), scope_(scope.createScope("benchmark.")),
8989
statistic_(std::move(statistic)), use_h2_(use_h2),
9090
benchmark_client_counters_({ALL_BENCHMARK_CLIENT_COUNTERS(POOL_COUNTER(*scope_))}),
9191
cluster_manager_(cluster_manager), http_tracer_(http_tracer),
9292
cluster_name_(std::string(cluster_name)), request_generator_(std::move(request_generator)),
9393
provide_resource_backpressure_(provide_resource_backpressure),
94-
response_latency_header_name_(response_latency_header_name) {
94+
latency_response_header_name_(latency_response_header_name) {
9595
statistic_.connect_statistic->setId("benchmark_http_client.queue_to_connect");
9696
statistic_.response_statistic->setId("benchmark_http_client.request_to_response");
9797
statistic_.response_header_size_statistic->setId("benchmark_http_client.response_header_size");
@@ -168,7 +168,7 @@ bool BenchmarkClientHttpImpl::tryStartRequest(CompletionCallback caller_completi
168168
*statistic_.connect_statistic, *statistic_.response_statistic,
169169
*statistic_.response_header_size_statistic, *statistic_.response_body_size_statistic,
170170
*statistic_.origin_latency_statistic, request->header(), shouldMeasureLatencies(),
171-
content_length, generator_, http_tracer_, response_latency_header_name_);
171+
content_length, generator_, http_tracer_, latency_response_header_name_);
172172
requests_initiated_++;
173173
pool_ptr->newStream(*stream_decoder, *stream_decoder);
174174
return true;

source/client/benchmark_client_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class BenchmarkClientHttpImpl : public BenchmarkClient,
107107
Envoy::Tracing::HttpTracerSharedPtr& http_tracer,
108108
absl::string_view cluster_name, RequestGenerator request_generator,
109109
const bool provide_resource_backpressure,
110-
absl::string_view response_latency_header_name);
110+
absl::string_view latency_response_header_name);
111111
void setConnectionLimit(uint32_t connection_limit) { connection_limit_ = connection_limit; }
112112
void setMaxPendingRequests(uint32_t max_pending_requests) {
113113
max_pending_requests_ = max_pending_requests;
@@ -163,7 +163,7 @@ class BenchmarkClientHttpImpl : public BenchmarkClient,
163163
std::string cluster_name_;
164164
const RequestGenerator request_generator_;
165165
const bool provide_resource_backpressure_;
166-
const std::string response_latency_header_name_;
166+
const std::string latency_response_header_name_;
167167
};
168168

169169
} // namespace Client

source/client/options_impl.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) {
294294
stats_flush_interval_),
295295
false, 5, "uint32_t", cmd);
296296

297-
TCLAP::ValueArg<std::string> response_latency_header_name(
298-
"", "response-latency-header-name",
297+
TCLAP::ValueArg<std::string> latency_response_header_name(
298+
"", "latency-response-header-name",
299299
"Set an optional header name that will be returned in responses, whose values will be "
300300
"tracked in a latency histogram if set. "
301301
"Can be used in tandem with the test server's response option "
@@ -435,7 +435,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) {
435435
}
436436
}
437437
TCLAP_SET_IF_SPECIFIED(stats_flush_interval, stats_flush_interval_);
438-
TCLAP_SET_IF_SPECIFIED(response_latency_header_name, response_latency_header_name_);
438+
TCLAP_SET_IF_SPECIFIED(latency_response_header_name, latency_response_header_name_);
439439

440440
// CLI-specific tests.
441441
// TODO(oschaaf): as per mergconflicts's remark, it would be nice to aggregate
@@ -621,8 +621,8 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) {
621621
no_duration_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(options, no_duration, no_duration_);
622622
}
623623
std::copy(options.labels().begin(), options.labels().end(), std::back_inserter(labels_));
624-
response_latency_header_name_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(
625-
options, response_latency_header_name, response_latency_header_name_);
624+
latency_response_header_name_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(
625+
options, latency_response_header_name, latency_response_header_name_);
626626

627627
validate();
628628
}
@@ -795,8 +795,8 @@ CommandLineOptionsPtr OptionsImpl::toCommandLineOptionsInternal() const {
795795
*command_line_options->add_stats_sinks() = stats_sink;
796796
}
797797
command_line_options->mutable_stats_flush_interval()->set_value(stats_flush_interval_);
798-
command_line_options->mutable_response_latency_header_name()->set_value(
799-
response_latency_header_name_);
798+
command_line_options->mutable_latency_response_header_name()->set_value(
799+
latency_response_header_name_);
800800
return command_line_options;
801801
}
802802

source/client/options_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable<Envoy::Logger
8686
}
8787
uint32_t statsFlushInterval() const override { return stats_flush_interval_; }
8888
std::string responseHeaderWithLatencyInput() const override {
89-
return response_latency_header_name_;
89+
return latency_response_header_name_;
9090
};
9191

9292
private:
@@ -141,7 +141,7 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable<Envoy::Logger
141141
bool no_duration_{false};
142142
std::vector<envoy::config::metrics::v3::StatsSink> stats_sinks_;
143143
uint32_t stats_flush_interval_{5};
144-
std::string response_latency_header_name_;
144+
std::string latency_response_header_name_;
145145
};
146146

147147
} // namespace Client

source/client/stream_decoder.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ void StreamDecoder::decodeHeaders(Envoy::Http::ResponseHeaderMapPtr&& headers, b
1919
response_header_sizes_statistic_.addValue(response_headers_->byteSize());
2020
const uint64_t response_code = Envoy::Http::Utility::getResponseStatus(*response_headers_);
2121
stream_info_.response_code_ = static_cast<uint32_t>(response_code);
22-
if (!response_latency_header_name_.empty()) {
23-
const auto timing_header_name = Envoy::Http::LowerCaseString(response_latency_header_name_);
22+
if (!latency_response_header_name_.empty()) {
23+
const auto timing_header_name = Envoy::Http::LowerCaseString(latency_response_header_name_);
2424
const Envoy::Http::HeaderEntry* timing_header = response_headers_->get(timing_header_name);
2525
if (timing_header != nullptr) {
2626
absl::string_view timing_value = timing_header->value().getStringView();

source/client/stream_decoder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder,
4747
HeaderMapPtr request_headers, bool measure_latencies, uint32_t request_body_size,
4848
Envoy::Random::RandomGenerator& random_generator,
4949
Envoy::Tracing::HttpTracerSharedPtr& http_tracer,
50-
absl::string_view response_latency_header_name)
50+
absl::string_view latency_response_header_name)
5151
: dispatcher_(dispatcher), time_source_(time_source),
5252
decoder_completion_callback_(decoder_completion_callback),
5353
caller_completion_callback_(std::move(caller_completion_callback)),
@@ -59,7 +59,7 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder,
5959
complete_(false), measure_latencies_(measure_latencies),
6060
request_body_size_(request_body_size), stream_info_(time_source_),
6161
random_generator_(random_generator), http_tracer_(http_tracer),
62-
response_latency_header_name_(response_latency_header_name) {
62+
latency_response_header_name_(latency_response_header_name) {
6363
if (measure_latencies_ && http_tracer_ != nullptr) {
6464
setupForTracing();
6565
}
@@ -121,7 +121,7 @@ class StreamDecoder : public Envoy::Http::ResponseDecoder,
121121
Envoy::Tracing::HttpTracerSharedPtr& http_tracer_;
122122
Envoy::Tracing::SpanPtr active_span_;
123123
Envoy::StreamInfo::UpstreamTiming upstream_timing_;
124-
const std::string response_latency_header_name_;
124+
const std::string latency_response_header_name_;
125125
};
126126

127127
} // namespace Client

test/integration/test_integration_basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ def test_http_h1_response_header_latency_tracking(http_test_server_fixture, serv
713713
parsed_json, _ = http_test_server_fixture.runNighthawkClient([
714714
http_test_server_fixture.getTestServerRootUri(), "--connections", "1", "--rps", "100",
715715
"--duration", "100", "--termination-predicate", "benchmark.http_2xx:99",
716-
"--response-latency-header-name", "x-origin-request-receipt-delta"
716+
"--latency-response-header-name", "x-origin-request-receipt-delta"
717717
])
718718
global_histograms = http_test_server_fixture.getNighthawkGlobalHistogramsbyIdFromJson(parsed_json)
719719
asserts.assertEqual(int(global_histograms["benchmark_http_client.latency_2xx"]["count"]), 100)

test/options_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ TEST_F(OptionsImplTest, AlmostAll) {
118118
"--experimental-h2-use-multiple-connections "
119119
"--experimental-h1-connection-reuse-strategy lru --label label1 --label label2 {} "
120120
"--simple-warmup --stats-sinks {} --stats-sinks {} --stats-flush-interval 10 "
121-
"--response-latency-header-name zz",
121+
"--latency-response-header-name zz",
122122
client_name_,
123123
"{name:\"envoy.transport_sockets.tls\","
124124
"typed_config:{\"@type\":\"type.googleapis.com/envoy.api.v2.auth.UpstreamTlsContext\","
@@ -248,7 +248,7 @@ TEST_F(OptionsImplTest, AlmostAll) {
248248
ASSERT_EQ(cmd->stats_sinks_size(), options->statsSinks().size());
249249
EXPECT_TRUE(util(cmd->stats_sinks(0), options->statsSinks()[0]));
250250
EXPECT_TRUE(util(cmd->stats_sinks(1), options->statsSinks()[1]));
251-
EXPECT_EQ(cmd->response_latency_header_name().value(), options->responseHeaderWithLatencyInput());
251+
EXPECT_EQ(cmd->latency_response_header_name().value(), options->responseHeaderWithLatencyInput());
252252

253253
OptionsImpl options_from_proto(*cmd);
254254
std::string s1 = Envoy::MessageUtil::getYamlStringFromMessage(

0 commit comments

Comments
 (0)