Skip to content

Commit

Permalink
fix: add more data to ecs service
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jul 8, 2024
1 parent 46b2f68 commit 65d32f3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions scrapers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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}},
})
Expand Down

0 comments on commit 65d32f3

Please sign in to comment.