-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add grafana gitea-mixin #17758
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
Merged
Merged
Add grafana gitea-mixin #17758
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7a32f37
add gitea mixin
v-zhuravlev 9d7f1b6
remove alerts/rules
v-zhuravlev 8d78b7a
gitea-mixin: add interval factor of 1/2 to remove duplicated change e…
v-zhuravlev 1246988
gitea-mixin: fix changes panel, add aggregation interval for changes …
v-zhuravlev 6f6622a
gitea-mixin: add totals singlestat
v-zhuravlev f4a07bd
gitea mixin: switch change graph to timeseries type
v-zhuravlev e70fd58
add color overrides for issue labels
v-zhuravlev 7ccd873
bump grafonnet version
v-zhuravlev 55023bd
gitea-mixin: convert graphs to timeseries
v-zhuravlev 1dcc141
gitea-mixin: make fmt
v-zhuravlev dc51d8f
gitea-mixin: add .PHONE in Makefile
v-zhuravlev 7739dcb
gitea-mixin: add time configration
v-zhuravlev 15c17ac
gitea-mixin: make fmt and collapse addPanel grid
v-zhuravlev c8b305f
gitea-mixin: add static ids for shared panels
v-zhuravlev 74c4a8d
gitea-mixin: add flags showIssuesByRepository, showIssuesByLabel to s…
v-zhuravlev 3b32e19
gitea-mixin: update aggregation interval
v-zhuravlev e549661
gitea-mixin: update defaults
v-zhuravlev 493b4d6
gitea-mixin: update panel names
v-zhuravlev 8d44068
rename dir to gitea-monitoring-mixin
v-zhuravlev b7b822c
gitea-mixin: add gitea_issues_open, gitea_issues_closed metrics
v-zhuravlev 2a14eba
gitea-mixin: update visible name for datasource
v-zhuravlev a75b139
gitea-mixin: update README
v-zhuravlev e628e20
Merge branch 'main' into main
lunny 102de09
Merge branch 'main' into main
zeripath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dashboards_out | ||
vendor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 1 --string-style s --comment-style s | ||
|
||
.PHONY: all | ||
all: build dashboards_out | ||
|
||
vendor: jsonnetfile.json | ||
jb install | ||
|
||
.PHONY: build | ||
build: vendor | ||
|
||
.PHONY: fmt | ||
fmt: | ||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \ | ||
xargs -n 1 -- $(JSONNET_FMT) -i | ||
|
||
.PHONY: lint | ||
lint: build | ||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \ | ||
while read f; do \ | ||
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \ | ||
done | ||
mixtool lint mixin.libsonnet | ||
|
||
dashboards_out: mixin.libsonnet config.libsonnet $(wildcard dashboards/*) | ||
@mkdir -p dashboards_out | ||
jsonnet -J vendor -m dashboards_out lib/dashboards.jsonnet | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf dashboards_out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Gitea Mixin | ||
|
||
Gitea Mixin is a set of configurable Grafana dashboards based on the metrics exported by the Gitea built-in metrics endpoint. | ||
|
||
## 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 | ||
v-zhuravlev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
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` if required and then build JSON dashboard files for Grafana: | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
For more advanced uses of mixins, see | ||
https://github.com/monitoring-mixins/docs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
_config+:: { | ||
local c = self, | ||
dashboardNamePrefix: 'Gitea', | ||
dashboardTags: ['gitea'], | ||
dashboardPeriod: 'now-1h', | ||
dashboardTimezone: 'default', | ||
dashboardRefresh: '1m', | ||
|
||
// please see https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics | ||
// Show issue by repository metrics with format gitea_issues_by_repository{repository="org/repo"} 5. | ||
// Requires Gitea 1.16.0 with ENABLED_ISSUE_BY_REPOSITORY set to true. | ||
showIssuesByRepository: true, | ||
// Show graphs for issue by label metrics with format gitea_issues_by_label{label="bug"} 2. | ||
// Requires Gitea 1.16.0 with ENABLED_ISSUE_BY_LABEL set to true. | ||
showIssuesByLabel: true, | ||
|
||
// Requires Gitea 1.16.0. | ||
showIssuesOpenClose: true, | ||
|
||
// add or remove metrics from dashboard | ||
giteaStatMetrics: | ||
[ | ||
{ | ||
name: 'gitea_organizations', | ||
description: 'Organizations', | ||
}, | ||
{ | ||
name: 'gitea_teams', | ||
description: 'Teams', | ||
}, | ||
{ | ||
name: 'gitea_users', | ||
description: 'Users', | ||
}, | ||
{ | ||
name: 'gitea_repositories', | ||
description: 'Repositories', | ||
}, | ||
{ | ||
name: 'gitea_milestones', | ||
description: 'Milestones', | ||
}, | ||
{ | ||
name: 'gitea_stars', | ||
description: 'Stars', | ||
}, | ||
{ | ||
name: 'gitea_releases', | ||
description: 'Releases', | ||
}, | ||
] | ||
+ | ||
if c.showIssuesOpenClose then | ||
[ | ||
{ | ||
name: 'gitea_issues_open', | ||
description: 'Issues opened', | ||
}, | ||
{ | ||
name: 'gitea_issues_closed', | ||
description: 'Issues closed', | ||
}, | ||
] else | ||
[ | ||
{ | ||
name: 'gitea_issues', | ||
description: 'Issues', | ||
}, | ||
], | ||
//set this for using label colors on graphs | ||
issueLabels: [ | ||
{ | ||
label: 'bug', | ||
color: '#ee0701', | ||
}, | ||
{ | ||
label: 'duplicate', | ||
color: '#cccccc', | ||
}, | ||
{ | ||
label: 'invalid', | ||
color: '#e6e6e6', | ||
}, | ||
{ | ||
label: 'enhancement', | ||
color: '#84b6eb', | ||
}, | ||
{ | ||
label: 'help wanted', | ||
color: '#128a0c', | ||
}, | ||
{ | ||
label: 'question', | ||
color: '#cc317c', | ||
}, | ||
], | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(import 'overview.libsonnet') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.