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

prometheus metrics format #114

Closed
wants to merge 3 commits into from
Closed

prometheus metrics format #114

wants to merge 3 commits into from

Conversation

pavel987
Copy link

This PR adds an alternate display format for data. It's a lot of code that I modified after copy & pasting. I'm not a C developer so I wouldn't be surprised if there's a lot of things wrong with it. Let me know what needs to be fixed/changed to get this merged. Thanks!

@ghost
Copy link

ghost commented Mar 15, 2018

Hi, Any news about this?

@SuperQ
Copy link
Collaborator

SuperQ commented Mar 15, 2018

Have you tested this with promtool check-metrics mode?

@ghost
Copy link

ghost commented Mar 15, 2018

error while linting: text format parsing error in line 37: second HELP line for metric name "nginx_server_requests"
error while linting: text format parsing error in line 37: second TYPE line for metric name "nginx_server_requests", or TYPE reported after samples
...
# HELP nginx_server_requests requests counter
# TYPE nginx_server_requests counter
nginx_server_requests{code="1xx",host="domain.com"} 0
nginx_server_requests{code="2xx",host="domain.com"} 17
nginx_server_requests{code="3xx",host="domain.com"} 2
nginx_server_requests{code="4xx",host="domain.com"} 3
nginx_server_requests{code="5xx",host="domain.com"} 0
# HELP nginx_server_requests requests counter
# TYPE nginx_server_requests counter
nginx_server_requests{code="1xx",host="_"} 0
nginx_server_requests{code="2xx",host="_"} 1812
nginx_server_requests{code="3xx",host="_"} 0
nginx_server_requests{code="4xx",host="_"} 8
nginx_server_requests{code="5xx",host="_"} 0
# HELP nginx_server_requests requests counter
# TYPE nginx_server_requests counter
nginx_server_requests{code="1xx",host="*"} 0
nginx_server_requests{code="2xx",host="*"} 1829
nginx_server_requests{code="3xx",host="*"} 2
nginx_server_requests{code="4xx",host="*"} 11
nginx_server_requests{code="5xx",host="*"} 0

It looks like a small patch would come in handy, but the gun works.
The data appears in the prometheus.

@vozlt
Copy link
Owner

vozlt commented May 11, 2018

Thanks for the pull request.
I'll check it out soon.

@vozlt
Copy link
Owner

vozlt commented Jun 1, 2018

That feature has added.
I have rewritten but it's not much different from yours.
One of the differences is that all mertric names are started with nginx_vts_(*).
I can not guarantee that it will work well because I know little about prometheus.
Please test it.
Thanks.

Latest commit: 2f9434f

@pavel987
Copy link
Author

pavel987 commented Jun 8, 2018

Did a bit of testing and it seems to work well. Do you plan on making a release with these changes anytime soon?

@vozlt
Copy link
Owner

vozlt commented Jun 8, 2018

I will release it after checking the histogram in #62 (comment).
Thanks.

@vozlt
Copy link
Owner

vozlt commented Jun 10, 2018

The metric type of histogram in format/prometheus has added.
See the directive vhost_traffic_status_histogram_buckets for details.
I quickly added the feature and did not test it much.
So it is necessary to verify that I have implemented the function correctly according to prometheus histogram metric type.
Please test it.
Thanks.

Latest commit: 2fd3ae4

@vozlt
Copy link
Owner

vozlt commented Jun 20, 2018

I have tagged the latest commit as v0.1.17.
Thanks.

@etlfg
Copy link

etlfg commented Nov 13, 2018

Don't know if this is a configuration problem from my side but I have many upstreams behind nginx and I only got one from the /status/format/prometheus. They appear when I use the /status/ or /status/format/json. Any explanation here ?

I didn't create a new issue as It may be an error in your code as you mentioned it.

Used version :
NGINX_VERSION=1.13.12
NGINX_VTS_VERSION=0.1.18

@SuperQ
Copy link
Collaborator

SuperQ commented Jan 21, 2019

I think this is obsolete.

@vozlt
Copy link
Owner

vozlt commented Jan 18, 2021

@etlfg If you still encounter such a problem, please create a new issue.

@vozlt vozlt closed this Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants