-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add grafana gitea-mixin #17758
Add grafana gitea-mixin #17758
Conversation
It seems that https://gitea.com/gitea/awesome-gitea is the better place to list this dashboard. Usually, users do not read files in So listing this dashboard and document in awesome-gitea will help more users. |
HI! Thanks for the reply, |
I think accepting this into contrib/ and then adding to awesome-gitea for visibility would be reasonable. |
contrib/gitea-mixin/Makefile
Outdated
@mkdir -p dashboards_out | ||
jsonnet -J vendor -m dashboards_out lib/dashboards.jsonnet | ||
|
||
build: vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Makefile is missing declaration of .PHONY
targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, added .PHONY targets
Also maybe rename folder to |
|
||
local giteaSelector = 'job="$job", instance="$instance"', | ||
local giteaStatsPanel = grafana.statPanel.new( | ||
'Gitea stats', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much indentation? If libsonnet syntax does not require this, I would suggest follow 2-space indendation rule to make this much more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, too much, it had been generated by jsonnetfmt so I made some adjustments to make suremake fmt
stick 2-spcae indendation as much as possible.
Codecov Report
@@ Coverage Diff @@
## main #17758 +/- ##
==========================================
- Coverage 45.20% 45.19% -0.01%
==========================================
Files 823 823
Lines 91371 91389 +18
==========================================
- Hits 41305 41304 -1
- Misses 43471 43492 +21
+ Partials 6595 6593 -2
Continue to review full report at Codecov.
|
…how/hide corresponding panels
Thanks for the suggestion, to make it more clear, I renamed this dir to gitea-monitoring-mixin: |
Thanks for your reviews, I made changes as you requested as well as more improvements to the Grafana dashboard:
|
Thank you! Opened PR for awesome-gitea, as had been discussed |
This PR adds gitea-mixin, configurable Grafana dashboards (and potentially prometheus alerts+recording rules) based on Gitea [metrics](https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics). The overview dashboard is described using jsonnet and grafonnet library: https://grafana.github.io/grafonnet-lib/ Mixins help to define dashboard and alerts as code so they can be collaboratively improved by the users. ![image](https://user-images.githubusercontent.com/14870891/142862822-fe57b384-c74a-4103-8548-033e92f90751.png) __ ## Generate config files You can manually generate dashboards, but first you should install some tools: ```bash go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb go get github.com/google/go-jsonnet/cmd/jsonnet # or in brew: brew install go-jsonnet ``` For linting and formatting, you would also need `mixtool` and `jsonnetfmt` installed. If you have a working Go development environment, it's easiest to run the following: ```bash go get github.com/monitoring-mixins/mixtool/cmd/mixtool go get github.com/google/go-jsonnet/cmd/jsonnetfmt ``` The files in `dashboards_out` need to be imported into your Grafana server. The exact details will be depending on your environment. Edit `config.libsonnet` (for example, list of Gitea metrics to be shown under stats can be adjusted). if required and then build JSON dashboard files for Grafana: ```bash make ``` For more about mixins, please see: https://github.com/monitoring-mixins/docs https://www.youtube.com/watch?v=GDdnL5R_l-Y* add gitea mixin * remove alerts/rules * gitea-mixin: add interval factor of 1/2 to remove duplicated change events * gitea-mixin: fix changes panel, add aggregation interval for changes panel * gitea-mixin: add totals singlestat * gitea mixin: switch change graph to timeseries type * add color overrides for issue labels * bump grafonnet version * gitea-mixin: convert graphs to timeseries * gitea-mixin: make fmt * gitea-mixin: add .PHONE in Makefile * gitea-mixin: add time configration * gitea-mixin: make fmt and collapse addPanel grid * gitea-mixin: add static ids for shared panels * gitea-mixin: add flags showIssuesByRepository, showIssuesByLabel to show/hide corresponding panels * gitea-mixin: update aggregation interval * gitea-mixin: update defaults * gitea-mixin: update panel names * rename dir to gitea-monitoring-mixin * gitea-mixin: add gitea_issues_open, gitea_issues_closed metrics * gitea-mixin: update visible name for datasource * gitea-mixin: update README Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
This PR adds gitea-mixin, configurable Grafana dashboards (and potentially prometheus alerts+recording rules) based on Gitea metrics.
The overview dashboard is described using jsonnet and grafonnet library: https://grafana.github.io/grafonnet-lib/
Mixins help to define dashboard and alerts as code so they can be collaboratively improved by the users.
__
Generate config files
You can manually generate dashboards, but first you should install some tools:
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb go get github.com/google/go-jsonnet/cmd/jsonnet # or in brew: brew install go-jsonnet
For linting and formatting, you would also need
mixtool
andjsonnetfmt
installed. If youhave a working Go development environment, it's easiest to run the following:
The files in
dashboards_out
need to be importedinto your Grafana server. The exact details will be depending on your environment.
Edit
config.libsonnet
(for example, list of Gitea metrics to be shown under stats can be adjusted). if required and then build JSON dashboard files for Grafana:For more about mixins, please see:
https://github.com/monitoring-mixins/docs
https://www.youtube.com/watch?v=GDdnL5R_l-Y