Skip to content

Commit

Permalink
fix: Region filter
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Apr 5, 2023
1 parent 2ec5613 commit 21b136f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions exporter/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func (m *Metrics) init(ctx context.Context, c *cli.Context) {
panic(err.Error())
}

if c.String("regions") != "all-regions" {
m.regions = strings.Split(c.String("regions"), ",")
}
}

func (m *Metrics) Describe(ch chan<- *prometheus.Desc) {
Expand Down
1 change: 1 addition & 0 deletions exporter/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func (m *Metrics) GetOrgEvents() []HealthEvent {
From: &m.lastScrape,
To: &now,
},
Regions: m.regions,
},
})

Expand Down
1 change: 1 addition & 0 deletions exporter/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func (m *Metrics) GetEvents() []HealthEvent {
To: &now,
},
},
Regions: m.regions,
},
})

Expand Down
12 changes: 7 additions & 5 deletions exporter/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ import (
)

type Metrics struct {
health *health.Client
organizationEnabled bool
awsconfig aws.Config
lastScrape time.Time
health *health.Client

slackApi *slack.Client
slackToken string
slackChannel string

tz *time.Location
tz *time.Location
lastScrape time.Time

awsconfig aws.Config
organizationEnabled bool
regions []string
}

type HealthEvent struct {
Expand Down

0 comments on commit 21b136f

Please sign in to comment.