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

[receiver/k8sobjects] use same data structure for objects received via pull and watch mode #36432

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

Conversation

bacherfl
Copy link
Contributor

Description

This PR ensures that the structure of log records generated by the k8sobjects receiver is the same, regardless of the mode (watch or pull) being used. This also solves the issue of the k8s.namespace.name attribute not being set for objects retrieved with watch mode.

Link to tracking issue

Fixes #36352

Testing

Added unit tests and adapted e2e tests

… and use same data structure as with pull based mode for log entries

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@bacherfl bacherfl changed the title Fix/36352/k8sobjects namespace [receiver/k8sobjects] use same data structure for objects received via pull and watch mode Nov 19, 2024
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@@ -37,6 +34,7 @@ func watchObjectsToLogData(event *watch.Event, observedAt time.Time, config *K8s
if name != "" {
attrs.PutStr("event.domain", "k8s")
attrs.PutStr("event.name", name)
attrs.PutStr("event.type", string(event.Type))

Choose a reason for hiding this comment

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

FYI: there is an issue regarding reflecting of k8s events to the events API definition - #35857 (comment), maybe it makes sense to include event.type to the events api convention

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.

[receiver/k8sobjects] Kubernetes events are missing namespace resource attribute
3 participants