influxer 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +3 -0
- data/lib/influxer/metrics/metrics.rb +15 -1
- data/lib/influxer/version.rb +1 -1
- data/spec/metrics/metrics_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cec9cd466a9efd8fae51deb50a907b6414f0a91
|
4
|
+
data.tar.gz: e5f8a42ee86a15d2a771bdce69c816cbedd5d765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae2a0c3b78427f808a13cf53cefb320c2ef6e8ff62ece027962c65b06fc0c4db27716193781cc6b0a6be619884e73eb795d4fd96505ea45d7250fb949b3c3fa
|
7
|
+
data.tar.gz: 45d12dc4e1f446a0d33c217adbb0fd37cb9dc0bd917a2698741698397e5d2c34e539c0c20311284670fe9c5239efe77d1c69a2653d9589fa4f980d35e7341eec
|
data/Changelog.md
CHANGED
@@ -33,6 +33,7 @@ module Influxer
|
|
33
33
|
|
34
34
|
attr_reader :series
|
35
35
|
attr_accessor :tag_names
|
36
|
+
attr_accessor :retention_policy
|
36
37
|
|
37
38
|
def attributes(*attrs)
|
38
39
|
attrs.each do |name|
|
@@ -61,6 +62,10 @@ module Influxer
|
|
61
62
|
subclass.tag_names = tag_names.nil? ? [] : tag_names.dup
|
62
63
|
end
|
63
64
|
|
65
|
+
def set_retention_policy(policy_name)
|
66
|
+
@retention_policy = policy_name
|
67
|
+
end
|
68
|
+
|
64
69
|
# rubocop:disable Metrics/MethodLength
|
65
70
|
# rubocop:disable Metrics/AbcSize
|
66
71
|
def set_series(*args)
|
@@ -102,9 +107,18 @@ module Influxer
|
|
102
107
|
quoted_series(val.first)
|
103
108
|
end
|
104
109
|
else
|
105
|
-
|
110
|
+
if retention_policy.present?
|
111
|
+
[quote(@retention_policy), quote(val)].join('.')
|
112
|
+
else
|
113
|
+
quote(val)
|
114
|
+
end
|
106
115
|
end
|
107
116
|
end
|
117
|
+
|
118
|
+
def quote(name)
|
119
|
+
'"' + name.to_s.gsub(/\"/) { '\"' } + '"'
|
120
|
+
end
|
121
|
+
|
108
122
|
# rubocop:enable Metrics/MethodLength
|
109
123
|
end
|
110
124
|
|
data/lib/influxer/version.rb
CHANGED
@@ -11,6 +11,7 @@ describe Influxer::Metrics, :query do
|
|
11
11
|
|
12
12
|
specify { is_expected.to respond_to :attributes }
|
13
13
|
specify { is_expected.to respond_to :set_series }
|
14
|
+
specify { is_expected.to respond_to :set_retention_policy }
|
14
15
|
specify { is_expected.to respond_to :series }
|
15
16
|
specify { is_expected.to respond_to :write }
|
16
17
|
specify { is_expected.to respond_to :write! }
|
@@ -138,6 +139,26 @@ describe Influxer::Metrics, :query do
|
|
138
139
|
end
|
139
140
|
end
|
140
141
|
|
142
|
+
describe "#quoted_series" do
|
143
|
+
context "with retention policy" do
|
144
|
+
let(:dummy_with_retention_policy) do
|
145
|
+
Class.new(described_class) do
|
146
|
+
attributes :user_id, :test_id
|
147
|
+
set_series :dummies
|
148
|
+
set_retention_policy :week
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
it "sets retention policy" do
|
153
|
+
expect(dummy_with_retention_policy.retention_policy).to eq :week
|
154
|
+
end
|
155
|
+
|
156
|
+
it "sets quoted series with retention policy" do
|
157
|
+
expect(dummy_with_retention_policy.quoted_series).to eq "\"week\".\"dummies\""
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
141
162
|
describe ".tags" do
|
142
163
|
let(:dummy1) { Class.new(DummyMetrics) }
|
143
164
|
let!(:dummy2) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlad Dem
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|