diff --git a/api/api-doc/metrics.def.json b/api/api-doc/metrics.def.json new file mode 100644 index 0000000000..c8ae6c64d4 --- /dev/null +++ b/api/api-doc/metrics.def.json @@ -0,0 +1,34 @@ + "metrics_config": { + "id": "metrics_config", + "summary": "An entry in the metrics configuration", + "properties": { + "source_labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The source labels, a match is based on concatination of the labels" + }, + "action": { + "type": "string", + "description": "The action to perfrom on match", + "enum": ["skip_when_empty", "report_when_empty", "replace", "keep", "drop", "drop_label"] + }, + "target_label": { + "type": "string", + "description": "The application state version" + }, + "replacement": { + "type": "string", + "description": "The replacement string to use when replacing a value" + }, + "regex": { + "type": "string", + "description": "The regex string to use when replacing a value" + }, + "separator": { + "type": "string", + "description": "The separator string to use when concatinating the labels" + } + } + } \ No newline at end of file diff --git a/api/api-doc/metrics.json b/api/api-doc/metrics.json new file mode 100644 index 0000000000..76b47a75bd --- /dev/null +++ b/api/api-doc/metrics.json @@ -0,0 +1,66 @@ + "/v2/metrics-config/":{ + "get":{ + "description":"Return the metrics layer configuration", + "operationId":"get_metrics_config", + "produces":[ + "application/json" + ], + "tags":[ + "metrics" + ], + "parameters":[ + ], + "responses":{ + "200":{ + "schema": { + "type":"array", + "items":{ + "$ref":"#/definitions/metrics_config", + "description":"metrics Config value" + } + } + }, + "default":{ + "description":"unexpected error", + "schema":{ + "$ref":"#/definitions/ErrorModel" + } + } + } + }, + "post": { + "description":"Set the metrics layer relabel configuration", + "operationId":"set_metrics_config", + "produces":[ + "application/json" + ], + "tags":[ + "metrics" + ], + "parameters":[ + { + "in":"body", + "name":"conf", + "description":"An array of relabel_config objects", + "schema": { + "type":"array", + "items":{ + "$ref":"#/definitions/metrics_config", + "description":"metrics Config value" + } + } + } + ], + "responses":{ + "200":{ + "description": "OK" + }, + "default":{ + "description":"unexpected error", + "schema":{ + "$ref":"#/definitions/ErrorModel" + } + } + } + } + } diff --git a/configure.py b/configure.py index e6d335721b..08f344b734 100755 --- a/configure.py +++ b/configure.py @@ -1140,6 +1140,7 @@ api = ['api/api.cc', 'api/task_manager_test.cc', 'api/config.cc', Json2Code('api/api-doc/config.json'), + Json2Code('api/api-doc/metrics.json'), 'api/error_injection.cc', Json2Code('api/api-doc/error_injection.json'), 'api/authorization_cache.cc',