prebid / prebid-cache-java

Java version of Prebid Cache server
Apache License 2.0
6 stars 15 forks source link

MetricsConfig for Prometheus #102

Closed 0xlee closed 1 year ago

0xlee commented 1 year ago

Hi,

I updated our prebid-cache to the latest version 1.17.0, but encountered some issues.

The keys in prometheus doesn't allow dots, but when I run this application, all prometheus metric keys comes with dots like following:

# HELP jvm.memory.max The maximum amount of memory in bytes that can be used for memory management
# TYPE jvm.memory.max gauge
jvm.memory.max{area="nonheap",id="CodeHeap 'profiled nmethods'",} 1.22908672E8
jvm.memory.max{area="heap",id="G1 Survivor Space",} -1.0
jvm.memory.max{area="heap",id="G1 Old Gen",} 8.350859264E9
jvm.memory.max{area="nonheap",id="Metaspace",} -1.0
jvm.memory.max{area="nonheap",id="CodeHeap 'non-nmethods'",} 5840896.0
jvm.memory.max{area="heap",id="G1 Eden Space",} -1.0
jvm.memory.max{area="nonheap",id="Compressed Class Space",} 1.073741824E9
jvm.memory.max{area="nonheap",id="CodeHeap 'non-profiled nmethods'",} 1.22908672E8
# HELP disk.total Total space for path
# TYPE disk.total gauge
disk.total{path="/home/dongha/projects/gutefrage/GD/prebid-cache-java/.",} 1.023671271424E12
# HELP application.started.time Time taken (ms) to start the application
# TYPE application.started.time gauge
application.started.time{main.application.class="org.prebid.cache.PBCacheApplication",} 3.444
# HELP log4j2.events_total Number of fatal level log events
# TYPE log4j2.events_total counter
log4j2.events_total{level="warn",} 0.0
log4j2.events_total{level="debug",} 0.0
log4j2.events_total{level="error",} 0.0
log4j2.events_total{level="trace",} 0.0
log4j2.events_total{level="fatal",} 0.0
log4j2.events_total{level="info",} 3.0

But if I remove the following method, then it works as expected: https://github.com/prebid/prebid-cache-java/blob/1.17.0/src/main/java/org/prebid/cache/config/MetricsConfig.java#L15-L19

I think the identity naming convention prevents from converting the prometheus renaming.

How about putting the identity naming convention into graphitePrefixMeterCustomizer?

Net-burst commented 1 year ago

@0xlee again sorry for the long delay. The plan is to include your proposed fix in the next tag. Thanks!