diff --git a/.bazelrc b/.bazelrc index 584586ca3..85c32c0c0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 diff --git a/api/server/response_options.proto b/api/server/response_options.proto index bf64b916d..0eea906c2 100644 --- a/api/server/response_options.proto +++ b/api/server/response_options.proto @@ -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; +} diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 12c66cb12..106d31176 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -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" diff --git a/docs/root/examples/HEADER_BASED_LATENCY.md b/docs/root/examples/HEADER_BASED_LATENCY.md index 7126a5f32..dbf4572a6 100644 --- a/docs/root/examples/HEADER_BASED_LATENCY.md +++ b/docs/root/examples/HEADER_BASED_LATENCY.md @@ -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 diff --git a/source/server/README.md b/source/server/README.md index 1eb05b14c..23f4ab097 100644 --- a/source/server/README.md +++ b/source/server/README.md @@ -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 diff --git a/source/server/http_dynamic_delay_filter.cc b/source/server/http_dynamic_delay_filter.cc index 197b0b898..2324f31c6 100644 --- a/source/server/http_dynamic_delay_filter.cc +++ b/source/server/http_dynamic_delay_filter.cc @@ -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) {} diff --git a/source/server/http_dynamic_delay_filter.h b/source/server/http_dynamic_delay_filter.h index 45bc75b2e..57d7cdd39 100644 --- a/source/server/http_dynamic_delay_filter.h +++ b/source/server/http_dynamic_delay_filter.h @@ -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. */ diff --git a/source/server/http_dynamic_delay_filter_config.cc b/source/server/http_dynamic_delay_filter_config.cc index 89db6baeb..0cafdf7a7 100644 --- a/source/server/http_dynamic_delay_filter_config.cc +++ b/source/server/http_dynamic_delay_filter_config.cc @@ -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( - 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( diff --git a/source/server/http_time_tracking_filter.cc b/source/server/http_time_tracking_filter.cc index 0c2b51a24..140104503 100644 --- a/source/server/http_time_tracking_filter.cc +++ b/source/server/http_time_tracking_filter.cc @@ -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()) {} uint64_t diff --git a/source/server/http_time_tracking_filter.h b/source/server/http_time_tracking_filter.h index 7c0f38b16..cd6cdf4bf 100644 --- a/source/server/http_time_tracking_filter.h +++ b/source/server/http_time_tracking_filter.h @@ -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). diff --git a/source/server/http_time_tracking_filter_config.cc b/source/server/http_time_tracking_filter_config.cc index 50277aaf0..16c615bcb 100644 --- a/source/server/http_time_tracking_filter_config.cc +++ b/source/server/http_time_tracking_filter_config.cc @@ -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( - 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(proto_config)); diff --git a/test/integration/configurations/nighthawk_http_origin.yaml b/test/integration/configurations/nighthawk_http_origin.yaml index 7e5a5dc9c..5bc86323d 100644 --- a/test/integration/configurations/nighthawk_http_origin.yaml +++ b/test/integration/configurations/nighthawk_http_origin.yaml @@ -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 diff --git a/test/integration/configurations/nighthawk_https_origin.yaml b/test/integration/configurations/nighthawk_https_origin.yaml index 91beefb3b..28af0aaf7 100644 --- a/test/integration/configurations/nighthawk_https_origin.yaml +++ b/test/integration/configurations/nighthawk_https_origin.yaml @@ -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 diff --git a/test/integration/configurations/nighthawk_https_origin_dsa.yaml b/test/integration/configurations/nighthawk_https_origin_dsa.yaml index 5865115ef..ba9f2ec98 100644 --- a/test/integration/configurations/nighthawk_https_origin_dsa.yaml +++ b/test/integration/configurations/nighthawk_https_origin_dsa.yaml @@ -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 diff --git a/test/integration/configurations/nighthawk_https_origin_quic.yaml b/test/integration/configurations/nighthawk_https_origin_quic.yaml index bc607f33a..90701fbae 100644 --- a/test/integration/configurations/nighthawk_https_origin_quic.yaml +++ b/test/integration/configurations/nighthawk_https_origin_quic.yaml @@ -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 diff --git a/test/integration/configurations/nighthawk_track_timings.yaml b/test/integration/configurations/nighthawk_track_timings.yaml index de16b4ed0..ad26d78d7 100644 --- a/test/integration/configurations/nighthawk_track_timings.yaml +++ b/test/integration/configurations/nighthawk_track_timings.yaml @@ -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 diff --git a/test/server/http_dynamic_delay_filter_integration_test.cc b/test/server/http_dynamic_delay_filter_integration_test.cc index 5f5d1ceec..712134aa4 100644 --- a/test/server/http_dynamic_delay_filter_integration_test.cc +++ b/test/server/http_dynamic_delay_filter_integration_test.cc @@ -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), @@ -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()); @@ -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 @@ -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 diff --git a/test/server/http_filter_base_test.cc b/test/server/http_filter_base_test.cc index 23eeacf35..cb816f744 100644 --- a/test/server/http_filter_base_test.cc +++ b/test/server/http_filter_base_test.cc @@ -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}))); diff --git a/test/server/http_time_tracking_filter_integration_test.cc b/test/server/http_time_tracking_filter_integration_test.cc index 7ea03f46f..a34da6b89 100644 --- a/test/server/http_time_tracking_filter_integration_test.cc +++ b/test/server/http_time_tracking_filter_integration_test.cc @@ -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 @@ -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),