gusutabopb / aioinflux

Asynchronous Python client for InfluxDB
MIT License
159 stars 31 forks source link

Add support for unix sockets #2

Closed carlos-jenkins closed 6 years ago

carlos-jenkins commented 6 years ago

Hi!

First of all thank you very much for this project. It has been very helpful and is working great.

This PR adds support to connect to influxdb using a unix sockets:

https://docs.influxdata.com/influxdb/v1.4/administration/config/#unix-socket-enabled-false

For example, if influxdb is configured as follows:

[http]
  unix-socket-enabled = true
  bind-socket = "/var/run/influxd.sock"

Then:

client = AsyncInfluxDBClient(unix_socket='/var/run/influxd.sock')

Important to note that the process using aioinflux must have permissions to read and write to the unix socket.

Regards

gusutabopb commented 6 years ago

Thanks for the PR! I am happy you find this package useful.

I just tested locally and everything seems to working fine. It'd be nice having some unit tests, but I guess adding tests for multiple connection methods with multiple InfluxDB configuration settings wouldn't be so trivial. Anyways, the changes are quite small so it shouldn't affect anything, so I will just merge the PR as it is.

Thanks!

carlos-jenkins commented 6 years ago

Thanks a lot!