Skip to content

Conversation

gizas
Copy link

@gizas gizas commented Nov 5, 2024

Adding a new alias for the resource.attributes.k8s.namespace.name field that is used as a filter in Otel kubernetes Dashboard

For more information check elastic/integrations#11591

@gizas gizas requested a review from a team as a code owner November 5, 2024 10:52
@gizas gizas requested a review from felixbarny November 5, 2024 10:52
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.0.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Nov 5, 2024
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Nov 5, 2024
type: alias
path: resource.attributes.k8s.node.hostname
# Below is needed for the k8s events filtering per namespace
resource.attributes.k8s.namespace.name:
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that will work because the field is already defined in line 74 as a keyword field. Defining the same field multiple times with different field types isn't possible in ES.

Could we instead copy body.object.regarding.namespace to resource.attributes.k8s.namespace.name in the OTel collector?

Copy link
Author

Choose a reason for hiding this comment

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

Yes we can do that. I will close this PR and try the change in collector side

Copy link
Author

Choose a reason for hiding this comment

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

@felixbarny I rushed to say that can be done , by testing proved me wrong.

The k8sobject receiver is used for the events see https://github.com/elastic/opentelemetry/blob/main/resources/kubernetes/operator/helm/values.yaml#L158-L164

And used the attributes processor like:

        resource/k8sevents:
          attributes:
            - key: k8s.namespace.name
              from_attribute: body_structured.object.regarding.namespace
              action: insert

But I dont think is a valid scenario one processor to interact with other, or to rephrase it does not seem that the attribute processor can read the event logs.

I will create a seperate issue to enhance events with namespace and will research there for any solution

@gizas gizas closed this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team Team:obs-ds-hosted-services v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants