integrations-core icon indicating copy to clipboard operation
integrations-core copied to clipboard

Set kubernetes.cpu metrics as gauge typed

Open JacksonDavenport opened this issue 3 years ago • 0 comments

What does this PR do?

No functional change here. While the Datadog Agent uses the self.rate(...) function to submit these:

  • https://github.com/DataDog/integrations-core/blob/0284eaf179a8f780920d23e8b6a02fd95afc1388/kubelet/datadog_checks/kubelet/prometheus.py#L276-L320

These are actually going to be submitted as a GAUGE typed metric

  • The rate typed metric is a rate of occurrence
  • while self.rate Agent function is measuring is a rate of change submitted as a gauge typed metric

The Agent should also be sending up the metadata when it is sending these metrics up, so in app these metrics are already shown as gauge typed. This change is really just to update the docs where these 5 metrics are shown as (rate).

https://docs.datadoghq.com/containers/kubernetes/data_collected/#kubelet

Metric Description
kubernetes.cpu.system.total(rate) The number of cores used for system timeShown as core
kubernetes.cpu.user.total(rate) The number of cores used for user timeShown as core
kubernetes.cpu.cfs.periods(rate) Number of elapsed enforcement period intervals
kubernetes.cpu.cfs.throttled.periods(rate) Number of throttled period intervals
kubernetes.cpu.cfs.throttled.seconds(rate) Total time duration the container has been throttled

The underlying metrics we are hitting here are of the prometheus # TYPE ... COUNTER, so it makes sense to use the self.rate(...) to calculate the diff. That being said these are still measured and submitted as gauge so docs should reflect that.

Motivation

https://datadoghq.atlassian.net/browse/CONS-4953

Additional Notes

Review checklist (to be filled by reviewers)

  • [ ] Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • [ ] PR title must be written as a CHANGELOG entry (see why)
  • [ ] Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • [ ] PR must have changelog/ and integration/ labels attached

JacksonDavenport avatar Aug 09 '22 19:08 JacksonDavenport