spring-micrometer

Why does MicroMeter Timer returns zero?

非 Y 不嫁゛ 提交于 2021-02-11 12:13:51
问题 Consider the following code: public static void main(String[] args) { Timer timer = Metrics.timer("item.processing"); for (int i = 0; i < 100; i++) { timer.record(i, TimeUnit.SECONDS); } System.out.println(timer.count()); System.out.println(timer.mean(TimeUnit.SECONDS)); } The output is zero for both prints, but of course it is expected to be a positive number. I'm using the globalRegistry but I don't think it should make a difference. 回答1: The reason you are seeing the results you're seeing

IOException When Trying to Load JSON data file via Spring Boot Command Line Runner

情到浓时终转凉″ 提交于 2020-01-30 09:17:24
问题 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 │ └───microservice │ │ │ └───MicroServiceApplication.java │ └───resources │ └───data.json │ application.properties Have the following JSON file (inside src/main/resources/data.json): {"firstName": "John", "lastName": "Doe"} MicroServiceApplication: @SpringBootApplication public class MicroServiceApplication { @Bean

querying data with micrometer

試著忘記壹切 提交于 2020-01-06 14:54:28
问题 We have this fancy monitoring system to which our spring-boot services are posting metrics to an influx DB with micrometer. There's a nice grafana frontend, but the problem is that we're now at a stage where we have to have some of these metrics available in other services to reason on. The whole system was set up by my predecessor, and my current understanding of it is practically zero. I can add and post new metrics, but I can't for the life of me get anything out of it. Here's a short

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

十年热恋 提交于 2019-12-23 07:47:04
问题 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 metrics. Spring blog about Micrometer metrics management.metrics.enable.root=false management.metrics.enable.jvm=true The problem is, that it doesn't work. All existing metrics are written to our graphite instance. We found already a workaround but we would

Why do reading Micrometer measurement returns NaN sometimes?

我们两清 提交于 2019-12-12 20:06:48
问题 I'm trying to programmatically read the Meters as follows: Get registry: MeterRegistry registry = Metrics.globalRegistry.getRegistries().iterator().next(); Read measurement: double systemCpuUsage = registry.get("system.cpu.usage").gauge().measure().iterator().next().getValue(); The problem is that sometimes I get NaN . I read about this in the docs: Why is my Gauge reporting NaN or disappearing? but I'm not sure what I shall do. Also, I'm reading the "built-in" gauge of Spring Boot actuator

Metrics Collection for Spring Boot REST APIs

岁酱吖の 提交于 2019-11-28 01:47:07
问题 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 requests are being processed/errored. The actuator /actuator/metrics endpoint gives lot of info but I am not sure if any of those are useful for my case. Also, can someone tell if @Timed(or any other out-of-the-box annotation) can be used for achieving