fluent-plugin-cmetrics 0.1.0.rc8 → 0.1.0

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: e207c02b8b1d7751c344573ec09c0d1ccf56c83d99776b2dade2e3b1366cb3d7
4
- data.tar.gz: 448a06563a66ff12155a5059598c6fb99334f178f4564c0220c7baaecbc19eed
3
+ metadata.gz: 24fd1261db862a55b33f49932214689ec9b65bdcd8aa0c3287993f21bba26943
4
+ data.tar.gz: c264c77b3be6894a9a36a5053b142ed8b27fb3fc89c6b2de74b36bc6ec407d01
5
5
  SHA512:
6
- metadata.gz: a7219f2904e99a3b8f48f6fbaaa89d4261169563919be1d02552322b78b2756e56218e1982ef36bb93932813659e7c20ef40724f2768d6c2568f0b2fab24fc7f
7
- data.tar.gz: fee515f5d3ae1cf09ce5af4fe4e45a6a471255d9db3ab4e9226c53cf74ea5146e764956fba8e78d16ddb65fee5e6a8b48530213d9c1d0e075cd54864d5fc4ec5
6
+ metadata.gz: f0db025054c9c808875e29612dba17abccdb6fc6f3337cd41f2b68a2c6429b3133eb07cd8a4fb3e0a38f532a70f0c241bc597675f1767057db6fa8ca40f3d548
7
+ data.tar.gz: fa1764de2e06cc32c2d880366b98d3912224500e7214cd3cb75231813c09515b865279ec7e9a0ea639638968e1c624df2efec7c5706678c0f175a8719d63595e
data/README.md CHANGED
@@ -110,6 +110,12 @@ Specify splunk source name
110
110
 
111
111
  Specify splunk sourcetype name
112
112
 
113
+ ### only_use_last_field_keys (bool) (optional)
114
+
115
+ Whether using only last key values or not when processing for field keys
116
+
117
+ Default value: `false`
118
+
113
119
  ### \<fields\> section (optional) (single)
114
120
 
115
121
  This secsion is used for adding extra fields as dimensions into cmetrics msgpack Splunk metric payload.
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-cmetrics"
6
- spec.version = "0.1.0.rc8"
6
+ spec.version = "0.1.0"
7
7
  spec.authors = ["Hiroshi Hatake"]
8
8
  spec.email = ["cosmo0920.oucc@gmail.com"]
9
9
 
@@ -44,8 +44,10 @@ module Fluent
44
44
  config_param :source, :string, default: nil
45
45
  desc "Specify splunk sourcetype name"
46
46
  config_param :sourcetype, :string, default: nil
47
- config_section :fields, init: false, multi: false,required: false do
48
- # Nothing here. For later purpose.
47
+ desc "Whether using only last key values or not when processing for field keys"
48
+ config_param :only_use_last_field_keys, :bool, default: false
49
+ config_section :fields, init: false, multi: false, required: false do
50
+ # Other parameters nothing here. For later purpose.
49
51
  end
50
52
 
51
53
  def initialize
@@ -77,9 +79,6 @@ module Fluent
77
79
  end
78
80
  extra_fields = {}
79
81
 
80
- @fields_accessors.each do |key, accessor|
81
- extra_fields[key] = accessor.call(record)
82
- end
83
82
  payload = {
84
83
  host: host,
85
84
  # From the API reference
@@ -96,7 +95,16 @@ module Fluent
96
95
  if dims = @cmetrics_dims_accessor.call(record)
97
96
  fields.merge!(dims)
98
97
  end
99
- if @fields_accessors
98
+ @fields_accessors.each do |key, accessor|
99
+ if record = accessor.call(record)
100
+ record.each do |k, v|
101
+ if @only_use_last_field_keys
102
+ extra_fields[k.split(".").last] = v
103
+ else
104
+ extra_fields[k] = v
105
+ end
106
+ end
107
+ end
100
108
  fields.merge!(extra_fields)
101
109
  end
102
110
  payload.merge!(fields)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cmetrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2021-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 1.3.1
124
+ version: '0'
125
125
  requirements: []
126
126
  rubygems_version: 3.2.22
127
127
  signing_key: