fluent-plugin-collectd-nest 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bba55592cd34722ec7367e2982ec508733e6d709
4
- data.tar.gz: 94cf0b675dfedcd6c4714ee3eb6512c255e195a8
3
+ metadata.gz: 8a6c9c825dcac21c10cc64d0a14d4b2c1a627f24
4
+ data.tar.gz: 01b92bd981e2912400fe166434f489b94edd61a9
5
5
  SHA512:
6
- metadata.gz: 2abad621c9710d0cdcd15f91de134b19ec650619c3f9182a50f1c929130b20d1f05e2c84fe95519b9447f1a4cb2ded33a399e19257bfeabfc3aa7f57e50e50ee
7
- data.tar.gz: 1f440928fba063c64efe1958aadba16dcb3678fe900b0981eeb3443237b1f6e45f0c1dfdae7337bda31c2ab4d0373649e51e851624f3afe2f4806b279d3d9ffb
6
+ metadata.gz: a585ddc20fc0adf61ad51440aa384ff4298fd355473d9afbeb7392b704298e03e719c9c76facb751262ca1e4fea5a1fb9b9a6e4c383672c45c1d395328d4e9ca
7
+ data.tar.gz: acc742fca42df97fde3d1df3c5a133c81b6f21bac10b9af2b7bf8d890481d8ef2b3b6b4bbef227d9d8c7980180e1f8f321c1e81836dbdbc7c2f70883ae2b2336
data/README.md CHANGED
@@ -22,20 +22,42 @@ If you use fluentd
22
22
  If the following record is passed:
23
23
 
24
24
  ```js
25
- [{"time" => 1000, "host" => 'host_v', "interval" => 5, "plugin" => 'plugin_v', "plugin_instance" => 'plugin_instance_v', "type" => 'type_v', "type_instance" => 'type_instance_v', "values" => ['v1', 'v2'], "dsnames" => ['n1', 'n2'], "dstypes" => ['t1', 't2']}]
25
+ {"time":1000, "host":"host_v", "interval":5, "plugin":"plugin_v", "plugin_instance":"plugin_instance_v",
26
+ "type":"type_v", "type_instance":"type_instance_v", "values":["v1", "v2"], "dsnames":["n1", "n2"],
27
+ "dstypes":["t1", "t2"]}
26
28
  ```
27
29
 
28
30
  then you get new record:
29
31
 
30
32
  ```js
31
- [{"host" => "host_v", "collectd": {"time" => 1000, "interval" => 5,
32
- "plugin" => "plugin_v", "plugin_instace" => "plugin_instance_v",
33
- "type" => "type_v", "type_instance" => "type_instance_v", "dstypes" => "t1",
34
- "plugin_v" => {"type_v" => {"n1" => "v1", "n2" => "v2"}}}}]
33
+ {"host":"host_v",
34
+ "collectd": {
35
+ "time":1000, "interval":5, "plugin":"plugin_v", "plugin_instance":"plugin_instance_v",
36
+ "type":"type_v", "type_instance":"type_instance_v", "dstypes":"t1",
37
+ "plugin_v": {"type_v": {"n1":"v1", "n2":"v2"}}
38
+ }
39
+ }
35
40
  ```
36
41
 
37
42
  Empty values in "plugin", "plugin_instance", "type" or "type_instance" will not be copied into the new tag name
38
43
 
44
+ If a records has only one value like :
45
+ ```js
46
+ {"time":1000, "host":"host_v", "interval":5, "plugin":"plugin_v", "plugin_instance":"plugin_instance_v",
47
+ "type":"type_v", "type_instance":"type_instance_v", "values":["v1"], "dsnames":["n1"],
48
+ "dstypes":["t1"]}
49
+ ```
50
+ then the new record will be:
51
+
52
+ ```js
53
+ {"host":"host_v",
54
+ "collectd": {
55
+ "time":1000, "interval":5, "plugin":"plugin_v", "plugin_instance":"plugin_instance_v",
56
+ "type":"type_v", "type_instance":"type_instance_v", "dstypes":"t1",
57
+ "plugin_v": {"type_v":"v1"}
58
+ }
59
+ }
60
+ ```
39
61
 
40
62
  ## WARNING
41
63
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -44,11 +44,14 @@ module Fluent
44
44
  rec_plugin = record['plugin']
45
45
  rec_type = record['type']
46
46
  record[rec_plugin] = {rec_type => {}}
47
-
48
- record['values'].each_with_index { |value, index|
49
- record[rec_plugin][rec_type][record['dsnames'][index]] = value
50
- }
51
- record['dstypes'] = record['dstypes'].uniq
47
+ if record['dsnames'].length == 1
48
+ record[rec_plugin][rec_type] = record['values']
49
+ else
50
+ record['values'].each_with_index { |value, index|
51
+ record[rec_plugin][rec_type][record['dsnames'][index]] = value
52
+ }
53
+ record['dstypes'] = record['dstypes'].uniq
54
+ end
52
55
  record.delete('host')
53
56
  record.delete('dsnames')
54
57
  record.delete('values')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-collectd-nest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sherkhonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-15 00:00:00.000000000 Z
11
+ date: 2017-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd