Skip to content

Fix for influxdb container labels and network stats #2184

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

Closed
wants to merge 9 commits into from

Conversation

ddtmachado
Copy link

This fixes the lack of labels when using the influxdb storage.

The driver was referencing an attribute from ContainerInfo that was not initialized, resulting in no container labels being stored even when the user set the flags for exporting labels on metrics:
store_container_labels / whitelisted_container_labels. Complements #2113

In addition to that I added a new flag storage_driver_influxdb_whitelisted_labels only for influxdb, so it is controlled separately but on the same format of #1984

Also Network.Interfaces was not being used so it only returned stats for the first network interface inside the container (the old behavior). I changed that to collect stats for each network interface adding a tag/label to the metric with the interface name. Fixes #1737

What do you think of this approach?

Let me know if I missed something

@k8s-ci-robot
Copy link
Collaborator

Hi @ddtmachado. Thanks for your PR.

I'm waiting for a google or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dashpole
Copy link
Collaborator

can we just re-use the whitelisted_container_labels flag?

@dashpole
Copy link
Collaborator

/ok-to-test

Copy link
Collaborator

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

looks mostly good

@@ -299,14 +319,26 @@ func newStorage(
return nil, err
}

//Reuse cadvisor flag for whitelisted container labels
var argWhitelistedLabels = flag.Lookup("whitelisted_container_labels").Value.(flag.Getter).Get().(string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would rather explicitly plumb this through, and do all of the flag parsing when cAdvisor starts if possible.

Copy link
Author

Choose a reason for hiding this comment

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

It can be done, but I'm not so familiar with the patterns and preferences here yet.

Are you suggesting to pass it down on the storage constructor or maybe add it to the StorageDriver.AddStats interface?

I was trying to avoid modifying anything on other storage drivers as I have no context on then but it makes sense that they also respect the labels when storing if possible.

@k8s-ci-robot
Copy link
Collaborator

@ddtmachado: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-cadvisor-e2e 3a902f3 link /test pull-cadvisor-e2e

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@dashpole dashpole self-assigned this Jun 21, 2019
@dashpole dashpole closed this Sep 11, 2020
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.

InfluxDB Storage driver sends network stats of only the first interface found
3 participants