1Open(Policy) Open(Policy)
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 (default 1)
49
50
51 -d, --data="" set policy or data file(s). This flag can be
52 repeated.
53
54
55 --fail[=true] exits with non-zero exit code on undefined/empty
56 result 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 --stdin[=false] read query from stdin
82
83
84 -I, --stdin-input[=false] read input document from stdin
85
86
87
89 opa(1)
90
91
92
932020 Agent(1)Oct Open(Policy)