From 823b7f90b32afef79196f74c77a5cce0e48a63d9 Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Thu, 30 Nov 2017 17:08:34 +0530 Subject: [PATCH 1/5] Use the files globbed files and not the files in cfg Signed-off-by: Goutham Veeramachaneni --- cmd/prometheus/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index fc7951e5f2..ab3a862e2d 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -289,7 +289,7 @@ func main() { } files = append(files, fs...) } - return ruleManager.Update(time.Duration(cfg.GlobalConfig.EvaluationInterval), cfg.RuleFiles) + return ruleManager.Update(time.Duration(cfg.GlobalConfig.EvaluationInterval), files) }, } From 9146760aab9b4958409e77558a1535bfc3352e64 Mon Sep 17 00:00:00 2001 From: Vickenty Fesunov Date: Thu, 30 Nov 2017 18:14:27 +0100 Subject: [PATCH 2/5] Bump required golang version in the README (#3528) 10b2e8c6375c pulled new TSDB, which uses `math/bits` package introduced in Go 1.9 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c7f50f26b..388ef759d2 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Prometheus will now be reachable at http://localhost:9090/. ### Building from source To build Prometheus from the source code yourself you need to have a working -Go environment with [version 1.8 or greater installed](http://golang.org/doc/install). +Go environment with [version 1.9 or greater installed](http://golang.org/doc/install). You can directly use the `go` tool to download and install the `prometheus` and `promtool` binaries into your `GOPATH`: From cae4538b3e9cab8f9e5fd972f6c35eb4b002014d Mon Sep 17 00:00:00 2001 From: Matthias Rampke Date: Fri, 1 Dec 2017 18:26:06 +0100 Subject: [PATCH 3/5] Docs: state that all regular expressions are RE2. (#3518) We already mentioned that regular expressions are RE2 for [relabeling][0], but left open what the regular expression syntax anywhere else is. In the querying examples and reference, make it explicit that _all_ regular expressions are RE2. [0]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config --- docs/querying/basics.md | 3 +++ docs/querying/examples.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/querying/basics.md b/docs/querying/basics.md index 062e2fe203..65798b74fe 100644 --- a/docs/querying/basics.md +++ b/docs/querying/basics.md @@ -116,6 +116,9 @@ The following expression selects all metrics that have a name starting with `job {__name__=~"job:.*"} +All regular expressions in Prometheus use [RE2 +syntax](https://github.com/google/re2/wiki/Syntax). + ### Range Vector Selectors Range vector literals work like instant vector literals, except that they diff --git a/docs/querying/examples.md b/docs/querying/examples.md index 589d6bbca6..5827ca5eb7 100644 --- a/docs/querying/examples.md +++ b/docs/querying/examples.md @@ -31,6 +31,9 @@ Note that this does a substring match, not a full string match: http_requests_total{job=~".*server"} +All regular expressions in Prometheus use [RE2 +syntax](https://github.com/google/re2/wiki/Syntax). + To select all HTTP status codes except 4xx ones, you could run: http_requests_total{status!~"4.."} From 29506e0bca5491aa7d0c28e6a020822c4de8bfe9 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Fri, 1 Dec 2017 17:32:27 +0000 Subject: [PATCH 4/5] one meaningless write to the config file to trigger anothe fsnotify (#3492) --- discovery/file/file_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discovery/file/file_test.go b/discovery/file/file_test.go index 2305a0684a..6ac5aa7e9f 100644 --- a/discovery/file/file_test.go +++ b/discovery/file/file_test.go @@ -76,6 +76,7 @@ func testFileSD(t *testing.T, prefix, ext string, expect bool) { }() newf, err := os.Create(filepath.Join(testDir, "_test_"+prefix+ext)) + defer newf.Close() if err != nil { t.Fatal(err) } @@ -90,14 +91,13 @@ func testFileSD(t *testing.T, prefix, ext string, expect bool) { t.Fatal(err) } - // File is written with the config so stop draining the discovery channel. - // It needs to be before the file closing so that fsnotify triggers a new loop of the discovery service. + // Test file is ready so stop draining the discovery channel. + // It contains two target groups. close(fileReady) <-drainReady - newf.Close() + newf.WriteString(" ") // One last meaningless write to trigger fsnotify and a new loop of the discovery service. timeout := time.After(15 * time.Second) - // The files contain two target groups. retry: for { select { @@ -105,7 +105,7 @@ retry: if expect { t.Fatalf("Expected new target group but got none") } else { - // invalid type fsd should always broken down. + // Invalid type fsd should always break down. break retry } case tgs := <-ch: From d7b3df5ae18fce41451cc0bf85e71e1bf26358e6 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Sat, 2 Dec 2017 13:52:43 +0000 Subject: [PATCH 5/5] Fix staticcheck errors --- discovery/file/file_test.go | 2 +- web/api/v1/api.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/discovery/file/file_test.go b/discovery/file/file_test.go index 6ac5aa7e9f..5116ab9bc1 100644 --- a/discovery/file/file_test.go +++ b/discovery/file/file_test.go @@ -76,10 +76,10 @@ func testFileSD(t *testing.T, prefix, ext string, expect bool) { }() newf, err := os.Create(filepath.Join(testDir, "_test_"+prefix+ext)) - defer newf.Close() if err != nil { t.Fatal(err) } + defer newf.Close() f, err := os.Open(filepath.Join(testDir, prefix+ext)) if err != nil { diff --git a/web/api/v1/api.go b/web/api/v1/api.go index 238ba8ff6e..28d0681b62 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -45,18 +45,18 @@ type status string const ( statusSuccess status = "success" - statusError = "error" + statusError status = "error" ) type errorType string const ( errorNone errorType = "" - errorTimeout = "timeout" - errorCanceled = "canceled" - errorExec = "execution" - errorBadData = "bad_data" - errorInternal = "internal" + errorTimeout errorType = "timeout" + errorCanceled errorType = "canceled" + errorExec errorType = "execution" + errorBadData errorType = "bad_data" + errorInternal errorType = "internal" ) var corsHeaders = map[string]string{