Skip to content

Commit

Permalink
Added K8s Container Waiting Reason (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhogayatakb authored Jul 30, 2024
1 parent d6caf8b commit 6d8ef62
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions receiver/k8sclusterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ Current status reason of the pod (1 - Evicted, 2 - NodeAffinity, 3 - NodeLost, 4
| k8s.clusterrolebinding.type | The type of the Cluster Role Binding. | Any Str | true |
| k8s.clusterrolebinding.uid | The UID of the Cluster Role Binding. | Any Str | true |
| k8s.container.name | The k8s container name | Any Str | true |
| k8s.container.status.current_waiting_reason | Current waiting reason of the Container. | Any Str | true |
| k8s.container.status.last_terminated_reason | Last terminated reason of a container. | Any Str | true |
| k8s.cronjob.name | The k8s CronJob name | Any Str | true |
| k8s.cronjob.start_time | The start time of the Cronjob. | Any Str | true |
Expand Down
1 change: 0 additions & 1 deletion receiver/k8sclusterreceiver/generated_package_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions receiver/k8sclusterreceiver/internal/container/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func RecordSpecMetrics(logger *zap.Logger, mb *imetadata.MetricsBuilder, c corev
if cs.LastTerminationState.Terminated != nil {
rb.SetK8sContainerStatusLastTerminatedReason(cs.LastTerminationState.Terminated.Reason)
}
if cs.State.Waiting != nil {
rb.SetK8sContainerStatusCurrentWaitingReason(cs.State.Waiting.Reason)
}
break
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ all_set:
enabled: true
k8s.container.name:
enabled: true
k8s.container.status.current_waiting_reason:
enabled: true
k8s.container.status.last_terminated_reason:
enabled: true
k8s.cronjob.name:
Expand Down Expand Up @@ -525,6 +527,8 @@ none_set:
enabled: false
k8s.container.name:
enabled: false
k8s.container.status.current_waiting_reason:
enabled: false
k8s.container.status.last_terminated_reason:
enabled: false
k8s.cronjob.name:
Expand Down Expand Up @@ -831,6 +835,10 @@ filter_set_include:
enabled: true
metrics_include:
- regexp: ".*"
k8s.container.status.current_waiting_reason:
enabled: true
metrics_include:
- regexp: ".*"
k8s.container.status.last_terminated_reason:
enabled: true
metrics_include:
Expand Down Expand Up @@ -1353,6 +1361,10 @@ filter_set_exclude:
enabled: true
metrics_exclude:
- strict: "k8s.container.name-val"
k8s.container.status.current_waiting_reason:
enabled: true
metrics_exclude:
- strict: "k8s.container.status.current_waiting_reason-val"
k8s.container.status.last_terminated_reason:
enabled: true
metrics_exclude:
Expand Down
5 changes: 5 additions & 0 deletions receiver/k8sclusterreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@ resource_attributes:
type: string
enabled: true

k8s.container.status.current_waiting_reason:
description: Current waiting reason of the Container.
type: string
enabled: true

k8s.daemonset.start_time:
description: "The start time of the Daemonset."
enabled: true
Expand Down

0 comments on commit 6d8ef62

Please sign in to comment.