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

Introduce join_standard_tags setting #6253

Merged
merged 4 commits into from
Apr 16, 2020

Conversation

xornivore
Copy link
Contributor

What does this PR do?

join_standard_tags enables label joins for standard tags captured from the following labels:

  • tags.datadoghq.com/version
  • tags.datadoghq.com/env
  • tags.datadoghq.com/service

Metrics are being enriched for the following objects: Pod, Deployment, ReplicaSet, DaemonSet, StatefulSet, Job, CronJob.

Motivation

Unified tagging in KSM integration.

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

@xornivore xornivore requested a review from a team April 3, 2020 18:46
@xornivore xornivore requested a review from a team as a code owner April 3, 2020 18:46
`join_standard_tags` enables label joins for standard tags captured from the following labels:
- `tags.datadoghq.com/version`
- `tags.datadoghq.com/env`
- `tags.datadoghq.com/service`

Metrics are being enriched for the following objects: Pod, Deployment, ReplicaSet, DaemonSet, StatefulSet, Job, CronJob.
@xornivore xornivore force-pushed the xornivore/ksm-join-standard-tags branch from 893b95b to d921f76 Compare April 3, 2020 18:47
Comment on lines 376 to 434
{
"kube_pod_labels": {
"labels_to_match": ["pod", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
"kube_deployment_labels": {
"labels_to_match": ["deployment", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
"kube_replicaset_labels": {
"labels_to_match": ["replicaset", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
"kube_daemonset_labels": {
"labels_to_match": ["daemonset", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
"kube_statefulset_labels": {
"labels_to_match": ["statefulset", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
"kube_job_labels": {
"labels_to_match": ["job", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
"kube_cronjob_labels": {
"labels_to_match": ["cronjob", "namespace"],
"labels_to_get": [
"label_tags_datadoghq_com_env",
"label_tags_datadoghq_com_service",
"label_tags_datadoghq_com_version"
]
},
}
)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we declare these as global variables and refactor them a bit? we're duplicating labels_to_get

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point, will refactor, thank you!

@@ -70,7 +70,7 @@ kube_deployment_created{deployment="tiller-deploy",namespace="kube-system"} 1.50
# HELP kube_deployment_labels Kubernetes labels converted to Prometheus labels.
# TYPE kube_deployment_labels gauge
kube_deployment_labels{deployment="failingtest",label_app="failingtest",namespace="default"} 1
kube_deployment_labels{deployment="tiller-deploy",label_app="helm",label_name="tiller",namespace="kube-system"} 1
kube_deployment_labels{deployment="tiller-deploy",label_tags_datadoghq_com_env="dev",label_tags_datadoghq_com_service="tiller",label_tags_datadoghq_com_version="xyz",label_app="helm",label_name="tiller",namespace="kube-system"} 1
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for the tests, could you please cover all the targeted objects in this PR not only deployments and pods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, will add those!

@ofek ofek changed the title [kubernetes_state] Introduce join_standard_tags setting Introduce join_standard_tags setting Apr 6, 2020
ahmed-mez
ahmed-mez previously approved these changes Apr 7, 2020
@xornivore xornivore merged commit 815c59b into master Apr 16, 2020
@xornivore xornivore deleted the xornivore/ksm-join-standard-tags branch April 16, 2020 14:34
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