Skip to content

Commit

Permalink
Merge branch 'main' into cleanup-fm-state
Browse files Browse the repository at this point in the history
  • Loading branch information
yanavlasov committed Aug 1, 2024
2 parents 60e63a0 + ec61a3c commit c0881b5
Show file tree
Hide file tree
Showing 56 changed files with 639 additions and 346 deletions.
2 changes: 2 additions & 0 deletions api/envoy/service/ratelimit/v3/rls.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ message RateLimitRequest {

// Rate limit requests can optionally specify the number of hits a request adds to the matched
// limit. If the value is not set in the message, a request increases the matched limit by 1.
// This value can be overridden by setting filter state value ``envoy.ratelimit.hits_addend``
// to the desired number. Invalid number (< 0) or number will be ignored.
uint32 hits_addend = 3;
}

Expand Down
8 changes: 8 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ new_features:
change: |
added %UPSTREAM_CLUSTER_RAW% access log formatter to log the original upstream cluster name, regardless of whether
``alt_stat_name`` is set.
- area: formatter
change: |
Added full feature absl::FormatTime() support to the DateFormatter. This allows the timepoint formatters (like
``%START_TIME%``) to use ``%E#S``, ``%E*S``, ``%E#f`` and ``%E*f`` to format the subsecond part of the timepoint.
- area: sockets
change: |
Added socket ``type`` field for specifying a socket type to apply the socket option to under :ref:`SocketOption
Expand All @@ -111,6 +115,10 @@ new_features:
<envoy_v3_api_field_extensions.transport_sockets.tls.v3.CommonTlsContext.custom_tls_certificate_selector>`
to allow overriding TLS certificate selection behavior.
An extension can select certificate base on the incoming SNI, in both sync and async mode.
- area: ratelimit
change: |
Added the ability to modify :ref:`hits_addend <envoy_v3_api_field_service.ratelimit.v3.RateLimitRequest.hits_addend>`
by setting by setting filter state value ``envoy.ratelimit.hits_addend`` to the desired value.
- area: access_log
change: |
Added new access log command operators ``%START_TIME_LOCAL%`` and ``%EMIT_TIME_LOCAL%``,
Expand Down
5 changes: 5 additions & 0 deletions docs/root/configuration/advanced/well_known_filter_state.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ The following lists the filter state object keys used by the Envoy extensions:
<envoy_v3_api_field_extensions.filters.network.tcp_proxy.v3.TcpProxy.idle_timeout>` override on a per-connection
basis. Accepts a count of milliseconds number string as a constructor.

``envoy.ratelimit.hits_addend``
:ref:`Rate Limit Hits Addend
<envoy_v3_api_field_service.ratelimit.v3.RateLimitRequest.hits_addend>` override on a per-route basis.
Accepts a number string as a constructor.

Filter state object fields
--------------------------

Expand Down
11 changes: 5 additions & 6 deletions envoy/common/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ class EnvoyException : public std::runtime_error {
// the macros above.
#define THROW_IF_STATUS_NOT_OK(variable, throw_action) THROW_IF_NOT_OK_REF(variable.status());

// TODO(alyssawilk) remove in favor of RETURN_IF_NOT_OK
#define RETURN_IF_STATUS_NOT_OK(variable) \
if (!variable.status().ok()) { \
return variable.status(); \
#define RETURN_IF_NOT_OK_REF(variable) \
if (const absl::Status& temp_status = variable; !temp_status.ok()) { \
return temp_status; \
}

// Make sure this works for functions without calling the functoin twice as well.
#define RETURN_IF_NOT_OK(variable) \
if (absl::Status temp_status = variable; !temp_status.ok()) { \
#define RETURN_IF_NOT_OK(status_fn) \
if (absl::Status temp_status = (status_fn); !temp_status.ok()) { \
return temp_status; \
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ApiListenerManagerImpl::addOrUpdateListener(const envoy::config::listener::v3::L
}
if (!api_listener_ && !added_via_api) {
auto listener_or_error = HttpApiListener::create(config, server_, config.name());
RETURN_IF_STATUS_NOT_OK(listener_or_error);
RETURN_IF_NOT_OK(listener_or_error.status());
api_listener_ = std::move(listener_or_error.value());
return true;
} else {
Expand Down
1 change: 1 addition & 0 deletions source/common/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ envoy_cc_library(
"//envoy/common:interval_set_interface",
"//envoy/common:time_interface",
"//source/common/singleton:const_singleton",
"@com_googlesource_code_re2//:re2",
],
)

Expand Down
Loading

0 comments on commit c0881b5

Please sign in to comment.