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

Add labels_mapper option to kubernetes_state to allow tag renaming #651

Merged
merged 2 commits into from
Aug 17, 2017

Conversation

xvello
Copy link
Contributor

@xvello xvello commented Aug 2, 2017

What does this PR do?

Allows user to set a labels_mapper option in init_config to rename tags from their original prometheus label name to better values. This is based on the existing mechanism in PrometheusCheck, so changes are minimal.

Motivation

User request to have metrics tagged with kube_namespace instead of namespace for consistency with the kubernetes check.

Versioning

  • [ ] Bumped the version check in manifest.json
  • Updated CHANGELOG.md

@bits-bot
Copy link
Collaborator

bits-bot commented Aug 2, 2017

@xvello, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gmmeyer, @olivielpeau and @truthbk to be potential reviewers.

@xvello xvello force-pushed the xvello/kstate_labels_mapper branch 2 times, most recently from d44952e to 33a0bbc Compare August 2, 2017 16:16
# Tags are reported as set by kube-state-metrics. If you want to translate
# them to other tags, you can use the labels_mapper dictionary
# labels_mapper:
# namespace: kube_namespace
Copy link
Member

Choose a reason for hiding this comment

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

i think the plan for agent 6 is to make init_config optional when it's not needed. And I think the kubernetes_state check only needs one instance, so init_config is unnecessary. If there's no particular reason to keep it here could you move this setting to the instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was planning to do costly processing of the dict on import, but went without at the end. Moving to instance

@@ -1,4 +1,10 @@
init_config:
# Tags are reported as set by kube-state-metrics. If you want to translate
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@xvello xvello force-pushed the xvello/kstate_labels_mapper branch from 11a5d68 to 4d7d97b Compare August 10, 2017 15:39
xvello added a commit to DataDog/docker-dd-agent that referenced this pull request Aug 10, 2017
@xvello xvello force-pushed the xvello/kstate_labels_mapper branch from 4d7d97b to 1911403 Compare August 10, 2017 16:14
@xvello xvello added this to the 5.17 milestone Aug 17, 2017
hkaj
hkaj previously approved these changes Aug 17, 2017
@xvello
Copy link
Contributor Author

xvello commented Aug 17, 2017

Rebase dismissed approval, checks green, force merging

@xvello xvello merged commit 48063de into master Aug 17, 2017
@xvello xvello deleted the xvello/kstate_labels_mapper branch August 17, 2017 11:12
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.

3 participants