Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'Add the metrics config api' from Amnon Heiman
This series is based on top of the seastar relabel config API. The series adds a REST API for the configuration, it allows to get and set it. The API is registered under the V2 prefix and uses the swagger 2.0 definition. After this series to get the current relabel-config configuration: ``` curl -X GET --header 'Accept: application/json' 'http://localhost:10000/v2/metrics-config/' ``` A set config example: ``` curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[ \ { \ "source_labels": [ \ "__name__" \ ], \ "action": "replace", \ "target_label": "level", \ "replacement": "1", \ "regex": "io_que.*" \ } \ ]' 'http://localhost:10000/v2/metrics-config/' ``` This is how it looks like in the UI ![image](https://user-images.githubusercontent.com/2118079/230763730-bafcaf8b-ea6d-4a6c-a778-6271fa3b6f82.png) Closes #12670 * github.com:scylladb/scylladb: api: Add the metrics API api/config: make it optional if the config API is the first to register api: Add the metrics.json Swagger file Preparing for V2 API from files
- Loading branch information
Showing
8 changed files
with
187 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
} | ||
}, | ||
"host": "{{Host}}", | ||
"basePath": "/v2", | ||
"basePath": "/", | ||
"schemes": [ | ||
"http" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters