8000 Add `/_admin/metrics/v2` DocuBlock (#14324) · arangodb/arangodb@a3ee719 · GitHub
[go: up one dir, main page]

Skip to content

Commit a3ee719

Browse files
Simran-BKVS85
andcommitted
Add /_admin/metrics/v2 DocuBlock (#14324)
* Add deprecation warning to old metrics endpoint * Add DocuBlock for /_admin/metrics/v2 * Try to make plain curl examples shortable * Strip whitespace from line * Update get_admin_metrics_v2.md Co-authored-by: Vadim Kondratyev <vadim@arangodb.com>
1 parent f38e952 commit a3ee719

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

Documentation/DocuBlocks/Rest/Administration/get_admin_metrics.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
@RESTHEADER{GET /_admin/metrics, Read the metrics, getMetrics}
66

7+
@HINTS
8+
{% hint 'warning' %}
9+
This endpoint should no longer be used. It is deprecated from version 3.8.0 on.
10+
Use `/_admin/metrics/v2` instead, which provides the data exposed by this API
11+
and a lot more.
12+
{% endhint %}
13+
714
@RESTQUERYPARAMETERS
815

916
@RESTQUERYPARAM{serverId,string,optional}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
@startDocuBlock get_admin_metrics_v2
3+
@brief return the current instance metrics
4+
5+
@RESTHEADER{GET /_admin/metrics/v2, Read the metrics, getMetricsV2}
6+
7+
@RESTQUERYPARAMETERS
8+
9+
@RESTQUERYPARAM{serverId,string,optional}
10+
Returns metrics of the specified server. If no serverId is given, the asked
11+
server will reply. This parameter is only meaningful on Coordinators.
12+
13+
@RESTDESCRIPTION
14+
Returns the instance's current metrics in Prometheus format. The
15+
returned document collects all instance metrics, which are measured
16+
at any given time and exposes them for collection by Prometheus.
17+
18+
The document contains different metrics and metrics groups dependent
19+
on the role of the queried instance. All exported metrics are
20+
published with the prefix `arangodb_` or `rocksdb_` to distinguish them from
21+
other collected data.
22+
23+
The API then needs to be added to the Prometheus configuration file
24+
for collection.
25+
26+
@RESTRETURNCODES
27+
28+
@RESTRETURNCODE{200}
29+
Metrics were returned successfully.
30+
31+
@RESTRETURNCODE{404}
32+
The metrics API may be disabled using `--server.export-metrics-api false`
33+
setting in the server. In this case, the result of the call indicates the API
34+
to be not found.
35+
36+
@EXAMPLES
37+
38+
@EXAMPLE_ARANGOSH_RUN{RestAdminMetricsV2}
39+
var url = "/_admin/metrics/v2";
40+
var response = logCurlRequest('GET', url);
41+
42+
assert(response.code === 200);
43+
44+
logPlainResponse(response);
45+
@END_EXAMPLE_ARANGOSH_RUN
46+
@endDocuBlock

Documentation/Scripts/codeBlockReader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath):
144144
curlState = CURL_STATE_CMD
145145
elif curlState == CURL_STATE_CMD and line.startswith("HTTP/"):
146146
curlState = CURL_STATE_HEADER
147-
elif curlState == CURL_STATE_HEADER and line.startswith("{"):
147+
elif curlState == CURL_STATE_HEADER and len(line.strip()) == 0:
148148
curlState = CURL_STATE_BODY
149149

150150
if curlState == CURL_STATE_CMD or curlState == CURL_STATE_HEADER:
@@ -241,8 +241,8 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath):
241241
hideText
242242
))
243243
fh.write("</div>\n")
244-
245-
if shortable:
244+
245+
if shortable:
246246
fh.write("<div id=\"%s\" onclick=\"%s\">\n" % (shortTag, shortToggle))
247247
if blockType != "AQL" and blockType != "EXPLAIN":
248248
fh.write("<pre>\n")

0 commit comments

Comments
 (0)
0