From 40f33f45cb8fe9cc5badde7306142d9e706496f8 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 22 Nov 2017 13:11:21 +0100 Subject: [PATCH] Fix docs that use regexp anchors (#3504) Remove/fix docs that use anchors in label regexp matches. --- docs/querying/api.md | 2 +- docs/querying/basics.md | 2 +- docs/querying/examples.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/querying/api.md b/docs/querying/api.md index 8b33d4cda9..3069cc9ce9 100644 --- a/docs/querying/api.md +++ b/docs/querying/api.md @@ -47,7 +47,7 @@ Names of query parameters that may be repeated end with `[]`. `` placeholders refer to Prometheus [time series selectors](basics.md#time-series-selectors) like `http_requests_total` or -`http_requests_total{method=~"^GET|POST$"}` and need to be URL-encoded. +`http_requests_total{method=~"(GET|POST)"}` and need to be URL-encoded. `` placeholders refer to Prometheus duration strings of the form `[0-9]+[smhdwy]`. For example, `5m` refers to a duration of 5 minutes. diff --git a/docs/querying/basics.md b/docs/querying/basics.md index efbb73edeb..062e2fe203 100644 --- a/docs/querying/basics.md +++ b/docs/querying/basics.md @@ -114,7 +114,7 @@ Label matchers can also be applied to metric names by matching against the inter `{__name__="http_requests_total"}`. Matchers other than `=` (`!=`, `=~`, `!~`) may also be used. The following expression selects all metrics that have a name starting with `job:`: - {__name__=~"^job:.*"} + {__name__=~"job:.*"} ### Range Vector Selectors diff --git a/docs/querying/examples.md b/docs/querying/examples.md index 4e522ab85d..589d6bbca6 100644 --- a/docs/querying/examples.md +++ b/docs/querying/examples.md @@ -29,11 +29,11 @@ Using regular expressions, you could select time series only for jobs whose name match a certain pattern, in this case, all jobs that end with `server`. Note that this does a substring match, not a full string match: - http_requests_total{job=~"server$"} + http_requests_total{job=~".*server"} To select all HTTP status codes except 4xx ones, you could run: - http_requests_total{status!~"^4..$"} + http_requests_total{status!~"4.."} ## Using functions, operators, etc.