Skip to content

GitLab Prometheus metrics: Invalid escape sequence leads to parsing error (2)

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Hello,

While parsing https://$host/-/metrics?token=$token with telegraf using input.prometheus, I have the following error:

# telegraf --test --config /root/gitlab-prometheus.conf
2025-02-10T13:11:42Z I! Loading config: /root/gitlab-prometheus.conf
2025-02-10T13:11:42Z I! Starting Telegraf 1.33.0 brought to you by InfluxData the makers of InfluxDB
2025-02-10T13:11:42Z I! Available plugins: 236 inputs, 9 aggregators, 33 processors, 26 parsers, 63 outputs, 6 secret-stores
2025-02-10T13:11:42Z I! Loaded inputs: prometheus
2025-02-10T13:11:42Z I! Loaded aggregators:
2025-02-10T13:11:42Z I! Loaded processors:
2025-02-10T13:11:42Z I! Loaded secretstores:
2025-02-10T13:11:42Z W! Outputs are not used in testing mode!
2025-02-10T13:11:42Z I! Tags enabled: host=$host
2025-02-10T13:11:43Z E! [inputs.prometheus::gitlab] Error in plugin: error reading metrics for "https://$host/-/metrics?token=$token": decoding response failed: text format parsing error in line 47090: invalid escape sequence '\u'
2025-02-10T13:11:43Z E! [telegraf] Error running agent: input plugins recorded 1 errors

The output is:

# HELP rack_requests_total Multiprocess metric
# TYPE rack_requests_total counter
rack_requests_total{action="",controller="",route="",state="completed"} 2
rack_requests_total{action="${9898*323}",controller="",route="",state="completed"} 16
rack_requests_total{action="\u003cimg src=\"x\"\u003e",controller="pjAdmin",route="",state="completed"} 1        <- HERE
rack_requests_total{action="activity",controller="dashboard",route="",state="completed"} 5
rack_requests_total{action="activity",controller="groups",route="",state="completed"} 362
rack_requests_total{action="activity",controller="projects",route="",state="completed"} 21

This issue looks like #370604 (closed)

I checked, I correctly have the changes of !103507 (merged) in the codebase.

Using gitlab from sources v17.7.3-ee.

Edited by 🤖 GitLab Bot 🤖