Prometheus metrics endpoint for monitoring runners #96
Labels
No labels
Stage
Idea
Stage
Ready
No milestone
No assignees
6 participants
Notifications
Due date
No due date set.
Reference
forgejo/forgejo-actions-feature-requests#96
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
How to use this feature request
First hand experience
Sometimes my self hosted instance queues a lot of jobs. Since I only have a few runners, they are not enough and jobs start queuing up.
Needs and benefits
It would provide:
Feature Description
The following metrics:
Up for ideas about other metrics.
What needs to happen before a feature request is ready to be implemented?
Users can complete the first step (accumulating first and experience) on their own, even if this feature request did not catch the eye of someone with the necessary skills to implement it. And when it reaches that point, it will stand out and have a much higher chance of being implemented.
To fully grasp the scope of a feature request, and to brainstorm possible solutions, a feature request will generally wait until several users have provided their perspective.
Thumbs-up reactions help gauge popularity, but do not provide the same amount of useful information.
Results from discussions and additional user experiences are incorporated into a final summary to provide a single reference for the developers working on this change.
This can be done by the author of the issue or anyone else in a followup comment.
Stage/Ideais changed toStage/Ready.Depending on the feature request it can be in Forgejo or Forgejo runner.
A copy/paste of the "Needs and benefit" and "Feature description" should be used, with link to this issue so the developer knows where to find more details if they need to.
This would be great. In our setup i ended up creating another service that queries https://code.forgejo.org/api/swagger#/admin/adminSearchRunJobs and transform the result into Prometheus metrics. It would be great if it was native.
Makes sense.
I expect that this feature will need a lot of research/planning.
I haven't checked whether Forgejo has any metrics capabilities. If it hasn't, we need a suitable tool. Is there something like Micrometer for Go?
How forgiving are tools like Prometheus when it comes to format/variable changes?
What would really help a lot: examples. Develop the charts/alerts you want to have. What data is required to generate them? How does it have to be structured? Let us know. Without that information, this feature will take forever.
@aahlenst Prometheus is already supported in forgejo at least according to the cheat sheet. I think we would just have to make a new collector
Biggest question is what metrics is actually generally applicable
I think the idea of tracking per-runner metrics is worth considering separately from server metrics related to runners.
Most importantly, it should be possible to monitor user self-hosted runners connected to someone else's server, as in that situation the user operating the runner would not have permission to access the server
/metricsendpoint.Additionally, I don't think the server needs or wants to know process-specific information about runners; that's a lot to track, and for runners operated by others, the Forgejo server administrator can't do much in response to such information.
Finally, it is useful to monitor runners even when the server is unavailable for whatever reason. Verifying that the runner is online but unable to reach the server is a helpful debugging step for both runner operators and server administrators that operate instance-wide runners.
@aahlenst would you prefer to consider both server and runner metrics in this issue, or reopen forgejo/runner#1494 , or should I create a new issue in this repo?
There's no need for a new issue. This issue is literally titled "... monitoring runners", not monitoring Forgejo. A complete picture may require monitoring both systems -- for example, to determine the queue length for waiting jobs -- but it can all be discussed in one place.
I agree with Jason Owen that per-runner metrics are separate from Forgejo metrics about runners, as the later wouldn't help my case at all.
Personally, I just had an issue where Forgejo and Forgejo Runner failed to auto-start after my server reboot. I am not sure about the cause and I am almost certain it's my own setup that's wrong. However, since the runner never started, it couldn't restart on exit like it's usually configured to do. I couldn't know my runner was down until I tried to run a workflow and realized there was no runner to pick up the job. If I had multiple runners, I might have not even noticed.
Having a way to check if the runner is up externally, would be helpful. I guess this advocates for more of a
/healthzendpoint than/metrics, but I think both have their uses. I guess this means my needs are also broadly related to #81, but an external point to check would be necessary to guard against "the runner just never started" as opposed to something is broken with the runner. And beyond the runner just not starting, other issues like the network not working could occur that bring the runner offline but nothing within the runner can report that status without an external check.