hipages / php-fpm_exporter

A prometheus exporter for PHP-FPM.
Apache License 2.0
587 stars 117 forks source link

Fix escaping for all broken string values in php-fpm status json #291

Open jvrsantacruz opened 1 year ago

jvrsantacruz commented 1 year ago

Hi all! :wave:

We're experiencing the same issue in related issue #24 and probably #258 but with another field (user in this case). Clients sending invalid json values showing up in any string field of the status json will break the exporter.

eg:

Sending: user: my\small\windows\value Would trigger the following errors in the exporter:

Feb 15 01:02:18  prometheus-php-fpm[1451]: time="2023-02-15T01:02:18Z" level=error msg="invalid character 's' in string escape code"
Feb 15 01:02:18 prometheus-php-fpm[1451]: time="2023-02-15T01:02:18Z" level=error msg="Error scraping PHP-FPM: invalid character 's' in string escape code"