Skip to content

Commit

Permalink
Add /_admin/metrics/v2 DocuBlock (#14324)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Simran-B and KVS85 committed Jun 28, 2021
1 parent f38e952 commit a3ee719
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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_` or `rocksdb_` 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
6 changes: 3 additions & 3 deletions Documentation/Scripts/codeBlockReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.strip()) == 0:
curlState = CURL_STATE_BODY

if curlState == CURL_STATE_CMD or curlState == CURL_STATE_HEADER:
Expand Down Expand Up @@ -241,8 +241,8 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath):
hideText
))
fh.write("</div>\n")
if shortable:

if shortable:
fh.write("<div id=\"%s\" onclick=\"%s\">\n" % (shortTag, shortToggle))
if blockType != "AQL" and blockType != "EXPLAIN":
fh.write("<pre>\n")
Expand Down

0 comments on commit a3ee719

Please sign in to comment.