Search in sources :

Example 1 with NamingConvention

use of io.micrometer.core.instrument.config.NamingConvention in project micrometer by micrometer-metrics.

the class NewRelicMeterRegistry method event.

private String event(Meter.Id id, Iterable<Tag> extraTags, Attribute... attributes) {
    StringBuilder tagsJson = new StringBuilder();
    for (Tag tag : getConventionTags(id)) {
        tagsJson.append(",\"").append(tag.getKey()).append("\":\"").append(tag.getValue()).append("\"");
    }
    NamingConvention convention = config().namingConvention();
    for (Tag tag : extraTags) {
        tagsJson.append(",\"").append(convention.tagKey(tag.getKey())).append("\":\"").append(convention.tagValue(tag.getValue())).append("\"");
    }
    return "{\"eventType\":\"" + getConventionName(id) + "\"" + Arrays.stream(attributes).map(attr -> ",\"" + attr.getName() + "\":" + Double.toString(attr.getValue().doubleValue())).collect(Collectors.joining("")) + tagsJson.toString() + "}";
}
Also used : NamingConvention(io.micrometer.core.instrument.config.NamingConvention)

Aggregations

NamingConvention (io.micrometer.core.instrument.config.NamingConvention)1