Skip to content

Commit

Permalink
ENG-836: k8s.node.start_time added in all node metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
bhogayatakb committed Dec 14, 2023
1 parent b1f3254 commit d854006
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 9 deletions.
1 change: 1 addition & 0 deletions receiver/k8sclusterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ Current status reason of the pod (1 - Evicted, 2 - NodeAffinity, 3 - NodeLost, 4
| k8s.namespace.name | The k8s namespace name. | Any Str | true |
| k8s.namespace.uid | The k8s namespace uid. | Any Str | true |
| k8s.node.name | The k8s node name. | Any Str | true |
| k8s.node.start_time | The start time of the Node. | Any Str | true |
| k8s.node.uid | The k8s node uid. | Any Str | true |
| k8s.pod.name | The k8s pod name. | Any Str | true |
| k8s.pod.uid | The k8s pod uid. | Any Str | true |
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.

Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ all_set:
enabled: true
k8s.node.name:
enabled: true
k8s.node.start_time:
enabled: true
k8s.node.uid:
enabled: true
k8s.pod.name:
Expand Down Expand Up @@ -293,6 +295,8 @@ none_set:
enabled: false
k8s.node.name:
enabled: false
k8s.node.start_time:
enabled: false
k8s.node.uid:
enabled: false
k8s.pod.name:
Expand Down
1 change: 1 addition & 0 deletions receiver/k8sclusterreceiver/internal/node/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func CustomMetrics(set receiver.CreateSettings, rb *metadata.ResourceBuilder, no

rb.SetK8sNodeUID(string(node.UID))
rb.SetK8sNodeName(node.Name)
rb.SetK8sNodeStartTime(node.GetCreationTimestamp().String())
rb.SetOpencensusResourcetype("k8s")
rb.Emit().MoveTo(rm.Resource())
return rm
Expand Down
5 changes: 5 additions & 0 deletions receiver/k8sclusterreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ resource_attributes:
type: string
enabled: true

k8s.node.start_time:
description: "The start time of the Node."
enabled: true
type: string

container.id:
description: The container id.
type: string
Expand Down
3 changes: 2 additions & 1 deletion receiver/kubeletstatsreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ The time since the pod started
| k8s.container.name | Container name used by container runtime | Any Str | true |
| k8s.namespace.name | The name of the namespace that the pod is running in | Any Str | true |
| k8s.node.name | The name of the Node | Any Str | true |
| k8s.node.uid | The UID of the Node | Any Str | false |
| k8s.node.start_time | The start time of the Node. | Any Str | true |
| k8s.node.uid | The UID of the Node | Any Str | true |
| k8s.persistentvolumeclaim.name | The name of the Persistent Volume Claim | Any Str | true |
| k8s.pod.name | The name of the Pod | Any Str | true |
| k8s.pod.uid | The UID of the Pod | Any Str | true |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (a *metricDataAccumulator) nodeStats(s stats.NodeStats) {
// todo s.Runtime.ImageFs
rb := a.mbs.NodeMetricsBuilder.NewResourceBuilder()
rb.SetK8sNodeName(s.NodeName)
rb.SetK8sNodeName(s.NodeName)
rb.SetK8sNodeUID(a.getNodeUID(s.NodeName))
rb.SetK8sNodeStartTime(s.StartTime.Time.String())
a.m = append(a.m, a.mbs.NodeMetricsBuilder.Emit(
metadata.WithStartTimeOverride(pcommon.NewTimestampFromTime(s.StartTime.Time)),
metadata.WithResource(rb.Emit()),
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.

Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ all_set:
enabled: true
k8s.node.name:
enabled: true
k8s.node.start_time:
enabled: true
k8s.node.uid:
enabled: true
k8s.persistentvolumeclaim.name:
Expand Down Expand Up @@ -185,7 +187,7 @@ none_set:
k8s.node.uptime:
enabled: false
k8s.pod.cpu.time:
enabled: true
enabled: false
k8s.pod.cpu.utilization:
enabled: false
k8s.pod.filesystem.available:
Expand Down Expand Up @@ -243,6 +245,8 @@ none_set:
enabled: false
k8s.node.name:
enabled: false
k8s.node.start_time:
enabled: false
k8s.node.uid:
enabled: false
k8s.persistentvolumeclaim.name:
Expand Down
4 changes: 4 additions & 0 deletions receiver/kubeletstatsreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ resource_attributes:
description: "The name of the Node"
enabled: true
type: string
k8s.node.start_time:
description: "The start time of the Node."
enabled: true
type: string
k8s.pod.uid:
description: "The UID of the Pod"
enabled: true
Expand Down

0 comments on commit d854006

Please sign in to comment.