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

Improves Docker Labels handling and output #3024

Merged
merged 3 commits into from
Nov 18, 2016
Merged

Conversation

rikatz
Copy link
Contributor

@rikatz rikatz commented Nov 17, 2016

This PR improves Docker Label handling, by not turning it as an array of JSONs, but instead a set of different fields on a map string.

This is useful specially if you're building dashboards with Kibana and wants to filter based on container labels.

This is one of the items of issue #2629

Hope it helps 😄

@elasticsearch-release
Copy link

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

1 similar comment
@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

@rikatz
Copy link
Contributor Author

rikatz commented Nov 17, 2016

Signed the CLA

@karmi
Copy link

karmi commented Nov 17, 2016

Hi @rikatz, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile?

@rikatz rikatz changed the title Improves Docker Labels handling Improves Docker Labels handling and output Nov 17, 2016
@rikatz
Copy link
Contributor Author

rikatz commented Nov 17, 2016

@karmi Ops, my bad! Added my email to my profile. Do I need to change anything else?

Thanks!

@ruflin
Copy link
Member

ruflin commented Nov 17, 2016

jenkins, test it

@ruflin
Copy link
Member

ruflin commented Nov 17, 2016

@rikatz LGTM. Thanks for the contribution.

@@ -52,24 +51,15 @@ func ExtractContainerName(names []string) string {
return strings.Trim(output, "/")
}

func BuildLabelArray(labels map[string]string) []common.MapStr {
func BuildLabelArray(labels map[string]string) common.MapStr {
Copy link
Member

@andrewkroh andrewkroh Nov 17, 2016

Choose a reason for hiding this comment

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

I think the name of this function should change now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrew-moldovan suggestions? SetLabelsFields or BuildLabelsFields is better? Tks

Copy link

@andrew-moldovan andrew-moldovan Nov 17, 2016

Choose a reason for hiding this comment

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

@rikatz I think you meant @andrewkroh :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sorry!

Copy link
Member

@andrewkroh andrewkroh Nov 17, 2016

Choose a reason for hiding this comment

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

Looking at the what the function does, it seems to de-dot the label names. So how about DeDotLabels() or DeDotKeys? I would prefer that all exported functions have godoc accompanying them. So how about adding (assuming that's the name you go with):

// DeDotLabels returns a new common.MapStr containing a copy of the labels
// where the dots in each label name have been changed to an underscore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK! Just did a commit right now with the name ConvertContainerLabels, will rename them again to DeDotLabels (as they are directly related to Labels), and also add the comments!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrewkroh Did as suggested. Now let's wait the CI tasks complete 😄

Hope this can help!

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

Successfully merging this pull request may close these issues.

7 participants