Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Add support for InfluxDB line protocol write API #191

Closed
victorhooi opened this issue Jun 11, 2015 · 14 comments
Closed

Add support for InfluxDB line protocol write API #191

victorhooi opened this issue Jun 11, 2015 · 14 comments

Comments

@victorhooi
Copy link

InfluxDB recently introduced a new line protocol write API, for more efficient bulk entry of points:

influxdata/influxdb#2696

It would be awesome if support for this could be added in the Python client!

@trehn
Copy link
Contributor

trehn commented Jun 13, 2015

I'd also like to point out that UDP writes are currently broken since JSON over UDP was dropped in 0.9.0 already (in favor of this new line protocol).

Tempted to take a stab at this if @aviau isn't working on it already.

@aviau
Copy link
Collaborator

aviau commented Jun 14, 2015

@trehn I'm not yet working on it. Your contribution would be much appreciated! Go ahead and I'll review :)

@trehn
Copy link
Contributor

trehn commented Jun 21, 2015

I have an initial implementation here: https://github.com/trehn/influxdb-python/commits/feature/line-protocol

  • So far there is no reason to break backwards compatibility for the Python API.
  • I introduced a dependency on python-dateutil in order to parse the string dates the Python API expects. This has the added advantage of allowing more date formats (dateutil will recognize a lot of different formats).
  • datetime objects can now also be provided as timestamps (pretty much a side effect of parsing the date strings).
  • If users want to avoid the performance overhead resulting from date string parsing and datetime handling, they can just pass in nanosecond integers.
  • This is not implemented yet, but maybe we should use warnings.warn to warn people when they're specifying a database while using UDP. Selecting the database is now done on the server side for UDP and cannot be influenced by the client. Silently ignoring the database param might be confusing for users.
  • The branch linked to above still has lots of test failures. If someone could take a look at these, it would be much appreciated, as I don't understand all of them (some might be obsolete now etc).

@ynezz
Copy link
Contributor

ynezz commented Jun 24, 2015

@trehn Thanks for your effort, it seems like InfluxDB is still fast moving target as I had to do following small fixes on top of your changes to get it working again.

@aviau
Copy link
Collaborator

aviau commented Jun 24, 2015

Please make sure that the line protocol is optional. Maybe you can open a PR?

@trehn
Copy link
Contributor

trehn commented Jun 24, 2015

Why should the line protocol be optional? From what I read in influxdata/influxdb#2696 it sounds like JSON is going away.

I'll merge the changes from @ynezz into my branch and try to get rid of the test failures.

@aviau
Copy link
Collaborator

aviau commented Jun 24, 2015

it sounds like JSON is going away.

I didn't catch that at first. You are right then!

@tima
Copy link

tima commented Jun 24, 2015

As I understand it, JSON is going away once 1.0 is released, but JSON over TCP is remaining until then. I don't think keeping it around for a bit is such a bad idea since that is not a moving target. By keeping it around you have something functional to fallback on if the new line protocol implementation comes out of sync again.

@svetomir
Copy link

@aviau When will you add line protocol into your branch?

@aviau
Copy link
Collaborator

aviau commented Jun 26, 2015

@svetomir I am waiting for a pull request from @trehn

@eoltean
Copy link

eoltean commented Jul 16, 2015

@aviau Is there a reason this issue is still open line write was merged into master? Is it still not working fully yet?

@aviau
Copy link
Collaborator

aviau commented Jul 16, 2015

@adventures91 Forgot to close.

... Done!

@aviau aviau closed this as completed Jul 16, 2015
@eoltean
Copy link

eoltean commented Jul 16, 2015

@aviau cool thanks! Any chance you could add this to a release?

@aviau
Copy link
Collaborator

aviau commented Jul 17, 2015

Yes, soon!

Until then...

pip install https://github.com/influxdb/influxdb-python/archive/master.zip

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

No branches or pull requests

7 participants