public boolean isMatch(
            Invocation invocation, Map<String, String> sourceLabels, Set<TracingContextProvider> contextProviders) {
        // Match method
        if (getMethod() != null) {
            if (!getMethod().isMatch(invocation)) {
                return false;
            }
        }

        // Match Source Labels
        if (getSourceLabels() != null) {
            for (Map.Entry<String, String> entry : getSourceLabels().entrySet()) {
                String value = sourceLabels.get(entry.getKey());
                if (!entry.getValue().equals(value)) {
                    return false;
                }
            }
        }

        // Match attachment
        if (getAttachments() != null) {
            return getAttachments().isMatch(invocation, contextProviders);
        }

        // TODO Match headers

        return true;
    }
@Test
    void isMatch() {
        DubboMatchRequest dubboMatchRequest = new DubboMatchRequest();

        // methodMatch
        DubboMethodMatch dubboMethodMatch = new DubboMethodMatch();
        StringMatch nameStringMatch = new StringMatch();
        nameStringMatch.setExact("sayHello");
        dubboMethodMatch.setName_match(nameStringMatch);

        dubboMatchRequest.setMethod(dubboMethodMatch);

        RpcInvocation rpcInvocation = new RpcInvocation();
        rpcInvocation.setMethodName("sayHello");
        assertTrue(dubboMatchRequest.isMatch(rpcInvocation, new HashMap<>(), Collections.emptySet()));

        rpcInvocation.setMethodName("satHi");
        assertFalse(dubboMatchRequest.isMatch(rpcInvocation, new HashMap<>(), Collections.emptySet()));

        // sourceLabels
        Map<String, String> sourceLabels = new HashMap<>();
        sourceLabels.put("key1", "value1");
        sourceLabels.put("key2", "value2");

        dubboMatchRequest.setSourceLabels(sourceLabels);

        Map<String, String> inputSourceLabelsMap = new HashMap<>();
        inputSourceLabelsMap.put("key1", "value1");
        inputSourceLabelsMap.put("key2", "value2");
        inputSourceLabelsMap.put("key3", "value3");

        Map<String, String> inputSourceLabelsMap2 = new HashMap<>();
        inputSourceLabelsMap2.put("key1", "other");
        inputSourceLabelsMap2.put("key2", "value2");
        inputSourceLabelsMap2.put("key3", "value3");

        rpcInvocation.setMethodName("sayHello");
        assertTrue(dubboMatchRequest.isMatch(rpcInvocation, inputSourceLabelsMap, Collections.emptySet()));
        assertFalse(dubboMatchRequest.isMatch(rpcInvocation, inputSourceLabelsMap2, Collections.emptySet()));

        // tracingContext
        DubboAttachmentMatch dubboAttachmentMatch = new DubboAttachmentMatch();
        Map<String, StringMatch> tracingContextMatchMap = new HashMap<>();
        StringMatch nameMatch = new StringMatch();
        nameMatch.setExact("qinliujie");
        tracingContextMatchMap.put("name", nameMatch);
        dubboAttachmentMatch.setTracingContext(tracingContextMatchMap);
        dubboMatchRequest.setAttachments(dubboAttachmentMatch);

        Map<String, String> invokeTracingContextMap = new HashMap<>();
        invokeTracingContextMap.put("name", "qinliujie");
        invokeTracingContextMap.put("machineGroup", "test_host");
        invokeTracingContextMap.put("other", "other");

        TracingContextProvider tracingContextProvider = (invocation, key) -> invokeTracingContextMap.get(key);
        assertTrue(dubboMatchRequest.isMatch(
                rpcInvocation, inputSourceLabelsMap, Collections.singleton(tracingContextProvider)));

        Map<String, String> invokeTracingContextMap2 = new HashMap<>();
        invokeTracingContextMap2.put("name", "jack");
        invokeTracingContextMap2.put("machineGroup", "test_host");
        invokeTracingContextMap2.put("other", "other");

        TracingContextProvider tracingContextProvider2 = (invocation, key) -> invokeTracingContextMap2.get(key);
        assertFalse(dubboMatchRequest.isMatch(
                rpcInvocation, inputSourceLabelsMap, Collections.singleton(tracingContextProvider2)));

        // dubbo context
        dubboAttachmentMatch = new DubboAttachmentMatch();

        Map<String, StringMatch> eagleeyecontextMatchMap = new HashMap<>();
        nameMatch = new StringMatch();
        nameMatch.setExact("qinliujie");
        eagleeyecontextMatchMap.put("name", nameMatch);
        dubboAttachmentMatch.setTracingContext(eagleeyecontextMatchMap);

        Map<String, StringMatch> dubboContextMatchMap = new HashMap<>();
        StringMatch dpathMatch = new StringMatch();
        dpathMatch.setExact("PRE");
        dubboContextMatchMap.put("dpath", dpathMatch);
        dubboAttachmentMatch.setDubboContext(dubboContextMatchMap);

        dubboMatchRequest.setAttachments(dubboAttachmentMatch);

        Map<String, String> invokeDubboContextMap = new HashMap<>();
        invokeDubboContextMap.put("dpath", "PRE");

        rpcInvocation.setAttachments(invokeDubboContextMap);
        TracingContextProvider tracingContextProvider3 = (invocation, key) -> invokeTracingContextMap.get(key);
        assertTrue(dubboMatchRequest.isMatch(
                rpcInvocation, inputSourceLabelsMap, Collections.singleton(tracingContextProvider3)));

        Map<String, String> invokeDubboContextMap2 = new HashMap<>();
        invokeDubboContextMap.put("dpath", "other");

        rpcInvocation.setAttachments(invokeDubboContextMap2);
        assertFalse(dubboMatchRequest.isMatch(
                rpcInvocation, inputSourceLabelsMap, Collections.singleton(tracingContextProvider3)));
    }