influxdb 0.6.1 → 0.6.2

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: 9b1a5b7dc10839360a584d7b4eee0c6163c2b0cdcb653a0963cdfe2b5612fcb4
4
- data.tar.gz: ab5b75766b41b32edf7669e7efc521540d407f17b7148c285b673b93db96d86d
3
+ metadata.gz: a7762707820de5633483a02078dd8d6254fbda6bd412fbf56c67e8517bd51684
4
+ data.tar.gz: 3ba80a79c409b7768a65616cf2f6b1e7a6097c862799a56cf5a9bc419a5c49e5
5
5
  SHA512:
6
- metadata.gz: 55a4402f0355c7bb6269e05d487d5d941e8d72675653ada7a8f41903b67040c2602738aa3eb2f4619530f49f9202595ed258a4ace8e0ec130d2ba64bfec66a4f
7
- data.tar.gz: a134972af2b74c6704a08485ac784cf54f9696cd0b3db7788b7d14156ecd51a36110763565f2b115c116e949a7d503e630b33b4e08018632900bf3516719ca62
6
+ metadata.gz: 76cf43822faa5426b10160f7bb40cbd48af59a4cd1bfd494cd7978a82484b984e35440e3f714491884f78e6d497163567c162e66164c602bb7eeefe84c7b86a9
7
+ data.tar.gz: 742e37b48e925a5e0985570cc502a976c41f9059258d6347a9a132d8a4ef452d070f344aa20e4880a1b0bd800a887220816c9c370f2a176a04855a18dc865b98
@@ -21,6 +21,10 @@ Layout/EmptyLinesAroundArguments:
21
21
  Layout/SpaceBeforeBlockBraces:
22
22
  EnforcedStyleForEmptyBraces: space
23
23
 
24
+ Layout/AlignHash:
25
+ EnforcedColonStyle: table
26
+ EnforcedHashRocketStyle: table
27
+
24
28
  Metrics/AbcSize:
25
29
  Max: 20
26
30
 
@@ -8,9 +8,9 @@ before_install:
8
8
  - bin/provision.sh
9
9
  rvm:
10
10
  - 2.2.9
11
- - 2.3.7
12
- - 2.4.4
13
- - 2.5.1
11
+ - 2.3.8
12
+ - 2.4.5
13
+ - 2.5.3
14
14
  - ruby-head
15
15
  env:
16
16
  - TEST_TASK=spec
@@ -20,29 +20,31 @@ matrix:
20
20
  - rvm: jruby-head
21
21
  - rvm: ruby-head
22
22
  - rvm: jruby-9.1.5.0
23
- - rvm: 2.5.1
23
+ - rvm: 2.5.3
24
24
  env: influx_version=nightly channel=nightlies
25
25
  include:
26
- - rvm: 2.5.1
26
+ - rvm: 2.5.3
27
27
  env: TEST_TASK=rubocop
28
28
  - rvm: jruby-9.1.5.0
29
29
  - rvm: jruby-head
30
30
  env: JRUBY_OPTS='--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -J-Xmx256M'
31
- - rvm: 2.5.1
31
+ - rvm: 2.5.3
32
32
  env: influx_version=1.0.2 pkghash=88f6c30fec2c6e612e802e23b9161fdfc7c5c29f6be036f0376326445aff0037
33
- - rvm: 2.5.1
33
+ - rvm: 2.5.3
34
34
  env: influx_version=1.1.0 pkghash=f1520a2e18e0ab47e8a8810671e07d5a47960e54f7553b78bebe7d3c7594742f
35
- - rvm: 2.5.1
35
+ - rvm: 2.5.3
36
36
  env: influx_version=1.2.4 pkghash=2fac8391e04aa1bec9151e8f0d8f18df030c866af2b4963ab7d86c6ddc172182
37
- - rvm: 2.5.1
37
+ - rvm: 2.5.3
38
38
  env: influx_version=1.3.6 pkghash=6406cdd21466bcb832b967078adaa9f07cb6ae524a6579c15141692031f5f840
39
- - rvm: 2.5.1
39
+ - rvm: 2.5.3
40
40
  env: influx_version=1.4.3 pkghash=0477080f1d1cf8e1242dc7318280b9010c4c45cf6a415a2a5de607ae17fa0359
41
- - rvm: 2.5.1
41
+ - rvm: 2.5.3
42
42
  env: influx_version=1.5.2 pkghash=42fede7b497bdf30d4eb5138db218d1add986fca4fce4a8bcd9c7d6dabaf572a
43
- - rvm: 2.5.1
43
+ - rvm: 2.5.3
44
44
  env: influx_version=1.6.1 pkghash=a833ac16890182a75983c61e5fe6471ae27cbab7984d7b7361034887b7428de2
45
- - rvm: 2.5.1
45
+ - rvm: 2.5.3
46
+ env: influx_version=1.7.0 pkghash=0615a395b3f8e68455b0a8a2584d00ff8694f62caf77468900f7cf0a77f2b8be
47
+ - rvm: 2.5.3
46
48
  env: influx_version=nightly channel=nightlies
47
49
  fail_fast: true
48
50
  addons:
@@ -2,6 +2,11 @@
2
2
 
3
3
  For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/commits/master).
4
4
 
5
+ ## v0.6.2, released 2018-11-30
6
+
7
+ - Added `InfluxDB.convert_timestamp` utility to convert a `Time` to a
8
+ timestamp with (taken from PR influxdb-rails#53 by @ChrisBr).
9
+
5
10
  ## v0.6.1, released 2018-08-23
6
11
 
7
12
  - Fix `InfluxDB::Client#delete_retention_policy`: the database name
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec", "~> 3.6"
24
- spec.add_development_dependency "rubocop", "~> 0.49"
24
+ spec.add_development_dependency "rubocop", "~> 0.60.0"
25
25
  spec.add_development_dependency "webmock", "~> 3.0"
26
26
  end
@@ -4,6 +4,7 @@ require "influxdb/logging"
4
4
  require "influxdb/max_queue"
5
5
  require "influxdb/point_value"
6
6
  require "influxdb/config"
7
+ require "influxdb/timestamp_conversion"
7
8
 
8
9
  require "influxdb/writer/async"
9
10
  require "influxdb/writer/udp"
@@ -58,6 +58,7 @@ module InfluxDB
58
58
  unless (config.retry == -1 || retry_count <= config.retry) && !stopped?
59
59
  raise InfluxDB::ConnectionError, "Tried #{retry_count - 1} times to reconnect but failed."
60
60
  end
61
+
61
62
  log(:warn) { "Failed to contact host #{host}: #{e.inspect} - retrying in #{delay}s." }
62
63
  sleep delay
63
64
  delay = [config.max_delay, delay * 2].min
@@ -96,13 +97,14 @@ module InfluxDB
96
97
  end
97
98
 
98
99
  errors = errors_from_response(parsed_response)
99
-
100
100
  raise InfluxDB::QueryError, errors if errors
101
+
101
102
  options.fetch(:parse, false) ? parsed_response : response
102
103
  end
103
104
 
104
105
  def errors_from_response(parsed_resp)
105
106
  return unless parsed_resp.is_a?(Hash)
107
+
106
108
  parsed_resp
107
109
  .fetch('results', [])
108
110
  .fetch(0, {})
@@ -168,6 +168,7 @@ module InfluxDB
168
168
 
169
169
  OPTIONS_FROM_PARAMS.each_with_object({}) do |k, opts|
170
170
  next unless params[k.to_s].size == 1
171
+
171
172
  opts[k] = coerce(k, params[k.to_s].first)
172
173
  end
173
174
  end
@@ -10,6 +10,7 @@ module InfluxDB
10
10
 
11
11
  def logger
12
12
  return false if @logger == false
13
+
13
14
  @logger ||= ::Logger.new(STDERR).tap { |logger| logger.level = Logger::INFO }
14
15
  end
15
16
 
@@ -5,6 +5,7 @@ module InfluxDB
5
5
 
6
6
  def initialize(max = 10_000)
7
7
  raise ArgumentError, "queue size must be positive" if max <= 0
8
+
8
9
  @max = max
9
10
  super()
10
11
  end
@@ -21,11 +21,11 @@ module InfluxDB
21
21
  private
22
22
 
23
23
  ESCAPES = {
24
- measurement: [' '.freeze, ','.freeze],
25
- tag_key: ['='.freeze, ' '.freeze, ','.freeze],
26
- tag_value: ['='.freeze, ' '.freeze, ','.freeze],
27
- field_key: ['='.freeze, ' '.freeze, ','.freeze, '"'.freeze],
28
- field_value: ["\\".freeze, '"'.freeze],
24
+ measurement: [' '.freeze, ','.freeze],
25
+ tag_key: ['='.freeze, ' '.freeze, ','.freeze],
26
+ tag_value: ['='.freeze, ' '.freeze, ','.freeze],
27
+ field_key: ['='.freeze, ' '.freeze, ','.freeze, '"'.freeze],
28
+ field_value: ["\\".freeze, '"'.freeze],
29
29
  }.freeze
30
30
 
31
31
  private_constant :ESCAPES
@@ -34,7 +34,7 @@ module InfluxDB
34
34
  # rubocop:disable Layout/AlignParameters
35
35
  str = str.encode "UTF-8".freeze, "UTF-8".freeze,
36
36
  invalid: :replace,
37
- undef: :replace,
37
+ undef: :replace,
38
38
  replace: "".freeze
39
39
  # rubocop:enable Layout/AlignParameters
40
40
 
@@ -46,6 +46,7 @@ module InfluxDB
46
46
 
47
47
  def escape_values(values)
48
48
  return if values.nil?
49
+
49
50
  values.map do |k, v|
50
51
  key = escape(k.to_s, :field_key)
51
52
  val = escape_value(v)
@@ -74,8 +74,8 @@ module InfluxDB
74
74
 
75
75
  def write(data, precision, retention_policy = nil, database = nil)
76
76
  params = {
77
- db: database || config.database,
78
- precision: precision || config.time_precision,
77
+ db: database || config.database,
78
+ precision: precision || config.time_precision,
79
79
  }
80
80
 
81
81
  params[:rp] = retention_policy if retention_policy
@@ -4,6 +4,7 @@ module InfluxDB
4
4
  def list_measurements(database = config.database)
5
5
  data = execute("SHOW MEASUREMENTS", db: database, parse: true)
6
6
  return nil if data.nil? || data["results"][0]["series"].nil?
7
+
7
8
  data["results"][0]["series"][0]["values"].flatten
8
9
  end
9
10
 
@@ -9,6 +9,7 @@ module InfluxDB
9
9
  resp = execute("SHOW SERIES".freeze, parse: true, db: config.database)
10
10
  resp = fetch_series(resp)
11
11
  return [] if resp.empty?
12
+
12
13
  raw_values(resp[0])
13
14
  .fetch('values'.freeze, [])
14
15
  .map { |val| val[0].split(',')[0] }
@@ -0,0 +1,23 @@
1
+ module InfluxDB #:nodoc:
2
+ TIMESTAMP_CONVERSIONS = {
3
+ "ns" => 1e9.to_r,
4
+ nil => 1e9.to_r,
5
+ "u" => 1e6.to_r,
6
+ "ms" => 1e3.to_r,
7
+ "s" => 1.to_r,
8
+ "m" => 1.to_r / 60,
9
+ "h" => 1.to_r / 60 / 60,
10
+ }.freeze
11
+ private_constant :TIMESTAMP_CONVERSIONS
12
+
13
+ # Converts a Time to a timestamp with the given precision.
14
+ #
15
+ # `convert_timestamp(Time.now, "ms")` might return `1543533308243`.
16
+ def self.convert_timestamp(time, time_precision)
17
+ factor = TIMESTAMP_CONVERSIONS.fetch(time_precision) do
18
+ raise "Invalid time precision: #{time_precision}"
19
+ end
20
+
21
+ (time.to_r * factor).to_i
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.6.1".freeze
2
+ VERSION = "0.6.2".freeze
3
3
  end
@@ -19,10 +19,12 @@ module InfluxDB
19
19
  WORKER_MUTEX = Mutex.new
20
20
  def worker
21
21
  return @worker if @worker
22
+
22
23
  WORKER_MUTEX.synchronize do
23
24
  # this return is necessary because the previous mutex holder
24
25
  # might have already assigned the @worker
25
26
  return @worker if @worker
27
+
26
28
  @worker = Worker.new(client, config)
27
29
  end
28
30
  end
@@ -65,26 +65,26 @@ describe InfluxDB::Client do
65
65
 
66
66
  let :response do
67
67
  { "results" => [{ "statement_id" => 0,
68
- "series" => [{ "name" => "requests_per_minute",
69
- "columns" => %w[time value],
70
- "values" => [%w[2018-04-02T00:00:00Z 204]] }] },
68
+ "series" => [{ "name" => "requests_per_minute",
69
+ "columns" => %w[time value],
70
+ "values" => [%w[2018-04-02T00:00:00Z 204]] }] },
71
71
  { "statement_id" => 1 },
72
72
  { "statement_id" => 2,
73
- "series" => [{ "name" => "requests_per_minute",
74
- "columns" => %w[time value],
75
- "values" => [%w[2018-04-02T00:00:00Z 204]] }] }] }
73
+ "series" => [{ "name" => "requests_per_minute",
74
+ "columns" => %w[time value],
75
+ "values" => [%w[2018-04-02T00:00:00Z 204]] }] }] }
76
76
  end
77
77
 
78
78
  let :expected_result do
79
79
  [
80
- [{ "name" => "requests_per_minute",
81
- "tags" => nil,
82
- "values" => [{ "time" => "2018-04-02T00:00:00Z",
80
+ [{ "name" => "requests_per_minute",
81
+ "tags" => nil,
82
+ "values" => [{ "time" => "2018-04-02T00:00:00Z",
83
83
  "value" => "204" }] }],
84
84
  [],
85
- [{ "name" => "requests_per_minute",
86
- "tags" => nil,
87
- "values" => [{ "time" => "2018-04-02T00:00:00Z",
85
+ [{ "name" => "requests_per_minute",
86
+ "tags" => nil,
87
+ "values" => [{ "time" => "2018-04-02T00:00:00Z",
88
88
  "value" => "204" }] }],
89
89
  ]
90
90
  end
@@ -113,24 +113,24 @@ describe InfluxDB::Client do
113
113
 
114
114
  let :response do
115
115
  { "results" => [{ "statement_id" => 0,
116
- "series" => [{ "name" => "requests_per_minute",
117
- "tags" => { "status_code" => "200" },
118
- "columns" => %w[time value],
119
- "values" => [%w[2018-04-02T00:00:00Z 204]] },
120
- { "name" => "requests_per_minute",
121
- "tags" => { "status_code" => "500" },
122
- "columns" => %w[time value],
123
- "values" => [%w[2018-04-02T00:00:00Z 204]] }] }] }
116
+ "series" => [{ "name" => "requests_per_minute",
117
+ "tags" => { "status_code" => "200" },
118
+ "columns" => %w[time value],
119
+ "values" => [%w[2018-04-02T00:00:00Z 204]] },
120
+ { "name" => "requests_per_minute",
121
+ "tags" => { "status_code" => "500" },
122
+ "columns" => %w[time value],
123
+ "values" => [%w[2018-04-02T00:00:00Z 204]] }] }] }
124
124
  end
125
125
 
126
126
  let :expected_result do
127
- [[{ "name" => "requests_per_minute",
128
- "tags" => { "status_code" => "200" },
129
- "values" => [{ "time" => "2018-04-02T00:00:00Z",
127
+ [[{ "name" => "requests_per_minute",
128
+ "tags" => { "status_code" => "200" },
129
+ "values" => [{ "time" => "2018-04-02T00:00:00Z",
130
130
  "value" => "204" }] },
131
- { "name" => "requests_per_minute",
132
- "tags" => { "status_code" => "500" },
133
- "values" => [{ "time" => "2018-04-02T00:00:00Z",
131
+ { "name" => "requests_per_minute",
132
+ "tags" => { "status_code" => "500" },
133
+ "values" => [{ "time" => "2018-04-02T00:00:00Z",
134
134
  "value" => "204" }] }]]
135
135
  end
136
136
 
@@ -49,7 +49,8 @@ describe InfluxDB::Client do
49
49
  describe "#list_cluster_admins" do
50
50
  let(:response) do
51
51
  { "results" => [{ "statement_id" => 0,
52
- "series" => [{ "columns" => %w[user admin], "values" => [["dbadmin", true], ["foobar", false]] }] }] }
52
+ "series" => [{ "columns" => %w[user admin],
53
+ "values" => [["dbadmin", true], ["foobar", false]] }] }] }
53
54
  end
54
55
  let(:expected_result) { ["dbadmin"] }
55
56
 
@@ -17,10 +17,12 @@ describe InfluxDB::Client do
17
17
  let(:database) { "testdb" }
18
18
  let(:response) do
19
19
  { "results" => [{ "statement_id" => 0,
20
- "series" => [{ "name" => "otherdb", "columns" => %w[name query],
21
- "values" => [["clicks_per_hour", "CREATE CONTINUOUS QUERY clicks_per_hour ON otherdb BEGIN SELECT count(name) INTO \"otherdb\".\"default\".clicksCount_1h FROM \"otherdb\".\"default\".clicks GROUP BY time(1h) END"]] },
22
- { "name" => "testdb", "columns" => %w[name query],
23
- "values" => [["event_counts", "CREATE CONTINUOUS QUERY event_counts ON testdb BEGIN SELECT count(type) INTO \"testdb\".\"default\".typeCount_10m_byType FROM \"testdb\".\"default\".events GROUP BY time(10m), type END"]] }] }] }
20
+ "series" => [{ "name" => "otherdb",
21
+ "columns" => %w[name query],
22
+ "values" => [["clicks_per_hour", "CREATE CONTINUOUS QUERY clicks_per_hour ON otherdb BEGIN SELECT count(name) INTO \"otherdb\".\"default\".clicksCount_1h FROM \"otherdb\".\"default\".clicks GROUP BY time(1h) END"]] },
23
+ { "name" => "testdb",
24
+ "columns" => %w[name query],
25
+ "values" => [["event_counts", "CREATE CONTINUOUS QUERY event_counts ON testdb BEGIN SELECT count(type) INTO \"testdb\".\"default\".typeCount_10m_byType FROM \"testdb\".\"default\".events GROUP BY time(10m), type END"]] }] }] }
24
26
  end
25
27
 
26
28
  let(:expected_result) do
@@ -16,8 +16,8 @@ describe InfluxDB::Client do
16
16
 
17
17
  let :response do
18
18
  { "results" => [{ "statement_id" => 0,
19
- "series" => [{ "name" => "requests_per_minute",
20
- "columns" => %w[time value] }] }] }
19
+ "series" => [{ "name" => "requests_per_minute",
20
+ "columns" => %w[time value] }] }] }
21
21
  end
22
22
 
23
23
  before do
@@ -6,10 +6,10 @@ describe InfluxDB::Client do
6
6
  described_class.new(
7
7
  "database",
8
8
  {
9
- host: "influxdb.test",
10
- port: 9999,
11
- username: "username",
12
- password: "password",
9
+ host: "influxdb.test",
10
+ port: 9999,
11
+ username: "username",
12
+ password: "password",
13
13
  time_precision: "s"
14
14
  }.merge(args)
15
15
  )
@@ -18,8 +18,8 @@ describe InfluxDB::Client do
18
18
 
19
19
  let(:response) do
20
20
  { "results" => [{ "statement_id" => 0,
21
- "series" => [{ "name" => "requests_per_minute",
22
- "columns" => %w[time value] }] }] }
21
+ "series" => [{ "name" => "requests_per_minute",
22
+ "columns" => %w[time value] }] }] }
23
23
  end
24
24
 
25
25
  before do
@@ -7,10 +7,10 @@ require "json"
7
7
  describe InfluxDB::Client do
8
8
  let(:subject) do
9
9
  described_class.new "database", {
10
- host: "influxdb.test",
11
- port: 9999,
12
- username: "username",
13
- password: "password",
10
+ host: "influxdb.test",
11
+ port: 9999,
12
+ username: "username",
13
+ password: "password",
14
14
  time_precision: "s"
15
15
  }.merge(args)
16
16
  end
@@ -33,11 +33,11 @@ describe InfluxDB::Client do
33
33
 
34
34
  let(:response_line_1) do
35
35
  { "results" => [{ "statement_id" => 0,
36
- "series" => [{ "name" => "cpu", "tags" => { "region" => "pl" }, "columns" => %w[time temp value], "values" => [["2015-07-07T15:13:04Z", 34, 0.343443]] }] }] }
36
+ "series" => [{ "name" => "cpu", "tags" => { "region" => "pl" }, "columns" => %w[time temp value], "values" => [["2015-07-07T15:13:04Z", 34, 0.343443]] }] }] }
37
37
  end
38
38
  let(:response_line_2) do
39
39
  { "results" => [{ "statement_id" => 0,
40
- "series" => [{ "name" => "cpu", "tags" => { "region" => "us" }, "columns" => %w[time temp value], "values" => [["2015-07-07T14:58:37Z", 92, 0.3445], ["2015-07-07T14:59:09Z", 68, 0.8787]] }] }] }
40
+ "series" => [{ "name" => "cpu", "tags" => { "region" => "us" }, "columns" => %w[time temp value], "values" => [["2015-07-07T14:58:37Z", 92, 0.3445], ["2015-07-07T14:59:09Z", 68, 0.8787]] }] }] }
41
41
  end
42
42
  let(:response) do
43
43
  JSON.generate(response_line_1) + "\n" + JSON.generate(response_line_2)
@@ -62,28 +62,48 @@ describe InfluxDB::Client do
62
62
 
63
63
  let(:response_line_1) do
64
64
  { "results" => [{ "statement_id" => 0,
65
- "series" => [{ "name" => "access_times.service_1", "tags" => { "code" => "200", "result" => "failure", "status" => "OK" }, "columns" => %w[time value], "values" => [["2015-07-08T07:15:22Z", 327]] }] }] }
65
+ "series" => [{ "name" => "access_times.service_1",
66
+ "tags" => { "code" => "200", "result" => "failure", "status" => "OK" },
67
+ "columns" => %w[time value],
68
+ "values" => [["2015-07-08T07:15:22Z", 327]] }] }] }
66
69
  end
67
70
  let(:response_line_2) do
68
71
  { "results" => [{ "statement_id" => 0,
69
- "series" => [{ "name" => "access_times.service_1", "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" }, "columns" => %w[time value], "values" => [["2015-07-08T06:15:22Z", 873]] }] }] }
72
+ "series" => [{ "name" => "access_times.service_1",
73
+ "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" },
74
+ "columns" => %w[time value],
75
+ "values" => [["2015-07-08T06:15:22Z", 873]] }] }] }
70
76
  end
71
77
  let(:response_line_3) do
72
78
  { "results" => [{ "statement_id" => 0,
73
- "series" => [{ "name" => "access_times.service_2", "tags" => { "code" => "200", "result" => "failure", "status" => "OK" }, "columns" => %w[time value], "values" => [["2015-07-08T07:15:22Z", 943]] }] }] }
79
+ "series" => [{ "name" => "access_times.service_2",
80
+ "tags" => { "code" => "200", "result" => "failure", "status" => "OK" },
81
+ "columns" => %w[time value],
82
+ "values" => [["2015-07-08T07:15:22Z", 943]] }] }] }
74
83
  end
75
84
  let(:response_line_4) do
76
85
  { "results" => [{ "statement_id" => 0,
77
- "series" => [{ "name" => "access_times.service_2", "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" }, "columns" => %w[time value], "values" => [["2015-07-08T06:15:22Z", 606]] }] }] }
86
+ "series" => [{ "name" => "access_times.service_2",
87
+ "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" },
88
+ "columns" => %w[time value],
89
+ "values" => [["2015-07-08T06:15:22Z", 606]] }] }] }
78
90
  end
79
91
  let(:response) do
80
92
  JSON.generate(response_line_1) + "\n" + JSON.generate(response_line_2) + "\n" + JSON.generate(response_line_3) + "\n" + JSON.generate(response_line_4)
81
93
  end
82
94
  let(:expected_result) do
83
- [{ "name" => "access_times.service_1", "tags" => { "code" => "200", "result" => "failure", "status" => "OK" }, "values" => [{ "time" => "2015-07-08T07:15:22Z", "value" => 327 }] },
84
- { "name" => "access_times.service_1", "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" }, "values" => [{ "time" => "2015-07-08T06:15:22Z", "value" => 873 }] },
85
- { "name" => "access_times.service_2", "tags" => { "code" => "200", "result" => "failure", "status" => "OK" }, "values" => [{ "time" => "2015-07-08T07:15:22Z", "value" => 943 }] },
86
- { "name" => "access_times.service_2", "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" }, "values" => [{ "time" => "2015-07-08T06:15:22Z", "value" => 606 }] }]
95
+ [{ "name" => "access_times.service_1",
96
+ "tags" => { "code" => "200", "result" => "failure", "status" => "OK" },
97
+ "values" => [{ "time" => "2015-07-08T07:15:22Z", "value" => 327 }] },
98
+ { "name" => "access_times.service_1",
99
+ "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" },
100
+ "values" => [{ "time" => "2015-07-08T06:15:22Z", "value" => 873 }] },
101
+ { "name" => "access_times.service_2",
102
+ "tags" => { "code" => "200", "result" => "failure", "status" => "OK" },
103
+ "values" => [{ "time" => "2015-07-08T07:15:22Z", "value" => 943 }] },
104
+ { "name" => "access_times.service_2",
105
+ "tags" => { "code" => "500", "result" => "failure", "status" => "Internal Server Error" },
106
+ "values" => [{ "time" => "2015-07-08T06:15:22Z", "value" => 606 }] }]
87
107
  end
88
108
  let(:query) { "SELECT * FROM /access_times.*/" }
89
109