Skip to content

Commit

Permalink
coroot-pg-agent updated to v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
def committed Jun 9, 2022
1 parent a1d03d0 commit 5fd2377
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/aws/aws-sdk-go v1.40.51
github.com/coroot/coroot-pg-agent v1.0.0
github.com/coroot/coroot-pg-agent v1.0.4
github.com/coroot/logger v1.0.0
github.com/coroot/logparser v1.0.4
github.com/google/go-cmp v0.5.6 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coroot/coroot-pg-agent v1.0.0 h1:+TrTiJpYkaJJwUwS/L/N75NURofO1kUI/Sgz6+Qti4M=
github.com/coroot/coroot-pg-agent v1.0.0/go.mod h1:N3X0m2Z2TXln+7blrGdygPOBERaykKC/4d+nO6RecYE=
github.com/coroot/coroot-pg-agent v1.0.4 h1:hprCVy+fsv3d6w/pNDgTdhQghh36Z1yu7NxTmZfEvPQ=
github.com/coroot/coroot-pg-agent v1.0.4/go.mod h1:8z3BLlH1tAN3mzKgguLkgznFBetwopHgI5v2snXanOg=
github.com/coroot/logger v1.0.0 h1:n8iNkGk6ete9wp/L49FXsZlNiySuA+IJ7TsTkYkiqPc=
github.com/coroot/logger v1.0.0/go.mod h1:rEO5EQqDbB4bnCoo5Ot9Dj51Bkl40RUVqB03rba54HE=
github.com/coroot/logparser v1.0.4 h1:xp3Tc6/3gVFcm6t9TD/zJrHCCu16e7wA/VnnFLtoseU=
github.com/coroot/logparser v1.0.4/go.mod h1:GHsVO1xE8pR5mmu9Eiop9IXHwN/QzNRx1s0fuzVxq7I=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func main() {
rdsDbConnectTimeout := kingpin.Flag("rds-db-connect-timeout", "RDS db connect timeout").Default("1s").Duration()
rdsDbQueryTimeout := kingpin.Flag("rds-db-query-timeout", "RDS db query timeout").Default("30s").Duration()
rdsLogsScrapeInterval := kingpin.Flag("rds-logs-scrape-interval", "RDS logs scrape interval (0 to disable)").Default("30s").Duration()
dbScrapeInterval := kingpin.Flag("db-scrape-interval", "How often to scrape DB system views").Default("30s").Duration()
listenAddress := kingpin.Flag("listen-address", `Listen address (env: LISTEN_ADDRESS) - "<ip>:<port>" or ":<port>".`).Envar("LISTEN_ADDRESS").Default("0.0.0.0:80").String()
kingpin.HelpFlag.Short('h').Hidden()
kingpin.Version(version)
Expand All @@ -48,6 +49,7 @@ func main() {
QueryTimeout: *rdsDbQueryTimeout,

LogsScrapeInterval: *rdsLogsScrapeInterval,
DbScrapeInterval: *dbScrapeInterval,
}
go rds.NewDiscoverer(reg, awsSession, *rdsDiscoveryInterval, rdsDbConf).Run()

Expand Down
3 changes: 2 additions & 1 deletion rds/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type DbCollectorConf struct {
QueryTimeout time.Duration

LogsScrapeInterval time.Duration
DbScrapeInterval time.Duration
}

type DbCollector interface {
Expand Down Expand Up @@ -123,7 +124,7 @@ func (c *Collector) startDbCollector() {
}
statementTimeout := int(c.dbConf.QueryTimeout.Milliseconds())
dsn := fmt.Sprintf("postgresql://%s@%s/postgres?connect_timeout=%d&statement_timeout=%d", userPass, endpoint, connectTimeout, statementTimeout)
if collector, err := postgres.New(dsn, c.logger); err != nil {
if collector, err := postgres.New(dsn, c.dbConf.DbScrapeInterval, c.logger); err != nil {
c.logger.Warning("failed to init postgres collector:", err)
} else {
c.logger.Info("started postgres collector:", endpoint)
Expand Down

0 comments on commit 5fd2377

Please sign in to comment.