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`: 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) }, } diff --git a/discovery/file/file_test.go b/discovery/file/file_test.go index 2305a0684a..5116ab9bc1 100644 --- a/discovery/file/file_test.go +++ b/discovery/file/file_test.go @@ -79,6 +79,7 @@ func testFileSD(t *testing.T, prefix, ext string, expect bool) { if err != nil { t.Fatal(err) } + defer newf.Close() f, err := os.Open(filepath.Join(testDir, prefix+ext)) if err != nil { @@ -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: 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.."} diff --git a/web/api/v1/api.go b/web/api/v1/api.go index 474b10b438..462e492262 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -50,19 +50,19 @@ 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" - errorUnavailable = "unavailable" + errorTimeout errorType = "timeout" + errorCanceled errorType = "canceled" + errorExec errorType = "execution" + errorBadData errorType = "bad_data" + errorInternal errorType = "internal" + errorUnavailable errorType = "unavailable" ) var corsHeaders = map[string]string{