1Open Policy Agent(1) Open Policy Agent(1)
2
3
4
6 opa-bench - Benchmark a Rego query
7
8
9
11 opa bench [flags]
12
13
14
16 Benchmark a Rego query and print the results.
17
18
19 The benchmark command works very similar to 'eval' and will evaluate
20 the query in the same fashion. The evaluation will be repeated a number
21 of times and performance results will be returned.
22
23
24 Example with bundle and input data:
25
26
27 opa bench -b ./policy-bundle -i input.json 'data.authz.allow'
28
29
30
31 To enable more detailed analysis use the --metrics and --benchmem
32 flags.
33
34
35 The optional "gobench" output format conforms to the Go Benchmark Data
36 Format.
37
38
39
41 --benchmem[=true] report memory allocations with benchmark results
42
43
44 -b, --bundle="" set bundle file(s) or directory path(s). This flag
45 can be repeated.
46
47
48 --count=1 number of times to repeat each benchmark
49
50
51 -d, --data="" set policy or data file(s). This flag can be re‐
52 peated.
53
54
55 --fail[=true] exits with non-zero exit code on undefined/empty re‐
56 sult and errors
57
58
59 -f, --format=pretty set output format
60
61
62 -h, --help[=false] help for bench
63
64
65 --ignore=[] set file and directory names to ignore during loading
66 (e.g., '.*' excludes hidden files)
67
68
69 --import="" set query import(s). This flag can be repeated.
70
71
72 -i, --input="" set input file path
73
74
75 --metrics[=true] report query performance metrics
76
77
78 --package="" set query package
79
80
81 -p, --partial[=false] perform partial evaluation
82
83
84 -s, --schema="" set schema file path or directory path
85
86
87 --stdin[=false] read query from stdin
88
89
90 -I, --stdin-input[=false] read input document from stdin
91
92
93 -t, --target=rego set the runtime to exercise
94
95
96 -u, --unknowns=[input] set paths to treat as unknown during par‐
97 tial evaluation
98
99
100
102 opa(1)
103
104
105
106 Jan 2023 Open Policy Agent(1)