Skip to content

[pkg/stanza] container parser should add k8s metadata as resource attributes #33341

@ChrsMark

Description

@ChrsMark

Component(s)

pkg/stanza

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

At the moment the newly added container parser extracts some k8s metadata from the file paths.
However, these are added as Attributes and not as Resource attributes.

Describe the solution you'd like

The k8s metadata should be added as Resource Attributes instead of Attributes.

Expected log records:

Resource SchemaURL: 
Resource attributes:
     -> k8s.namespace.name: Str(default)
     -> k8s.pod.name: Str(daemonset-logs-6qglg)
     -> k8s.container.restart_count: Str(0)
     -> k8s.pod.uid: Str(898553cb-ce78-4a45-bc7b-8464d56ec894)
     -> k8s.container.name: Str(busybox)
ScopeLogs #0
ScopeLogs SchemaURL: 
InstrumentationScope  
LogRecord #0
ObservedTimestamp: 2024-06-03 15:19:20.052244563 +0000 UTC
Timestamp: 2024-06-03 15:19:19.896279612 +0000 UTC
SeverityText: 
SeverityNumber: Unspecified(0)
Body: Str(otel logs at 15:19:19)
Attributes:
     -> log.file.path: Str(/var/log/pods/default_daemonset-logs-6qglg_898553cb-ce78-4a45-bc7b-8464d56ec894/busybox/0.log)
     -> time: Str(2024-06-03T15:19:19.896279612Z)
     -> logtag: Str(F)
     -> log.iostream: Str(stdout)

That's also aligned with the Helm preset.

Describe alternatives you've considered

No response

Additional context

Would that be considered as a breaking change though since the parser has already been released?
On the other hand since the main goal of the parser is to replicate the existent behavior of the Helm preset I would consider it as a bug fix for something that we need to fix anyways.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions