1
#include "source/extensions/retry/host/omit_host_metadata/omit_host_metadata.h"
2

            
3
#include "source/common/config/metadata.h"
4

            
5
namespace Envoy {
6
namespace Extensions {
7
namespace Retry {
8
namespace Host {
9

            
10
5
bool OmitHostsRetryPredicate::shouldSelectAnotherHost(const Upstream::Host& host) {
11
  // Note: The additional check to verify if the labelSet is empty is performed since
12
  // metadataLabelMatch returns true in case of an empty labelSet. However, for an empty labelSet,
13
  // i.e. if there is no matching criteria defined, this method should return false.
14
5
  return !label_set_.empty() && Envoy::Config::Metadata::metadataLabelMatch(
15
4
                                    label_set_, host.metadata().get(),
16
4
                                    Envoy::Config::MetadataFilters::get().ENVOY_LB, true);
17
5
}
18

            
19
} // namespace Host
20
} // namespace Retry
21
} // namespace Extensions
22
} // namespace Envoy