MetricImporterUtils { public static Metric mergeWithExtraTags(Metric metric, Map<String, String> extraTags) { if (CollectionUtils.isEmpty(extraTags)) { return metric; } for (Map.Entry<String, String> e : extraTags.entrySet()) { metric.getTags().putIfAbsent(e.getKey(), e.getValue()); } return metric; } private  MetricImporterUtils(); static void validExtraTags(Map<String, String> extraTags); static Metric mergeWithExtraTags(Metric metric, Map<String, String> extraTags); static void resolveExtraTagsFromURI(String baseURIPath, String requestURI,
                                               Map<String, String> map); static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request,
                                                                         Map<String, String> map);  }
@Test public void testMergeWithExtraTags() { Map<String, String> tags = new HashMap<>(); tags.put("app", "demo"); tags.put("step", "10000"); Metric metric = new Metric(); metric.getTags().put("a", "b"); Metric m = MetricImporterUtils.mergeWithExtraTags(metric, tags); Assert.assertEquals(3, m.getTags().size()); }