angry-cellophane / micrometer-prometheus-fix

Trying a fix to deal with metrics with non-consistent tags
3 stars 0 forks source link

Errors while running Multi tag Micrometer Collector and Prometheus Tag Registry classes #1

Open ramyasree0299 opened 3 years ago

ramyasree0299 commented 3 years ago

I tried copying the class files from io.micrometer.prometheus -- Running into undefined reference runtime issues -

java: cannot find symbol
symbol:   variable UNKNOWN
location: class io.prometheus.client.Collector.Type
java: cannot find symbol
symbol:   method writeFormat(java.lang.String,java.io.Writer,java.util.Enumeration)
location: class io.prometheus.client.exporter.common.TextFormat
java: cannot find symbol
symbol:   method onMeterRegistrationFailed((id,reason[...]n); })
location: class io.micrometer.core.instrument.MeterRegistry.Config

in MultiTagPrometheusTagRegistry.java, FYI I'm very new to this, and not sure how to fix this import issue.

angry-cellophane commented 3 years ago

io.prometheus.client.Collector.Type, io.prometheus.client.exporter.common.TextFormat and io.micrometer.core.instrument.MeterRegistry.Config are in the io.prometheus:simpleclient library.

Micrometer has a dependency on this library. There were some changes in the prometheus library like UNTYPED was renamed to UNKNOWN.

Most likely you're using an old version of the prometheus library. Please make sure it's at least version 0.0.10.

To add dependency in maven

<dependency>
    <groupId>io.prometheus</groupId>
    <artifactId>simpleclient</artifactId>
    <version>0.10.0</version>
</dependency>

and in gradle

dependencies {
  implementation 'io.prometheus:simpleclient:0.10.0'
}

https://mvnrepository.com/artifact/io.prometheus/simpleclient/0.10.0

To see your project's dependencies run:

UPD: also double check micrometer version - io.micrometer:micrometer-core. I'd recommend at least 1.7.0.