Skip to content

Commit

Permalink
fix: scrapeconfig level global tags on aws and azure scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jul 9, 2024
1 parent c3189b0 commit 701d87d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scrapers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,13 @@ func (aws Scraper) Scrape(ctx api.ScrapeContext) v1.ScrapeResults {
Value: lo.FromPtr(awsCtx.Caller.Account),
})

for _, t := range awsConfig.Tags {
(*results)[i].Tags = append((*results)[i].Tags, v1.Tag{
Name: t.Name,
Value: t.Value,
})
}

delete((*results)[i].Labels, "name")
delete((*results)[i].Labels, "Name")
}
Expand Down
7 changes: 7 additions & 0 deletions scrapers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ func (azure Scraper) Scrape(ctx api.ScrapeContext) v1.ScrapeResults {
Value: azure.subscriptionName,
})

for _, t := range config.Tags {
results[i].Tags = append(results[i].Tags, v1.Tag{
Name: t.Name,
Value: t.Value,
})
}

// Set parents where missing
for j, parent := range results[i].Parents {
if parent.ExternalID == "" {
Expand Down
4 changes: 4 additions & 0 deletions scrapers/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ func scheduleScraperJob(sc api.ScrapeContext) error {
return fmt.Errorf("[%s] failed to schedule %v", j.Name, err)
}

if sc.Properties().On("scraper.kubernetes.watch.disable") {
return nil
}

for _, config := range sc.ScrapeConfig().Spec.Kubernetes {
if len(config.Watch) == 0 {
config.Watch = v1.DefaultWatchKinds
Expand Down

0 comments on commit 701d87d

Please sign in to comment.