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

[k8s_events] label support for namespace related events #37434

Open
fc92 opened this issue Jan 23, 2025 · 3 comments
Open

[k8s_events] label support for namespace related events #37434

fc92 opened this issue Jan 23, 2025 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed never stale Issues marked with this label will be never staled and automatically removed priority:p2 Medium receiver/k8sevents receiver/k8sobjects

Comments

@fc92
Copy link

fc92 commented Jan 23, 2025

Component(s)

No response

Is your feature request related to a problem? Please describe.

k8s_events related to namespaces are currently missing labels, which are important for filters in the context of Kubernetes.

Describe the solution you'd like

Use k8s_cluster and k8s_events receivers, and k8s_atributes processor to inject labels to k8s_events logs related to a given k8s.object.type

Example: inject namespace labels on logs related to namespaces

Describe alternatives you've considered

An alternative could be to configure k8s_events directly to collect labels, without k8s_cluster receiver and k8s_attributes processor

Additional context

No response

@fc92 fc92 added enhancement New feature or request needs triage New item requiring triage labels Jan 23, 2025
Copy link
Contributor

Pinging code owners for receiver/k8sobjects: @dmitryax @hvaghani221 @TylerHelmuth @ChrsMark. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

Copy link
Contributor

Pinging code owners for receiver/k8sevents: @dmitryax @TylerHelmuth @ChrsMark. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

@ChrsMark
Copy link
Member

Probably that would be doable at

func k8sEventToLogData(logger *zap.Logger, ev *corev1.Event) plog.Logs {
by retrieving the labels from the Event's ObjectMeta: https://github.com/kubernetes/api/blob/f78f1754d9369a889faaef4f9b7655bd857c0607/events/v1beta1/types.go#L41.

The labels should go under k8s.pod.label.* when object kind is Pod. For other type of objects we don't have a SemConv attribute defined yet so I would keep that part out for now.

@ChrsMark ChrsMark added help wanted Extra attention is needed never stale Issues marked with this label will be never staled and automatically removed priority:p2 Medium and removed needs triage New item requiring triage labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed never stale Issues marked with this label will be never staled and automatically removed priority:p2 Medium receiver/k8sevents receiver/k8sobjects
Projects
None yet
Development

No branches or pull requests

2 participants