From 078c404c3b0f283a242ad93b6a2f4cabb2575410 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Mon, 5 Nov 2018 06:20:00 +0300 Subject: 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 --- modules/setting/setting.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/setting/setting.go') diff --git a/modules/setting/setting.go b/modules/setting/setting.go index a15dc116af..42ee102e0d 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -561,6 +561,15 @@ var ( TrustedFacets []string }{} + // Metrics settings + Metrics = struct { + Enabled bool + Token string + }{ + Enabled: false, + Token: "", + } + // I18n settings Langs []string Names []string @@ -1125,6 +1134,8 @@ func NewContext() { log.Fatal(4, "Failed to map Git settings: %v", err) } else if err = Cfg.Section("api").MapTo(&API); err != nil { log.Fatal(4, "Failed to map API settings: %v", err) + } else if err = Cfg.Section("metrics").MapTo(&Metrics); err != nil { + log.Fatal(4, "Failed to map Metrics settings: %v", err) } sec = Cfg.Section("mirror") -- cgit v1.2.3