Skip to content

Commit 13b5222

Browse files
committed
Address review feedback
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
1 parent f150f6a commit 13b5222

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

source/client/output_formatter_impl.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ std::string FortioOutputFormatterImpl::formatProto(const nighthawk::client::Outp
223223
fortio_output.set_jitter(output.options().has_jitter_uniform());
224224
fortio_output.set_runtype("HTTP");
225225

226-
// The stock Envoy h2 pool doesn't offer supper for multiple connections here. So we must ignore
226+
// The stock Envoy h2 pool doesn't offer support for multiple connections here. So we must ignore
227227
// the connections setting when h2 is enabled and the experimental h2-pool which supports multiple
228228
// connections isn't enabled. Also, the number of workers acts as a multiplier.
229229
const uint32_t number_of_connections =
@@ -269,11 +269,9 @@ std::string FortioOutputFormatterImpl::formatProto(const nighthawk::client::Outp
269269
nighthawk::client::DurationHistogram fortio_histogram;
270270
uint64_t prev_fortio_count = 0;
271271
double prev_fortio_end = 0;
272-
const int percentiles_size = nh_stat.percentiles().size();
273-
for (int i = 0; i < percentiles_size; i++) {
272+
int i = 0;
273+
for (const auto& nh_percentile : nh_stat.percentiles()) {
274274
nighthawk::client::DataEntry fortio_data_entry;
275-
const auto& nh_percentile = nh_stat.percentiles().at(i);
276-
277275
// fortio_percent = 100 * nh_percentile
278276
fortio_data_entry.set_percent(nh_percentile.percentile() * 100);
279277

@@ -285,7 +283,7 @@ std::string FortioOutputFormatterImpl::formatProto(const nighthawk::client::Outp
285283
fortio_data_entry.set_end(nh_percentile_duration_sec);
286284

287285
// fortio_start = prev_fortio_end
288-
if (i == 0) {
286+
if (i++ == 0) {
289287
// If this is the first entry, force the start and end time to be the same.
290288
// This prevents it from starting at 0, making it disproportionally big in the UI.
291289
prev_fortio_end = nh_percentile_duration_sec;

source/common/version_info.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ const std::string& VersionInfo::version() {
1616
}
1717

1818
const envoy::config::core::v3alpha::BuildVersion& VersionInfo::buildVersion() {
19-
static const auto* result = new envoy::config::core::v3alpha::BuildVersion(
20-
makeBuildVersion(NIGHTHAWK_BUILD_VERSION_NUMBER));
21-
return *result;
19+
CONSTRUCT_ON_FIRST_USE(envoy::config::core::v3alpha::BuildVersion,
20+
makeBuildVersion(NIGHTHAWK_BUILD_VERSION_NUMBER));
2221
}
2322

2423
envoy::config::core::v3alpha::BuildVersion VersionInfo::makeBuildVersion(const char* version) {

0 commit comments

Comments
 (0)