Skip to content

Commit

Permalink
feat: Add hidden flag to inject time on query filter
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Apr 4, 2024
1 parent dbd6000 commit 4838314
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exporter/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (m *Metrics) init(ctx context.Context, c *cli.Context) {

m.NewHealthClient(ctx)

m.lastScrape = time.Now()
m.lastScrape = time.Now().Add(c.Duration("time-shift"))

if len(c.String("slack-token")) > 0 && len(c.String("slack-channel")) > 0 {
m.slackToken = c.String("slack-token")
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"os"
"time"

"github.com/AndreZiviani/aws-health-exporter/exporter"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -25,6 +26,8 @@ func main() {
&cli.StringFlag{Name: "ignore-events", Usage: "Comma separated list of events to be ignored on all resources"},
&cli.StringFlag{Name: "ignore-resources", Usage: "Comma separated list of resources to be ignored on all events, format is dependant on resource type (some are ARN others are Name, check AWS docs)"},
&cli.StringFlag{Name: "ignore-resource-event", Usage: "Comma separated list of events to be ignored on a specific resource (format: <event name>:<resource identifier>)"},

&cli.DurationFlag{Name: "time-shift", Usage: "[INTERNAL] Apply a time delta to event filter instead of looking at previous scrape", Hidden: true, Value: 0 * time.Second},
}

app := &cli.App{
Expand Down

0 comments on commit 4838314

Please sign in to comment.