Skip to content

Commit 078c404

Browse files
Stanislavtechknowlogick
Stanislav
authored andcommitted
Prometheus endpoint (#5256)
* Add prometheus collector and route * dep ensure -add github.com/prometheus/client_golang/prometheus * dep ensure -update github.com/golang/protobuf * add metrics to reserved usernames * add comment head in metrics package * fix style imports * add metrics settings * add bearer token check * mapping metrics configs * fix lint * update config cheat sheet * update conf sample, typo fix
1 parent 92fb89f commit 078c404

File tree

112 files changed

+24655
-2973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+24655
-2973
lines changed

Gopkg.lock

Lines changed: 66 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,7 @@ ignored = ["google.golang.org/appengine*"]
107107
[[override]]
108108
revision = "c10ba270aa0bf8b8c1c986e103859c67a9103061"
109109
name = "golang.org/x/oauth2"
110+
111+
[[constraint]]
112+
name = "github.com/prometheus/client_golang"
113+
version = "0.9.0"

custom/conf/app.ini.sample

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,3 +659,9 @@ FILE_EXTENSIONS = .adoc,.asciidoc
659659
RENDER_COMMAND = "asciidoc --out-file=- -"
660660
; Don't pass the file on STDIN, pass the filename as argument instead.
661661
IS_INPUT_FILE = false
662+
663+
[metrics]
664+
; Enables metrics endpoint. True or false; default is false.
665+
ENABLED = false
666+
; If you want to add authorization, specify a token here
667+
TOKEN =

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
302302
- `PULL`: **300**: Git pull from internal repositories timeout seconds.
303303
- `GC`: **60**: Git repository GC timeout seconds.
304304

305+
## Metrics (`metrics`)
306+
307+
- `ENABLED`: **false**: Enables /metrics endpoint for prometheus.
308+
- `TOKEN`: **\<empty\>**: You need to specify the token, if you want to include in the authorization the metrics . The same token need to be used in prometheus parameters `bearer_token` or `bearer_token_file`.
309+
305310
## API (`api`)
306311

307312
- `ENABLE_SWAGGER_ENDPOINT`: **true**: Enables /api/swagger, /api/v1/swagger etc. endpoints. True or false; default is true.

models/user.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ var (
698698
"issues",
699699
"js",
700700
"less",
701+
"metrics",
701702
"new",
702703
"org",
703704
"plugins",

0 commit comments

Comments
 (0)