@@ -292,7 +292,8 @@ bool LogTypeFilter::evaluate(const Formatter::HttpFormatterContext& context,
292
292
293
293
MetadataFilter::MetadataFilter (const envoy::config::accesslog::v3::MetadataFilter& filter_config,
294
294
Server::Configuration::CommonFactoryContext& context)
295
- : default_match_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(filter_config, match_if_key_not_found, true )),
295
+ : present_matcher_(true ),
296
+ default_match_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(filter_config, match_if_key_not_found, true )),
296
297
filter_(filter_config.matcher().filter()) {
297
298
298
299
if (filter_config.has_matcher ()) {
@@ -306,11 +307,6 @@ MetadataFilter::MetadataFilter(const envoy::config::accesslog::v3::MetadataFilte
306
307
const auto & val = matcher_config.value ();
307
308
value_matcher_ = Matchers::ValueMatcher::create (val, context);
308
309
}
309
-
310
- // Matches if the value is present in dynamic metadata
311
- auto present_val = envoy::type::matcher::v3::ValueMatcher ();
312
- present_val.set_present_match (true );
313
- present_matcher_ = Matchers::ValueMatcher::create (present_val, context);
314
310
}
315
311
316
312
bool MetadataFilter::evaluate (const Formatter::HttpFormatterContext&,
@@ -319,7 +315,7 @@ bool MetadataFilter::evaluate(const Formatter::HttpFormatterContext&,
319
315
Envoy::Config::Metadata::metadataValue (&info.dynamicMetadata (), filter_, path_);
320
316
// If the key corresponds to a set value in dynamic metadata, return true if the value matches the
321
317
// the configured 'MetadataMatcher' value and false otherwise
322
- if (present_matcher_-> match (value)) {
318
+ if (present_matcher_. match (value)) {
323
319
return value_matcher_ && value_matcher_->match (value);
324
320
}
325
321
0 commit comments