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

Publish metrics to Prometheus and Grafana #256

Closed
realshuting opened this issue Aug 2, 2019 · 9 comments
Closed

Publish metrics to Prometheus and Grafana #256

realshuting opened this issue Aug 2, 2019 · 9 comments
Assignees
Labels

Comments

@realshuting
Copy link
Member

realshuting commented Aug 2, 2019

Currently policy metrics are shown in the status. It would be good to expose a /metrics endpoint that can be used by Prometheus to collect and aggregate metrics. A Grafana dashboard can then be used to display policy execution state and trends.

@realshuting
Copy link
Member Author

realshuting commented Aug 7, 2019

These could be high-level considerations:

  • Total count of violations
  • Number of violations on audit mode
  • Number of violations of blocked resources (enforce mode)
  • Total count of successful policy application
  • Number of audit policies
  • Time to evaluate the request
  • Time to process a rule (mutate/validate/generate)
  • Time to add a new policy
  • Time to process policy vs resource

This is just an initial proposal. @JimBugwadia @shivdudhani Please add to the list if you have valuable cases.

@realshuting realshuting self-assigned this Aug 9, 2019
@realshuting realshuting added the enhancement New feature or request label Aug 9, 2019
@realshuting realshuting added the Documentation Update Documentation label Dec 3, 2019
@realshuting realshuting removed their assignment Aug 12, 2020
@dirien
Copy link

dirien commented Nov 20, 2020

hi, i would suggest to support ServiceMonitor / PodMonitor of the prometheus operator.

@JimBugwadia JimBugwadia changed the title Display statistics info via prometheus Publish metrics to Prometheus and Grafana Jan 23, 2021
@yashvardhan-kukreja
Copy link
Contributor

yashvardhan-kukreja commented Jan 23, 2021

@realshuting , I don't think, as a part of this issue, we'd have to programme anything for grafana per se.
The way it seems to me, we just have to code a new custom exporter in kyverno which exposes the metrics you listed above on /metrics

Then, while using grafana, we just have to make it use the prometheus datasource which would be storing kyverno's metrics (exported in the first place by the custom exporter)

Please correct me if I am wrong :)

@phoenixking25
Copy link

I think this task will also include thanos to make metrics globally available at a central place to present on Grafana.

@JimBugwadia
Copy link
Member

We should think about the use cases for different metric sets. I see at least 2 user stories:

  • I am a cluster admin and want to see if policy rules are executing correctly and efficiently. I need to provide these reports for compliance and also report things like how many API requests were blocked.
  • I am a cluster admin and want to see violation trends across namespaces.
  • I am a workload / namespace admin and want to see metrics and trends for my namespace.

There are likely others...

Based on these concerns / use cases we can determine the appropriate metrics and dashboards / reports.

@JimBugwadia
Copy link
Member

See: https://github.com/fjogeleit/policy-reporter - this may help address some of the use cases mentioned.

@realshuting
Copy link
Member Author

It would be good to have these metrics https://kubernetes.slack.com/archives/CLGR9BJU9/p1614050069016200?thread_ts=1614025217.009600&cid=CLGR9BJU9 to help tune the memory usage.

@yashvardhan-kukreja
Copy link
Contributor

@realshuting I guess we can close this one as well now

@realshuting
Copy link
Member Author

Closed via #1877.

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

No branches or pull requests

5 participants