use of io.micrometer.core.instrument.Tags in project webpieces by deanhiller.
the class PersistenceHelper method monitorExecutionTime.
private void monitorExecutionTime(String transactionName, long start, long end) {
String requestPath = (String) Context.get(ContextKey.REQUEST_PATH.toString());
if ((requestPath == null) || requestPath.isBlank()) {
requestPath = "unknown";
}
Tags transactionTags = Tags.of(DatabaseTransactionTags.EXECUTION_ID, transactionName, DatabaseTransactionTags.REQUEST, requestPath);
meterRegistry.timer(DatabaseMetric.EXECUTION_TIME.getDottedMetricName(), transactionTags).record(end - start, TimeUnit.MILLISECONDS);
}
use of io.micrometer.core.instrument.Tags in project spring-boot by spring-projects.
the class DefaultRepositoryTagsProvider method repositoryTags.
@Override
public Iterable<Tag> repositoryTags(RepositoryMethodInvocation invocation) {
Tags tags = Tags.empty();
tags = and(tags, invocation.getRepositoryInterface(), "repository", this::getSimpleClassName);
tags = and(tags, invocation.getMethod(), "method", Method::getName);
tags = and(tags, invocation.getResult().getState(), "state", State::name);
tags = and(tags, invocation.getResult().getError(), "exception", this::getExceptionName, EXCEPTION_NONE);
return tags;
}
use of io.micrometer.core.instrument.Tags in project spring-boot by spring-projects.
the class DiskSpaceMetricsBinderTests method diskSpaceMetricsWithSinglePath.
@Test
void diskSpaceMetricsWithSinglePath() {
MeterRegistry meterRegistry = new SimpleMeterRegistry();
File path = new File(".");
DiskSpaceMetricsBinder metricsBinder = new DiskSpaceMetricsBinder(Collections.singletonList(path), Tags.empty());
metricsBinder.bindTo(meterRegistry);
Tags tags = Tags.of("path", path.getAbsolutePath());
assertThat(meterRegistry.get("disk.free").tags(tags).gauge()).isNotNull();
assertThat(meterRegistry.get("disk.total").tags(tags).gauge()).isNotNull();
}
use of io.micrometer.core.instrument.Tags in project spring-boot by spring-projects.
the class DiskSpaceMetricsBinderTests method diskSpaceMetricsWithCustomTags.
@Test
void diskSpaceMetricsWithCustomTags() {
MeterRegistry meterRegistry = new SimpleMeterRegistry();
File path = new File(".");
Tags customTags = Tags.of("foo", "bar");
DiskSpaceMetricsBinder metricsBinder = new DiskSpaceMetricsBinder(Collections.singletonList(path), customTags);
metricsBinder.bindTo(meterRegistry);
Tags tags = Tags.of("path", path.getAbsolutePath(), "foo", "bar");
assertThat(meterRegistry.get("disk.free").tags(tags).gauge()).isNotNull();
assertThat(meterRegistry.get("disk.total").tags(tags).gauge()).isNotNull();
}
use of io.micrometer.core.instrument.Tags in project feign by OpenFeign.
the class MeteredClient method countResponseCode.
protected void countResponseCode(Request request, Response response, Options options, int responseStatus, Exception e) {
final Tag[] extraTags = extraTags(request, response, options, e);
final RequestTemplate template = request.requestTemplate();
final Tags allTags = metricTagResolver.tag(template.methodMetadata(), template.feignTarget(), e, Tag.of("http_status", String.valueOf(responseStatus)), Tag.of("status_group", responseStatus / 100 + "xx"), Tag.of("uri", template.methodMetadata().template().path())).and(extraTags);
meterRegistry.counter(metricName.name("http_response_code"), allTags).increment();
}
Aggregations