Skip to content

[Explored Related] Add platform type for Container Insights in EKS#1638

Merged
zhihonl merged 6 commits intomainfrom
platform-entity-main
Apr 7, 2025
Merged

[Explored Related] Add platform type for Container Insights in EKS#1638
zhihonl merged 6 commits intomainfrom
platform-entity-main

Conversation

@zhihonl
Copy link
Contributor

@zhihonl zhihonl commented Apr 4, 2025

Description of the issue

The CWLogs team is unable to build an entire "Entity" object for ContainerInsights since metrics don't indicate whether they're running on EKS or native K8s, which is needed for key attributes (e.g. the Environment). Without this, telemetry cannot be correlated for ContainerInsights metrics making customers lose out on the Explore Related experience for these metrics.

We have EKS detection logic in the CloudWatch Agent. We want to invoke this in the Entity Processor translation logic to set the platform type for Entity. Then, we want the Entity Processor to process this into the resource attributes so that it becomes present in EMF logs.

Description of changes

  • Update the entity processor to emit platform type in Container Insights EKS

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Unit Tests.

Sample Output

"CloudWatchMetrics": [
        {
            "Namespace": "ContainerInsights",
            "Dimensions": [
                [
                    "ClusterName"
                ],
                [
                    "ClusterName",
                    "ContainerName",
                    "FullPodName",
                    "Namespace",
                    "PodName"
                ],
                [
                    "ClusterName",
                    "ContainerName",
                    "Namespace",
                    "PodName"
                ]
            ],
            "Metrics": [
                {
                    "Name": "container_memory_failures_total",
                    "Unit": "Count/Second",
                    "StorageResolution": 60
                },
                {
                    "Name": "container_cpu_utilization",
                    "Unit": "Percent",
                    "StorageResolution": 60
                },
                {
                    "Name": "container_memory_utilization",
                    "Unit": "Percent",
                    "StorageResolution": 60
                }
            ]
        }
    ],
    "ClusterName": "cluster-name",
    "ContainerName": "petclinic-container",
    "FullPodName": "petclinic-pod-lq2wb",
    "InstanceId": "i-123456789",
    "InstanceType": "m5.large",
    "Namespace": "default",
    "NodeName": "ip-123-456-7-890.ec2.internal",
    "PlatformType": "AWS::EKS",
    "PodName": "petclinic-pod",

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

@zhihonl zhihonl requested a review from a team as a code owner April 4, 2025 20:07
@zhihonl zhihonl merged commit 08fcbeb into main Apr 7, 2025
135 checks passed
@zhihonl zhihonl deleted the platform-entity-main branch April 7, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants