New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metrics: Add support for InfluxDB Database / RetentionPolicy and HTTP client #3391
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
metrics/influxdb.go
Outdated
} else { | ||
log.Warnf("Unsupported protocol: %s, defaulting to udp") | ||
default: | ||
log.Warnf("Unsupported protocol: %s, defaulting to udp.", config.Address) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
log.Warnf("Unsupported protocol: %s, defaulting to udp.", config.Protocol)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What does this PR do?
types.InfluxDB
Protocol
: Defaults to"udp"
, can also be"http"
Database
,RetentionPolicy
: Allows specification of database and RP when protocol is"http"
(UDP client does not support queries)net/http/httptest
/ channel based test similar to the existing udp based test in metrics/influxdb_test.goMotivation
The InfluxDB UDP endpoint does not support choosing a database, so environments that have many datasources for InfluxDB generally need the ability to separate influx data into multiple databases.
More
Additional Notes
One of the more bigger changes here is the fact that it attempts to create a database if an error is encountered containing the message
"database not found"
. This is a nice to have, (but not required) feature present in other similar applications (like telegraf -> https://github.com/influxdata/telegraf/blob/master/plugins/outputs/influxdb/influxdb.go#L209-L215 for example).