@Override
    public void customize(ServiceInstance serviceInstance, ApplicationModel applicationModel) {
        MetadataInfo metadataInfo = serviceInstance.getServiceMetadata();
        if (metadataInfo == null || CollectionUtils.isEmptyMap(metadataInfo.getServices())) {
            return;
        }

        // try to load instance params that do not appear in service urls
        // TODO, duplicate snippet in ApplicationConfig
        Map<String, String> extraParameters = Collections.emptyMap();
        Set<InfraAdapter> adapters =
                applicationModel.getExtensionLoader(InfraAdapter.class).getSupportedExtensionInstances();
        if (CollectionUtils.isNotEmpty(adapters)) {
            Map<String, String> inputParameters = new HashMap<>();
            inputParameters.put(APPLICATION_KEY, applicationModel.getApplicationName());
            for (InfraAdapter adapter : adapters) {
                extraParameters = adapter.getExtraAttributes(inputParameters);
            }
        }

        serviceInstance.getMetadata().putAll(extraParameters);
        if (CollectionUtils.isNotEmptyMap(metadataInfo.getInstanceParams())) {
            serviceInstance.getMetadata().putAll(metadataInfo.getInstanceParams());
        }
    }
@Test
    void testCustomizeWithExcludeFilters() {
        ApplicationModel applicationModel = spy(ApplicationModel.defaultModel());
        ApplicationConfig applicationConfig = new ApplicationConfig("aa");
        doReturn(applicationConfig).when(applicationModel).getCurrentConfig();

        DefaultServiceInstance serviceInstance1 =
                new DefaultServiceInstance("ServiceInstanceMetadataCustomizerTest", applicationModel);
        MetadataInfo metadataInfo = new MetadataInfo();
        metadataInfo.addService(
                URL.valueOf(
                        "tri://127.1.1.1:50052/org.apache.dubbo.demo.GreetingService?application=ServiceInstanceMetadataCustomizerTest&env=test&side=provider&group=test&params-filter=-customized,-dubbo"));
        serviceInstance1.setServiceMetadata(metadataInfo);
        serviceInstanceMetadataCustomizer.customize(serviceInstance1, applicationModel);
        Assertions.assertEquals(2, serviceInstance1.getMetadata().size());
        Assertions.assertEquals("ServiceInstanceMetadataCustomizerTest", serviceInstance1.getMetadata("application"));
        Assertions.assertEquals("test", serviceInstance1.getMetadata("env"));

        Assertions.assertNull(serviceInstance1.getMetadata("side"));
        Assertions.assertNull(serviceInstance1.getMetadata("group"));
    }