Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jinja2 committed Dec 18, 2024
1 parent 4c3da15 commit 5582d26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .chloggen/add_k8scluster_attr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ change_type: enhancement
component: k8sclusterreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add additional attributes to node/pod entities
note: Add additional attributes to node and pod entities

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35879]
Expand Down
7 changes: 4 additions & 3 deletions receiver/k8sclusterreceiver/internal/node/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
)

const (
// Keys for node metadata.
nodeCreationTime = "node.creation_timestamp"
// Keys for node metadata and entity attributes. These are NOT used by resource attributes.
nodeCreationTime = "node.creation_timestamp"
k8sNodeConditionPrefix = "k8s.node.condition"
)

// Transform transforms the node to remove the fields that we don't use to reduce RAM utilization.
Expand Down Expand Up @@ -165,7 +166,7 @@ func GetMetadata(node *corev1.Node) map[experimentalmetricmetadata.ResourceID]*m

for _, c := range node.Status.Conditions {
if _, ok := kubeletConditions[c.Type]; ok {
meta[fmt.Sprintf("k8s.node.condition_%s", strcase.ToSnake(string(c.Type)))] = strings.ToLower(string(c.Status))
meta[fmt.Sprintf("%s_%s", k8sNodeConditionPrefix, strcase.ToSnake(string(c.Type)))] = strings.ToLower(string(c.Status))
}
}

Expand Down
2 changes: 1 addition & 1 deletion receiver/k8sclusterreceiver/internal/pod/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

const (
// Keys for pod metadata.
// Keys for pod metadata and entity attributes. These are NOT used by resource attributes.
podCreationTime = "pod.creation_timestamp"
podPhase = "k8s.pod.phase"
podStatusReason = "k8s.pod.status_reason"
Expand Down

0 comments on commit 5582d26

Please sign in to comment.