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

Introducing Deployment condition status metric in Kubernetes module #35999

Merged
merged 14 commits into from
Jul 6, 2023
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]


*Metricbeat*
- Introducing Deployment condition status metric in Kubernetes module {pull}35999[35999]
Copy link
Member

Choose a reason for hiding this comment

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

This is not a breaking change. Hence it should go in ==== Added section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed



*Osquerybeat*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
"MetricSetFields": {
"name": "coredns",
"paused": false,
"status": {
ChrsMark marked this conversation as resolved.
Show resolved Hide resolved
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 2,
"desired": 2,
Expand All @@ -77,4 +81,4 @@
"Period": 0,
"DisableTimeSeries": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
"MetricSetFields": {
"name": "coredns",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 2,
"desired": 2,
Expand All @@ -77,4 +81,4 @@
"Period": 0,
"DisableTimeSeries": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
"MetricSetFields": {
"name": "coredns",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blew my brain :) Fixed thanks @ChrsMark

"replicas": {
"available": 2,
"desired": 2,
Expand All @@ -77,4 +81,4 @@
"Period": 0,
"DisableTimeSeries": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
"MetricSetFields": {
"name": "coredns",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 2,
"desired": 2,
Expand All @@ -77,4 +81,4 @@
"Period": 0,
"DisableTimeSeries": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"deployment": {
"name": "local-path-provisioner",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 1,
"desired": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"deployment": {
"name": "coredns",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 2,
"desired": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"deployment": {
"name": "coredns",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 2,
"desired": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"deployment": {
"name": "local-path-provisioner",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 1,
"desired": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"deployment": {
"name": "coredns",
"paused": false,
"status": {
"available": "true",
"progressing": "true"
},
"replicas": {
"available": 2,
"desired": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,23 @@ var mapping = &p.MetricsMapping{
"kube_deployment_status_replicas_unavailable": p.Metric("replicas.unavailable"),
"kube_deployment_status_replicas_available": p.Metric("replicas.available"),
"kube_deployment_spec_replicas": p.Metric("replicas.desired"),
"kube_deployment_spec_paused": p.BooleanMetric("paused"),
/*
This is how deployment_status_condition field will be exported:

kube_deployment_status_condition{namespace="default",deployment="test-deployment",condition="Available",status="true"} 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be enough to add it in corresponding plain file - https://github.com/elastic/beats/blob/ac1d127d6868caff2f1bbbc670bbfff7f88930fc/metricbeat/module/kubernetes/_meta/test/ksm.v2.4.2.plain, instead of this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is already there see line 222

It is more alligned to this comment:

// These fields will be set to "true", "false", or "unknown" based on input that looks
// like this:
//
// kube_job_complete{namespace="default",job_name="timer-27074308",condition="true"} 1
// kube_job_complete{namespace="default",job_name="timer-27074308",condition="false"} 0
// kube_job_complete{namespace="default",job_name="timer-27074308",condition="unknown"} 0

I found it helpful when first looked the code, because you can not understand how the p.LabelMatric works from first glance.

Let me know if you think is obsolete and I can remove it

kube_deployment_status_condition{namespace="default",deployment="test-deployment",condition="Available",status="false"} 1
kube_deployment_status_condition{namespace="default",deployment="test-deployment",condition="Available",status="unknown"} 0
kube_deployment_status_condition{namespace="default",deployment="test-deployment",condition="Progressing",status="true"} 1
kube_deployment_status_condition{namespace="default",deployment="test-deployment",condition="Progressing",status="false"} 0
kube_deployment_status_condition{namespace="default",deployment="test-deployment",condition="Progressing",status="unknown"} 0
*/
"kube_deployment_status_condition": p.LabelMetric("status", "status", p.OpFilterMap(
"condition", map[string]string{
"Progressing": "progressing",
"Available": "available",
},
)), //The current status conditions of a deployment
"kube_deployment_spec_paused": p.BooleanMetric("paused"),
},

Labels: map[string]p.LabelMap{
Expand Down