def match()

in aws_xray_sdk/core/sampling/sampling_rule.py [0:0]


    def match(self, sampling_req):
        """
        Determines whether or not this sampling rule applies to the incoming
        request based on some of the request's parameters.
        Any ``None`` parameter provided will be considered an implicit match.
        """
        if sampling_req is None:
            return False

        host = sampling_req.get('host', None)
        method = sampling_req.get('method', None)
        path = sampling_req.get('path', None)
        service = sampling_req.get('service', None)
        service_type = sampling_req.get('service_type', None)

        return (not host or wildcard_match(self._host, host)) \
            and (not method or wildcard_match(self._method, method)) \
            and (not path or wildcard_match(self._path, path)) \
            and (not service or wildcard_match(self._service, service)) \
            and (not service_type or wildcard_match(self._service_type, service_type))