[metricbeat] - Prometheus module - invalid escape sequence '\"'

Hi,

Metricbeat: 7.10.2

I am trying to use Metricbeat prometheus module to pull metrics from Spring boot application with micrometer prometheus format . It fails with the following error

2022-06-29T12:21:37.658 +0000 INFO module/wrapper.go:259 Error fetching data for metricset prometheus.collector: unable to decode response from prometheus endpoint: decoding of metric family failed: text format parsing error in line 56: invalid escape sequence '"'

I suspect, it is failing to parse the below content in the metrics output (see the HELP line with double quotes in it)

# HELP system_cpu_usage The "recent cpu usage" of the system the application is running in
# TYPE system_cpu_usage gauge
system_cpu_usage 0.007843363418783701

May i know if this is a bug and if yes, is it fixed in any other version of metricbeat?

Hey @harikvemula, welcome to discuss :slight_smile:

Would you have the chance to use a more recent version of Metricbeat? Maybe this issue has been already solved. If you need to continue using a 7.X version, please try using 7.17.

In any case, Metricbeat uses the official prometheus client to read responses, so this may actually be an invalid format that should be solved in the application, or in micrometer.

Hi @jsoriano,

Sorry, i was travelling, so couldn't test and reply earlier.

Thank you, with 7.17.x it parses properly.

Unfortunately have to handle the compatibility issues now due to license change :frowning: .

Failed to connect to backoff(elasticsearch(https://localhost:9200)): Connection marked as failed because the onConnect callback failed: could not connect to a compatible version of Elasticsearch: 400 Bad Request: {"error":{"root_cause":[{"type":"invalid_index_name_exception","reason":"Invalid index name [_license], must not start with '_'.","index":"_license","index_uuid":"_na_"}],"type":"invalid_index_name_exception","reason":"Invalid index name [_license], must not start with '_'.","index":"_license","index_uuid":"_na_"},"status":400}

If i use prometheus, it properly parses the metrics generated by micrometer. Its only problem in metricbeat 7.10.x. Haven't verified what changed in metricbeat 7.17 though.

Thank you!

Regards,
Hari

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.