Analytics
The gateway counts every request it handles and measures how long it took. Prometheus scrapes those numbers from the gateway nodes, and Analytics, under Analytics in the menu, reads them from Prometheus for the environment you are in.
Who may open it
Analytics needs the view permission of Analytics in the environment (analytics.view). The Environment administrator holds it, and a custom role can carry it. The Editor and the Viewer are refused: the page is absent from their menu, and opening it by its address shows a page that names their role.
The Changes in this window card reads the environment's audit log. It appears only for a role that also holds the view permission of Audit log (audit.view).
What has to be connected
- The environment's Prometheus. A Platform administrator enters its address under Observability in the environment's settings. Without it, the page carries this title: Prometheus is not connected.
- The prometheus plugin running on the gateway. The installation guide writes the global rule that runs it on every request, and G8 does not write it; leave it in place. G8 writes only the global rule of request records,
g8-request-records, when logging is turned on. When no copy of the prometheus plugin runs, the page says: Request metrics are off in Production: no global rule runs the prometheus plugin and no route carries its own copy.
Prometheus has to be prepared for this, as the installation guide shows. Its scrape adds the label g8_environment with the environment's slug to every value, g8_environment="dev" for the slug dev, so that no environment reads another's. Its retention has to cover the 30-day window and the same window a week before it; the guide keeps --storage.tsdb.retention.time=40d. Prometheus 3.15 needs the flag --enable-feature=promql-extended-range-selectors to count each time slice exactly. Without it, the page marks its counts as estimates.
What the page shows
Pick a time range at the top, from the last 15 minutes to the last 30 days or a range of your own. The cards read, in order:
- Gateway nodes: each gateway node, whether it reports now, and its share of the requests.
- Requests: the requests of the window by status class, beside the same window a week ago, and where today is heading.
- Shares: requests by status class, Server errors and Client errors by code, and By source, which says who answered.
- Backend: the backend sent the answer.
- Unreachable: the request was handed to a node and no answer came back.
- Client closed: the client left before the answer.
- Gateway: the gateway answered before it handed the request to any node, for a refused key or a limit for example.
- Changes in this window: the changes people made to gateway objects during the window, from the audit log, numbered on the chart so you can see what a change did to the traffic.
- Response time: as the client sees it, in the backend, and the gateway's own time, each as p50, p95 and p99, with last week's p95 beside it.
- Routes, services and upstreams: the routes, services and upstreams with the most requests, the most server errors and the slowest p95.
The environment's Overview page shows the requests of the last hour and the gateway nodes from the same numbers.
What it does not show
Analytics counts and times requests; it does not show single requests. For one request, its path, its headers and what the backend answered, use Request records.
Related
- Where the numbers come from: how a request becomes a count, and why a count can be an estimate.
- Alerts: rules on the same numbers that tell you when something changes.
- Apply a plugin to every request: the global rules, where the prometheus plugin lives.