Description
metrics-export-role 0.1.0
had introduced a way to set up metrics HTTP server through Tarantool 3 configuration:
roles_cfg:
roles.metrics-export:
http:
- listen: 8081
endpoints:
- path: /metrics
format: json
- path: /metrics/prometheus/
format: prometheus
- listen: '127.0.0.1:8082'
endpoints:
- path: /metrics/
format: json
The next step is to introduce some configurable HTTP server that can be reused by several roles (like with Tarantool Cartridge Web UI HTTP server). It can go like this:
roles_cfg:
roles.http:
default_server:
- listen: 8081
additional_server:
- listen: '127.0.0.1:8082'
roles.metrics-export:
http:
- server: default_server
endpoints:
- path: /metrics
format: json
- path: /metrics/prometheus/
format: prometheus
- server: additional_server
endpoints:
- path: /metrics/
format: json
roles.tcf-worker:
http:
- server: default_server
Such approach will also allow to set up server port on instance level and metrics/other HTTP users on global level instead of copypasting all of it to the instance level.
So HTTP role should support
- creating servers with some unique identifier,
- API to get server object by its ID for other roles.
It would also be nice to have some "get_default_server" handle so it can be used like this:
roles_cfg:
roles.http:
default:
- listen: 8081
roles.metrics-export:
http:
endpoints:
- path: /metrics
format: json
- path: /metrics/prometheus/
format: prometheus
Default server can be a "first server created with role" or "server with default
key". This case should be useful since "single HTTP server for administration and monitoring" is a well-spread case from Tarantool Cartridge applications.
(Configuration structure proposed here is an example and not a strict requirement.)