opa-bench - Man Page

Benchmark a Rego query

Synopsis

opa bench  [flags]

Description

Benchmark a Rego query and print the results.

The benchmark command works very similar to 'eval' and will evaluate the query in the same fashion. The evaluation will be repeated a number of times and performance results will be returned.

Example with bundle and input data:

opa bench -b ./policy-bundle -i input.json 'data.authz.allow'

To enable more detailed analysis use the --metrics and --benchmem flags.

The optional "gobench" output format conforms to the Go Benchmark Data Format.

Options

--benchmem[=true] report memory allocations with benchmark results

-b, --bundle="" set bundle file(s) or directory path(s). This flag can be repeated.

--count=1 number of times to repeat each benchmark

-d, --data="" set policy or data file(s). This flag can be repeated.

--fail[=true] exits with non-zero exit code on undefined/empty result and errors

-f, --format=pretty set output format

-h, --help[=false] help for bench

--ignore=[] set file and directory names to ignore during loading (e.g., '.*' excludes hidden files)

--import="" set query import(s). This flag can be repeated.

-i, --input="" set input file path

--metrics[=true] report query performance metrics

--package="" set query package

-p, --partial[=false] perform partial evaluation

-s, --schema="" set schema file path or directory path

--stdin[=false] read query from stdin

-I, --stdin-input[=false] read input document from stdin

-t, --target=rego set the runtime to exercise

-u, --unknowns=[input] set paths to treat as unknown during partial evaluation

See Also

opa(1)

Referenced By

opa(1).

Jan 2023