influxcommunity / influxdb-ruby Goto Github PK
View Code? Open in Web Editor NEWRuby client for InfluxDB
License: MIT License
Ruby client for InfluxDB
License: MIT License
Looks like the interface might have changed slightly from what's documented. Clean it up.
I'm getting Invalid username/password
(InfluxDB::AuthenticationError
) from time to time. I wasn't yet able to reproduce this reliably. It "just" happens quite regularly, sometimes in the middle of a series of queries I'm running. I think I see it more often with queries where I try to check if a series was already created (by running SELECT * FROM foo.bar LIMIT 1
) but it also happens during an insert.
I'm running Influx 0.5.1 (but I also see this with 0.5.2).
I'll provide more details as soon as I have them.
Hi,
Is there a way to set the retention policy at write time?
Following this doc, it should be possible. Is it implemented already and I missed it ?
Thanks,
Arthur
Can't find why this doesn't work
d = [
{:series=>"logstash", :values=>{"team"=>"cml0", "logstash_receiver"=>"receiver-ubuntu-1404"}},
{:series=>"logstash", :values=>{"team"=>"cml1", "logstash_receiver"=>"receiver-ubuntu-1404"}},
{:series=>"logstash", :values=>{"team"=>"cml2", "logstash_receiver"=>"receiver-ubuntu-1404"}},
{:series=>"logstash", :values=>{"team"=>"cml3", "logstash_receiver"=>"receiver-ubuntu-1404"}},
{:series=>"logstash", :values=>{"team"=>"cml4", "logstash_receiver"=>"receiver-ubuntu-1404"}},
{:series=>"logstash", :values=>{"team"=>"cml5", "logstash_receiver"=>"receiver-ubuntu-1404"}}
]
influx_cnx.write_points(d)
Only the last one get insert (or is shown using select * from logstash
Inserting them to different series works like a charm (logstash1 to logstash6)
For some reason I'm getting this when attempting to use async mode.
Using latest client and Influxdb 0.9.2
Cannot write data: #<ArgumentError: wrong number of arguments (1 for 2)>
I looked through this rescue block and I'm unsure why there aren't enough arguments here.
I invoked it with nil
, .
, /
which returned a success, but if I try to use these in the web interface, I get all sorts of errors when looking at the js console. I also cannot delete
From ruby:
> res = i.create_database "/"
=> #<Net::HTTPCreated 201 Created readbody=true>
> res = i.create_database "."
=> #<Net::HTTPCreated 201 Created readbody=true>
> res = i.create_database nil
=> #<Net::HTTPCreated 201 Created readbody=true>
From js console:
OPTIONS http://localhost:8086/db/?u=root&p=root 404 (Not Found) influxdb-latest.js:1
XMLHttpRequest cannot load http://localhost:8086/db/?u=root&p=root. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8083' is therefore not allowed access. localhost/:1
I've ran into an issue where I get this
unable to parse 'apachecombined-access clientip=\"X.X.X.X\",request=\"/XXX/XXX/99999/XXX/1?XXXXX=[\\\\\"XXXXX\\\\\"]&XXXX=0\",response.integer=200,bytes.long=703,response_time.double=0.065,time=1443528858': invalid number\n
The original event request was like this (I could not find the EXACT same but I've got enough to be sure there are all the same)
/XXX/XXXX/99999/XXXX/1?XXXX=[\"XXXX\"]&XXXX=0
I guess the already escaped " caused an issue and made influxdb think the IP was not surrounded by quotes.
~|⇒ irb
irb(main):001:0> def escape_value(value, quote_escape)
irb(main):002:1> val = value.
irb(main):003:1* gsub(/\s/, '\ ').
irb(main):004:1* gsub(',', '\,').
irb(main):005:1* gsub('"', '\"')
irb(main):006:1> val = %("#{val}") if quote_escape
irb(main):007:1> val
irb(main):008:1> end
=> nil
irb(main):009:0> escape_value('/XXXX/XXXXX/99999/XXXX/1?XXXX=[\"XXXX\"]&XXXXX=0', true)
=> "\"/XXXX/XXXX/99999/XXXX/1?XXXXX=[\\\\\"XXXX\\\\\"]&XXXX=0\""
No matter if I use a cluster admin, database admin or database user, I always get an exception (InfluxDB::Error: Insufficient permission to write to test_runs
) when I try to run DELETE FROM foo.bar.blub WHERE time < now()
.
Reading through the gem's source code I couldn't find anything related to setting permissions etc, but I'm definitely confused that the cluster admin has no permission to delete data.
Client#delete_database
works fine, btw.
Considering that sending an InfluxDB line with empty tag values such as (notice the empty ident tag):
syslog,host=fwtpcore1b,ident= message=\"BLAHBLAHBLAH\" 1449233580
will result in InfluxDB returning a missing tag value error, I would say that the Ruby client should omit tags with empty values in the line altogether.
I have come upon this issue in cases where Syslog message were received with no ident field while using Fluentd with the fluent-plugin-influxdb output plugin.
Wrote this script. The double quotes in the string "test"
are included in the tag value when written to the database.
require 'influxdb'
database = 'mydb'
influxdb = InfluxDB::Client.new database, host: "localhost"
data = {
series: 'blueberries',
tags: {
station_id: "test"
},
values: {
value: 5
},
timestamp: Time.now.to_i
}
influxdb.write_points([data])
> select * from blueberries where station_id ='test'
> select * from blueberries where station_id ='"test"'
name: blueberries
tags: station_id="test"
time value
---- -----
2015-07-24T23:36:37Z 5
Love, Regan
ArgumentError: wrong number of arguments (given 2, expected 1)
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxer-0.3.1/lib/influxer/rails/client.rb:15:in `log'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:57:in `rescue in connect_with_retry'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:66:in `connect_with_retry'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:25:in `post'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxdb-0.2.3/lib/influxdb/query/core.rb:56:in `write'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxdb-0.2.3/lib/influxdb/query/core.rb:42:in `write_points'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/influxdb-0.2.3/lib/influxdb/query/core.rb:48:in `write_point'
from /usr/src/app/app/models/activity/point.rb:10:in `plot'
from /usr/src/app/app/models/activity.rb:32:in `plot'
from (irb):7:in `block in irb_binding'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
from (irb):6
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/console.rb:110:in `start'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/console.rb:9:in `start'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/r
On the coming weekend In the coming days I'd like to extend the test suite with integration/smoke tests. The current suite exclusively relies on a stubbed HTTP endpoint (which is fine for local, fast tests), but doesn't actually tell me whether I can use the Gem with a specific version of InfluxDB.
v0.11 for example introduced some subtle changes in SHOW SERIES
and SHOW TAG VALUES
—and although these queries are not natively covered by this Gem (yet), I would feel more confident if I can see a green smoke test result.
(1) Because I'm lazy, I want a script which generates a .travis.yml
from the AWS bucket (or maybe another resource) with the latest n major versions, e.g. 0.12.1, 0.11.1 and 0.10.2 but neither 0.12.0, nor 0.11.0, nor 0.10.1.
Each version should generate an matrix.include
entry:
It should be sufficient to include the .deb
download file(s) in the build matrix:
matrix:
include:
- rvm: 2.3.0
env: USE_INFLUXDB="influxdb_0.11.1-1_amd64.deb"
- rvm: 2.3.0
env: USE_INFLUXDB="influxdb_0.12.1-1_amd64.deb"
- # ...
(2) Depending on the presence of the $USE_INFLUXDB
env var, a before_install
or install
script needs to provision the specified InfluxDB version.
(3) The Rake default
task should, in presence of ENV["USE_INFLUXDB"]
, only fire up the smoke test suite (maybe I can leverage script
to execute rake spec:integration
or sth. similar).
(4) Finally, some actual smoke tests need to be written. As a first step, I'd transform the examples in the README.
Did I miss something obvious? Am I crazy and shouldn't do this? Are there similar attempts in the other client library implementations (if not, should this be portable enough to act as reusable template)?
To keep my sanity, I don't really want to parse XML for (1). This might give me a nice starting point to find the relevant version prefixes, though (ex.).
/cc @toddboom
When sending a invalid valid, but not executable query, write_point(s) returns successfuly(!).
When sending an invalid write request to InfluxDB, the database answers with HTTP 200 OK
and the error in the message body. Only if HTTP 204 No Content
is sent, the request was executed successfully.
See: https://docs.influxdata.com/influxdb/v0.10/guides/writing_data/
In method post
in file lib/influxdb/client/http.rb
: Change Net::HTTPSuccess
(2xx) to Net::HTTPNoContent
(204)
The line protocol now requires that int's be explicitly defined via a trailing 'i' (see influxdata/influxdb#3526).
It's currently impossible to accomplish this using the #write_point
/#write_points
methods, so you'll wind up with an error like this:
InfluxDB::Error: write failed: field type conflict: input field "foo" on measurement "bar" is type float64, already exists as type integer
I'm happy to work up a PR, but I'm not sure what the best approach is. I don't know that we can simply tack on an 'i' for all Fixnums
without breaking things for users currently passing them to float
fields.
Right now, my temporary workaround is to add a wrapper class around Fixnum
that tacks on an 'i' in its #to_s
method, which I then pass to #write_point
, but that's not a longterm/ideal solution, unless it's exposed by the gem itself.
I don't know why but, gem install influxdb
fails:
$ gem install influxdb
ERROR: Could not find a valid gem 'influxdb' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - bad response Gateway Time-out 504 (https://tokyo-m.rubygems.org/quick/Marshal.4.8/influxdb-0.1.7.gemspec.rz)
although installing 0.1.6 works
$ gem install influxdb -v 0.1.6
Fetching: influxdb-0.1.6.gem (100%)
Successfully installed influxdb-0.1.6
1 gem installed
Is it possible to release v0.1.8 by any chances?
Now, it's possible to send multiple points but only for the same serie. The http api supports it, then it would be nice add this feature to the gem. What do you think?
I could contribute with a patch but I prefer read your opinion before. Thanks!
InfluxDB::Error
should not inherit from Exception
but StandardError
. It's not good practice to do so, and here is one of many examples why.
The following code will not catch MyError
, as the default rescue
will catch anything inherited from StandardError
:
class MyError < Exception
end
begin
raise MyError
rescue
puts 'Caught it!'
end
I'm wondering why this was changed in ee078db.
Sidenote: You should not try to rescue Exception
either, because that will cover many error cases that you cannot properly handle at all (like SIGTERM, OOMs, etc).
If i shutdown influxdb server, and start rails, then sometimes the influxdb client worker threads won't ever shutdown.
I believe this code is causing the issue:
at_exit do
log :debug, "Thread exiting, flushing queue."
check_background_queue(thread_num) until @queue.empty?
end
If there is something in the queue, it doesn't seem to exit it (I have to guess). It could also be that there are other things running putting stuff back in the queue, while this 'last gasp' is being attempted.
If I take out this:
check_background_queue(thread_num) until @queue.empty?
Then I can always clean up nicely by hitting CTRL + C.
I understand why you would want to have the last_gasp behavior, but I think probably the best idea here is to only try and flush this queue for either a) a certain amount of time, or b) flush but give up if any attempts fail to reach influxdb server.
Or just don't do it at all... I'm OK with that, too.
When defining a new InfluxDB client, it should be defaulted to look for InfluxDB on localhost.
db = InfluxDB::Client.new
Instead of
db = InfluxDB::Client.new 'localhost', 8086, 'root', 'root'
All I am using a influxdb chef handler i am having crazy problem, i am pretty sure this output is not from either the gem or influxdb but i would like to validate that.
[2016-03-22T16:23:12-04:00] ERROR: Report handler ChefInfluxDB raised #<InfluxDB::Error:
<TITLE>Network Error</TITLE>
Network Error (tcp_error)
A communication error occurred: "" The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
For assistance, contact your network support team.
It would be nice to have non-raising methods on Client
, like delete_database
or create_database_user
. In my project I'm automating this (creating databases and users on the fly) and the management code get's quite noise with all those exception handling. One issue is that there are no specific Exceptions: Both examples raise InfluxDB::Error
and you have to match the message in order to figure out what the problem was (I'm happy to provide a PR for that too).
Take this real world code e.g.:
def drop_database(database_name, options={})
influxdb = influx_client(database_name, options)
begin
influxdb.delete_database(database_name)
rescue InfluxDB::Error => e
raise e unless e.message == "Database #{database_name} doesn't exist"
false
end
true
end
IMO these methods should only return true
(or something else) on success and false
otherwise. A bang variant could raise on e.g. "not found" errors. They should raise InfluxDB::AuthenticationError
though.
def drop_database(database_name, options={})
influx_client(database_name, options).delete_database(database_name)
end
If accepted, I'm happy to provide a PR.
A latest influxdb is running on my local machine and the web UI works well, as well as the console. I am attempting to use this client lib to do some write or database creation operation to my local influxdb. However that error keeps prompting when I run any operation. Here is the most simplified script I tried.
require 'influxdb'
username = 'root'
password = 'root'
database = 'test_db'
name = 'foobar'
influxdb = InfluxDB::Client.new
influxdb.create_database(database)
And the whole error.
/var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:384:in `block in post': 404 page not found (InfluxDB::Error)
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:431:in `call'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:431:in `connect_with_retry'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:375:in `post'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:94:in `create_database'
from ./test1.rb:10:in `<main>'
Update:
I found the lib installed via gem install is inconsistent with the latest update in this repository. Then I replaced the lib with the latest code. Now the error changed.
/var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client/http.rb:95:in `resolve_error': 404 page not found (InfluxDB::Error)
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client/http.rb:33:in `block in post'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client/http.rb:65:in `call'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client/http.rb:65:in `connect_with_retry'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/client/http.rb:26:in `post'
from /var/lib/gems/2.1.0/gems/influxdb-0.1.9/lib/influxdb/query/database.rb:8:in `create_database'
from ./test1.rb:11:in `<main>'
The following example is given in the documentation
database = 'site_development'
new_username = 'foo'
new_password = 'bar'
permission = :write
###with all permissions
influxdb.create_database_user(database, new_username, new_password)
This amounts to the following for me
JSON::ParserError: A JSON text must at least contain two octets!
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/json-1.8.3/lib/json/common.rb:155:in `initialize'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/json-1.8.3/lib/json/common.rb:155:in `new'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:88:in `handle_successful_response'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:14:in `block in get'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:52:in `call'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:52:in `connect_with_retry'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/client/http.rb:11:in `get'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/query/core.rb:94:in `execute'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/influxdb-0.2.3/lib/influxdb/query/user.rb:8:in `create_database_user'
from (irb):13
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/martin/.rvm/gems/ruby-2.2.3@cpass/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/martin/Documents/Development/Rails/cpass/bin/rails:9:in `require'
from /Users/martin/Documents/Development/Rails/cpass/bin/rails:9:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
The execute block in create_database_user seems to be returning an "" source which the parse method is trying to execute upon.
gem install influxdb
Successfully installed influxdb-0.0.13
1 gem installed
(open new file)
require 'influxdb'
run
cannot load such file — influxdb/errors
Grabbed a copy of the errors.rb file and dropped it into gem, everything was good.
For some reason that file was not included in the package. Could just be my machine. Thought I'd mention it anyway. Allez!
Since a lot has changed between InfluxDB 0.8.x and 0.9, it would be great to have a note/warning in README.md that states, what versions of this gem is considered compatible which what version of InfluxDB.
When I try using the continuous_queries method, it doesn't work. I believe it is because it isnt passing the database it is looking for the continuous_queries in.
a simple test
pry(main)> influxdb.continuous_queries
InfluxDB::Error: 404 page not found
from /Users/lyon/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/influxdb-0.0.17/lib/influxdb/client.rb:170:in `get'
pry(main)> influxdb.send :get, "/db/test/continuous_queries?u=root&p=root"
=> [{"id"=>1,
"query"=>
"select mean(cpu) as cpu from stats.test group by time(1m) into test.cpu.min.avg"},
{"id"=>2,
"query"=>
"select mean(cpu) as cpu from stats.test group by time(1h) into test.cpu.hour.avg"}]
For statistics data, I think it would be preferable to use UDP to send data instead of using http.
Is there anything in the works for 0.9 or are you looking for pull requests?
My timestamp is like 2015-12-13T07:39:31Z, but when insert to influxdb has only one message in one second. In fact, one second has more than one message.
fluent-plugin-influxdb (0.2.2)
influxdb (0.2.3)
influxdb server : 0.9.6.1
Please update gemspec to change cause dependency to only needed for ruby <2.1
move cause under conditional.
if RUBY_VERSION < '2.1'
spec.add_runtime_dependency "cause"
end
Should you create a new branch for the upcoming influxDB 0.9.0 ?
Would be good to start implementing the new features and API changes.
Hi,
Could you please add link to sources of influxdb-ruby on page http://rubygems.org/gems/influxdb ?
Thanks
How to do batch operations or transactions?
Shall I just concatenate query strings?
Now some async parameters are not configurable
MAX_POST_POINTS = 1000
MAX_QUEUE_SIZE = 10_000
NUM_WORKER_THREADS = 3
SLEEP_INTERVAL = 5
Because of the way it's defined,
def write_point(name, data, async=@async, time_precision=@time_precision)
there's no way to specify a time_precision
without also specifying whether to use async or not. So far, I've found I'm much more likely to care about setting the precision (which can change based on what data you're writing) than deciding whether to be synchronous.
I'd suggest making them keyword arguments so either or both can be specified.
When I try to require the gem, I get:
"cannot load such file -- influxdb/errors"
I think this is because influxdb/errors was added to influxdb.rb, but the file was not added to the repository.
There seems to be no client side metric name validation being done so you end up with an obtuse server error.
E.g.
2.1-head :113 > name = "an:example"
=> "an:example"
2.1-head :114 > data = {:value => 0, :time => Time.now.to_i}
=> {:value=>0, :time=>1394712156}
2.1-head :115 > influxdb.write_point(name, data)
RuntimeError: Write failed with 'Bad Request'
from /home/charl/.rvm/gems/ruby-2.1-head@global/gems/influxdb-0.0.16/lib/influxdb/client.rb:131:in `_write'
from /home/charl/.rvm/gems/ruby-2.1-head@global/gems/influxdb-0.0.16/lib/influxdb/client.rb:121:in `write_point'
from (irb):115
from /home/charl/.rvm/rubies/ruby-2.1-head/bin/irb:11:in `<main>'
In my case it looks like colons in the metric name are causing issues.
The InfluxDB 0.9 docs mention that the default for time_precision is nanoseconds, unless specified otherwise. The ruby client defaults to a precision of seconds unless specified explicitly.
The difference in the behavior has caused me quite a headache debugging why my metrics were not showing up when sending nanoseconds without explicitly defining time_precision: 'n'
when connecting to influxdb.
Was there a specific reason to choose a different default in the ruby client?
Get this endless error loop when try to write data with influxdb.write_point(name, values: { value: 1000 })
D, [2015-10-08T16:01:47.123284 #25257] DEBUG -- : [httplog] Connecting: localhost:8086
D, [2015-10-08T16:01:47.124780 #25257] DEBUG -- : [httplog] Sending: POST http://localhost:8086/write?db=metrics_development&precision=s&u=IM&p=password
D, [2015-10-08T16:01:47.124923 #25257] DEBUG -- : [httplog] Data: listed_vehicle value=1000
D, [2015-10-08T16:01:47.231284 #25257] DEBUG -- : [httplog] Status: 204
D, [2015-10-08T16:01:47.231490 #25257] DEBUG -- : [httplog] Benchmark: 0.10622857399994245 seconds
E, [2015-10-08T16:01:47.234091 #25257] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Zlib::GzipFile::Error: not in gzip format> - retrying in 0.01s.
D, [2015-10-08T16:01:47.244934 #25257] DEBUG -- : [httplog] Connecting: localhost:8086
D, [2015-10-08T16:01:47.249441 #25257] DEBUG -- : [httplog] Sending: POST http://localhost:8086/write?db=metrics_development&precision=s&u=IM&p=password
D, [2015-10-08T16:01:47.249731 #25257] DEBUG -- : [httplog] Data: listed_vehicle value=1000
D, [2015-10-08T16:01:47.296315 #25257] DEBUG -- : [httplog] Status: 204
D, [2015-10-08T16:01:47.296566 #25257] DEBUG -- : [httplog] Benchmark: 0.0464037459996689 seconds
E, [2015-10-08T16:01:47.299095 #25257] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Zlib::GzipFile::Error: not in gzip format> - retrying in 0.02s.
The tests depend on the order in which key/value pairs are serialized which is causing it fail on some ruby versions and not others. We shouldn't be dependent on the order of hash serialization.
The README states that it is only compatible with 0.9.x, but I have tried writing data with the influxdb-ruby master branch library to influxdb 0.9.1 and I get errors. It would seem that influxdb-ruby is still incompatible with 0.9.0.
Can we keep the README as stating it is compatible with 0.8.x until we have verified that 0.9.x actually works? #92 would seem to actually need to be merged before we can work with 0.9.x.
It would be useful to remove this line: "If you're reading this message, then you should only expect support for InfluxDB v0.9.0 and higher."
Also, query() should allow an optional override.
Hey folks, would it be possible to release commit #425cbb955 as 0.1.9?
The user permissions support that's pending in master would make a Rubyist's life much easier :-)
Thanks!
When following the example from the README the client still attempts to connect through TCP on the default port:
2.2.1 :001 > require 'influxdb'
=> true
2.2.1 :002 > host = '127.0.0.1'
=> "127.0.0.1"
2.2.1 :003 > port = 4444
=> 4444
2.2.1 :004 >
2.2.1 :005 > influxdb = InfluxDB::Client.new :udp => { :host => host, :port => port }
=> #<InfluxDB::Client:0x00000001a00590 @hosts=["localhost"], @port=8086, @username="root", @password="root", @use_ssl=false, @time_precision="s", @initial_delay=0.01, @max_delay=30, @open_timeout=5, @read_timeout=300, @async=false, @retry=-1>
2.2.1 :006 >
2.2.1 :007 > name = 'hitchhiker'
=> "hitchhiker"
2.2.1 :008 >
2.2.1 :009 > data = {
2.2.1 :010 > :answer => 42,
2.2.1 :011 > :question => "life the universe and everything?"
2.2.1 :012?> }
=> {:answer=>42, :question=>"life the universe and everything?"}
2.2.1 :013 >
2.2.1 :014 > influxdb.write_point(name, data)
E, [2015-04-25T21:48:36.342313 #21026] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 8086> - retrying in 0.01s.
E, [2015-04-25T21:48:36.352889 #21026] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 8086> - retrying in 0.02s.
E, [2015-04-25T21:48:36.373542 #21026] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 8086> - retrying in 0.04s.
E, [2015-04-25T21:48:36.414519 #21026] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 8086> - retrying in 0.08s.
E, [2015-04-25T21:48:36.495320 #21026] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 8086> - retrying in 0.16s.
E, [2015-04-25T21:48:36.655993 #21026] ERROR -- : [InfluxDB] Failed to contact host localhost: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 8086> - retrying in 0.32s.
Validated the same behavior in jruby-1.7.19.
[root@ecLog01 ~]# irb
irb(main):001:0>
irb(main):002:0* require 'influxdb'
=> true
irb(main):003:0>
irb(main):004:0* InfluxDB::VERSION
=> "0.1.9"
irb(main):005:0>
irb(main):006:0* influxdb = InfluxDB::Client.new
=> #<InfluxDB::Client:0x00000001f8e598 @hosts=["localhost"], @PORT=8086, @path="", @username="root", @password="root", @auth_method="params", @use_ssl=false, @verify_ssl=true, @ssl_ca_cert=false, @time_precision="s", @initial_delay=0.01, @max_delay=30, @open_timeout=5,
@read_timeout=300, @async=false, @Retry=-1, @udp_client=nil>
irb(main):007:0>
irb(main):008:0* database = 'site_development'
=> "site_development"
irb(main):009:0>
irb(main):010:0* influxdb.create_database(database)
InfluxDB::Error: 404 page not found
from /usr/local/share/ruby/gems/2.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:384:in `block in post'
from /usr/local/share/ruby/gems/2.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:431:in `call'
from /usr/local/share/ruby/gems/2.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:431:in `connect_with_retry'
from /usr/local/share/ruby/gems/2.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:375:in `post'
from /usr/local/share/ruby/gems/2.0/gems/influxdb-0.1.9/lib/influxdb/client.rb:94:in `create_database'
from (irb):10
from /usr/bin/irb:12:in `<main>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.