Skip to content

Commit 15b9ec8

Browse files
committed
docs: Address additional PR #7929 review feedback
- Move metrics overview into Prometheus section for better flow - Add explicit /metrics path mention in Prometheus intro - Add links to Status API and Decision Logs documentation - Fix CLI tools to include proper documentation links - Clarify which metrics are enabled with instrument=true parameter - Remove inaccurate 'subset' terminology for Status API Addresses review comments from charlieegan3 on September 25, 2025 Signed-off-by: Anivar A Aravind <[email protected]>
1 parent dc63b7f commit 15b9ec8

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

docs/docs/monitoring.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ for all OpenTelemetry-related configurables.
2020

2121
## Prometheus
2222

23-
OPA exposes an HTTP endpoint that can be used to collect performance metrics
23+
OPA exposes an HTTP endpoint at `/metrics` that can be used to collect performance metrics
2424
for all API calls. The Prometheus endpoint is enabled by default when you run
2525
OPA as a server.
2626

27+
OPA provides two ways to access performance metrics:
28+
29+
1. **System-wide metrics** via the `/metrics` Prometheus endpoint - Instance-level metrics across all OPA operations
30+
2. **Per-query metrics** via API responses with `?metrics=true` - Metrics for individual query executions
31+
32+
These serve different purposes: system metrics for OPA instance monitoring and alerting, per-query metrics for debugging and optimization.
33+
2734
You can enable metric collection from OPA with the following `prometheus.yml` config:
2835

2936
```yaml
@@ -86,21 +93,9 @@ When Prometheus is enabled in the status plugin (see [Configuration](./configura
8693
| last_success_bundle_request | gauge | Last successful bundle request in UNIX nanoseconds. | STABLE |
8794
| bundle_loading_duration_ns | histogram | A histogram of duration for bundle loading. | STABLE |
8895

89-
## Metrics Overview
90-
91-
OPA provides two ways to access performance metrics:
92-
93-
1. **System-wide metrics** via the `/metrics` Prometheus endpoint - Instance-level metrics across all OPA operations
94-
2. **Per-query metrics** via API responses with `?metrics=true` - Metrics for individual query executions
95-
96-
These serve different purposes: system metrics for OPA instance monitoring and alerting, per-query metrics for debugging and optimization.
97-
98-
99-
## Accessing Metrics
100-
101-
### System-Wide Metrics (Prometheus Endpoint)
96+
## Available Metrics
10297

103-
Access instance-level metrics across all OPA operations:
98+
The Prometheus `/metrics` endpoint exposes the following instance-level metrics:
10499

105100
- **URL**: `http://localhost:8181/metrics` (default configuration)
106101
- **Method**: HTTP GET
@@ -112,9 +107,9 @@ Access instance-level metrics across all OPA operations:
112107

113108
- **Per-query metrics**: See [REST API Performance Metrics](./rest-api#performance-metrics) for debugging individual queries
114109
- **Policy performance**: See [Policy Performance](./policy-performance#performance-metrics) for optimization guidance
115-
- **Status API**: Includes subset of metrics in status reports
116-
- **Decision logs**: Can include request-level metrics when configured
117-
- **CLI tools**: `opa eval --metrics` and `opa bench --metrics`
110+
- **Status API**: See [Status API](./management-status) for metrics reporting via status updates
111+
- **Decision logs**: See [Decision Logs](./management-decision-logs) for including metrics in decision logs
112+
- **CLI tools**: See [opa eval](./cli#eval) and [opa bench](./cli#bench) for command-line metric collection
118113

119114
## Health Checks
120115

docs/docs/rest-api.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,13 @@ OPA provides the following query performance metrics:
22772277
- **timer_server_handler_ns**: time taken (in nanoseconds) to handle the API request.
22782278
- **counter_server_query_cache_hit**: number of cache hits for the query.
22792279

2280-
When query instrumentation is enabled (`instrument=true`), additional evaluation metrics are included. See [Policy Performance](./policy-performance#performance-metrics) for details on interpreting these metrics.
2280+
When query instrumentation is enabled (`instrument=true`), the following additional detailed evaluation metrics are included:
2281+
- **timer_eval_op_***: Various evaluation operation timers (e.g., `timer_eval_op_plug_ns`, `timer_eval_op_resolve_ns`)
2282+
- **histogram_eval_op_***: Histograms tracking evaluation operation time distributions
2283+
- **timer_rego_builtin_***: Built-in function execution times
2284+
- **counter_rego_builtin_***: Built-in function call counts and cache hits
2285+
2286+
See [Policy Performance](./policy-performance#performance-metrics) for details on interpreting these metrics.
22812287

22822288
The `counter_server_query_cache_hit` counter gives an indication about whether OPA creates a new Rego query
22832289
or it uses a pre-processed query which holds some prepared state to serve the API request. A pre-processed query will be

0 commit comments

Comments
 (0)