loki4j / loki-logback-appender

Fast and lightweight implementation of Logback appender for Grafana Loki
https://loki4j.github.io/loki-logback-appender/
BSD 2-Clause "Simplified" License
314 stars 27 forks source link

<metricsEnabled>true</metricsEnabled> not adding any metrics #269

Closed patpatpat123 closed 2 weeks ago

patpatpat123 commented 2 weeks ago

Hello,

Just wanted to reach out with a small issue I am observing. We are using this appender, and configuring this property to true.

   <appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
        <metricsEnabled>true</metricsEnabled>
        <format>
            <label>
                <pattern>name=${name},host=${HOSTNAME},level=%level,pid=${PID},thread=%thread</pattern>
                <readMarkers>true</readMarkers>
            </label>
            <message>
                <pattern>

With this metrics enabled, we were hoping to see "some metrics somewhere". Our application exposes micrometer metrics, as well as JVM metrics. By turning this property to true, there is no any metrics.

Therefore, I would like to report an issue where despite having this property to true, it sems there is no metrics being exposed. Thank you

nehaev commented 2 weeks ago

Hi @patpatpat123, I've checked metrics and they work as expected.

Metrics are written to Metrics.globalRegistry. Make sure it's added to your registry.

patpatpat123 commented 2 weeks ago

Hello, may I ask what metrics are you seeing?

All I am seeing are these (please see screenshot)

Screenshot 2024-10-31 at 11 03 10

Something like logback_events_total

But I think they are part of the spring logback by default, nothing loki related.

Could you please let me know what are the metrics you are seeing?

Thank you