Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid UTF-8 label -- Prometheus Error with VTS Exporter. #142

Closed
jakirpatel opened this issue Oct 30, 2018 · 8 comments · Fixed by #260
Closed

Invalid UTF-8 label -- Prometheus Error with VTS Exporter. #142

jakirpatel opened this issue Oct 30, 2018 · 8 comments · Fixed by #260
Labels

Comments

@jakirpatel
Copy link

Prometheus Version : v2.4.3
Error message :
error while linting: text format parsing error in line 501: invalid label value "\xfftest-api"

Problem information:

We are having 10 nginx servers with VTS module enabled. Somehow the client is making the wrong http request and nginx is throwing 502 error. In this scenario VTS is capturing the invalid character as well.

Prometheus is collecting the metrics from all nginx servers. So if someone hit the nginx with invalid http host then prometheus is scraping all the metrics even with invalid character. This is causing potential failure at prometheus layer.

Its throwing the error:
error while linting: text format parsing error in line 501: invalid label value "\xfftest-api"
We do have three different layers here Nginx , VTS module and Prometheus. Because of this we are potentially loosing our all metrics.

Is there any solution to have on these? Anyway we can tell the prometheus to remove the metric with invalid label and start functioning as usual . I think prometheus somehow should ignore these kind of metric to be logged in prometheus to avoid the failure of prometheus itself.

@jakirpatel
Copy link
Author

@vozlt Anything we can do for the error that we have got with the VTS..

@vozlt
Copy link
Owner

vozlt commented Jan 25, 2021

@jakirpatel
Thanks the bug report.
I merged the pull/151.

@vozlt vozlt closed this as completed Jan 25, 2021
@vozlt vozlt added the bug label Jan 25, 2021
@axingblog
Copy link

use release v0.2.1 ,have same problem

request uri : /ip/%E6%B1%89%E5%AD%97
image

@vozlt
Copy link
Owner

vozlt commented Oct 17, 2022

@axingblog
Thanks for reporting. I'll check it soon.

@vozlt vozlt reopened this Oct 17, 2022
@topicgit
Copy link

@axingblog Thanks for reporting. I'll check it soon.

Has this issue been fixed? I'm facing the same problem with 'invalid UTF-8 label value'.
Thanks.

@u5surf
Copy link
Collaborator

u5surf commented Feb 15, 2023

@axingblog
Hi, I’m a new collaborator for this module.
Thanks for your all bug report!
First of all, sadly we could not reproduce on this behavior with this configuraion which I assumed your reproduced one. I’d like to reproduce this behavior, can you provide your reproduced one? It is possible to clarify what happen in escaping that.

nginx_vts_filter_bytes_total{filter="appname::nginx",filter_name="/ip/%E6%B1%89%E5%AD%97",direction="in"} 99
nginx_vts_filter_bytes_total{filter="appname::nginx",filter_name="/ip/%E6%B1%89%E5%AD%97",direction="out"} 314

nginx.conf


http {
    include       mime.types;
    default_type  application/octet-stream;

    vhost_traffic_status_zone;
    upstream web {
            zone backend 64k;
            server 127.0.0.1:9000;
    }
    server {
        listen       8000;
        location / {
            vhost_traffic_status_filter_by_set_key $request_uri appname::nginx;
            proxy_pass http://web;
        }
    }
    server {
        listen       80;
        gzip off;
        client_max_body_size 100M;
        location /status/ {
            vhost_traffic_status_display;
            vhost_traffic_status_display_format prometheus;
        }
    }
}

@topicgit
Also, if you have any clues(e.g. you have a configuraion which can be reproduced assuredly.) please inform for us🙏

@u5surf
Copy link
Collaborator

u5surf commented Feb 15, 2023

ngx_http_vhost_status_escape_prometheus seems not to escape the character which is represented by byte sequences between 0x80 - 0x10ffff.

@u5surf
Copy link
Collaborator

u5surf commented Feb 15, 2023

@axingblog @topicgit @vozlt @SuperQ
I will fix it below.

Which is prefer to represent \\x encoding format or % one?

e.g. request

curl http://localhost:8000/ip/姹夊瓧

result

nginx_vts_filter_bytes_total{filter="appname::nginx",filter_name="/ip/%E5%A7%B9%E5%A4%8A%E7%93%A7",direction="in"} 90
nginx_vts_filter_bytes_total{filter="appname::nginx",filter_name="/ip/%E5%A7%B9%E5%A4%8A%E7%93%A7",direction="out"} 314

u5surf added a commit to u5surf/nginx-module-vts that referenced this issue Feb 19, 2023
* Fixes vozlt#142
* it can be escaped the 2 - 4 bytes character
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants