Skip to content

Commit

Permalink
[receiver/k8scluster] add os.type to node resource attributes (open-t…
Browse files Browse the repository at this point in the history
  • Loading branch information
povilasv authored Jan 18, 2024
1 parent bcc7163 commit 974aa42
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .chloggen/k8scluster_add-resource-attributes.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 new disabled os.version, os.description, k8s.container_runtime.version resource attributes"
note: "add new disabled os.description, k8s.container_runtime.version resource attributes"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30342]
Expand Down
27 changes: 27 additions & 0 deletions .chloggen/k8scluster_fix-resource-attributes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: k8sclusterreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "add os.type resource attribute"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30342]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
2 changes: 1 addition & 1 deletion receiver/k8sclusterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,4 +458,4 @@ Current status reason of the pod (1 - Evicted, 2 - NodeAffinity, 3 - NodeLost, 4
| openshift.clusterquota.name | The k8s ClusterResourceQuota name. | Any Str | true |
| openshift.clusterquota.uid | The k8s ClusterResourceQuota uid. | Any Str | true |
| os.description | The os description used by Kubernetes Node. | Any Str | false |
| os.version | The version of operating system used by Kubernetes Node. | Any Str | false |
| os.type | The os type used by Kubernetes Node. | Any Str | false |

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 @@ -162,7 +162,7 @@ all_set:
enabled: true
os.description:
enabled: true
os.version:
os.type:
enabled: true
none_set:
metrics:
Expand Down Expand Up @@ -327,5 +327,5 @@ none_set:
enabled: false
os.description:
enabled: false
os.version:
os.type:
enabled: false
4 changes: 2 additions & 2 deletions receiver/k8sclusterreceiver/internal/node/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func Transform(node *corev1.Node) *corev1.Node {
NodeInfo: corev1.NodeSystemInfo{
KubeletVersion: node.Status.NodeInfo.KubeletVersion,
KubeProxyVersion: node.Status.NodeInfo.KubeProxyVersion,
KernelVersion: node.Status.NodeInfo.KernelVersion,
ContainerRuntimeVersion: node.Status.NodeInfo.ContainerRuntimeVersion,
OSImage: node.Status.NodeInfo.OSImage,
OperatingSystem: node.Status.NodeInfo.OperatingSystem,
},
},
}
Expand Down Expand Up @@ -115,7 +115,7 @@ func CustomMetrics(set receiver.CreateSettings, rb *metadata.ResourceBuilder, no
rb.SetK8sNodeName(node.Name)
rb.SetK8sKubeletVersion(node.Status.NodeInfo.KubeletVersion)
rb.SetK8sKubeproxyVersion(node.Status.NodeInfo.KubeProxyVersion)
rb.SetOsVersion(node.Status.NodeInfo.KernelVersion)
rb.SetOsType(node.Status.NodeInfo.OperatingSystem)

runtime, version := getContainerRuntimeInfo(node.Status.NodeInfo.ContainerRuntimeVersion)
if runtime != "" {
Expand Down
4 changes: 2 additions & 2 deletions receiver/k8sclusterreceiver/internal/node/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestNodeOptionalMetrics(t *testing.T) {
rac.K8sKubeproxyVersion.Enabled = true
rac.ContainerRuntime.Enabled = true
rac.ContainerRuntimeVersion.Enabled = true
rac.OsVersion.Enabled = true
rac.OsType.Enabled = true
rac.OsDescription.Enabled = true

rb := metadata.NewResourceBuilder(rac)
Expand Down Expand Up @@ -256,9 +256,9 @@ func TestTransform(t *testing.T) {
NodeInfo: corev1.NodeSystemInfo{
KubeletVersion: "v1.25.3",
KubeProxyVersion: "v1.25.3",
KernelVersion: "6.4.12-arch1-1",
OSImage: "Ubuntu 22.04.1 LTS",
ContainerRuntimeVersion: "containerd://1.6.9",
OperatingSystem: "linux",
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ resourceMetrics:
- key: os.description
value:
stringValue: Ubuntu 22.04.1 LTS
- key: os.version
- key: os.type
value:
stringValue: "6.4.12-arch1-1"
stringValue: "linux"

schemaUrl: https://opentelemetry.io/schemas/1.18.0
scopeMetrics:
Expand Down
2 changes: 1 addition & 1 deletion receiver/k8sclusterreceiver/internal/testutils/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ func NewNode(id string) *corev1.Node {
NodeInfo: corev1.NodeSystemInfo{
KubeletVersion: "v1.25.3",
KubeProxyVersion: "v1.25.3",
KernelVersion: "6.4.12-arch1-1",
OSImage: "Ubuntu 22.04.1 LTS",
ContainerRuntimeVersion: "containerd://1.6.9",
OperatingSystem: "linux",
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions receiver/k8sclusterreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ resource_attributes:
type: string
enabled: false

os.version:
description: The version of operating system used by Kubernetes Node.
os.description:
description: The os description used by Kubernetes Node.
type: string
enabled: false

os.description:
description: The os description used by Kubernetes Node.
os.type:
description: The os type used by Kubernetes Node.
type: string
enabled: false

Expand Down

0 comments on commit 974aa42

Please sign in to comment.