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

[kubernetes_state] refactor gauge submission, fix container.restarts #3297

Merged
merged 1 commit into from
Apr 5, 2017

Conversation

hkaj
Copy link
Member

@hkaj hkaj commented Apr 4, 2017

Note: Please remember to review the Datadog Contribution Guidelines
if you have not yet done so.

What does this PR do?

  • removes some of the duplicated code for gauges
  • fixes the container.restarts metric type
  • introduces a type check for prometheus metrics

Motivation

container.restarts is always 0 because we use the gauge value instead of counter value.

Testing Guidelines

See DataDog/integrations-core#317

@hkaj hkaj added this to the 5.12.4 milestone Apr 4, 2017
@xvello xvello self-assigned this Apr 4, 2017
@hkaj hkaj force-pushed the haissam/fix-k8s-state-container-restarts branch from 3dd3590 to b9869c9 Compare April 4, 2017 14:18
@hkaj hkaj requested a review from xvello April 4, 2017 14:20
@hkaj hkaj force-pushed the haissam/fix-k8s-state-container-restarts branch from b9869c9 to 5c0096e Compare April 5, 2017 04:53
Copy link
Contributor

@xvello xvello left a comment

Choose a reason for hiding this comment

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

Also, need to check with Quentin why the CI sometimes fails on kazoo.client install

"""
try:
getattr(self, message.name)(message, **kwargs)
if message.name in self.metric_to_gauge:
self._submit_gauges(self.metric_to_gauge[message.name], message)
Copy link
Contributor

Choose a reason for hiding this comment

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

We loose the label argument if passed to process(). Should we keep it in _submit_gauges or just remove the corresponding code branch?

Copy link
Member Author

Choose a reason for hiding this comment

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

i feel like it could be useful someday, but yeah let's kill it for now since it's not used.

'kube_deployment_status_replicas_unavailable': NAMESPACE + '.deployment.replicas_unavailable',
'kube_deployment_status_replicas_updated': NAMESPACE + '.deployment.replicas_updated',
'kube_deployment_spec_replicas': NAMESPACE + '.deployment.replicas_desired',
'kube_pod_container_resource_requests_cpu_cores': NAMESPACE + '.container.cpu_requested',
Copy link
Contributor

Choose a reason for hiding this comment

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

The CI check fail on .container.cpu_requested, looks like the valid k8s metric name is : kube_pod_container_requested_cpu_cores

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I think what makes the CI fail is that we need to merge the protobuf.bin fixture, otherwise the metric doesn't exist. Tests pass locally when I copy the files.

@hkaj hkaj force-pushed the haissam/fix-k8s-state-container-restarts branch from 5c0096e to 7e6d507 Compare April 5, 2017 19:09
@hkaj hkaj merged commit 1d354da into master Apr 5, 2017
@hkaj hkaj deleted the haissam/fix-k8s-state-container-restarts branch April 5, 2017 19:16
@masci masci modified the milestones: 5.13.0, 5.12.4 Apr 11, 2017
@xvello xvello modified the milestones: 5.12.4, 5.13.0 Apr 12, 2017
@masci masci modified the milestones: 5.12.4, 5.13.0 Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants