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/k8scluster] add entity attributes to namespace and container #37581

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

Conversation

jinja2
Copy link
Contributor

@jinja2 jinja2 commented Jan 30, 2025

Description

Add attributes to entities namespace and container emitted by k8scluster receiver.

Add to k8s.namespace the attributes -

k8s.namespace.phase - Values can be active, terminating, unknown.
k8s.namespace.creation_timestamp - The creation timestamp of namespace object.

Add to container entity the attribute -

container.creation_timestamp - This is the timestamp the container was started at. The attribute is available when the state of the container is running or terminated (waiting container does not have this attr). Note, for other entities like namespace the creation_timestamp is the time from metadata of the object, whereas for a container this is the StartedAt field from the containerStatus. I am not certain if we want to make this distinction here with a different key, e.g. container.started_at.

Link to tracking issue

Fixes - #37580

Testing

Unit test and e2e test

Documentation

Updated changelog

@jinja2 jinja2 marked this pull request as ready for review January 30, 2025 21:44
@jinja2 jinja2 requested a review from a team as a code owner January 30, 2025 21:44
@@ -245,25 +249,206 @@ func containerImageShorten(value string) string {
return shortenNames(value[(strings.LastIndex(value, "/") + 1):])
}

func startUpSink(t *testing.T, mc *consumertest.MetricsSink) func() {
func startUpSink(t *testing.T, consumer interface{}) func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func startUpSink(t *testing.T, consumer interface{}) func() {
func startUpSink(t *testing.T, consumer any) func() {

Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants