influxdb 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c280c4f839a7d00e2c716226f06987df217edebbf7149bf309906b8b34ea2e26
4
- data.tar.gz: 3dc453ebb5a914de3e364da388255d7d38e266a468dce14dc9a7e5f9e7a2b273
3
+ metadata.gz: 9b1a5b7dc10839360a584d7b4eee0c6163c2b0cdcb653a0963cdfe2b5612fcb4
4
+ data.tar.gz: ab5b75766b41b32edf7669e7efc521540d407f17b7148c285b673b93db96d86d
5
5
  SHA512:
6
- metadata.gz: b4b0f7d6475d31e3506e4c3979548c56cd70bd9c632ba77b6d3a8fae26cc3b2885c34662848ed1096a456b2156347c8f6b8b7746ca5b68cd170f877d6b5409c4
7
- data.tar.gz: 72a5903843c25150e2daf01c31f57f3636a3f7730183704c111a6c6be5c42ed84cd42970087087292328f6ecce7ffa20313a87e09644b8199eadcd639f5c6733
6
+ metadata.gz: 55a4402f0355c7bb6269e05d487d5d941e8d72675653ada7a8f41903b67040c2602738aa3eb2f4619530f49f9202595ed258a4ace8e0ec130d2ba64bfec66a4f
7
+ data.tar.gz: a134972af2b74c6704a08485ac784cf54f9696cd0b3db7788b7d14156ecd51a36110763565f2b115c116e949a7d503e630b33b4e08018632900bf3516719ca62
@@ -29,17 +29,19 @@ matrix:
29
29
  - rvm: jruby-head
30
30
  env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
31
31
  - rvm: 2.5.1
32
- env: influx_version=1.0.2 pkghash=3e4c349cb57507913d9abda1459bdbed
32
+ env: influx_version=1.0.2 pkghash=88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037
33
33
  - rvm: 2.5.1
34
- env: influx_version=1.1.0 pkghash=682904c350ecfc2a60ec9c6c08453ef2
34
+ env: influx_version=1.1.0 pkghash=f1520a2e18e0ab47e8a8810671e07d5a47960e54f7553b78bebe7d3c7594742f
35
35
  - rvm: 2.5.1
36
- env: influx_version=1.2.4 pkghash=0545d67217393282188e5d5cdedfdc85
36
+ env: influx_version=1.2.4 pkghash=2fac8391e04aa1bec9151e8f0d8f18df030c866af2b4963ab7d86c6ddc172182
37
37
  - rvm: 2.5.1
38
- env: influx_version=1.3.6 pkghash256=6406cdd21466bcb832b967078adaa9f07cb6ae524a6579c15141692031f5f840
38
+ env: influx_version=1.3.6 pkghash=6406cdd21466bcb832b967078adaa9f07cb6ae524a6579c15141692031f5f840
39
39
  - rvm: 2.5.1
40
- env: influx_version=1.4.3 pkghash256=0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359
40
+ env: influx_version=1.4.3 pkghash=0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359
41
41
  - rvm: 2.5.1
42
- env: influx_version=1.5.2 pkghash256=42fede7b497bdf30d4eb5138db218d1add986fca4fce4a8bcd9c7d6dabaf572a
42
+ env: influx_version=1.5.2 pkghash=42fede7b497bdf30d4eb5138db218d1add986fca4fce4a8bcd9c7d6dabaf572a
43
+ - rvm: 2.5.1
44
+ env: influx_version=1.6.1 pkghash=a833ac16890182a75983c61e5fe6471ae27cbab7984d7b7361034887b7428de2
43
45
  - rvm: 2.5.1
44
46
  env: influx_version=nightly channel=nightlies
45
47
  fail_fast: true
@@ -2,6 +2,13 @@
2
2
 
3
3
  For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/commits/master).
4
4
 
5
+ ## v0.6.1, released 2018-08-23
6
+
7
+ - Fix `InfluxDB::Client#delete_retention_policy`: the database name
8
+ argument is now quoted (#221, #222 @AishwaryaRK).
9
+ - Add `InfluxDB::Client#list_measurements` and `#delete_measuerment`
10
+ (#220)
11
+
5
12
  ## v0.6.0, released 2018-07-10
6
13
 
7
14
  - Add batch query support via `InfluxDB::Client#batch` (and using
@@ -22,21 +22,14 @@ else
22
22
  fi
23
23
 
24
24
  echo "== Download verification"
25
- hash_sum=$(md5sum "${HOME}/${package_name}" | awk '{ print $1 }')
26
25
  sha2_sum=$(sha256sum "${HOME}/${package_name}" | awk '{ print $1 }')
27
26
 
28
- if [ -z "${pkghash}" ] || [ -z "${pkghash256}"]; then
27
+ if [ -z "${pkghash}" ]; then
29
28
  echo "-- Skipping, pkghash is empty"
30
- else
31
- if [ -n "${pkghash256}" ] && [ "${sha2_sum}" != "${pkghash256}" ]; then
32
- echo >&2 "E: Hash sum mismatch (got ${sha2_sum}, expected ${pkghash256})"
33
- exit 1
34
- elif [ "${hash_sum}" != "${pkghash}" ]; then
35
- echo >&2 "E: Hash sum mismatch (got ${hash_sum}, expected ${pkghash})"
36
- exit 1
37
- fi
29
+ elif [ -n "${pkghash}" ] && [ "${sha2_sum}" != "${pkghash}" ]; then
30
+ echo >&2 "E: Hash sum mismatch (got ${sha2_sum}, expected ${pkghash})"
31
+ exit 1
38
32
  fi
39
- echo "-- Download has MD5 hash: ${hash_sum}"
40
33
  echo "-- Download has SHA256 hash: ${sha2_sum}"
41
34
 
42
35
 
@@ -15,6 +15,7 @@ require "influxdb/query/continuous_query"
15
15
  require "influxdb/query/core"
16
16
  require "influxdb/query/core"
17
17
  require "influxdb/query/database"
18
+ require "influxdb/query/measurement"
18
19
  require "influxdb/query/retention_policy"
19
20
  require "influxdb/query/series"
20
21
  require "influxdb/query/user"
@@ -14,6 +14,7 @@ module InfluxDB
14
14
  include InfluxDB::Query::ContinuousQuery
15
15
  include InfluxDB::Query::RetentionPolicy
16
16
  include InfluxDB::Query::Series
17
+ include InfluxDB::Query::Measurement
17
18
 
18
19
  # Initializes a new InfluxDB client
19
20
  #
@@ -0,0 +1,16 @@
1
+ module InfluxDB
2
+ module Query
3
+ module Measurement # :nodoc:
4
+ def list_measurements(database = config.database)
5
+ data = execute("SHOW MEASUREMENTS", db: database, parse: true)
6
+ return nil if data.nil? || data["results"][0]["series"].nil?
7
+ data["results"][0]["series"][0]["values"].flatten
8
+ end
9
+
10
+ def delete_measurement(measurement_name, database = config.database)
11
+ execute "DROP MEASUREMENT \"#{measurement_name}\"", db: database
12
+ true
13
+ end
14
+ end
15
+ end
16
+ end
@@ -8,7 +8,7 @@ module InfluxDB
8
8
  default = false,
9
9
  shard_duration: nil)
10
10
  execute(
11
- "CREATE RETENTION POLICY \"#{name}\" ON #{database} " \
11
+ "CREATE RETENTION POLICY \"#{name}\" ON \"#{database}\" " \
12
12
  "DURATION #{duration} REPLICATION #{replication}" \
13
13
  "#{shard_duration ? " SHARD DURATION #{shard_duration}" : ''}" \
14
14
  "#{default ? ' DEFAULT' : ''}"
@@ -27,7 +27,7 @@ module InfluxDB
27
27
  end
28
28
 
29
29
  def delete_retention_policy(name, database)
30
- execute("DROP RETENTION POLICY \"#{name}\" ON #{database}")
30
+ execute("DROP RETENTION POLICY \"#{name}\" ON \"#{database}\"")
31
31
  end
32
32
 
33
33
  def alter_retention_policy(name,
@@ -37,7 +37,7 @@ module InfluxDB
37
37
  default = false,
38
38
  shard_duration: nil)
39
39
  execute(
40
- "ALTER RETENTION POLICY \"#{name}\" ON #{database} " \
40
+ "ALTER RETENTION POLICY \"#{name}\" ON \"#{database}\" " \
41
41
  "DURATION #{duration} REPLICATION #{replication}" \
42
42
  "#{shard_duration ? " SHARD DURATION #{shard_duration}" : ''}" \
43
43
  "#{default ? ' DEFAULT' : ''}"
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.6.1".freeze
3
3
  end
@@ -0,0 +1,53 @@
1
+ require "spec_helper"
2
+ require "json"
3
+
4
+ describe InfluxDB::Client do
5
+ let(:subject) do
6
+ described_class.new \
7
+ database: "database",
8
+ host: "influxdb.test",
9
+ port: 9999,
10
+ username: "username",
11
+ password: "password",
12
+ time_precision: "s"
13
+ end
14
+
15
+ let(:query) { nil }
16
+ let(:response) { { "results" => [{ "statement_id" => 0 }] } }
17
+
18
+ before do
19
+ stub_request(:get, "http://influxdb.test:9999/query")
20
+ .with(query: { u: "username", p: "password", q: query })
21
+ .to_return(body: JSON.generate(response))
22
+ end
23
+
24
+ describe "#list_measuremtns" do
25
+ let(:query) { "SHOW MEASUREMENTS" }
26
+
27
+ context "with measurements" do
28
+ let(:response) { { "results" => [{ "statement_id" => 0, "series" => [{ "columns" => "name", "values" => [["average_temperature"], ["h2o_feet"], ["h2o_pH"], ["h2o_quality"], ["h2o_temperature"]] }] }] } }
29
+ let(:expected_result) { %w[average_temperature h2o_feet h2o_pH h2o_quality h2o_temperature] }
30
+
31
+ it "should GET a list of measurements" do
32
+ expect(subject.list_measurements).to eq(expected_result)
33
+ end
34
+ end
35
+
36
+ context "without measurements" do
37
+ let(:response) { { "results" => [{ "statement_id" => 0 }] } }
38
+ let(:expected_result) { nil }
39
+
40
+ it "should GET a list of measurements" do
41
+ expect(subject.list_measurements).to eq(expected_result)
42
+ end
43
+ end
44
+ end
45
+
46
+ describe "#delete_retention_policy" do
47
+ let(:query) { "DROP MEASUREMENT \"foo\"" }
48
+
49
+ it "should GET to remove a database" do
50
+ expect(subject.delete_measurement('foo')).to be true
51
+ end
52
+ end
53
+ end
@@ -45,7 +45,7 @@ describe InfluxDB::Client do
45
45
 
46
46
  describe "#create_retention_policy" do
47
47
  context "default" do
48
- let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON foo DURATION 1h REPLICATION 2 DEFAULT" }
48
+ let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 1h REPLICATION 2 DEFAULT" }
49
49
 
50
50
  it "should GET to create a new database" do
51
51
  expect(subject.create_retention_policy('1h.cpu', 'foo', '1h', 2, true)).to be_a(Net::HTTPOK)
@@ -53,7 +53,7 @@ describe InfluxDB::Client do
53
53
  end
54
54
 
55
55
  context "non-default" do
56
- let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON foo DURATION 1h REPLICATION 2" }
56
+ let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 1h REPLICATION 2" }
57
57
 
58
58
  it "should GET to create a new database" do
59
59
  expect(subject.create_retention_policy('1h.cpu', 'foo', '1h', 2)).to be_a(Net::HTTPOK)
@@ -61,7 +61,7 @@ describe InfluxDB::Client do
61
61
  end
62
62
 
63
63
  context "default_with_shard_duration" do
64
- let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h DEFAULT" }
64
+ let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 48h REPLICATION 2 SHARD DURATION 1h DEFAULT" }
65
65
 
66
66
  it "should GET to create a new database" do
67
67
  expect(subject.create_retention_policy('1h.cpu', 'foo', '48h', 2, true, shard_duration: '1h')).to be_a(Net::HTTPOK)
@@ -69,7 +69,7 @@ describe InfluxDB::Client do
69
69
  end
70
70
 
71
71
  context "non-default_with_shard_duration" do
72
- let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h" }
72
+ let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 48h REPLICATION 2 SHARD DURATION 1h" }
73
73
 
74
74
  it "should GET to create a new database" do
75
75
  expect(subject.create_retention_policy('1h.cpu', 'foo', '48h', 2, shard_duration: '1h')).to be_a(Net::HTTPOK)
@@ -78,7 +78,7 @@ describe InfluxDB::Client do
78
78
  end
79
79
 
80
80
  describe "#delete_retention_policy" do
81
- let(:query) { "DROP RETENTION POLICY \"1h.cpu\" ON foo" }
81
+ let(:query) { "DROP RETENTION POLICY \"1h.cpu\" ON \"foo\"" }
82
82
 
83
83
  it "should GET to remove a database" do
84
84
  expect(subject.delete_retention_policy('1h.cpu', 'foo')).to be_a(Net::HTTPOK)
@@ -87,7 +87,7 @@ describe InfluxDB::Client do
87
87
 
88
88
  describe "#alter_retention_policy" do
89
89
  context "default" do
90
- let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 1h REPLICATION 2 DEFAULT" }
90
+ let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 1h REPLICATION 2 DEFAULT" }
91
91
 
92
92
  it "should GET to alter a new database" do
93
93
  expect(subject.alter_retention_policy('1h.cpu', 'foo', '1h', 2, true)).to be_a(Net::HTTPOK)
@@ -95,7 +95,7 @@ describe InfluxDB::Client do
95
95
  end
96
96
 
97
97
  context "non-default" do
98
- let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 1h REPLICATION 2" }
98
+ let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 1h REPLICATION 2" }
99
99
 
100
100
  it "should GET to alter a new database" do
101
101
  expect(subject.alter_retention_policy('1h.cpu', 'foo', '1h', 2)).to be_a(Net::HTTPOK)
@@ -103,7 +103,7 @@ describe InfluxDB::Client do
103
103
  end
104
104
 
105
105
  context "default_with_shard_duration" do
106
- let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h DEFAULT" }
106
+ let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 48h REPLICATION 2 SHARD DURATION 1h DEFAULT" }
107
107
 
108
108
  it "should GET to alter a new database" do
109
109
  expect(subject.alter_retention_policy('1h.cpu', 'foo', '48h', 2, true, shard_duration: '1h')).to be_a(Net::HTTPOK)
@@ -111,7 +111,7 @@ describe InfluxDB::Client do
111
111
  end
112
112
 
113
113
  context "non-default_with_shard_duration" do
114
- let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h" }
114
+ let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON \"foo\" DURATION 48h REPLICATION 2 SHARD DURATION 1h" }
115
115
 
116
116
  it "should GET to alter a new database" do
117
117
  expect(subject.alter_retention_policy('1h.cpu', 'foo', '48h', 2, shard_duration: '1h')).to be_a(Net::HTTPOK)
@@ -9,7 +9,9 @@ end
9
9
  # rubocop:enable Lint/HandleExceptions
10
10
 
11
11
  def min_influx_version(version)
12
- current = Gem::Version.new ENV.fetch("influx_version", "0")
12
+ v = ENV.fetch("influx_version", "0")
13
+ return true if v == "nightly"
14
+ current = Gem::Version.new(v)
13
15
  current >= Gem::Version.new(version)
14
16
  end
15
17
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Persen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-10 00:00:00.000000000 Z
11
+ date: 2018-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,6 +111,7 @@ files:
111
111
  - lib/influxdb/query/continuous_query.rb
112
112
  - lib/influxdb/query/core.rb
113
113
  - lib/influxdb/query/database.rb
114
+ - lib/influxdb/query/measurement.rb
114
115
  - lib/influxdb/query/retention_policy.rb
115
116
  - lib/influxdb/query/series.rb
116
117
  - lib/influxdb/query/user.rb
@@ -123,6 +124,7 @@ files:
123
124
  - spec/influxdb/cases/query_continuous_query_spec.rb
124
125
  - spec/influxdb/cases/query_core_spec.rb
125
126
  - spec/influxdb/cases/query_database_spec.rb
127
+ - spec/influxdb/cases/query_measurements.rb
126
128
  - spec/influxdb/cases/query_retention_policy_spec.rb
127
129
  - spec/influxdb/cases/query_series_spec.rb
128
130
  - spec/influxdb/cases/query_shard_spec.rb
@@ -175,6 +177,7 @@ test_files:
175
177
  - spec/influxdb/cases/query_continuous_query_spec.rb
176
178
  - spec/influxdb/cases/query_core_spec.rb
177
179
  - spec/influxdb/cases/query_database_spec.rb
180
+ - spec/influxdb/cases/query_measurements.rb
178
181
  - spec/influxdb/cases/query_retention_policy_spec.rb
179
182
  - spec/influxdb/cases/query_series_spec.rb
180
183
  - spec/influxdb/cases/query_shard_spec.rb