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

[processor/k8sattributes]: apply attribute value from retrieved k8s object if original value is empty #36466

Merged

Conversation

bacherfl
Copy link
Contributor

Description

This PR extends the previous check whether an attribute value has not been present with a check for an empty value in the original resource attributes. This way, attributes, such as k8s.namespace.name will be set based on the retrieved kubernetes resource also if the original value has been set to e.g. an empty string

Link to tracking issue

Fixes #36373

Testing

Added unit tests

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@bacherfl bacherfl marked this pull request as ready for review December 6, 2024 06:09
@bacherfl bacherfl requested a review from a team as a code owner December 6, 2024 06:09
@ChrsMark
Copy link
Member

@dmitryax, @fatsheep9146, @TylerHelmuth PTAL

},
},
{
name: "attribute present - do not overwrite value",
Copy link
Contributor

Choose a reason for hiding this comment

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

Small nit
attribute present with non-empty value - do not overwrite value

Copy link
Contributor

@fatsheep9146 fatsheep9146 left a comment

Choose a reason for hiding this comment

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

Small nits

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@fatsheep9146 fatsheep9146 added the ready to merge Code review completed; ready to merge by maintainers label Dec 12, 2024
@andrzej-stencel andrzej-stencel merged commit df405c5 into open-telemetry:main Dec 16, 2024
170 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 16, 2024
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…bject if original value is empty (open-telemetry#36466)

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

This PR extends the previous check whether an attribute value has not
been present with a check for an empty value in the original resource
attributes. This way, attributes, such as `k8s.namespace.name` will be
set based on the retrieved kubernetes resource also if the original
value has been set to e.g. an empty string

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

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests

---------

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
mterhar pushed a commit to mterhar/opentelemetry-collector-contrib that referenced this pull request Dec 19, 2024
…bject if original value is empty (open-telemetry#36466)

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

This PR extends the previous check whether an attribute value has not
been present with a check for an empty value in the original resource
attributes. This way, attributes, such as `k8s.namespace.name` will be
set based on the retrieved kubernetes resource also if the original
value has been set to e.g. an empty string

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

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests

---------

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/k8sattributes k8s Attributes processor ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
4 participants