kubewarden / policy-server

Webhook server that evaluates WebAssembly policies to validate Kubernetes requests
https://kubewarden.io
Apache License 2.0
138 stars 18 forks source link

Metric: policy evaluation latency #103

Closed flavio closed 2 years ago

flavio commented 3 years ago

The goal of this metric is to allow an operator to understand the latency introduced by the evaluation of policies.

The policy provides also some labels, that can be used to filter the metric and provide really specific data.

Metric name

kubewarden_policy_evaluation_duration_seconds

Metric type

Histogram

Use cases

Labels

Deliverables

jvanz commented 2 years ago

Some possible queries using this metric:

Show the latency of the 90th percentile among all the policies in the past 10 minutes

histogram_quantile(0.9, sum by (le) (rate(kubewarden_policy_evaluation_latency_milliseconds_bucket[10m])))

Show the latency of the 90th percentile by the policy in the past 10 minutes


histogram_quantile(0.9, sum by (le, policy_name) (rate(kubewarden_policy_evaluation_latency_milliseconds_bucket[10m])))
jvanz commented 2 years ago

I'm adding new panels in the Grafana dashboard to use this metric. Thus, for any query that I add or change, I'll update this issue as well.