From 07341421736219cdb980ff9430267a40252ca235 Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Thu, 3 Jun 2021 14:21:08 +0200 Subject: [PATCH 1/5] Add deprecation warning to old metrics endpoint --- .../DocuBlocks/Rest/Administration/get_admin_metrics.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics.md b/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics.md index e6cf0eaef3b6..d04e1dfd95dc 100644 --- a/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics.md +++ b/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics.md @@ -4,6 +4,13 @@ @RESTHEADER{GET /_admin/metrics, Read the metrics, getMetrics} +@HINTS +{% hint 'warning' %} +This endpoint should no longer be used. It is deprecated from version 3.8.0 on. +Use `/_admin/metrics/v2` instead, which provides the data exposed by this API +and a lot more. +{% endhint %} + @RESTQUERYPARAMETERS @RESTQUERYPARAM{serverId,string,optional} From dc1ca76cf9dcc98eba08393864a605a770bc2c29 Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Thu, 3 Jun 2021 14:21:42 +0200 Subject: [PATCH 2/5] Add DocuBlock for /_admin/metrics/v2 --- .../Administration/get_admin_metrics_v2.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md diff --git a/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md b/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md new file mode 100644 index 000000000000..29d4854744a1 --- /dev/null +++ b/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md @@ -0,0 +1,46 @@ + +@startDocuBlock get_admin_metrics_v2 +@brief return the current instance metrics + +@RESTHEADER{GET /_admin/metrics/v2, Read the metrics, getMetricsV2} + +@RESTQUERYPARAMETERS + +@RESTQUERYPARAM{serverId,string,optional} +Returns metrics of the specified server. If no serverId is given, the asked +server will reply. This parameter is only meaningful on Coordinators. + +@RESTDESCRIPTION +Returns the instance's current metrics in Prometheus format. The +returned document collects all instance metrics, which are measured +at any given time and exposes them for collection by Prometheus. + +The document contains different metrics and metrics groups dependent +on the role of the queried instance. All exported metrics are +published with the prefix `arangodb_` to distinguish them from other +collected data. + +The API then needs to be added to the Prometheus configuration file +for collection. + +@RESTRETURNCODES + +@RESTRETURNCODE{200} +Metrics were returned successfully. + +@RESTRETURNCODE{404} +The metrics API may be disabled using `--server.export-metrics-api false` +setting in the server. In this case, the result of the call indicates the API +to be not found. + +@EXAMPLES + +@EXAMPLE_ARANGOSH_RUN{RestAdminMetricsV2} + var url = "/_admin/metrics/v2"; + var response = logCurlRequest('GET', url); + + assert(response.code === 200); + + logPlainResponse(response); +@END_EXAMPLE_ARANGOSH_RUN +@endDocuBlock From 125116b14210e1fe85ea702fae5b8439d229aeb2 Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Thu, 3 Jun 2021 14:22:15 +0200 Subject: [PATCH 3/5] Try to make plain curl examples shortable --- Documentation/Scripts/codeBlockReader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/Scripts/codeBlockReader.py b/Documentation/Scripts/codeBlockReader.py index 13fa6bc80056..9e36ff662f01 100644 --- a/Documentation/Scripts/codeBlockReader.py +++ b/Documentation/Scripts/codeBlockReader.py @@ -144,7 +144,7 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath): curlState = CURL_STATE_CMD elif curlState == CURL_STATE_CMD and line.startswith("HTTP/"): curlState = CURL_STATE_HEADER - elif curlState == CURL_STATE_HEADER and line.startswith("{"): + elif curlState == CURL_STATE_HEADER and len(line) == 0: curlState = CURL_STATE_BODY if curlState == CURL_STATE_CMD or curlState == CURL_STATE_HEADER: @@ -241,8 +241,8 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath): hideText )) fh.write("\n") - - if shortable: + + if shortable: fh.write("
\n" % (shortTag, shortToggle)) if blockType != "AQL" and blockType != "EXPLAIN": fh.write("
\n")

From dbfd412a4aef9dc1efc800eb9a557a422f8287f4 Mon Sep 17 00:00:00 2001
From: Simran Spiller 
Date: Thu, 3 Jun 2021 23:56:35 +0200
Subject: [PATCH 4/5] Strip whitespace from line

---
 Documentation/Scripts/codeBlockReader.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/Scripts/codeBlockReader.py b/Documentation/Scripts/codeBlockReader.py
index 9e36ff662f01..6ad047bfa824 100644
--- a/Documentation/Scripts/codeBlockReader.py
+++ b/Documentation/Scripts/codeBlockReader.py
@@ -144,7 +144,7 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath):
         curlState = CURL_STATE_CMD
       elif curlState == CURL_STATE_CMD and line.startswith("HTTP/"):
         curlState = CURL_STATE_HEADER
-      elif curlState == CURL_STATE_HEADER and len(line) == 0:
+      elif curlState == CURL_STATE_HEADER and len(line.strip()) == 0:
         curlState = CURL_STATE_BODY
 
       if curlState == CURL_STATE_CMD or curlState == CURL_STATE_HEADER:

From d5658fb47b7c83bf7926abba2cfdb8acbd7b2aa3 Mon Sep 17 00:00:00 2001
From: Vadim 
Date: Fri, 18 Jun 2021 15:56:58 +0300
Subject: [PATCH 5/5] Update get_admin_metrics_v2.md

---
 .../DocuBlocks/Rest/Administration/get_admin_metrics_v2.md    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md b/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md
index 29d4854744a1..0c825986fd08 100644
--- a/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md
+++ b/Documentation/DocuBlocks/Rest/Administration/get_admin_metrics_v2.md
@@ -17,8 +17,8 @@ at any given time and exposes them for collection by Prometheus.
 
 The document contains different metrics and metrics groups dependent
 on the role of the queried instance. All exported metrics are
-published with the prefix `arangodb_` to distinguish them from other
-collected data.
+published with the prefix `arangodb_` or `rocksdb_` to distinguish them from
+other collected data.
 
 The API then needs to be added to the Prometheus configuration file
 for collection.