-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the metrics config api #12670
Add the metrics config api #12670
Conversation
CI state |
V2 - A forced push rebase to resolve a conflict |
CI state |
Failed because linker crashed with bus error. Re-kicked. |
CI state |
This patch changes the base path of the V2 of the API to be '/'. That means that the v2 prefix will be part of the path definition. Currently, it only affect the config API that is created from code. The motivation for the change is for Swagger definitions that are read from a file. Currently, when using the swagger-ui with a doc path set to http://localhost:10000/v2 and reading the Swagger from a file swagger ui will concatenate the path and look for http://localhost:10000/v2/v2/{path} Instead, the base path is now '/' and the /v2 prefix will be added by each endpoint definition. From the user perspective, there is no change in current functionality. Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This patch adds the swagger definition for the metrics API. Currently, the API defines a get and set of the metric_relabel_config.
Until now, only the configuration API was part of the V2 API. Now, when other APIs are added, it is possible that another API would be the first to register. The first to register API is different in the sense that it does not have a leading ',' to it. This patch adds an option to mark the config API if it's the first.
This patch adds a metrics API implementation. The API supports get and set the metric relabel config. Seastar supports metrics relabeling in runtime, following Prometheus relabel_config. Based on metrics and label name, a user can add or remove labels, disable a metric and set the skip_when_empty flag. The metrics-config API support such configuration to be done using the RestFull API. As it's a new API it is placed under the V2 path. After this patch the following API will be available 'http://localhost:10000/v2/metrics-config/' GET/POST. For example: To get the current config: ``` curl -X GET --header 'Accept: application/json' 'http://localhost:10000/v2/metrics-config/' ``` To set a config: ``` 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/' ```
CI state |
@denesb I've pulled rebased to master and tests are passing. |
@@ -1140,6 +1140,7 @@ def find_headers(repodir, excluded_dirs): | |||
'api/task_manager_test.cc', | |||
'api/config.cc', | |||
Json2Code('api/api-doc/config.json'), | |||
Json2Code('api/api-doc/metrics.json'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack. thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); | ||
}).then([&failed](){ | ||
if (failed) { | ||
throw bad_param_exception("conflicts found during relabeling"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should try adding more details here, can be a follow-up.
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:
A set config example:
This is how it looks like in the UI