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

Add a OpenTSDB input protocol #870

Merged
merged 1 commit into from
Apr 6, 2015
Merged

Add a OpenTSDB input protocol #870

merged 1 commit into from
Apr 6, 2015

Conversation

tcolgate
Copy link
Contributor

This adds an input supporting the telnet put interface from OpenTSDB.
OpenTSDB's tag keys and values and tranformed into Inlflux DB columns.
At present all values are stored as 64 bit floats.

This is based on a mix of the UDP, and Graphite APIs. I've given it a bit of initial testing with tcollector, and so far things looks OK. Not load tested it yet.

I noticed the graphite collector uses a buffered channel, where the UDP one does not. Is the buffering taken care of elsewhere now? TSDB clients will be quite bursty, so buffering may improve things if needed

@pauldix
Copy link
Member

pauldix commented Sep 8, 2014

Thanks @tcolgate! Would it be possible to update the config so that there are different ways to map tag keys?

Having tag keys mapped as columns may end up giving users very poor query performance. It's probably preferable to map the tag keys into the series names. For example:

cpu|host=foo|datacenter=uswest

Or something like that.

@tcolgate
Copy link
Contributor Author

Hi,
Using columns maps to the OpenTSDB usage directly, and has proved to be a really nice way of working with data (You can build up aggregates and queries without needing to resort to regex's, it generally feels more correct).
I will look into it though, but may not be doing it any time soon. The current state of the derivative gunction in influx means that I can't use it at the moment (I'm trying to review the code to work out if I can help fix that), and I've not got much time spare right now.
I don't mean to be negative, Influx is looking fantastic, and working with the code is a real joy, so if I can find the time I will.

@pauldix
Copy link
Member

pauldix commented Sep 10, 2014

Yeah, it might make it better to work with in some ways, but if people are commonly doing queries where the filter out a ton of data by doing "where tag = 'foo'" then the performance is going to be very poor.

Is this something you need for yourself right now? If not, I think I'd rather hold off on this until we can address how to map OpenTSDB onto InfluxDB in a way that provides good performance.

@tcolgate
Copy link
Contributor Author

No urgency, we're back on to OpenTSDB for the moment, and I'll follow influx's progress. I'll have a crack at the alternative mapping at some point, if no one beats me to it.

@Dieterbe
Copy link
Contributor

note: it seems we'll get this optimisation in a transparent way when we have #582

@jvshahid jvshahid force-pushed the master branch 2 times, most recently from 987efd5 to 5e9750f Compare October 20, 2014 22:37
@toddboom
Copy link
Contributor

@tcolgate The underlying codebase has changed a bunch for the v0.9.0 release. Is there any chance you'd be willing to update this code to work with the new codebase? The new plugins should give you a pretty good idea of how things would need to be restructured.

@otoolep
Copy link
Contributor

otoolep commented Feb 28, 2015

+1, I'd really like this to see this re-implemented for 0.9. We can certainly offer advice along the way.

@tcolgate
Copy link
Contributor Author

Hi all, sorry, missed the comments. Will look into it.

@tcolgate
Copy link
Contributor Author

@toddboom First stab at updating for the new API, pretty much untested.

// Spin up any OpenTSDB servers
if config.OpenTSDB.Enabled {
o := config.OpenTSDB
db := opentsdb.DefaultDatabaseName
Copy link
Contributor

Choose a reason for hiding this comment

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

We prefer to do this on the config object. In other words, the config object should have a method called "OpenTSDBDatabase()` (or something like that) and encapsulate the default-detection logic.

@otoolep
Copy link
Contributor

otoolep commented Mar 30, 2015

Thanks @tcolgate -- generally making sense. I do have some feedback, and you'll want to look into adding an integration test in server_integration.go. There are some Graphite examples in there already.

@tcolgate
Copy link
Contributor Author

@otoolep Cheers, will update. FWIW, the graphite and collectd plugins seemed to use different approaches for the settings so it wasn't completely clear which was the preferred option.

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 1, 2015

@otoolep hopefully satisfied the review comments.

The test doesn't pass yet, not quite sure why, but will try and fix that up as soon as possible.

Enabled bool `toml:"enabled"`
Database string `toml:"database"`
RetentionPolicy string `toml:"retention-policy"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add a toml directive here, just so it's clear what it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, not sure what you mean here. Each line already has the toml struct tag, and the entry in the Config struct does too (line 97)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is what I meant, I see you've got the toml directive in the right place after all -- thanks.

@otoolep
Copy link
Contributor

otoolep commented Apr 1, 2015

Looking good, I'll wait until the tests are green before I fully review it. Can you squash the commits?

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 2, 2015

@otoolep input unit test now passes (will add more later)

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 2, 2015

@otoolep config test is in. Server test passes. Commits squashed

@otoolep
Copy link
Contributor

otoolep commented Apr 2, 2015

Thanks @tcolgate -- have you signed the CLA?

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 3, 2015

Done
On 3 Apr 2015 00:20, "otoolep" notifications@github.com wrote:

Thanks @tcolgate https://github.com/tcolgate -- have you signed the CLA?


Reply to this email directly or view it on GitHub
#870 (comment).

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 3, 2015

I'm going to try and add support for the http interface (TSDB is a bit "special" in this regard, with a http and telnet inteface on the same port), so it presents an interesting challenge.
I'll also add support for batching of the data point writes at some point.

@otoolep
Copy link
Contributor

otoolep commented Apr 3, 2015

@tcolgate -- I'm not sure I follow you. What do you mean "add support for the HTTP interface"? Do you mean propose a change to our HTTP API for writing data?

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 3, 2015

@otoolep nope. TSDB actually provides it's telnet interface and http on the same port.The http interface supports batch upload of data so will map quite nicely to influx internal API. The telnet interface is used by tcollector (the tool I use). The http protocol is used by scollector, a newer tool, and probably other more sane tools out there.
Supporting both would be nice, and users will expect to be able to use the same port for both (it's bonkers, but true).
I've got a rough proof of concept that I should be able to make work.
This wont be on the influxdb endpoint, it'll be served on the same TCP port that the OpenTSDB input currently spins up.
See the feature/opentsdb-http-input branch for my WIP (much tidying to do)

return o.Database
}

func (o OpenTSDB) ListenAddress() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function needs to take the default bind address, and use it if an address is not set for openTSDB. See https://github.com/influxdb/influxdb/blob/master/cmd/influxd/config.go#L390

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 5, 2015

@otoolep updated and rebased as request. One point unresolved.

Add an input collector for the OpenTSDB telnet protcol
otoolep added a commit that referenced this pull request Apr 6, 2015
@otoolep otoolep merged commit 7e58f98 into influxdata:master Apr 6, 2015
@otoolep
Copy link
Contributor

otoolep commented Apr 6, 2015

Thanks @tcolgate for this very useful functionality.

@pauldix
Copy link
Member

pauldix commented Apr 6, 2015

awesome work, thanks @tcolgate!

@corylanou
Copy link
Contributor

Super cool @tcolgate thanks for your effort!

@toddboom
Copy link
Contributor

toddboom commented Apr 6, 2015

👏 💃 👏

@tcolgate
Copy link
Contributor Author

tcolgate commented Apr 7, 2015

Thanks for merging. I've got some in progress work on support the http interface too.

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

Successfully merging this pull request may close these issues.

6 participants