@Test public void testResolveExtraTagsFromRequestHeaders() { HttpHeaders headers = new HttpHeaders(); headers.add("app", "demo"); ServerRequest req = MockServerRequest.builder().headers(headers).build(); Map<String, String> map = new HashMap<>(); MetricImporterUtils.resolveExtraTagsFromRequestHeaders(req, map); Assert.assertEquals("demo", map.get("app")); }
public static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request, Map<String, String> map) { Preconditions.checkNotNull(request); String app = WebfluxUtils.getHeaderValue(request, "app"); if (app != null) { map.put("app", app); } String clientIp = WebfluxUtils.getHeaderValue(request, "ip"); if (clientIp != null) { map.put("ip", clientIp); } String step = WebfluxUtils.getHeaderValue(request, "step"); if (step != null) { map.put("step", step); } return map; }
MetricImporterUtils { public static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request, Map<String, String> map) { Preconditions.checkNotNull(request); String app = WebfluxUtils.getHeaderValue(request, "app"); if (app != null) { map.put("app", app); } String clientIp = WebfluxUtils.getHeaderValue(request, "ip"); if (clientIp != null) { map.put("ip", clientIp); } String step = WebfluxUtils.getHeaderValue(request, "step"); if (step != null) { map.put("step", step); } return map; } }
MetricImporterUtils { public static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request, Map<String, String> map) { Preconditions.checkNotNull(request); String app = WebfluxUtils.getHeaderValue(request, "app"); if (app != null) { map.put("app", app); } String clientIp = WebfluxUtils.getHeaderValue(request, "ip"); if (clientIp != null) { map.put("ip", clientIp); } String step = WebfluxUtils.getHeaderValue(request, "step"); if (step != null) { map.put("step", step); } return map; } private  MetricImporterUtils(); }
MetricImporterUtils { public static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request, Map<String, String> map) { Preconditions.checkNotNull(request); String app = WebfluxUtils.getHeaderValue(request, "app"); if (app != null) { map.put("app", app); } String clientIp = WebfluxUtils.getHeaderValue(request, "ip"); if (clientIp != null) { map.put("ip", clientIp); } String step = WebfluxUtils.getHeaderValue(request, "step"); if (step != null) { map.put("step", step); } return map; } 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); }
MetricImporterUtils { public static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request, Map<String, String> map) { Preconditions.checkNotNull(request); String app = WebfluxUtils.getHeaderValue(request, "app"); if (app != null) { map.put("app", app); } String clientIp = WebfluxUtils.getHeaderValue(request, "ip"); if (clientIp != null) { map.put("ip", clientIp); } String step = WebfluxUtils.getHeaderValue(request, "step"); if (step != null) { map.put("step", step); } return map; } 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);  }