-
Task
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
None
-
False
-
-
False
-
No
-
---
-
---
What
Add a /metrics/metadata endpoint which returns the list of the available metrics that are available in the KAS Fleet Manager metrics API.
The endpoint should comply to the response returned by the Prometheus /api/v1/metadata
Example request and response:
curl -G http://localhost:9090/api/v1/metadata?limit=2 { "status": "success", "data": { "cortex_ring_tokens": [ { "type": "gauge", "help": "Number of tokens in the ring", "unit": "" } ], "http_requests_total": [ { "type": "counter", "help": "Number of HTTP requests", "unit": "" }, { "type": "counter", "help": "Amount of HTTP requests", "unit": "" } ] } }
We should also specify how to get a list of all metrics exposed via our metrics API to the description of all /metrics endpoints in the KAS Fleet Manager openapi spec.
Why
This would make it easier for users to discover the available metrics we expose via our API (based on architecture call and discussion with devexp team)
How
Add the /metrics/metadata endpoint
The result of this endpoint should make use of the metrics metadata we list in KAS Fleet Manager (see internal/kafka/constants/metrics.go).
- Note: another alternative is to just proxy this from Observatorium. The /api/v1/metadata is already available via the Thanos API. We may be able to call this endpoint in our Observatorium instance. This would require a bit more investigation.
Ensure the endpoint result follows the same format as what is returned by the Prometheus /api/v1/metadata endpoint as described above.
Specify this endpoint in the other /metrics endpoints
Update the description of the following endpoints in the public kas-fleet-manager openapi spec.
- /api/kafkas_mgmt/v1/kafkas/{id}/metrics/query_range
- /api/kafkas_mgmt/v1/kafkas/{id}/metrics/query
- /api/kafkas_mgmt/v1/kafkas/{id}/metrics/federate
The description should mention the /metrics/metadata endpoint so users can use this endpoint to see all available metrics and its descriptions.
Ensure to run make openapi/generate after making your changes.
Done
- New /metrics/metadata endpoint added
- New endpoint documented in the existing /metrics endpoint to make it easier for users to discover it.
- Unit/Integration tests created/updated