Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile / Benchmarking policies #96

Closed
garethahealy opened this issue Jul 29, 2020 · 2 comments
Closed

Profile / Benchmarking policies #96

garethahealy opened this issue Jul 29, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@garethahealy
Copy link
Contributor

Look into:

Could this be added as part of the CI?

@garethahealy garethahealy added the enhancement New feature or request label Jul 29, 2020
@garethahealy
Copy link
Contributor Author

$ opa bench --bundle policy/ --input policy/ocp/bestpractices/common-k8s-labels-notset/test_data/unit/list.yml "data.ocp.bestpractices.common_k8s_labels_notset"
+-------------------------------------------+------------+
| samples                                   |      14152 |
| ns/op                                     |      85223 |
| B/op                                      |      41718 |
| allocs/op                                 |        786 |
| histogram_timer_rego_query_eval_ns_75%    |      76590 |
| histogram_timer_rego_query_eval_ns_90%    |      86340 |
| histogram_timer_rego_query_eval_ns_95%    |      96418 |
| histogram_timer_rego_query_eval_ns_99%    |     302869 |
| histogram_timer_rego_query_eval_ns_99.9%  |     479065 |
| histogram_timer_rego_query_eval_ns_99.99% |     479783 |
| histogram_timer_rego_query_eval_ns_count  |      14152 |
| histogram_timer_rego_query_eval_ns_max    |     479783 |
| histogram_timer_rego_query_eval_ns_mean   |      78770 |
| histogram_timer_rego_query_eval_ns_median |      70684 |
| histogram_timer_rego_query_eval_ns_min    |      64479 |
| histogram_timer_rego_query_eval_ns_stddev |      37006 |
+-------------------------------------------+------------+

@garethahealy
Copy link
Contributor Author

garethahealy commented Jul 29, 2020

$ opa eval --bundle policy/ --input /tmp/rhcop/29-07-2020-21-07/policy/ocp/bestpractices/common-k8s-labels-notset/test_data/unit/list.yml --profile --format=pretty "data.ocp.bestpractices.common_k8s_labels_notset"
{
  "violation": [
    "Deployment/nolabels: does not contain all the expected k8s labels in 'metadata.labels'. See: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels"
  ]
}
+------------------------------+----------+
|            METRIC            |  VALUE   |
+------------------------------+----------+
| timer_rego_load_bundles_ns   | 18567551 |
| timer_rego_module_compile_ns | 27352946 |
| timer_rego_module_parse_ns   | 4080646  |
| timer_rego_query_compile_ns  | 83375    |
| timer_rego_query_eval_ns     | 12196921 |
| timer_rego_query_parse_ns    | 12819    |
+------------------------------+----------+
+------------+----------+----------+---------------------------------------------------------------+
|    TIME    | NUM EVAL | NUM REDO |                           LOCATION                            |
+------------+----------+----------+---------------------------------------------------------------+
| 7.650367ms | 1        | 1        | policy/lib/openshift.rego:32                                  |
| 1.792691ms | 2        | 2        | policy/lib/konstraint.rego:29                                 |
| 1.020513ms | 1        | 1        | policy/ocp/bestpractices/common-k8s-labels-notset/src.rego:13 |
| 694.166µs  | 3        | 2        | policy/lib/openshift.rego:6                                   |
| 367.984µs  | 3        | 1        | policy/ocp/bestpractices/common-k8s-labels-notset/src.rego:16 |
| 319.135µs  | 1        | 1        | policy/lib/konstraint.rego:3                                  |
| 56.242µs   | 1        | 1        | data.ocp.bestpractices.common_k8s_labels_notset               |
| 34.72µs    | 5        | 5        | policy/ocp/bestpractices/common-k8s-labels-notset/src.rego:18 |
| 29.373µs   | 3        | 2        | policy/lib/konstraint.rego:48                                 |
| 29.359µs   | 3        | 2        | policy/lib/openshift.rego:11                                  |
+------------+----------+----------+---------------------------------------------------------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant