It's nice to third parties if you set User-Agent so the caller can be
identified. By default Go will set a User-Agent header to a string like
"Go-http-client/1.1".
The library now sets it to a string that identifies the source of the
program (github.com/jamesog/aaisp-chaos) and the compiled Go OS, arch
and version, to aid any potential debugging:
chaos-go (darwin; amd64; go1.15.5) github.com/jamesog/aaisp-chaos
Switch to a custom FlagSet and add a nicer usage message.
Check for the required CHAOS_CONTROL_LOGIN and CHAOS_CONTROL_PASSWORD
environment variables and exit with an error if neither is set. The
usage string also mentions that both must be set.
Create a standard log object and use dependency injection to pass it to
the broadbandCollector and a new loggingMiddleware for wrapping HTTP
requests to log the request.
Logs are emitted as structured JSON logs by default but can be switched
to a human-friendly output by passing -log.level console.
The Prometheus client_golang library has also been upgraded.
Previously if we fail to connect to CHAOS during a scrape no metrics are
emitted.
Now a aaisp_scrape_success metric is always emitted with values 0 for
failure and 1 for success, along the lines of blackbox_exporter's
probe_success metric.
The README for the Prometheus exporter failed to mention that you must
set some environment variables for authentication or that you can change
the address the exporter listens on.