Skip to content

[processor/k8sattributes] support extracting labels and annotations from Deployments #38343

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

Conversation

odubajDT
Copy link
Contributor

@odubajDT odubajDT commented Mar 4, 2025

Description

Add support for extraction of labels and annotations from Deployments. This change comes with elevated RBAC permissions - adding Deployment permissions to the ClusterRole

Link to tracking issue

Fixes #37957

@github-actions github-actions bot added the processor/k8sattributes k8s Attributes processor label Mar 4, 2025
@odubajDT odubajDT force-pushed the k8sattributes-processor-workload-informers branch 2 times, most recently from aff9e65 to cad5b00 Compare March 10, 2025 12:47
@odubajDT odubajDT changed the title [processor/k8sattributes] support extracting metadata from high-level workloads [processor/k8sattributes] support extracting labels and annotations from k8s Deployments Mar 11, 2025
@odubajDT odubajDT force-pushed the k8sattributes-processor-workload-informers branch 3 times, most recently from 7a3bd1f to f1745c9 Compare March 11, 2025 14:10
@odubajDT odubajDT changed the title [processor/k8sattributes] support extracting labels and annotations from k8s Deployments [processor/k8sattributes] support extracting labels and annotations from Deployments Mar 11, 2025
@odubajDT odubajDT marked this pull request as ready for review March 11, 2025 15:04
@odubajDT odubajDT requested a review from a team as a code owner March 11, 2025 15:04
newInformer InformerProvider,
newNamespaceInformer InformerProviderNamespace,
newReplicaSetInformer InformerProviderReplicaSet,
informersFactory InformersFactoryList,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

small refactoring for potential future extensions

Copy link
Member

Choose a reason for hiding this comment

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

Usually we have refactorings in standalone PRs first :): https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#refactoring-work.

But I would be fine keeping this here if others agree.

@odubajDT odubajDT force-pushed the k8sattributes-processor-workload-informers branch from e9e79c1 to 87e27be Compare March 12, 2025 11:17
@@ -996,6 +1091,22 @@ func (c *WatchClient) extractNamespaceLabelsAnnotations() bool {
return false
}

func (c *WatchClient) extractDeploymentLabelsAnnotations() bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this also to be checked with which metrics are enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure I understand...

@atoulme atoulme marked this pull request as draft March 18, 2025 18:02
@odubajDT odubajDT marked this pull request as ready for review March 19, 2025 08:55
@atoulme atoulme marked this pull request as draft March 20, 2025 06:12
@odubajDT odubajDT force-pushed the k8sattributes-processor-workload-informers branch 2 times, most recently from 068fb3d to ee12fbe Compare March 20, 2025 09:51
@odubajDT odubajDT marked this pull request as ready for review March 20, 2025 09:53
@odubajDT odubajDT marked this pull request as ready for review April 28, 2025 08:08
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

I don't for-see any objections on the schema but let's wait for open-telemetry/semantic-conventions#2168 to get merged first before moving on with this one.

@odubajDT
Copy link
Contributor Author

I don't for-see any objections on the schema but let's wait for open-telemetry/semantic-conventions#2168 to get merged first before moving on with this one.

Should be merged now

newInformer InformerProvider,
newNamespaceInformer InformerProviderNamespace,
newReplicaSetInformer InformerProviderReplicaSet,
informersFactory InformersFactoryList,
Copy link
Member

Choose a reason for hiding this comment

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

Usually we have refactorings in standalone PRs first :): https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#refactoring-work.

But I would be fine keeping this here if others agree.

@odubajDT odubajDT force-pushed the k8sattributes-processor-workload-informers branch from 7293f7f to 9645924 Compare May 7, 2025 10:57
@odubajDT odubajDT force-pushed the k8sattributes-processor-workload-informers branch from 3f15293 to 0b73a42 Compare May 14, 2025 05:12
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

LGTM

odubajDT added 11 commits May 23, 2025 11:42
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
@atoulme atoulme merged commit 6b9e959 into open-telemetry:main Jun 3, 2025
175 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 3, 2025
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.

[processor/k8sattributes] Add support for extracting labels and annotations from Deployments, StatefulSets, Jobs, and DaemonSets
6 participants