From 65d32f334e679e1fdb4bbacf303bd8cdb259a732 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Mon, 8 Jul 2024 18:46:54 +0545 Subject: [PATCH] fix: add more data to ecs service --- scrapers/aws/aws.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scrapers/aws/aws.go b/scrapers/aws/aws.go index 009c009ad..bd25b93e5 100644 --- a/scrapers/aws/aws.go +++ b/scrapers/aws/aws.go @@ -280,12 +280,12 @@ func (aws Scraper) ecsClusters(ctx *AWSContext, config v1.AWS, results *v1.Scrap continue } - labels := make(map[string]string) - for _, tag := range cluster.Clusters[0].Tags { - labels[*tag.Key] = *tag.Value - } - for _, clusterInfo := range cluster.Clusters { + labels := make(map[string]string) + for _, tag := range clusterInfo.Tags { + labels[*tag.Key] = *tag.Value + } + *results = append(*results, v1.ScrapeResult{ Type: v1.AWSECSCluster, Labels: labels, @@ -341,6 +341,11 @@ func (aws Scraper) ecsServices(ctx *AWSContext, config v1.AWS, client *ecs.Clien Relationship: "ECSTaskDefinitionECSService", }) + labels := make(map[string]string) + for _, tag := range service.Tags { + labels[*tag.Key] = *tag.Value + } + *results = append(*results, v1.ScrapeResult{ Type: v1.AWSECSService, ID: *service.ServiceArn, @@ -349,6 +354,9 @@ func (aws Scraper) ecsServices(ctx *AWSContext, config v1.AWS, client *ecs.Clien RelationshipResults: relationships, ConfigClass: "ECSService", BaseScraper: config.BaseScraper, + Labels: labels, + Status: formatStatus(lo.FromPtr(service.Status)), + CreatedAt: service.CreatedAt, Properties: []*types.Property{getConsoleLink(ctx.Session.Region, v1.AWSECSService, *service.ServiceArn, map[string]string{"cluster": clusterName})}, Parents: []v1.ConfigExternalKey{{Type: v1.AWSECSCluster, ExternalID: cluster}}, })