Closed ecerulm closed 5 months ago
Is this still the case with jmx_exporter
version 1.x
, or are you using an older version?
Is this still the case with jmx_exporter version 1.x, or are you using an older version?
@fstab, Using jmxexporter 0.20.0 as 1.x says This release has functional issues and should not be used.
I have been google around and I guess the _total
comes from prometheus client_java's PrometheusNaming
RESERVED_METRIC_NAME_SUFFIXES
.I'm assuming jmexporter uses client_java to generate the prometheus text format, and somehow jmxexporter overrides the metricname but it does not override the generated TYPE and HELP.
@dhoard time to release 1.0.1, this should fix it :)
The client_java documetation says
As defined in OpenMetrics, counter metric names must have the _total suffix. If you create a counter without the _total suffix the suffix will be appended automatically.
But in anycase jmxexporter should either produce
# HELP catalina_globalrequestprocessor_requestcount number of requests
# TYPE catalina_globalrequestprocessor_requestcount counter
catalina_globalrequestprocessor_requestcount{Application="Tableau",Service="vizqlservice",ServiceInstance="0",} 2848.0
or
# HELP catalina_globalrequestprocessor_requestcount_total number of requests
# TYPE catalina_globalrequestprocessor_requestcount_total counter
catalina_globalrequestprocessor_requestcount_total{Application="Tableau",Service="vizqlservice",ServiceInstance="0",} 2848.0
but not what's producing now, mixing catalina_globalrequestprocessor_requestcount_total
and catalina_globalrequestprocessor_requestcount
@dhoard time to release 1.0.1, this should fix it :)
yes, it does fix it.. I tried with main 2797571a0e27421c7ffd3627e091a6577087e251 and when I specify catalina_globalrequestprocessor_requestcount
as metric name I get
# HELP catalina_globalrequestprocessor_requestcount_total number of requests
# TYPE catalina_globalrequestprocessor_requestcount_total counter
catalina_globalrequestprocessor_requestcount_total{Application="Tableau",Service="vizqlservice",ServiceInstance="0"} 0.0
the metric name get rewritten to catalina_globalrequestprocessor_requestcount_total
everywhere (TYPE, HELP and the actual metric) which I guess it's the correct behaviour (from the openmetrics documentation point of view)
so yes, it does fix it.
@fstab @dhoard , I suggest to mention in the docs for rules > name something like
The metric name to set. Capture groups from the pattern can be used. If not specified, the default format will be used. If it evaluates to empty, processing of this attribute stops with no output. Additional suffix may be added to this name (e.g
_total
for typeCOUNTER
)
to help people that are not familiar with the _total suffix to discover it. (Specially since catalina_globalrequestprocessor_requestcount
without the _total
suffix is mentioned a lot on the internet, for example Prometheus metrics collected by the CloudWatch agent)
Then one question remains can I force jmxexporter to output catalina_globalrequestprocessor_requestcount
(without total) and still be a counter? or if I really want catalina_globalrequestprocessor_requestcount
I should leave it as UNKNOWN
/untyped
type?
@ecerulm I added the documentation change above and am in the process of publishing the 1.0.1 release.
@ecerulm release published. please test.
It works , it adds the _total
suffix to the metric name, in all 3 places ( TYPE
, HELP
and the actual metric value).
@ecerulm Thanks for the confirmation!
I'm using a jmxrule to convert the
requestCount
from MBeanCatalina:name="http-nio-8033",type=GlobalRequestProcessor
toCOUNTER
and although the metric name is set to
catalina_globalrequestprocessor_requestcount
the# HELP
and# TYPE
refer tocatalina_globalrequestprocessor_requestcount_total
(note the_total
suffix at the end).So the result prometheus text format is
As far as I understand this is incorrect since the metric name is actually
catalina_globalrequestprocessor_requestcount
notcatalina_globalrequestprocessor_requestcount_total
. So the generated# HELP
and#TYPE
are really for different non-existing metric.Here is the jmxexporter configuration:
If I remove the
type: COUNTER
line then the prometheus text format generated will beIn this case the metrics name matches in all three lines (no
_total
anywhere) but theTYPE
is not counter like I wanted it to be.