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

[receiver/k8scluster] Add Node resource attributes #26351

Merged

Conversation

povilasv
Copy link
Contributor

@povilasv povilasv commented Aug 31, 2023

Description:

Add optional k8s.kubelet.version, k8s.kubeproxy.version node resource attributes

Doing some actual testing with kind with k8s_cluster receiver and prometheus exporters.

     k8s_cluster:                                                    
        node_conditions_to_report: [Ready, MemoryPressure]            
        allocatable_types_to_report: [cpu, memory]                    
        resource_attributes:                                                                      
          k8s.kubelet.version:
            enabled: true 
          k8s.kubeproxy.version:                                      
            enabled: true   

and prometheus exporter:

   prometheus:
        resource_to_telemetry_conversion:
          enabled: true
        endpoint: 0.0.0.0:9090

Example metric:

k8s_node_allocatable_cpu{k8s_kubelet_version="v1.25.3",k8s_kubeproxy_version="v1.25.3",k8s_node_name="kind-control-plane",k8s_node_uid="09b55a47-87cb-4790-8834-2341d683999d",opencensus_resourcetype="k8s"} 8

Link to tracking Issue:
#24835

Testing:

  • added unit tests
  • manua ltest with kind

Documentation:

  • generated

@povilasv povilasv force-pushed the k8sclusterreceiver-node-info branch 4 times, most recently from 522a66f to 34cb775 Compare September 1, 2023 12:49
@povilasv povilasv marked this pull request as ready for review September 1, 2023 13:24
@povilasv povilasv requested a review from a team September 1, 2023 13:24
Comment on lines +155 to +164
k8s.kubelet.version:
description: The version of Kubelet running on the node.
type: string
enabled: false

k8s.kubeproxy.version:
description: The version of Kube Proxy running on the node.
type: string
enabled: false

Copy link
Member

Choose a reason for hiding this comment

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

Will these be added to all metrics or only node metrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only node metrics, I think it's same as other resource attributes are added only to the relevant metrics.

Example:

resource_attributes:
  k8s.hpa.name:
    description: The k8s hpa name.
    type: string
    enabled: true
  k8s.job.name:
    description: The k8s pod name.
    type: string
    enabled: true

@@ -1,6 +1,5 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

Copy link
Member

Choose a reason for hiding this comment

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

Nit: unrelated removal. We usually keep a space here

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. Thanks for review!

@TylerHelmuth TylerHelmuth merged commit b02d19c into open-telemetry:main Sep 11, 2023
90 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 11, 2023
@povilasv povilasv deleted the k8sclusterreceiver-node-info branch September 12, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants