BasicCounter counter = getCounter(name);
counter.increment();
}
private BasicCounter getCounter(String name) {
BasicCounter counter = map.get(name);
if (counter == null) {
synchronized (lock) {
counter = map.get(name);
if (counter != null) {
return counter;
}
List<Tag> tags = new ArrayList<Tag>(2);
tags.add(InjectableTag.HOSTNAME);
tags.add(InjectableTag.IP);
counter = new BasicCounter(MonitorConfig.builder(name).withTags(tags).build());
map.putIfAbsent(name, counter);
DefaultMonitorRegistry.getInstance().register(counter);
}
}
return counter;