Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ build:linux --copt=-fPIC
# We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace.
build --define absl=1

# Pass PATH, CC and CXX variables from the environment.
# Pass PATH, CC, CXX and LLVM_CONFIG variables from the environment.
build --action_env=CC
build --action_env=CXX
build --action_env=LLVM_CONFIG
build --action_env=PATH

# Common flags for sanitizers
Expand Down Expand Up @@ -162,7 +163,7 @@ build:remote-msan --config=rbe-toolchain-msan

# Docker sandbox
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L7
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:f0b2453c3587e3297f5caf5e97fbf57c97592c96136209ec13fe2795aae2c896
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
Expand Down
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
references:
envoy-build-image: &envoy-build-image
envoyproxy/envoy-build-ubuntu@sha256:3ca8acc35fdb57ab26e1bb5f9488f37095f45acd77a12602510410dbefa00b58 # October 31th, 2019
# Jan 9th, 2020
envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f
version: 2
jobs:
build:
Expand Down
5 changes: 2 additions & 3 deletions api/client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ api_cc_py_proto_library(
],
visibility = ["//visibility:public"],
deps = [
"@envoy_api//envoy/api/v2/auth:pkg",
"@envoy_api//envoy/api/v2/cluster:pkg",
"@envoy_api//envoy/api/v2/core:pkg",
"@envoy_api//envoy/config/core/v3alpha:pkg",
"@envoy_api//envoy/extensions/transport_sockets/tls/v3alpha:pkg",
],
)

Expand Down
12 changes: 6 additions & 6 deletions api/client/options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ package nighthawk.client;

import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";
import "envoy/api/v2/auth/cert.proto";
import "envoy/api/v2/core/base.proto";
import "envoy/config/core/v3alpha/base.proto";
import "envoy/extensions/transport_sockets/tls/v3alpha/cert.proto";
import "validate/validate.proto";

// Allows for static configuration of requests that should be send by the load generator.
message RequestOptions {
envoy.api.v2.core.RequestMethod request_method = 1;
repeated envoy.api.v2.core.HeaderValueOption request_headers = 2;
envoy.config.core.v3alpha.RequestMethod request_method = 1;
repeated envoy.config.core.v3alpha.HeaderValueOption request_headers = 2;
// Our StreamDecoder depends on bounding the size here, so if this changes, an amendment
// to that is needed as well.
google.protobuf.UInt32Value request_body_size = 3 [(validate.rules).uint32 = {lte: 4194304}];
Expand Down Expand Up @@ -130,7 +130,7 @@ message CommandLineOptions {
RequestSource request_source = 26;
}
// See :option:`--tls_context` for details.
envoy.api.v2.auth.UpstreamTlsContext tls_context = 13;
envoy.extensions.transport_sockets.tls.v3alpha.UpstreamTlsContext tls_context = 13;
// See :option:`--max-pending_requests` for details.
google.protobuf.UInt32Value max_pending_requests = 14;
// See :option:`--max-active_requests` for details.
Expand Down Expand Up @@ -167,5 +167,5 @@ message CommandLineOptions {
// See :option:`--labels`
repeated string labels = 28;
// See :option:`--transport-socket` for details.
envoy.api.v2.core.TransportSocket transport_socket = 27;
envoy.config.core.v3alpha.TransportSocket transport_socket = 27;
}
4 changes: 2 additions & 2 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

ENVOY_COMMIT = "a78311faf214bb9216f92407102b547b6fcd14a3" # December 13th, 2019
ENVOY_SHA = "2e65ed67b3413e5c177321360ae6e15bf78dac24f65336a252bd59c1f6bb5a08"
ENVOY_COMMIT = "29b30911dbfb3f9760efeb28238ceac36e1a1a23" # Jan 9th, 2019
ENVOY_SHA = "b52455552e922be27a51c2b0bb6e1c2b73c42207ddee46fd36b22401115e43fa"

RULES_PYTHON_COMMIT = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8"
RULES_PYTHON_SHA = "9a3d71e348da504a9c4c5e8abd4cb822f7afb32c613dc6ee8b8535333a81a938"
Expand Down
12 changes: 7 additions & 5 deletions include/nighthawk/client/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <memory>
#include <string>

#include "envoy/api/v2/cds.pb.h"
#include "envoy/api/v2/core/base.pb.h"
#include "envoy/common/pure.h"
#include "envoy/config/cluster/v3alpha/cluster.pb.h"
#include "envoy/config/core/v3alpha/base.pb.h"

#include "api/client/options.pb.h"

Expand Down Expand Up @@ -38,11 +38,13 @@ class Options {
virtual bool prefetchConnections() const PURE;
virtual uint32_t burstSize() const PURE;
virtual nighthawk::client::AddressFamily::AddressFamilyOptions addressFamily() const PURE;
virtual envoy::api::v2::core::RequestMethod requestMethod() const PURE;
virtual envoy::config::core::v3alpha::RequestMethod requestMethod() const PURE;
virtual std::vector<std::string> requestHeaders() const PURE;
virtual uint32_t requestBodySize() const PURE;
virtual const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const PURE;
virtual const absl::optional<envoy::api::v2::core::TransportSocket>& transportSocket() const PURE;
virtual const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext&
tlsContext() const PURE;
virtual const absl::optional<envoy::config::core::v3alpha::TransportSocket>&
transportSocket() const PURE;
virtual uint32_t maxPendingRequests() const PURE;
virtual uint32_t maxActiveRequests() const PURE;
virtual uint32_t maxRequestsPerConnection() const PURE;
Expand Down
2 changes: 1 addition & 1 deletion source/client/factories_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ RequestSourcePtr RequestSourceFactoryImpl::create() const {
: Envoy::Http::Headers::get().SchemeValues.Http);
}

header->setMethod(envoy::api::v2::core::RequestMethod_Name(options_.requestMethod()));
header->setMethod(envoy::config::core::v3alpha::RequestMethod_Name(options_.requestMethod()));
const uint32_t content_length = options_.requestBodySize();
if (content_length > 0) {
header->setContentLength(content_length);
Expand Down
8 changes: 4 additions & 4 deletions source/client/options_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) {
if (request_method.isSet()) {
std::string upper_cased = request_method.getValue();
absl::AsciiStrToUpper(&upper_cased);
RELEASE_ASSERT(envoy::api::v2::core::RequestMethod_Parse(upper_cased, &request_method_),
RELEASE_ASSERT(envoy::config::core::v3alpha::RequestMethod_Parse(upper_cased, &request_method_),
"Failed to parse request method");
}
TCLAP_SET_IF_SPECIFIED(request_headers, request_headers_);
Expand Down Expand Up @@ -402,7 +402,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) {
}
if (!transport_socket.getValue().empty()) {
try {
transport_socket_.emplace(envoy::api::v2::core::TransportSocket());
transport_socket_.emplace(envoy::config::core::v3alpha::TransportSocket());
Envoy::MessageUtil::loadFromJson(transport_socket.getValue(), transport_socket_.value(),
Envoy::ProtobufMessage::getStrictValidationVisitor());
} catch (const Envoy::EnvoyException& e) {
Expand Down Expand Up @@ -475,7 +475,7 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) {

const auto& request_options = options.request_options();
if (request_options.request_method() !=
::envoy::api::v2::core::RequestMethod::METHOD_UNSPECIFIED) {
::envoy::config::core::v3alpha::RequestMethod::METHOD_UNSPECIFIED) {
request_method_ = request_options.request_method();
}
request_body_size_ =
Expand All @@ -497,7 +497,7 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) {
tls_context_.MergeFrom(options.tls_context());

if (options.has_transport_socket()) {
transport_socket_.emplace(envoy::api::v2::core::TransportSocket());
transport_socket_.emplace(envoy::config::core::v3alpha::TransportSocket());
transport_socket_.value().MergeFrom(options.transport_socket());
}

Expand Down
17 changes: 11 additions & 6 deletions source/client/options_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable<Envoy::Logger
nighthawk::client::AddressFamily::AddressFamilyOptions addressFamily() const override {
return address_family_;
};
envoy::api::v2::core::RequestMethod requestMethod() const override { return request_method_; };
envoy::config::core::v3alpha::RequestMethod requestMethod() const override {
return request_method_;
};
std::vector<std::string> requestHeaders() const override { return request_headers_; };
uint32_t requestBodySize() const override { return request_body_size_; };
const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const override {
const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext&
tlsContext() const override {
return tls_context_;
};
const absl::optional<envoy::api::v2::core::TransportSocket>& transportSocket() const override {
const absl::optional<envoy::config::core::v3alpha::TransportSocket>&
transportSocket() const override {
return transport_socket_;
}
uint32_t maxPendingRequests() const override { return max_pending_requests_; }
Expand Down Expand Up @@ -98,11 +102,12 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable<Envoy::Logger
uint32_t burst_size_{0};
nighthawk::client::AddressFamily::AddressFamilyOptions address_family_{
nighthawk::client::AddressFamily::AUTO};
envoy::api::v2::core::RequestMethod request_method_{envoy::api::v2::core::RequestMethod::GET};
envoy::config::core::v3alpha::RequestMethod request_method_{
envoy::config::core::v3alpha::RequestMethod::GET};
std::vector<std::string> request_headers_;
uint32_t request_body_size_{0};
envoy::api::v2::auth::UpstreamTlsContext tls_context_;
absl::optional<envoy::api::v2::core::TransportSocket> transport_socket_;
envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext tls_context_;
absl::optional<envoy::config::core::v3alpha::TransportSocket> transport_socket_;
uint32_t max_pending_requests_{0};
// This default is based the minimum recommendation for SETTINGS_MAX_CONCURRENT_STREAMS over at
// https://tools.ietf.org/html/rfc7540#section-6.5.2
Expand Down
40 changes: 22 additions & 18 deletions source/client/process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,27 +244,28 @@ ProcessImpl::mergeWorkerStatistics(const StatisticFactory& statistic_factory,
return merged_statistics;
}

void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Bootstrap& bootstrap,
const std::vector<UriPtr>& uris,
int number_of_clusters) const {
void ProcessImpl::createBootstrapConfiguration(
envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const std::vector<UriPtr>& uris,
int number_of_clusters) const {
for (int i = 0; i < number_of_clusters; i++) {
auto* cluster = bootstrap.mutable_static_resources()->add_clusters();
RELEASE_ASSERT(!uris.empty(), "illegal configuration with zero endpoints");
if (uris[0]->scheme() == "https") {
auto* tls_context = cluster->mutable_tls_context();
*tls_context = options_.tlsContext();
auto* common_tls_context = tls_context->mutable_common_tls_context();
auto* transport_socket = cluster->mutable_transport_socket();
transport_socket->set_name("envoy.transport_sockets.tls");
envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext context =
options_.tlsContext();
auto* common_tls_context = context.mutable_common_tls_context();
if (options_.h2()) {
common_tls_context->add_alpn_protocols("h2");
} else {
common_tls_context->add_alpn_protocols("http/1.1");
}
transport_socket->mutable_typed_config()->PackFrom(context);
}

if (options_.transportSocket().has_value()) {
*cluster->mutable_transport_socket() = options_.transportSocket().value();
}

cluster->set_name(fmt::format("{}", i));
cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count());
cluster->mutable_max_requests_per_connection()->set_value(options_.maxRequestsPerConnection());
Expand All @@ -279,7 +280,8 @@ void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Boo
options_.maxPendingRequests() == 0 ? 1 : options_.maxPendingRequests());
thresholds->mutable_max_requests()->set_value(options_.maxActiveRequests());

cluster->set_type(envoy::api::v2::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC);
cluster->set_type(
envoy::config::cluster::v3alpha::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC);
for (const UriPtr& uri : uris) {
auto* host = cluster->add_hosts();
auto* socket_address = host->mutable_socket_address();
Expand All @@ -289,27 +291,28 @@ void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Boo
}
}

void ProcessImpl::addTracingCluster(envoy::config::bootstrap::v2::Bootstrap& bootstrap,
void ProcessImpl::addTracingCluster(envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap,
const Uri& uri) const {
auto* cluster = bootstrap.mutable_static_resources()->add_clusters();
cluster->set_name("tracing");
cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count());
cluster->set_type(envoy::api::v2::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC);
cluster->set_type(
envoy::config::cluster::v3alpha::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC);
auto* host = cluster->add_hosts();
auto* socket_address = host->mutable_socket_address();
socket_address->set_address(uri.address()->ip()->addressAsString());
socket_address->set_port_value(uri.port());
}

void ProcessImpl::setupTracingImplementation(envoy::config::bootstrap::v2::Bootstrap& bootstrap,
const Uri& uri) const {
void ProcessImpl::setupTracingImplementation(
envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const Uri& uri) const {
#ifdef ZIPKIN_ENABLED
auto* http = bootstrap.mutable_tracing()->mutable_http();
auto scheme = uri.scheme();
const std::string kTracingClusterName = "tracing";
http->set_name(fmt::format("envoy.{}", scheme));
RELEASE_ASSERT(scheme == "zipkin", "Only zipkin is supported");
envoy::config::trace::v2::ZipkinConfig config;
envoy::config::trace::v3alpha::ZipkinConfig config;
config.mutable_collector_cluster()->assign(kTracingClusterName);
config.mutable_collector_endpoint()->assign(std::string(uri.path()));
config.mutable_shared_span_context()->set_value(true);
Expand All @@ -321,7 +324,8 @@ void ProcessImpl::setupTracingImplementation(envoy::config::bootstrap::v2::Boots
#endif
}

void ProcessImpl::maybeCreateTracingDriver(const envoy::config::trace::v2::Tracing& configuration) {
void ProcessImpl::maybeCreateTracingDriver(
const envoy::config::trace::v3alpha::Tracing& configuration) {
if (configuration.has_http()) {
#ifdef ZIPKIN_ENABLED
std::string type = configuration.http().name();
Expand All @@ -332,10 +336,10 @@ void ProcessImpl::maybeCreateTracingDriver(const envoy::config::trace::v2::Traci
// upstream code changes.
auto& factory =
Config::Utility::getAndCheckFactory<Envoy::Server::Configuration::TracerFactory>(
configuration.http().name());
configuration.http());
ProtobufTypes::MessagePtr message = Envoy::Config::Utility::translateToFactoryConfig(
configuration.http(), Envoy::ProtobufMessage::getStrictValidationVisitor(), factory);
auto zipkin_config = dynamic_cast<const envoy::config::trace::v2::ZipkinConfig&>(*message);
auto zipkin_config = dynamic_cast<const envoy::config::trace::v3alpha::ZipkinConfig&>(*message);
Envoy::Tracing::DriverPtr zipkin_driver =
std::make_unique<Envoy::Extensions::Tracers::Zipkin::Driver>(
zipkin_config, *cluster_manager_, store_root_, tls_,
Expand Down Expand Up @@ -402,7 +406,7 @@ bool ProcessImpl::run(OutputCollector& collector) {
if (options_.h2UseMultipleConnections()) {
cluster_manager_factory_->enableMultiConnectionH2Pool();
}
envoy::config::bootstrap::v2::Bootstrap bootstrap;
envoy::config::bootstrap::v3alpha::Bootstrap bootstrap;
createBootstrapConfiguration(bootstrap, uris, number_of_workers);
if (tracing_uri != nullptr) {
setupTracingImplementation(bootstrap, *tracing_uri);
Expand Down
9 changes: 5 additions & 4 deletions source/client/process_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ class ProcessImpl : public Process, public Envoy::Logger::Loggable<Envoy::Logger

uint32_t determineConcurrency() const;
bool run(OutputCollector& collector) override;
void addTracingCluster(envoy::config::bootstrap::v2::Bootstrap& bootstrap, const Uri& uri) const;
void setupTracingImplementation(envoy::config::bootstrap::v2::Bootstrap& bootstrap,
void addTracingCluster(envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap,
const Uri& uri) const;
void setupTracingImplementation(envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap,
const Uri& uri) const;
void createBootstrapConfiguration(envoy::config::bootstrap::v2::Bootstrap& bootstrap,
void createBootstrapConfiguration(envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap,
const std::vector<UriPtr>& uris, int number_of_workers) const;
void maybeCreateTracingDriver(const envoy::config::trace::v2::Tracing& configuration);
void maybeCreateTracingDriver(const envoy::config::trace::v3alpha::Tracing& configuration);
void shutdown() override;

private:
Expand Down
6 changes: 5 additions & 1 deletion source/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ admin:
```
USAGE:

bazel-bin/nighthawk_test_server [--use-fake-symbol-table <bool>]
bazel-bin/nighthawk_test_server [--disable-extensions <string>]
[--use-fake-symbol-table <bool>]
[--cpuset-threads]
[--enable-mutex-tracing]
[--disable-hot-restart]
Expand Down Expand Up @@ -114,6 +115,9 @@ bazel-bin/nighthawk_test_server [--use-fake-symbol-table <bool>]

Where:

--disable-extensions <string>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes related to this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is auto generated and originates from the updated Envoy version which apparently has a new cli arg. As ‘nighthawk_test_server’ basically is Envoy + a static extension we may see this when updating the dependency.

Comma-separated list of extensions to disable

--use-fake-symbol-table <bool>
Use fake symbol table implementation

Expand Down
2 changes: 1 addition & 1 deletion source/server/http_test_server_filter_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class HttpTestServerDecoderFilterConfig
return Envoy::ProtobufTypes::MessagePtr{new nighthawk::server::ResponseOptions()};
}

std::string name() override { return "test-server"; }
std::string name() const override { return "test-server"; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question here, not sure I follow if this is related to updating Envoy. Do we want a separate PR with description that would explain these additional changes?

Alternatively, please help me understand why they are necessary here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we hold off this PR for about a day? Eric is trying to import Nighthawk into our internal codebase. We are hoping to import just Nighthawk, not all of Envoy and this PR might break / delay that effort. We should be done with the import by tomorrow end of day.

Sure no problem


private:
Envoy::Http::FilterFactoryCb createFilter(const nighthawk::server::ResponseOptions& proto_config,
Expand Down
8 changes: 5 additions & 3 deletions test/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ class MockOptions : public Client::Options {
MOCK_CONST_METHOD0(prefetchConnections, bool());
MOCK_CONST_METHOD0(burstSize, uint32_t());
MOCK_CONST_METHOD0(addressFamily, nighthawk::client::AddressFamily::AddressFamilyOptions());
MOCK_CONST_METHOD0(requestMethod, envoy::api::v2::core::RequestMethod());
MOCK_CONST_METHOD0(requestMethod, envoy::config::core::v3alpha::RequestMethod());
MOCK_CONST_METHOD0(requestHeaders, std::vector<std::string>());
MOCK_CONST_METHOD0(requestBodySize, uint32_t());
MOCK_CONST_METHOD0(tlsContext, envoy::api::v2::auth::UpstreamTlsContext&());
MOCK_CONST_METHOD0(transportSocket, absl::optional<envoy::api::v2::core::TransportSocket>&());
MOCK_CONST_METHOD0(tlsContext,
envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext&());
MOCK_CONST_METHOD0(transportSocket,
absl::optional<envoy::config::core::v3alpha::TransportSocket>&());
MOCK_CONST_METHOD0(maxPendingRequests, uint32_t());
MOCK_CONST_METHOD0(maxActiveRequests, uint32_t());
MOCK_CONST_METHOD0(maxRequestsPerConnection, uint32_t());
Expand Down
Loading