@@ -152,35 +152,38 @@ message TraceableFilter {
152
152
"envoy.config.filter.accesslog.v2.TraceableFilter" ;
153
153
}
154
154
155
- // Filters for random sampling of requests .
155
+ // Filters requests based on runtime-configurable sampling rates .
156
156
message RuntimeFilter {
157
157
option (udpa.annotations.versioning ).previous_message_type =
158
158
"envoy.config.filter.accesslog.v2.RuntimeFilter" ;
159
159
160
- // Runtime key to get an optional overridden numerator for use in the
161
- // ``percent_sampled`` field. If found in runtime, this value will replace the
162
- // default numerator.
160
+ // Specifies a key used to look up a custom sampling rate from the runtime configuration. If a value is found for this
161
+ // key, it will override the default sampling rate specified in ``percent_sampled``.
163
162
string runtime_key = 1 [(validate.rules ).string = {min_len : 1 }];
164
163
165
- // The default sampling percentage. If not specified, defaults to 0% with
166
- // denominator of 100.
164
+ // Defines the default sampling percentage when no runtime override is present . If not specified, the default is
165
+ // **0%** (with a denominator of 100) .
167
166
type.v3.FractionalPercent percent_sampled = 2 ;
168
167
169
- // By default, sampling pivots on the header
170
- // :ref:`x-request-id<config_http_conn_man_headers_x-request-id>` being
171
- // present. If :ref:`x-request-id<config_http_conn_man_headers_x-request-id>`
172
- // is present, the filter will consistently sample across multiple hosts based
173
- // on the runtime key value and the value extracted from
174
- // :ref:`x-request-id<config_http_conn_man_headers_x-request-id>`. If it is
175
- // missing, or ``use_independent_randomness`` is set to true, the filter will
176
- // randomly sample based on the runtime key value alone.
177
- // ``use_independent_randomness`` can be used for logging kill switches within
178
- // complex nested :ref:`AndFilter
179
- // <envoy_v3_api_msg_config.accesslog.v3.AndFilter>` and :ref:`OrFilter
180
- // <envoy_v3_api_msg_config.accesslog.v3.OrFilter>` blocks that are easier to
181
- // reason about from a probability perspective (i.e., setting to true will
182
- // cause the filter to behave like an independent random variable when
183
- // composed within logical operator filters).
168
+ // Controls how sampling decisions are made.
169
+ //
170
+ // - Default behavior (``false``):
171
+ //
172
+ // * Uses the :ref:`x-request-id<config_http_conn_man_headers_x-request-id>` as a consistent sampling pivot.
173
+ // * When :ref:`x-request-id<config_http_conn_man_headers_x-request-id>` is present, sampling will be consistent
174
+ // across multiple hosts based on both the ``runtime_key`` and
175
+ // :ref:`x-request-id<config_http_conn_man_headers_x-request-id>`.
176
+ // * Useful for tracking related requests across a distributed system.
177
+ //
178
+ // - When set to ``true`` or :ref:`x-request-id<config_http_conn_man_headers_x-request-id>` is missing:
179
+ //
180
+ // * Sampling decisions are made randomly based only on the ``runtime_key``.
181
+ // * Useful in complex filter configurations (like nested
182
+ // :ref:`AndFilter<envoy_v3_api_msg_config.accesslog.v3.AndFilter>`/
183
+ // :ref:`OrFilter<envoy_v3_api_msg_config.accesslog.v3.OrFilter>` blocks) where independent probability
184
+ // calculations are desired.
185
+ // * Can be used to implement logging kill switches with predictable probability distributions.
186
+ //
184
187
bool use_independent_randomness = 3 ;
185
188
}
186
189
0 commit comments