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
Signed-off-by: Anivar A Aravind <[email protected]>
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).
2314
+
OPA currently supports the following query performance metrics:
2315
2315
2316
-
OPA provides the following query performance metrics:
2317
-
2318
-
### Core Query Metrics
2319
2316
-**timer_rego_input_parse_ns**: time taken (in nanoseconds) to parse the input
2320
2317
-**timer_rego_query_parse_ns**: time taken (in nanoseconds) to parse the query.
2321
2318
-**timer_rego_query_compile_ns**: time taken (in nanoseconds) to compile the query.
2322
2319
-**timer_rego_query_eval_ns**: time taken (in nanoseconds) to evaluate the query.
2323
2320
-**timer_rego_module_parse_ns**: time taken (in nanoseconds) to parse the input policy module.
2324
2321
-**timer_rego_module_compile_ns**: time taken (in nanoseconds) to compile the loaded policy modules.
2325
-
-**timer_server_handler_ns**: time taken (in nanoseconds) to handle the API request.
2322
+
-**timer_server_handler_ns**: time take (in nanoseconds) to handle the API request.
2326
2323
-**counter_server_query_cache_hit**: number of cache hits for the query.
2327
2324
2328
-
When query instrumentation is enabled (`instrument=true`), the following additional detailed evaluation metrics are included:
2329
-
-**timer_eval_op_***: Various evaluation operation timers (e.g., `timer_eval_op_plug_ns`, `timer_eval_op_resolve_ns`)
2330
-
-**histogram_eval_op_***: Histograms tracking evaluation operation time distributions
2331
-
-**timer_rego_builtin_***: Built-in function execution times
2332
-
-**counter_rego_builtin_***: Built-in function call counts and cache hits
2333
-
2334
-
See [Policy Performance](./policy-performance#performance-metrics) for details on interpreting these metrics.
2335
-
2336
2325
The `counter_server_query_cache_hit` counter gives an indication about whether OPA creates a new Rego query
2337
2326
or it uses a pre-processed query which holds some prepared state to serve the API request. A pre-processed query will be
2338
2327
faster to evaluate since OPA will not have to re-parse or compile it. Hence, when the query is served from the cache
@@ -2344,9 +2333,12 @@ Query instrumentation can help diagnose performance problems, however, it can
2344
2333
add significant overhead to query evaluation. We recommend leaving query
2345
2334
instrumentation off unless you are debugging a performance problem.
2346
2335
2347
-
When instrumentation is enabled there are several additional performance metrics
2348
-
for the compilation stages. They follow the format of `timer_compile_stage_*_ns`
2349
-
and `timer_query_compile_stage_*_ns` for the query and module compilation stages.
2336
+
When query instrumentation is enabled (`instrument=true`), the following additional detailed evaluation metrics are included:
2337
+
-**timer_eval_op_***: Various evaluation operation timers (e.g., `timer_eval_op_plug_ns`, `timer_eval_op_resolve_ns`)
2338
+
-**histogram_eval_op_***: Histograms tracking evaluation operation time distributions
2339
+
-**timer_rego_builtin_***: Built-in function execution times
2340
+
-**counter_rego_builtin_***: Built-in function call counts and cache hits
2341
+
-**timer_compile_stage_*_ns**: Compilation stage timers for the query and module compilation stages
0 commit comments