Skip to content

[ISSUE #431] Add Prometheus range query adapter#432

Open
Kris20030907 wants to merge 2 commits into
apache:rocketmq-studiofrom
Kris20030907:feat/prometheus-query-adapter
Open

[ISSUE #431] Add Prometheus range query adapter#432
Kris20030907 wants to merge 2 commits into
apache:rocketmq-studiofrom
Kris20030907:feat/prometheus-query-adapter

Conversation

@Kris20030907

Copy link
Copy Markdown

What is the purpose of the change

RocketMQ Studio currently returns generated sample data from its metrics API, so it cannot be used to query real RocketMQ monitoring data.

This change introduces a real Prometheus-compatible range query adapter as the foundation for the observability features proposed in #431. It enables Studio to query historical RocketMQ metrics collected by a configured Prometheus-compatible backend.

Part of #431.

Brief changelog

  • Replace the generated metrics source with a real /api/v1/query_range adapter.
  • Send PromQL range queries using form-encoded POST requests.
  • Add configurable base URL, connect timeout, read timeout, Basic authentication, and Bearer authentication.
  • Preserve Prometheus result types, multiple series, labels, decimal and special sample values, and warnings.
  • Validate query parameters and expose meaningful upstream errors through HTTP 400, 422, 502, 503, and 504 responses.
  • Add executable OpenAPI examples and response documentation.
  • Align the frontend metrics API with the backend request and response contract.
  • Add tests covering request encoding, response fidelity, authentication, invalid input, malformed responses, upstream errors, missing configuration, and timeouts.

Verifying this change

The following checks were completed with JDK 21:

  • mvn -q checkstyle:check package
    • 165 tests passed.
    • Checkstyle passed.
    • Server packaging succeeded.
  • npm test
    • 6 tests passed.
  • npm run lint
    • No lint errors.
  • npm run build
    • Production build succeeded.
  • Manually queried a Prometheus instance containing RocketMQ 5.5.0 metrics through RocketMQ Studio Swagger UI.
    • The request returned real matrix data with multiple labelled series.
    • Invalid PromQL and timeout responses were mapped to the expected HTTP errors.

Follow this checklist to help us incorporate your contribution quickly and easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant