Skip to content

[k8s] add k8s.hpa.scaletargetref #2180

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jinja2
Copy link
Contributor

@jinja2 jinja2 commented Apr 25, 2025

Fixes #2008

Changes

Please provide a brief description of the changes here.

Intorduces new attributes for the k8s.hpa resource to capture the scaleTargetRef fields.

Merge requirement checklist

@github-actions github-actions bot added enhancement New feature or request area:k8s labels Apr 25, 2025
@jinja2 jinja2 marked this pull request as ready for review April 25, 2025 04:21
@jinja2 jinja2 requested review from a team as code owners April 25, 2025 04:21
@@ -205,6 +205,30 @@ groups:
brief: >
The name of the horizontal pod autoscaler.
examples: ['opentelemetry']
- id: k8s.hpa.scaletarget.kind
Copy link
Member

Choose a reason for hiding this comment

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

what's the reason for scaletarget instead of scale_target? thanks

Copy link
Member

Choose a reason for hiding this comment

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

Since scaletarget is just a field and not a K8s resource that we'd use with kubectl get <resource> I guess it can also be scale_target.

Is there any documented guidance that would help us from similar discussions in the future? If so, we should also ensure that the K8s resource exception is also covered there.

Copy link
Member

Choose a reason for hiding this comment

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

is this what you're looking for? https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/naming.md

For each multi-word dot-delimited component of the name separate the words by underscores (i.e. use snake_case)

Copy link
Member

Choose a reason for hiding this comment

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

I believe we chose the one word form for consistency with other k8s naming patterns like daemonset statefulset which essentially result of k8s being written in Go.

Copy link
Member

Choose a reason for hiding this comment

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

@open-telemetry/semconv-k8s-approvers it would be great to document / agree on this: #2245

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a PR 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.

Should I update this to keep the attr name same as the full field name (k8s.hpa.scaletargetref.*) ? I dropped the Ref bit from the field name scaleTargetRef but think i should keep it consistent with k8s field

@lmolkova lmolkova moved this from Untriaged to Needs More Approval in Semantic Conventions Triage Apr 27, 2025
@jinja2 jinja2 changed the title [k8s] add k8s.hpa.scaletarget [k8s] add k8s.hpa.scaletargetref May 12, 2025
atoulme pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request May 14, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds new resource attributes to `k8s.hpa`. These attributes track the
target resource a given HPA is configured to scale. The attributes are -
`k8s.hpa.scaletargetref.kind`, `k8s.hpa.scaletargetref.name`, and
`k8s.hpa.scaletargetref.apiversion`. These attributes are disabled by
default.

PR for semantic-conventions is available
[here](open-telemetry/semantic-conventions#2180).

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes #38768

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests
Tested manually in a k8s cluster

<!--Describe the documentation added.-->
#### Documentation
Documentation updated with new attribute names

<!--Please delete paragraphs that you did not use before submitting.-->
seongpil0948 pushed a commit to seongpil0948/opentelemetry-collector-contrib that referenced this pull request May 16, 2025
)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds new resource attributes to `k8s.hpa`. These attributes track the
target resource a given HPA is configured to scale. The attributes are -
`k8s.hpa.scaletargetref.kind`, `k8s.hpa.scaletargetref.name`, and
`k8s.hpa.scaletargetref.apiversion`. These attributes are disabled by
default.

PR for semantic-conventions is available
[here](open-telemetry/semantic-conventions#2180).

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#38768

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests
Tested manually in a k8s cluster

<!--Describe the documentation added.-->
#### Documentation
Documentation updated with new attribute names

<!--Please delete paragraphs that you did not use before submitting.-->
johnleslie pushed a commit to johnleslie/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds new resource attributes to `k8s.hpa`. These attributes track the
target resource a given HPA is configured to scale. The attributes are -
`k8s.hpa.scaletargetref.kind`, `k8s.hpa.scaletargetref.name`, and
`k8s.hpa.scaletargetref.apiversion`. These attributes are disabled by
default.

PR for semantic-conventions is available
[here](open-telemetry/semantic-conventions#2180).

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#38768

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests
Tested manually in a k8s cluster

<!--Describe the documentation added.-->
#### Documentation
Documentation updated with new attribute names

<!--Please delete paragraphs that you did not use before submitting.-->
johnleslie pushed a commit to johnleslie/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds new resource attributes to `k8s.hpa`. These attributes track the
target resource a given HPA is configured to scale. The attributes are -
`k8s.hpa.scaletargetref.kind`, `k8s.hpa.scaletargetref.name`, and
`k8s.hpa.scaletargetref.apiversion`. These attributes are disabled by
default.

PR for semantic-conventions is available
[here](open-telemetry/semantic-conventions#2180).

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#38768

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests
Tested manually in a k8s cluster

<!--Describe the documentation added.-->
#### Documentation
Documentation updated with new attribute names

<!--Please delete paragraphs that you did not use before submitting.-->
dragonlord93 pushed a commit to dragonlord93/opentelemetry-collector-contrib that referenced this pull request May 23, 2025
)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds new resource attributes to `k8s.hpa`. These attributes track the
target resource a given HPA is configured to scale. The attributes are -
`k8s.hpa.scaletargetref.kind`, `k8s.hpa.scaletargetref.name`, and
`k8s.hpa.scaletargetref.apiversion`. These attributes are disabled by
default.

PR for semantic-conventions is available
[here](open-telemetry/semantic-conventions#2180).

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#38768

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests
Tested manually in a k8s cluster

<!--Describe the documentation added.-->
#### Documentation
Documentation updated with new attribute names

<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:k8s enhancement New feature or request
Projects
Status: No status
Status: Needs More Approval
Development

Successfully merging this pull request may close these issues.

[k8s/hpa] Add scaletargetref resource attributes to hpa metrics resource attributes
4 participants