Spring Download 2.0 Prometheus Backward Compatibility

I am migrating to Spring Boot 2.0 and am having problems with my Prometheus tags.

I know that MicroMeter is a new way of doing things that are not as crisp as the Prometheus libraries, but OK.

My problem is that if I do not want to change my indicators now, I can not switch to Spring Boot 2.0. I'm right?

I tried the following:

Trial No. 1

  • Keep my implementations "as is"
  • add a new dependency io.micrometer:micrometer-registry-prometheus:1.0.2to my application (the actuator is already there)
  • change the material in application.propertiesto access the endpointactuator/prometheus

=> My Countersand Gaugesfrom the past ignored. Well, I understand this from a technical point of view.

Trial No. 2

  • Keep my implementations "as is"
  • "" 'io.prometheus .
  • application.properties, actuator/prometheus

= > excpetion

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.endpoint.AbstractEndpoint
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_161]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_161]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[na:1.8.0_161]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_161]
... 37 common frames omitted

, : " "?

+6
2

Trial no 1 , Prometheus bean, Micrometer .

@Bean
public CollectorRegistry collectorRegistry() {
    return CollectorRegistry.defaultRegistry;
}

Micrometer , .

no 2 prometheus, SpringBoot 2. .

+4

, , Spring, . , " " "---" "--", :

  <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
        <exclusions>
            <exclusion>
                <groupId>io.micrometer</groupId>
                <artifactId>micrometer-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
   <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-registry-prometheus</artifactId>
    </dependency>
0

Source: https://habr.com/ru/post/1695565/


All Articles