Questions tagged [spring-micrometer]

Micrometer is the metrics collection facility included in Spring Boot 2’s Actuator. It has also been backported to Spring Boot 1.5, 1.4, and 1.3 with the addition of another dependency.

About

Micrometer is a dimensional-first metrics collection facade whose aim is to allow you to time, count, and gauge your code with a vendor neutral API. Through classpath and configuration, you may select one or several monitoring systems to export your metrics data to. Think of it like SLF4J, but for metrics!

Links

357 questions
33
votes
4 answers

/actuator/prometheus missing in @SpringbootTest

I'm using springbooot 2.4.0 and I added the following dependencies for enabling prometheus metrics: org.springframework.boot
23
votes
3 answers

How to read JSON file from resources in Spring Boot

Using Spring Boot 2.1.5 Release, have created the following sample Spring Boot Microservice: Maven Project Structure: MicroService │ pom.xml src │ └───main │ ├───java │ │ │ └───com │ …
PacificNW_Lover
  • 4,746
  • 31
  • 90
  • 144
15
votes
1 answer

How to specify a whitelist of the metrics I want to use in spring-boot with micrometer

We want to use only some of the given metrics from micrometer in our spring-boot application. We find the following code-snippet in the docs. This should disable all metrics by default and should enable us to create a whitelist of possible…
PhilippB
  • 205
  • 2
  • 9
13
votes
2 answers

Micrometer @Timed annotation on simple public and private (service) methods

I'm trying to apply Prometheus metrics using the micrometer @Timed annotations. I found out that they only work on controller endpoints and not "simple" public and private methods. Given this example: @RestController public class TestController { …
Edito
  • 3,030
  • 13
  • 35
  • 67
10
votes
1 answer

Spring Boot 2.3.2.RELEASE - Micrometer - KafkaMetrics - Failed to bind meter logs

I am using /actuator/prometheus endpoint for its kafka_consumer_* metrics. Upgrading from Spring Boot 2.3.1.RELEASE to 2.3.2.RELEASE, is showing me a lot of these "extra" logs - whenever there is a failure to…
jumping_monkey
  • 5,941
  • 2
  • 43
  • 58
10
votes
3 answers

In Spring Boot, how to reset the metrics registry before each test?

I have tests and want to make assertions against micrometer metrics, but the tests run in random order so I want to reset or clear all the micrometer metrics before each test so my assertion are always correct.
lfmunoz
  • 822
  • 1
  • 9
  • 16
9
votes
1 answer

Spring Boot actuator "system.cpu.usage" vs "process.cpu.usage"

I am using spring boot 2.3.2. With help of actuator, publishing the application metrics to metrics console. I would like to know what is the difference between system.cpu.usage and process.cpu.usage metrics polished by the actuator.
9
votes
2 answers

Unable to publish spring boot metrics to GCP stackdriver

I am trying to publish metrics of my spring boot(2.2.6.RELEASE) app running in a GCP compute engine to stackdriver. I have added the dependency of micrometer-registry-stackdriver:1.3.6 and spring-boot-actuator. Stackdriver metrics client…
9
votes
2 answers

Understanding Spring Boot actuator `http.server.requests` metrics MAX attribute

can someone explain what does the MAX statistic refers to in the below response. I don't see it documented anywhere. localhost:8081/actuator/metrics/http.server.requests?tag=uri:/myControllerMethod Response: { "name":"http.server.requests", …
Rahul Gupta
  • 1,079
  • 2
  • 15
  • 27
9
votes
3 answers

Metrics Collection for Spring Boot REST APIs

I am trying to collect metrics for my Spring Boot(2.1.0.RELEASE) Application. Specifically, I want to know No of times individual REST endpoints were called. Time taken by each of those endpoints to process the request. Average rate at which my…
8
votes
1 answer

Spring boot 3 issue with micrometer tracing with handling Traceparent header

I have below code which handle requests from other apps which pass the traceId through Traceparent header. I expect it will hydrate the parent traceId from the request, and in zipkin dashboard I should see the connection between this app and other…
8
votes
1 answer

TraceId and SpanId not available after migrating to Spring Boot 3

After migrating spring boot from version 2.x to 3 we miss traceId and spanId in our logs. We removed all sleuth dependencies and added implementation 'io.micrometer:micrometer-core' implementation 'io.micrometer:micrometer-tracing' implementation…
htmoia
  • 429
  • 4
  • 9
8
votes
1 answer

How @Counted works in spring boot?

How @Counted works? I have added @Counted annotation on my method in Controller and expecting to see how many hits are coming to the controller. But i cannot see metrics added onto the url http://localhost:8080/actuator/prometheus. @Counted(value =…
8
votes
1 answer

How to wire up Micrometer with @WebMvcTest

Im trying to test a Spring Boot 2.3 @Controller that does metrics via Actuator/Prometheus with @WebMvcTest. Unfortunately this fails with a NPE, probably because the Micrometer/Prometheus classes are not present in test. The controller…
Martin Schröder
  • 4,176
  • 7
  • 47
  • 81
8
votes
2 answers

How to configure Micrometer's monitoring system at runtime with Spring Boot

I'm new to metrics in general and especially Micrometer, so this might be a dumb question: Micrometer describes itself on the home page as a "facade" "without vendor lock-in", "think SLF4J, but for metrics". With "built-in support for [...] Netflix…
crusy
  • 1,424
  • 2
  • 25
  • 54
1
2 3
23 24