Skip to content

Commit

Permalink
Update envoy to f1a3fd1 (05/16/2022) (#852)
Browse files Browse the repository at this point in the history
* Update envoy to f1a3fd1 (05/16/2022)

Signed-off-by: Nathan Perry <[email protected]>

* Address codecheck comments.

Signed-off-by: Nathan Perry <[email protected]>

* Code comments and fix breakages

Signed-off-by: Nathan Perry <[email protected]>

* Update missed markdown file that referenced old method of using
dynamic-delay filter

Signed-off-by: Nathan Perry <[email protected]>
  • Loading branch information
dubious90 authored May 19, 2022
1 parent f911358 commit 4919c54
Show file tree
Hide file tree
Showing 19 changed files with 118 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ build:remote-clang-cl --config=rbe-toolchain-clang-cl

# Docker sandbox
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/main/toolchains/rbe_toolchains_config.bzl#L8
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:6fff5a6c67db843ddabde4533e24cab6122c7011
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:0a02a76af5951bf7f4c7029c0ea6d29d96c0f682
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
Expand Down
14 changes: 14 additions & 0 deletions api/server/response_options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@ message ResponseOptions {
// responses 3 and 2>.
string emit_previous_request_delta_in_response_header = 6;
}

// Configures the dynamic-delay test filter.
message DynamicDelayConfiguration {
// This is a temporary solution to allow this functionality to continue, but will likely be
// reconfigured soon.
ResponseOptions experimental_response_options = 1;
}

// Configures the time-tracking test filter
message TimeTrackingConfiguration {
// This is a temporary solution to allow this functionality to continue, but will likely be
// reconfigured soon.
ResponseOptions experimental_response_options = 1;
}
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 = "d3110f49cf4b14e7aa05388ec2ddc052c402381c"
ENVOY_SHA = "90cb3c5e8d6f3632edc7a26e6443937dfff03a7c3c13ffbc47516e93110e3518"
ENVOY_COMMIT = "f1a3fd1c549e86a02aa222784bcef9bf63dca19d"
ENVOY_SHA = "092e7243de4cd49e1ac9de611996a9dcc9fa2f398ef5e3f92fc90269abfcbfab"

HDR_HISTOGRAM_C_VERSION = "0.11.2" # October 12th, 2020
HDR_HISTOGRAM_C_SHA = "637f28b5f64de2e268131e4e34e6eef0b91cf5ff99167db447d9b2825eae6bad"
Expand Down
5 changes: 3 additions & 2 deletions docs/root/examples/HEADER_BASED_LATENCY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ Another use-case is tracking request-arrival time deltas using a feature of the
http_filters:
- name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
emit_previous_request_delta_in_response_header: x-origin-request-receipt-delta
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
experimental_response_options:
emit_previous_request_delta_in_response_header: x-origin-request-receipt-delta
- name: test-server
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
5 changes: 3 additions & 2 deletions source/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ static_resources:
http_filters:
- name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
static_delay: 0.5s
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
static_delay: 0.5s
- name: test-server # before envoy.router because order matters!
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
8 changes: 5 additions & 3 deletions source/server/http_dynamic_delay_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ namespace Nighthawk {
namespace Server {

HttpDynamicDelayDecoderFilterConfig::HttpDynamicDelayDecoderFilterConfig(
const nighthawk::server::ResponseOptions& proto_config, Envoy::Runtime::Loader& runtime,
const std::string& stats_prefix, Envoy::Stats::Scope& scope, Envoy::TimeSource& time_source)
: FilterConfigurationBase(proto_config, "dynamic-delay"), runtime_(runtime),
const nighthawk::server::DynamicDelayConfiguration& proto_config,
Envoy::Runtime::Loader& runtime, const std::string& stats_prefix, Envoy::Stats::Scope& scope,
Envoy::TimeSource& time_source)
: FilterConfigurationBase(proto_config.experimental_response_options(), "dynamic-delay"),
runtime_(runtime),
stats_prefix_(absl::StrCat(stats_prefix, fmt::format("{}.", filter_name()))), scope_(scope),
time_source_(time_source) {}

Expand Down
12 changes: 6 additions & 6 deletions source/server/http_dynamic_delay_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ class HttpDynamicDelayDecoderFilterConfig : public FilterConfigurationBase {
/**
* Constructs a new HttpDynamicDelayDecoderFilterConfig instance.
*
* @param proto_config The proto configuration of the filter. Will be tranlated internally into
* the right configuration for the base class structure (the failt filter and config).
* @param proto_config The proto configuration of the filter. Will be translated internally into
* the right configuration for the base class structure (the fault filter and config).
* @param runtime Envoy runtime to be used by the filter.
* @param stats_prefix Prefix to use by the filter when it names statistics. E.g.
* dynamic-delay.fault.delays_injected: 1
* @param scope Statistics scope to be used by the filter.
* @param time_source Time source to be used by the filter.
*/
HttpDynamicDelayDecoderFilterConfig(const nighthawk::server::ResponseOptions& proto_config,
Envoy::Runtime::Loader& runtime,
const std::string& stats_prefix, Envoy::Stats::Scope& scope,
Envoy::TimeSource& time_source);
HttpDynamicDelayDecoderFilterConfig(
const nighthawk::server::DynamicDelayConfiguration& proto_config,
Envoy::Runtime::Loader& runtime, const std::string& stats_prefix, Envoy::Stats::Scope& scope,
Envoy::TimeSource& time_source);
/**
* Increments the number of globally active filter instances.
*/
Expand Down
17 changes: 9 additions & 8 deletions source/server/http_dynamic_delay_filter_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@ class HttpDynamicDelayDecoderFilterConfigFactory
Envoy::Server::Configuration::FactoryContext& context) override {

auto& validation_visitor = Envoy::ProtobufMessage::getStrictValidationVisitor();
const nighthawk::server::ResponseOptions& response_options =
Envoy::MessageUtil::downcastAndValidate<const nighthawk::server::ResponseOptions&>(
proto_config, validation_visitor);
validateResponseOptions(response_options);
return createFilter(response_options, context);
const nighthawk::server::DynamicDelayConfiguration& dynamic_delay_configuration =
Envoy::MessageUtil::downcastAndValidate<
const nighthawk::server::DynamicDelayConfiguration&>(proto_config, validation_visitor);
validateResponseOptions(dynamic_delay_configuration.experimental_response_options());
return createFilter(dynamic_delay_configuration, context);
}

Envoy::ProtobufTypes::MessagePtr createEmptyConfigProto() override {
return Envoy::ProtobufTypes::MessagePtr{new nighthawk::server::ResponseOptions()};
return Envoy::ProtobufTypes::MessagePtr{new nighthawk::server::DynamicDelayConfiguration()};
}

std::string name() const override { return "dynamic-delay"; }

private:
Envoy::Http::FilterFactoryCb createFilter(const nighthawk::server::ResponseOptions& proto_config,
Envoy::Server::Configuration::FactoryContext& context) {
Envoy::Http::FilterFactoryCb
createFilter(const nighthawk::server::DynamicDelayConfiguration& proto_config,
Envoy::Server::Configuration::FactoryContext& context) {
Nighthawk::Server::HttpDynamicDelayDecoderFilterConfigSharedPtr config =
std::make_shared<Nighthawk::Server::HttpDynamicDelayDecoderFilterConfig>(
Nighthawk::Server::HttpDynamicDelayDecoderFilterConfig(
Expand Down
4 changes: 2 additions & 2 deletions source/server/http_time_tracking_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Nighthawk {
namespace Server {

HttpTimeTrackingFilterConfig::HttpTimeTrackingFilterConfig(
const nighthawk::server::ResponseOptions& proto_config)
: FilterConfigurationBase(proto_config, "time-tracking"),
const nighthawk::server::TimeTrackingConfiguration& proto_config)
: FilterConfigurationBase(proto_config.experimental_response_options(), "time-tracking"),
stopwatch_(std::make_unique<ThreadSafeMontonicTimeStopwatch>()) {}

uint64_t
Expand Down
2 changes: 1 addition & 1 deletion source/server/http_time_tracking_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class HttpTimeTrackingFilterConfig : public FilterConfigurationBase {
*
* @param proto_config The proto configuration of the filter.
*/
HttpTimeTrackingFilterConfig(const nighthawk::server::ResponseOptions& proto_config);
HttpTimeTrackingFilterConfig(const nighthawk::server::TimeTrackingConfiguration& proto_config);

/**
* Gets the number of elapsed nanoseconds since the last call (server wide).
Expand Down
17 changes: 9 additions & 8 deletions source/server/http_time_tracking_filter_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@ class HttpTimeTrackingFilterConfig
Envoy::Server::Configuration::FactoryContext& context) override {
Envoy::ProtobufMessage::ValidationVisitor& validation_visitor =
Envoy::ProtobufMessage::getStrictValidationVisitor();
const nighthawk::server::ResponseOptions& response_options =
Envoy::MessageUtil::downcastAndValidate<const nighthawk::server::ResponseOptions&>(
proto_config, validation_visitor);
validateResponseOptions(response_options);
return createFilter(response_options, context);
const nighthawk::server::TimeTrackingConfiguration& time_tracking_configuration =
Envoy::MessageUtil::downcastAndValidate<
const nighthawk::server::TimeTrackingConfiguration&>(proto_config, validation_visitor);
validateResponseOptions(time_tracking_configuration.experimental_response_options());
return createFilter(time_tracking_configuration, context);
}

Envoy::ProtobufTypes::MessagePtr createEmptyConfigProto() override {
return Envoy::ProtobufTypes::MessagePtr{new nighthawk::server::ResponseOptions()};
return Envoy::ProtobufTypes::MessagePtr{new nighthawk::server::TimeTrackingConfiguration()};
}

std::string name() const override { return "time-tracking"; }

private:
Envoy::Http::FilterFactoryCb createFilter(const nighthawk::server::ResponseOptions& proto_config,
Envoy::Server::Configuration::FactoryContext&) {
Envoy::Http::FilterFactoryCb
createFilter(const nighthawk::server::TimeTrackingConfiguration& proto_config,
Envoy::Server::Configuration::FactoryContext&) {
Nighthawk::Server::HttpTimeTrackingFilterConfigSharedPtr config =
std::make_shared<Nighthawk::Server::HttpTimeTrackingFilterConfig>(
Nighthawk::Server::HttpTimeTrackingFilterConfig(proto_config));
Expand Down
12 changes: 12 additions & 0 deletions test/integration/configurations/nighthawk_http_origin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ static_resources:
- "*"
http_filters:
- name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
experimental_response_options:
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1"}}
- name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1"}}
- name: test-server
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
6 changes: 6 additions & 0 deletions test/integration/configurations/nighthawk_https_origin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ static_resources:
- "*"
http_filters:
- name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1" } }
- name: test-server
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ static_resources:
- "*"
http_filters:
- name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1" } }
- name: test-server
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ static_resources:
- "*"
http_filters:
- name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
response_body_size: 10
v3_response_headers:
- { header: { key: "x-nh", value: "1" } }
- name: test-server
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
5 changes: 3 additions & 2 deletions test/integration/configurations/nighthawk_track_timings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ static_resources:
# Here we set up the time-tracking extension to emit request-arrival delta timings in a response header.
- name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
emit_previous_request_delta_in_response_header: x-origin-request-receipt-delta
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
experimental_response_options:
emit_previous_request_delta_in_response_header: x-origin-request-receipt-delta
- name: test-server
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
Expand Down
27 changes: 15 additions & 12 deletions test/server/http_dynamic_delay_filter_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ TEST_P(HttpDynamicDelayIntegrationTest,
const std::string invalid_configuration = R"EOF(
name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
response_headers:
- { header: { key: "key1", value: "value1"} }
v3_response_headers:
- { header: { key: "key1", value: "value1"} }
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
response_headers:
- { header: { key: "key1", value: "value1"} }
v3_response_headers:
- { header: { key: "key1", value: "value1"} }
)EOF";

ASSERT_DEATH(initializeFilterConfiguration(invalid_configuration),
Expand All @@ -62,7 +63,7 @@ TEST_P(HttpDynamicDelayIntegrationTest, NoStaticConfiguration) {
initializeFilterConfiguration(R"(
name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
)");
// Don't send any config request header ...
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
Expand All @@ -89,8 +90,9 @@ TEST_P(HttpDynamicDelayIntegrationTest, StaticConfigurationStaticDelay) {
initializeFilterConfiguration(R"EOF(
name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
static_delay: 1.33s
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
static_delay: 1.33s
)EOF");

// Without any request-level configuration, we expect the statically configured static delay to
Expand Down Expand Up @@ -135,10 +137,11 @@ TEST_P(HttpDynamicDelayIntegrationTest, StaticConfigurationConcurrentDelay) {
initializeFilterConfiguration(R"EOF(
name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
concurrency_based_linear_delay:
minimal_delay: 0.05s
concurrency_delay_factor: 0.01s
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
concurrency_based_linear_delay:
minimal_delay: 0.05s
concurrency_delay_factor: 0.01s
)EOF");
ASSERT_TRUE(getResponse(ResponseOrigin::UPSTREAM)->waitForEndStream());
// Based on the algorithm of concurrency_based_linear_delay, for the first request we expect to
Expand Down
10 changes: 6 additions & 4 deletions test/server/http_filter_base_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ INSTANTIATE_TEST_SUITE_P(
testing::ValuesIn({absl::string_view(R"EOF(
name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
emit_previous_request_delta_in_response_header: "foo"
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
experimental_response_options:
emit_previous_request_delta_in_response_header: "foo"
)EOF"),
absl::string_view(R"EOF(
name: dynamic-delay
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
static_delay: 0.1s
"@type": type.googleapis.com/nighthawk.server.DynamicDelayConfiguration
experimental_response_options:
static_delay: 0.1s
)EOF"),
absl::string_view("name: test-server")}),
testing::ValuesIn({TestRequestMethod::GET, TestRequestMethod::POST})));
Expand Down
16 changes: 9 additions & 7 deletions test/server/http_time_tracking_filter_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ const std::string kDefaultProtoFragment = fmt::format(
const std::string kProtoConfigTemplate = R"EOF(
name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
{}
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
experimental_response_options:
{}
)EOF";

class HttpTimeTrackingIntegrationTest
Expand All @@ -44,11 +45,12 @@ TEST_P(HttpTimeTrackingIntegrationTest,
const std::string invalid_configuration = R"EOF(
name: time-tracking
typed_config:
"@type": type.googleapis.com/nighthawk.server.ResponseOptions
response_headers:
- { header: { key: "key1", value: "value1"} }
v3_response_headers:
- { header: { key: "key1", value: "value1"} }
"@type": type.googleapis.com/nighthawk.server.TimeTrackingConfiguration
experimental_response_options:
response_headers:
- { header: { key: "key1", value: "value1"} }
v3_response_headers:
- { header: { key: "key1", value: "value1"} }
)EOF";

ASSERT_DEATH(initializeFilterConfiguration(invalid_configuration),
Expand Down

0 comments on commit 4919c54

Please sign in to comment.