From 56ac9f514566d0cbfa6125a28c96b759d4de1ff9 Mon Sep 17 00:00:00 2001 From: Chris Akritidis <43294513+cakrit@users.noreply.github.com> Date: Mon, 4 Mar 2019 18:36:08 +0100 Subject: Support legacy Prometheus metric names for source average (#5531) * Support older prometheus metric unit naming and allow removal of units from metrics * Update swagger * Added bats tests, improved efficiency of checking units --- web/api/exporters/allmetrics.c | 3 ++- web/api/netdata-swagger.json | 24 ++++++++++++++++++++++++ web/api/netdata-swagger.yaml | 14 ++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) (limited to 'web/api') diff --git a/web/api/exporters/allmetrics.c b/web/api/exporters/allmetrics.c index 91bb0f921e..88ff78e7e4 100644 --- a/web/api/exporters/allmetrics.c +++ b/web/api/exporters/allmetrics.c @@ -11,7 +11,8 @@ struct prometheus_output_options { { "names", PROMETHEUS_OUTPUT_NAMES }, { "timestamps", PROMETHEUS_OUTPUT_TIMESTAMPS }, { "variables", PROMETHEUS_OUTPUT_VARIABLES }, - + { "oldunits", PROMETHEUS_OUTPUT_OLDUNITS }, + { "hideunits", PROMETHEUS_OUTPUT_HIDEUNITS }, // terminator { NULL, PROMETHEUS_OUTPUT_NONE }, }; diff --git a/web/api/netdata-swagger.json b/web/api/netdata-swagger.json index ac84b754d6..99ed95209f 100644 --- a/web/api/netdata-swagger.json +++ b/web/api/netdata-swagger.json @@ -506,6 +506,30 @@ ], "default": "yes" }, + { + "name": "oldunits", + "in": "query", + "description": "When enabled, netdata will show metric names for the default source=average as they appeared before 1.12, by using the legacy unit naming conventions", + "required": false, + "type": "string", + "enum": [ + "yes", + "no" + ], + "default": "yes" + }, + { + "name": "hideunits", + "in": "query", + "description": "When enabled, netdata will not include the units in the metric names, for the default source=average.", + "required": false, + "type": "string", + "enum": [ + "yes", + "no" + ], + "default": "yes" + }, { "name": "server", "in": "query", diff --git a/web/api/netdata-swagger.yaml b/web/api/netdata-swagger.yaml index bf62fb95af..e5689e3927 100644 --- a/web/api/netdata-swagger.yaml +++ b/web/api/netdata-swagger.yaml @@ -333,6 +333,20 @@ paths: type: string enum: [ 'yes', 'no' ] default: 'yes' + - name: oldunits + in: query + description: 'When enabled, netdata will show metric names for the default source=average as they appeared before 1.12, by using the legacy unit naming conventions' + required: false + type: string + enum: [ 'yes', 'no' ] + default: 'yes' + - name: hideunits + in: query + description: 'When enabled, netdata will not include the units in the metric names, for the default source=average.' + required: false + type: string + enum: [ 'yes', 'no' ] + default: 'yes' - name: server in: query description: 'Set a distinct name of the client querying prometheus metrics. Netdata will use the client IP if this is not set.' -- cgit v1.2.3