You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Focus metrics documentation on specific builtins per review
Following final review guidance to document only builtin-specific metrics
in their respective reference pages.
Changes:
- http.mdx: Document http.send timer and cache metrics
- regex.mdx: Document regex cache hit metric
- glob.mdx: Document glob cache hit metric
- rest-api.md: Clarify available instrumentation metrics
Removed broader metrics documentation from monitoring.md and
policy-performance.md per reviewer request to keep changes focused.
Fixes#6730
Copy file name to clipboardExpand all lines: docs/docs/policy-reference/builtins/glob.mdx
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,3 +27,13 @@ The following table shows examples of how `glob.match` works:
27
27
|`output := glob.match("{cat,bat,[fr]at}", [], "bat")`|`true`| A glob with pattern-alternatives matchers. |
28
28
|`output := glob.match("{cat,bat,[fr]at}", [], "rat")`|`true`| A glob with pattern-alternatives matchers. |
29
29
|`output := glob.match("{cat,bat,[fr]at}", [], "at")`|`false`| A glob with pattern-alternatives matchers. |
30
+
31
+
## Performance Metrics
32
+
33
+
When OPA is configured with metrics enabled, `glob.match` operations expose the following metrics in per-query metrics (accessible when `?metrics=true` is specified in API requests):
34
+
35
+
| Metric | Description |
36
+
| ------ | ----------- |
37
+
|`counter_rego_builtin_glob_interquery_value_cache_hits`| Number of inter-query cache hits for compiled glob patterns |
38
+
39
+
Effective glob pattern caching improves performance when the same patterns are used repeatedly across queries. High cache hit ratios indicate that glob compilation overhead is being minimized through caching.
| Unix Socket URL Format |`http.send({"method": "get", "url": "unix://localhost/?socket=%F2path%F2file.socket"})`|
116
+
117
+
## Performance Metrics
118
+
119
+
When OPA is configured with metrics enabled, `http.send` operations expose the following metrics in per-query metrics (accessible when `?metrics=true` is specified in API requests):
120
+
121
+
| Metric | Description |
122
+
| ------ | ----------- |
123
+
|`timer_rego_builtin_http_send_ns`| Total time spent in `http.send` calls during query evaluation |
124
+
|`counter_rego_builtin_http_send_interquery_cache_hits`| Number of inter-query cache hits for `http.send` requests |
125
+
|`counter_rego_builtin_http_send_network_requests`| Number of actual network requests made by `http.send`|
126
+
127
+
High cache hit ratios indicate effective caching and reduced network overhead. These metrics help identify I/O bottlenecks in policies that make external HTTP requests.
When OPA is configured with metrics enabled, regex operations expose the following metrics in per-query metrics (accessible when `?metrics=true` is specified in API requests):
117
+
118
+
| Metric | Description |
119
+
| ------ | ----------- |
120
+
|`counter_rego_builtin_regex_interquery_value_cache_hits`| Number of regex cache hits for compiled patterns |
121
+
122
+
Effective regex caching improves performance when the same patterns are used repeatedly. High cache hit ratios indicate that regex compilation overhead is being minimized through caching.
> **Note**: These are per-query metrics returned inline with API responses. For system-wide instance metrics, see the `/metrics` Prometheus endpoint described in [Monitoring](./monitoring#prometheus).
2266
+
OPA currently supports the following query performance metrics:
2267
2267
2268
-
OPA provides the following query performance metrics:
2269
-
2270
-
### Core Query Metrics
2271
2268
-**timer_rego_input_parse_ns**: time taken (in nanoseconds) to parse the input
2272
2269
-**timer_rego_query_parse_ns**: time taken (in nanoseconds) to parse the query.
2273
2270
-**timer_rego_query_compile_ns**: time taken (in nanoseconds) to compile the query.
2274
2271
-**timer_rego_query_eval_ns**: time taken (in nanoseconds) to evaluate the query.
2275
2272
-**timer_rego_module_parse_ns**: time taken (in nanoseconds) to parse the input policy module.
2276
2273
-**timer_rego_module_compile_ns**: time taken (in nanoseconds) to compile the loaded policy modules.
2277
-
-**timer_server_handler_ns**: time taken (in nanoseconds) to handle the API request.
2274
+
-**timer_server_handler_ns**: time take (in nanoseconds) to handle the API request.
2278
2275
-**counter_server_query_cache_hit**: number of cache hits for the query.
2279
2276
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.
2287
-
2288
2277
The `counter_server_query_cache_hit` counter gives an indication about whether OPA creates a new Rego query
2289
2278
or it uses a pre-processed query which holds some prepared state to serve the API request. A pre-processed query will be
2290
2279
faster to evaluate since OPA will not have to re-parse or compile it. Hence, when the query is served from the cache
@@ -2296,9 +2285,12 @@ Query instrumentation can help diagnose performance problems, however, it can
2296
2285
add significant overhead to query evaluation. We recommend leaving query
2297
2286
instrumentation off unless you are debugging a performance problem.
2298
2287
2299
-
When instrumentation is enabled there are several additional performance metrics
2300
-
for the compilation stages. They follow the format of `timer_compile_stage_*_ns`
2301
-
and `timer_query_compile_stage_*_ns` for the query and module compilation stages.
2288
+
When query instrumentation is enabled (`instrument=true`), the following additional detailed evaluation metrics are included:
2289
+
-**timer_eval_op_***: Various evaluation operation timers (e.g., `timer_eval_op_plug_ns`, `timer_eval_op_resolve_ns`)
2290
+
-**histogram_eval_op_***: Histograms tracking evaluation operation time distributions
2291
+
-**timer_rego_builtin_***: Built-in function execution times
2292
+
-**counter_rego_builtin_***: Built-in function call counts and cache hits
2293
+
-**timer_compile_stage_*_ns**: Compilation stage timers for the query and module compilation stages
0 commit comments