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

Added labels and annotations to all the entities #718

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

turytsia
Copy link

@turytsia turytsia commented Sep 16, 2024

This PR adds labels and annotations to all the kubernetes entities.

@turytsia turytsia requested a review from a team as a code owner September 16, 2024 12:40
@turytsia turytsia changed the title NH-90528 Added labels and annotations to all the entities Added labels and annotations to all the entities Sep 16, 2024
Copy link
Contributor

@gantrior gantrior left a comment

Choose a reason for hiding this comment

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

Besides the two comments, I don't see how this code can set labels like k8s.pod.labels.label_name=123. It just sets the object to k8s.pod.labels object. Have you considered flatten function? It seems that it could do the job

deploy/helm/events-collector-config.yaml Show resolved Hide resolved
- context: log
statements:
# set entity annotations for the resource
- set(resource.attributes["k8s.pod.annotations"], body["metadata"]["annotations"]) where body["kind"] == "Pod"
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason why transform/manifest do not set resource attributes, but normal attributes followed by groupbyattrs/manifest is that setting resource attributes was not setting correctly in this case. Since all manifest events are in the same resource group they were overriding resource attributes of each other, so for example you have pod1 and pod2, they change both in the same time so collector is processing both in the same batch, pod1 set k8s.pod.annotations and pod2 override it. If we set standard attributes and then create resource groups by unique combinations of the attributes it worked.

Have you tested this?

Copy link
Author

Choose a reason for hiding this comment

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

The issue with data overriding was there, so I added annotations and labels to the groupbyattr processor as we discussed, and it seems to be working as expected now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants