Skip to content
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

Merged
merged 8 commits into from May 29, 2018

Conversation

drewkerrigan
Copy link
Contributor

@drewkerrigan drewkerrigan commented May 25, 2018

What does this PR do?

  • Adds fields to 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)
  • Adds a net/http/httptest / channel based test similar to the existing udp based test in metrics/influxdb_test.go
  • Adds new fields to documentation

Motivation

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

  • Added/updated tests
  • Added/updated documentation

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).

Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

} else {
log.Warnf("Unsupported protocol: %s, defaulting to udp")
default:
log.Warnf("Unsupported protocol: %s, defaulting to udp.", config.Address)
Copy link
Contributor Author

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)

@ldez ldez requested a review from mmatur May 28, 2018 14:36
Copy link
Member

@mmatur mmatur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@dtomcej dtomcej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
:shipit:

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

Successfully merging this pull request may close these issues.

None yet

5 participants