unit
unit copied to clipboard
How to extract metrics
A customer needs me to retrieve metrics (for prometheus) from a number of nginx-unit docker images. Is there currently a way to retrieve those, and if so, what are the necessary steps?
The metrics are a requirement of the setup, so if they're not available I need to start work on another solution.
Hi, @daniel-blake,
What kind of metrics are we talking about here? Currently, Unit forwards its access log to Docker container log, if it's any help to your cause.
We're looking for metrics like those exposed in the nginx stub_status:
- The current number of active client connections including Waiting connections.
- The total number of accepted client connections.
- The total number of handled connections.
- The total number of client requests.
- The current number of connections where nginx is reading the request header.
- The current number of connections where nginx is writing the response back to the client.
- The current number of idle client connections waiting for a request.
Not all are needed. We're also looking for metrics from the php subsystem, like:
- Memory usage
- Number of active processes
The precise metrics aren't set in stone, but the above is the ballpark estimate of what we need.
Thanks for the elaboration, Daniel. Unfortunately, this goes beyond Unit's capabilities at the moment. However, you can suggest specific metrics to be implemented in the future, as we're making mental notes of user concerns like this one.
Good day! Any news on getting metrics from the app? The project is actively developing, but it is impossible to introduce it into the product without metrics.
Just a reminder from 2022.
Hi
Here's the patch of metrics exported from Unit. https://gist.github.com/hongzhidao/79ace78851667e50474623f9d191aeab
Have a try:
- start
> ./build/unitd --control 127.0.0.1:8000
- get status
> curl http://127.1:8000/status
{
"connections": {
"accepted": 0,
"active": 0,
"idle": 0,
"closed": 0
},
"requests": {},
"applications": {}
}
Or
> curl http://127.1:8000/status/connections
{
"accepted": 0,
"active": 0,
"idle": 0,
"closed": 0
}
Currently, we only support very basic statistics, welcome to suggest more metrics.
Hi, We just committed the statistics patch, and it'll be in the 1.28 version. Welcome more suggestions on statistics, thanks.