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

Update controllermanager metrics #32037

Merged

Conversation

MichaelKatsoulis
Copy link
Contributor

@MichaelKatsoulis MichaelKatsoulis commented Jun 22, 2022

What does this PR do?

This PR updates the metrics that Kubernetes controllermamager metricset collects.
Also the OOTB dashboard is updated.

Why is it important?

controllermamager metricset currently collects metrics from kubernetes controllermanager prometheus endpoint that have been deprecated in latest versions of kubernetes. Currently we support k8s versions starting from 1.21.x.
As a result values from those fields are always nil and some of the dashboard visualisations show no values.

Those deprecated prometheus fields are

http_request_duration_microseconds
http_request_size_bytes          
http_response_size_bytes                
http_requests_total 

http_request_duration_microseconds can instead be collected from rest_client_request_duration_seconds
For the rest of them, there are no more, related metrics.

Also metrics like
process_max_fds, workqueue_work_duration_seconds are interesting and were added.

As part of this PR the following elasticsearch fields where dropped (their values were always nil in k8s versions we support)

  • kubernetes.controllermanager.http.request.duration.us.percentile.*
  • kubernetes.controllermanager.http.request.duration.us.sum
  • kubernetes.controllermanager.http.request.duration.us.count
  • kubernetes.controllermanager.http.request.size.bytes.percentile.*
  • kubernetes.controllermanager.http.request.size.bytes.sum
  • kubernetes.controllermanager.http.request.size.bytes.count
  • kubernetes.controllermanager.http.responsesize.bytes.percentile.*
  • kubernetes.controllermanager.http.response.size.bytes.sum
  • kubernetes.controllermanager.http.response.size.bytes.count
  • kubernetes.controllermanager.http.request.count
  • kubernetes.controllermanager.handler

and the following fields added:

  • kubernetes.controllermanager.url
  • kubernetes.controllermanager.verb
  • kubernetes.controllermanager.fds.max.count
  • kubernetes.controllermanager.client.request.duration.sec.sum
  • kubernetes.controllermanager.client.request.duration.sec.count
  • kubernetes.controllermanager.client.request.duration.sec.bucket.*
  • kubernetes.controllermanager.workqueue.work.duration.sec.sum
  • kubernetes.controllermanager.workqueue.work.duration.sec.count
  • kubernetes.controllermanager.workqueue.work.duration.sec.bucket.*

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Deploy Metricbeat from this PR branch with controllermanager metricset enabled.

- module: kubernetes
   metricsets:
       - controllermanager
   hosts: ["https://0.0.0.0:10257"]
   bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
   ssl.verification_mode: "none"
   period: 10s

Prefer Kind or Minikube in order for metricbeat to have access to controllermanager endpoint.
Check for the new fields and setup the new dashboards
./metricbeat setup --dashboards -E setup.dashboards.directory=./module/kubernetes/_meta/kibana/ -E setup.kibana.host=http://elastic:changeme@localhost:5601 -E ssl.verification_mode=none -e -d "*"

Related issues

Use cases

Screenshots

New dashboard

controller1

controller2

controller3

Logs

@MichaelKatsoulis MichaelKatsoulis added the Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team label Jun 22, 2022
@MichaelKatsoulis MichaelKatsoulis requested a review from a team June 22, 2022 10:19
@MichaelKatsoulis MichaelKatsoulis requested a review from a team as a code owner June 22, 2022 10:19
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jun 22, 2022
@MichaelKatsoulis MichaelKatsoulis marked this pull request as draft June 22, 2022 10:20
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 22, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-06-28T07:11:16.554+0000

  • Duration: 60 min 49 sec

Test stats 🧪

Test Results
Failed 0
Passed 3532
Skipped 873
Total 4405

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@MichaelKatsoulis MichaelKatsoulis marked this pull request as ready for review June 24, 2022 07:55
Copy link
Contributor

@gizas gizas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if you have the official link with the list of updated metrics that new kubernetes controlmanager supports add it to the description

chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* Update controllermanager metrics
* Update dashboard for controllermanager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update kubernetes controller manager metrics and dashboard
4 participants