@Override public void notify(ZuulFilter filter, ExecutionStatus status) { DynamicCounter.increment( METRIC_PREFIX + filter.getClass().getSimpleName(), "status", status.name(), "filtertype", filter.filterType()); }
/** Increment a counter specified by a name, and a sequence of (key, value) pairs. */ public static void increment(String name, String... tags) { final MonitorConfig.Builder configBuilder = MonitorConfig.builder(name); Preconditions.checkArgument( tags.length % 2 == 0, "The sequence of (key, value) pairs must have even size: one key, one value"); try { for (int i = 0; i < tags.length; i += 2) { configBuilder.withTag(tags[i], tags[i + 1]); } increment(configBuilder.build()); } catch (IllegalArgumentException e) { LOGGER.warn("Failed to get a counter to increment: {}", e.getMessage()); } }
/** Increment the counter for a given name, tagList by a given delta. */ public static void increment(String name, TagList list, long delta) { final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build(); increment(config, delta); }
/** Increment the counter for a given name, tagList. */ public static void increment(String name, TagList list) { final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build(); increment(config); }