Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Influxdb metrics provider #135

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mylesw42
Copy link

What type of PR is this?
Add support for more external metrics providers

What this PR does / why we need it:
This adds support for InfluxDB as a metric provider. This would be super helpful in adding Nomad autoscale support for the InfluxDB community.

Which issue(s) this PR fixes:
Fixes #134

Special notes for your reviewer:

4 additional sherpa server flags have been added:

      --metric-provider-influxdb-addr string       The address of the InfluxDB server in the form <protocol>://<addr>:<port>
      --metric-provider-influxdb-insecure          Skip TLS validation of InfluxDB server certificate
      --metric-provider-influxdb-password string   InfluxDB password
      --metric-provider-influxdb-username string   InfluxDB username

I had some issues with go modules while attempting to use the packaged ./vendor files.

build github.com/jrasell/sherpa/cmd: cannot load github.com/hashicorp/consul/api: ambiguous import: found github.com/hashicorp/consul/api in multiple modules:
	github.com/hashicorp/consul v1.4.0 (/Users/myles.williams/go/pkg/mod/github.com/hashicorp/consul@v1.4.0/api)
	github.com/hashicorp/consul/api v1.3.0 (/Users/myles.williams/go/pkg/mod/github.com/hashicorp/consul/api@v1.3.0)

The only way for me to resolve it was to add the following line to go.mod:

replace github.com/hashicorp/consul v1.4.0 => github.com/hashicorp/consul v1.7.0

Once that was in place, I also updated the associated vendor packages and the build started working.

I have tested with the influxdb example policy in the guide against a non-prod environment, and watched the job scale up and down! Thanks for considering this pull request :)

Does this PR introduce a user-facing change?:
NONE

Add InfluxDB external metrics provider

@chuckyz
Copy link

chuckyz commented Mar 7, 2020

@mylesw42 @jrasell commenting on this as it bumps consul's local version, but should this project utilize github.com/hashicorp/consul/api instead of github.com/hashicorp/consul ?

@mylesw42
Copy link
Author

mylesw42 commented Mar 8, 2020

@mylesw42 @jrasell commenting on this as it bumps consul's local version, but should this project utilize github.com/hashicorp/consul/api instead of github.com/hashicorp/consul ?

Yeah, this one confuses me. I think I actually tracked it down. It appears the influxdata client library is still pulling in a reference to an archived influxdata/platform go mod that requires github.com/hashicorp/consul@v1.4.0. This release is prior to go modules being used by consul, which is why I kept seeing the ambiguous import issue. Using the replace line to pin it to v1.7.0 is kind of a workaround, even though it's not used.

Maybe instead of using the client library, I could update it to use the HTTP API, similar to how the Prometheus provider is already implemented.

@mylesw42
Copy link
Author

mylesw42 commented Mar 8, 2020

Well, I found an issue on my part with using the wrong import for the influxdb client! Anyway, this resolved the other import issue, and allowed me to cleanup the original PR. Vendored files are back to the previous release, with the influxdb client being the only addition. The tests and build passed on my machine prior to the push, so I'm not sure why TravisCI failed...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: External metric provider support for InfluxDB
2 participants