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
1 change: 1 addition & 0 deletions api/envoy/config/accesslog/v3/accesslog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ message ResponseFlagFilter {
in: "DT"
in: "UPE"
in: "NC"
in: "OM"
}
}
}];
Expand Down
1 change: 1 addition & 0 deletions api/envoy/config/accesslog/v4alpha/accesslog.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion api/envoy/data/accesslog/v3/accesslog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ message AccessLogCommon {
}

// Flags indicating occurrences during request/response processing.
// [#next-free-field: 26]
// [#next-free-field: 27]
message ResponseFlags {
option (udpa.annotations.versioning).previous_message_type =
"envoy.data.accesslog.v2.ResponseFlags";
Expand Down Expand Up @@ -281,6 +281,9 @@ message ResponseFlags {

// Indicates no cluster was found for the request.
bool no_cluster_found = 25;

// Indicates overload manager terminated the request.
bool overload_manager = 26;
}

// Properties of a negotiated TLS connection.
Expand Down
1 change: 1 addition & 0 deletions docs/root/configuration/observability/access_log/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ The following command operators are supported:
* **DPE**: The downstream request had an HTTP protocol error.
* **UPE**: The upstream response had an HTTP protocol error.
* **UMSDR**: The upstream request reached to max stream duration.
* **OM**: Overload Manager terminated the request.

%ROUTE_NAME%
Name of the route.
Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Removed Config or Runtime
New Features
------------

* access_log: added the new response flag for :ref:`overload manager termination <envoy_v3_api_field_data.accesslog.v3.ResponseFlags.overload_manager>`. The response flag will be set when the http stream is terminated by overload manager.
* admission control: added :ref:`admission control <envoy_v3_api_field_extensions.filters.http.admission_control.v3alpha.AdmissionControl.rps_threshold>` option that when average RPS of the sampling window is below this threshold, the filter will not throttle requests. Added :ref:`admission control <envoy_v3_api_field_extensions.filters.http.admission_control.v3alpha.AdmissionControl.max_rejection_probability>` option to set an upper limit on the probability of rejection.
* bandwidth_limit: added new :ref:`HTTP bandwidth limit filter <config_http_filters_bandwidth_limit>`.
* bootstrap: added :ref:`dns_resolution_config <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.dns_resolution_config>` to aggregate all of the DNS resolver configuration in a single message. By setting one such configuration option *no_default_search_domain* as true the DNS resolver will not use the default search domains. And by setting the configuration *resolvers* we can specify the external DNS servers to be used for external DNS query.
Expand Down
4 changes: 3 additions & 1 deletion envoy/http/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ enum class StreamResetReason {
// Either there was an early TCP error for a CONNECT request or the peer reset with CONNECT_ERROR
ConnectError,
// Received payload did not conform to HTTP protocol.
ProtocolError
ProtocolError,
// If the stream was locally reset by the Overload Manager.
OverloadManager
};

/**
Expand Down
4 changes: 3 additions & 1 deletion envoy/stream_info/stream_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ enum ResponseFlag {
UpstreamProtocolError = 0x800000,
// No cluster found for a given request.
NoClusterFound = 0x1000000,
// Overload Manager terminated the stream.
OverloadManager = 0x2000000,
// ATTENTION: MAKE SURE THIS REMAINS EQUAL TO THE LAST FLAG.
LastFlag = NoClusterFound,
LastFlag = OverloadManager,
};

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion generated_api_shadow/envoy/data/accesslog/v3/accesslog.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions source/common/http/conn_pool_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void MultiplexedActiveClientBase::onStreamReset(Http::StreamResetReason reason)
break;
case StreamResetReason::LocalReset:
case StreamResetReason::ProtocolError:
case StreamResetReason::OverloadManager:
parent_.host()->cluster().stats().upstream_rq_tx_reset_.inc();
break;
case StreamResetReason::RemoteReset:
Expand Down
2 changes: 2 additions & 0 deletions source/common/http/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,8 @@ const std::string Utility::resetReasonToString(const Http::StreamResetReason res
return "remote error with CONNECT request";
case Http::StreamResetReason::ProtocolError:
return "protocol error";
case Http::StreamResetReason::OverloadManager:
return "overload manager reset";
}

NOT_REACHED_GCOVR_EXCL_LINE;
Expand Down
2 changes: 2 additions & 0 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,8 @@ Filter::streamResetReasonToResponseFlag(Http::StreamResetReason reset_reason) {
return StreamInfo::ResponseFlag::UpstreamRemoteReset;
case Http::StreamResetReason::ProtocolError:
return StreamInfo::ResponseFlag::UpstreamProtocolError;
case Http::StreamResetReason::OverloadManager:
return StreamInfo::ResponseFlag::OverloadManager;
}

NOT_REACHED_GCOVR_EXCL_LINE;
Expand Down
2 changes: 1 addition & 1 deletion source/common/stream_info/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const std::string ResponseFlagUtils::toShortString(const StreamInfo& stream_info
}

absl::flat_hash_map<std::string, ResponseFlag> ResponseFlagUtils::getFlagMap() {
static_assert(ResponseFlag::LastFlag == 0x1000000,
static_assert(ResponseFlag::LastFlag == 0x2000000,
"A flag has been added. Add the new flag to ALL_RESPONSE_STRING_FLAGS.");
absl::flat_hash_map<std::string, ResponseFlag> res;
for (auto [str, flag] : ResponseFlagUtils::ALL_RESPONSE_STRING_FLAGS) {
Expand Down
2 changes: 2 additions & 0 deletions source/common/stream_info/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ResponseFlagUtils {
constexpr static absl::string_view DURATION_TIMEOUT = "DT";
constexpr static absl::string_view UPSTREAM_PROTOCOL_ERROR = "UPE";
constexpr static absl::string_view NO_CLUSTER_FOUND = "NC";
constexpr static absl::string_view OVERLOAD_MANAGER = "OM";

static constexpr std::array ALL_RESPONSE_STRING_FLAGS{
FlagStringAndEnum{FAILED_LOCAL_HEALTH_CHECK, ResponseFlag::FailedLocalHealthCheck},
Expand Down Expand Up @@ -74,6 +75,7 @@ class ResponseFlagUtils {
FlagStringAndEnum{DURATION_TIMEOUT, ResponseFlag::DurationTimeout},
FlagStringAndEnum{UPSTREAM_PROTOCOL_ERROR, ResponseFlag::UpstreamProtocolError},
FlagStringAndEnum{NO_CLUSTER_FOUND, ResponseFlag::NoClusterFound},
FlagStringAndEnum{OVERLOAD_MANAGER, ResponseFlag::OverloadManager},
};

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void Utility::responseFlagsToAccessLogResponseFlags(
envoy::data::accesslog::v3::AccessLogCommon& common_access_log,
const StreamInfo::StreamInfo& stream_info) {

static_assert(StreamInfo::ResponseFlag::LastFlag == 0x1000000,
static_assert(StreamInfo::ResponseFlag::LastFlag == 0x2000000,
"A flag has been added. Fix this code.");

if (stream_info.hasResponseFlag(StreamInfo::ResponseFlag::FailedLocalHealthCheck)) {
Expand Down Expand Up @@ -140,6 +140,10 @@ void Utility::responseFlagsToAccessLogResponseFlags(
if (stream_info.hasResponseFlag(StreamInfo::ResponseFlag::NoClusterFound)) {
common_access_log.mutable_response_flags()->set_no_cluster_found(true);
}

if (stream_info.hasResponseFlag(StreamInfo::ResponseFlag::OverloadManager)) {
common_access_log.mutable_response_flags()->set_overload_manager(true);
}
}

void Utility::extractCommonAccessLogProperties(
Expand Down
1 change: 1 addition & 0 deletions test/common/access_log/access_log_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ name: accesslog
- DT
- UPE
- NC
- OM
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: /dev/null
Expand Down
2 changes: 2 additions & 0 deletions test/common/http/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,8 @@ TEST(HttpUtility, ResetReasonToString) {
Utility::resetReasonToString(Http::StreamResetReason::RemoteRefusedStreamReset));
EXPECT_EQ("remote error with CONNECT request",
Utility::resetReasonToString(Http::StreamResetReason::ConnectError));
EXPECT_EQ("overload manager reset",
Utility::resetReasonToString(Http::StreamResetReason::OverloadManager));
}

class TestConfig : public Router::RouteSpecificFilterConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ TEST(UtilityResponseFlagsToAccessLogResponseFlagsTest, All) {
common_access_log_expected.mutable_response_flags()->set_duration_timeout(true);
common_access_log_expected.mutable_response_flags()->set_upstream_protocol_error(true);
common_access_log_expected.mutable_response_flags()->set_no_cluster_found(true);
common_access_log_expected.mutable_response_flags()->set_overload_manager(true);

EXPECT_EQ(common_access_log_expected.DebugString(), common_access_log.DebugString());
}
Expand Down