---
id: w3/m2/t004
title: REST + GraphQL adapters for request metrics
worker: worker3
status: done
estimate: 40m
depends_on: [w3/m2/t003]
---

## Objective

Expose request metrics through REST and the dashboard-compatible GraphQL adapter, with Render's status-code / host / path filters and group-by.

## Context

- REST `operator/internal/api/rest.go`, GraphQL `operator/internal/api/graphql.go`, both over the request-metrics backend (t003).
- Render's Network Metrics filters: `Status Code`, `Host`, `Path`, plus `Group by` on Total Requests and a percentile selector on Response Times.

## Steps

1. Extend `GET /v1/metrics` (or add `/v1/metrics/requests`) with `status`, `host`, `path`, `groupBy`, and `percentile` params.
2. Add the matching GraphQL query + types delegating to `Core`.
3. Cover both in `api_test.go`.

## Files

- `operator/internal/api/rest.go`, `operator/internal/api/graphql.go`, `operator/internal/api/api_test.go`

## Acceptance criteria

- [ ] Request count / latency percentile / status / bandwidth queryable via REST and GraphQL.
- [ ] `status`, `host`, `path` filters and group-by work; `make test` green.

## Out of scope

- Cluster enablement + docs rollup (t005).
