From d75fc7f894af36d99c219c3f8547545b421d1f17 Mon Sep 17 00:00:00 2001 From: Benjamin Raskin Date: Wed, 8 May 2019 11:55:12 -0400 Subject: [PATCH] [docs] Clarify Prom querying in single_node docs (#1612) --- README.md | 4 ++++ docs/how_to/single_node.md | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index afc0a743cd..ef68565719 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,10 @@ curl http://localhost:9003/writetagged -s -X POST -d '{ "namespace": "default", "id": "foo", "tags": [ + { + "name": "__name__", + "value": "user_login" + }, { "name": "city", "value": "new_york" diff --git a/docs/how_to/single_node.md b/docs/how_to/single_node.md index d350651b7e..958f54f1af 100644 --- a/docs/how_to/single_node.md +++ b/docs/how_to/single_node.md @@ -57,6 +57,10 @@ curl -sS -X POST http://localhost:9003/writetagged -d '{ "namespace": "default", "id": "foo", "tags": [ + { + "name": "__name__", + "value": "user_login" + }, { "name": "city", "value": "new_york" @@ -74,7 +78,16 @@ curl -sS -X POST http://localhost:9003/writetagged -d '{ ' ``` -And reading the metrics you've written: +**Note:** In the above example we include the tag `__name__`. This is because `__name__` is a +reserved tag in Prometheus and will make querying the metric much easier. For example, if you have +[M3Query](query.md) setup as a Prometheus datasource in Grafana, you can then query for the metric +using the following PromQL query: + +``` +user_login{city="new_york",endpoint="/request"} +``` + +And reading the metrics you've written using the M3DB `/query` endpoint: ```json curl -sS -X POST http://localhost:9003/query -d '{ "namespace": "default", @@ -93,6 +106,10 @@ curl -sS -X POST http://localhost:9003/query -d '{ { "id": "foo", "tags": [ + { + "name": "__name__", + "value": "user_login" + }, { "name": "city", "value": "new_york"