fastly / fastly-exporter

A Prometheus exporter for the Fastly Real-time Analytics API
Apache License 2.0
99 stars 36 forks source link

Use package ff, enabling env vars and config files #46

Closed peterbourgon closed 4 years ago

peterbourgon commented 4 years ago

Alternative to #45. @dgarlitt, does this serve the purpose?

peterbourgon commented 4 years ago

Oops, you also want FASTLY_EXPORTER_SERVICE_IDS split on commas, eh?

mrnetops commented 4 years ago

@peterbourgon we probably want that for all fields that can potentially do multiple values, whitelist, blacklist etc.

I like that you just tossed in a potential config file too ;)

peterbourgon commented 4 years ago

Unfortunately the regexp fields can contain commas. Is it smart to allow those to be provided via env vars if they're not a complete solution?

mrnetops commented 4 years ago

Hmmm. Initial less clean thoughts

0) Is there a reasonable way to support bash arrays in golang? 1) regexp from environment variables only get one value, but being regexps, you can OR them together. i.e. "this|that" vs "this,that" 2) less clean, given that ',' is likely only going to be used for -service, -service-whitelist and -service-blacklist we could include the addendum that "," is a hard separator and inline commas would need to be replaced by "."

...I did say less clean thoughts ;)

peterbourgon commented 4 years ago

@dgarlitt Could you say a bit about why you want more flags controllable by env vars? Is it not possible to pass flags in your runtime environment?