justwatchcom / sql_exporter

Flexible SQL Exporter for Prometheus.
MIT License
393 stars 108 forks source link

feat: add support for scheduling jobs using cron syntax #61

Closed FUSAKLA closed 2 years ago

FUSAKLA commented 2 years ago

Instead of https://github.com/justwatchcom/sql_exporter/pull/30 implementing the CRON scheduling as suggested by @dewey

Not sure about the configuration if the precedence of the cron_schedule is ok or should bail out if both is configured?

PTAL

FUSAKLA commented 2 years ago

Possibly @dominikschulz :eyes:

dewey commented 2 years ago

Thanks for the PR. I'm going to take a look early next week :)

FUSAKLA commented 2 years ago

Great, thanks!

not sure about the vendoring issue in CI, locally go build -v ./... basses with no issues and the cron library is vendored :thinking:

FUSAKLA commented 2 years ago

@dewey friendly bump in case you may have forgotten?

dewey commented 2 years ago

Hey @FUSAKLA, not forgotten, just busy :)

I just tried it locally and I'm getting the same error as CI. The robfig cron library is not vendored that's why it doesn't work. After running go mod vendor it builds fine. Can you run a go mod vendor?

sql_exporter|fus-cronjob ⇒ go build -v ./...
config.go:16:2: cannot find package "." in:
    /Users/philippdefner/mod/github.com/justwatchcom/sql_exporter/vendor/github.com/robfig/cron/v3
FUSAKLA commented 2 years ago

:facepalm: I had a vendor ignored by the global git config. Sorry my bad. Should be fixed now.

dewey commented 2 years ago

Looks good now @FUSAKLA. Thanks for the feature!

FUSAKLA commented 2 years ago

Thanks for accepting it! :)