fluent-plugin-stackdriver-v1-metrics 0.4.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 36c9d3f125ea47812e05ed2f19f50ce2f70c23ea
4
+ data.tar.gz: f67502b4425fae6672cac1be08093a0da17b7d25
5
+ SHA512:
6
+ metadata.gz: fea7f083020c722715d5697265aac668da1a740781bc1197e0925ea1c0ed7dcd5e01583f4a57f84a35d4ffd16948e776aeedb6b3c4b5c2c629ce141721b8aa7c
7
+ data.tar.gz: 0458464c84f6e2b079cfc1f61c6f416790fa774a0fd77023feefcf49afd368bb06987a000526c52fbd703aeb339ec160059b8f43c734e91c754a89ac91410944
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ /certs/*key*
2
+ /certs/*priv*
3
+ **.gem
4
+ **.gem.sha*
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+
4
+ ## 0.1.0
5
+ * Initial release
6
+ ## 0.2.0
7
+ * Clean-up and renaming
8
+ ## 0.3.0
9
+ * Changing the metrics gathering implementation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-stackdriver-v1-metrics.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2017 Red Book Connect LLC. operating as HotSchedules
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,73 @@
1
+ # Fluentd plugin to push metrics to the Stackdriver V1 (pre-Google) API
2
+
3
+ ## Overview
4
+ This is a [buffered output plugin](http://docs.fluentd.org/v0.12/articles/buf_file) for fluentd. Buffer chunks are parsed to generate metrics based on configured criteria which are then pushed to the Stackdriver V1 (pre-Google) API. The metric publishing intervals are specified by the invervals for the buffer chunking. The plugin can compute two different types of metrics: counts of log entries matching specified criteria, and metrics derived from log entries. Currently, metric data collection has not really been tested, but count data collection is known to work.
5
+
6
+ Note that the plugin is incompatible with any plugin that uses the Ruby stackdriver library version >= 0.3.0. The Stackdriver V1 API compatibility was dropped beginning with this version.
7
+
8
+ ## Installation
9
+ ```bash
10
+ gem install fluent-plugin-stackdriver-v1-metrics
11
+ ```
12
+
13
+ ## Configuration
14
+ ```
15
+ <match>
16
+ type stackdriver-v1_metrics
17
+ api_key <Stackdriver V1 API key>
18
+ instance_id <AWS instance ID that the metrics should be attached to (optioal)>
19
+ counter_maps <JSON hash with the matching criteria and metric names>
20
+ counter_defaults <JSON list of hashes to specify metric default values>
21
+ metric_maps <JSON hash with ???>
22
+ metric_defaults <JSON list of hashes to specify metric default values>
23
+ [ fluent output buffer plugin configuration ]
24
+ </match>
25
+ ```
26
+
27
+ `api_key`: Stackdriver V1 API key
28
+
29
+ `instance_id`: AWS instance ID that the metricsc should be attach to (optional)
30
+
31
+ `counter_maps`: JSON hash of event matching criteria and metric names
32
+
33
+ `counter_defaults`: JSON list of hashes with metric default values
34
+
35
+ `metric_maps`: JSON hash of event matching criteria and metric names
36
+
37
+ `metric_defaults`: JSON list of hashes with metric default values
38
+
39
+ ## Methodology
40
+ The the metrics generation is performed by deserializing events from the buffer chunks to a hash called "event". Two types of data creation can be specified -- counters and metrics. For each type of data, there are two variables which can be set as JSON data structures in the configuration: "\*_maps" and "\*_defaults".
41
+
42
+ ### Counter data
43
+ The counter_maps variable must be set to a JSON serialized hash (the plugin value will default to an empty hash if not specified). Each key in the hash must be a valid Ruby command which evaluates to a Boolean. The corresponding value must be a Ruby command which evaulates to a Stackdriver metric name (string).
44
+
45
+ While iterating through the events in the buffer chunk, the plugin will "eval" each key in the counter_maps hash and increment the metric with the name specified by the corresponding value. For any key where no matching entry in the buffer chunk, there will be no metric created (not even a metric set to 0). If a metric needs to be sent to Stackdriver even when there are no matching entries in the buffer chunk, then the metric names and default values must be set in the counter_defaults variable.
46
+
47
+ When used, the counter_defaults variable must be specified as a JSON serialized list of hashes. In each hash in the array, the "name" key must be set to the Stackdriver metric name and the "value" key must be set to the value to use when there are no matching events for this metric in the buffer chunk. The values will typically be 0, but any integer can be used.
48
+
49
+ ### Metric data
50
+ The metric_maps variable must be set to a JSON serialized hash (the plugin value will default to an empty hash if not specified). Each key in the hash must be a valid Ruby command which evaluates to a Boolean. The corresponding value must be a Ruby command which evaulates to a Stackdriver metric name (string).
51
+
52
+ ## Usage examples
53
+ The original use case which prompted the creation of this plugin was sending fluent error counts to Stackdriver. This use case, in particular, does not lend itself to deriving metrics using the functionality of a logging backend since, when fleunt is throwing warnings or errors, the messages may not actually be getting to the logging backend. Using this plugin allows for setting up metrics and alerting on fluent problems which does not depend upon successful log transmissions to the logging back end, at least.
54
+
55
+ ```
56
+ <match *>
57
+ type copy
58
+ ...
59
+ <store>
60
+ type stackdriver-v1_metrics
61
+ api_key <your Stackdriver V1 API key>
62
+ instance_id <instance id to bind the metric to>
63
+ counter_maps '{ "event[\"tag\"] =~ /^fluent\\.(warn|error)/": "\"fluentd.daemon.daemon.\".concat(event[\"tag\"] =~ /warn/ ? \"warnings\" : \"errors\")" }'
64
+ counter_defaults '[ { "name": "fluentd.daemon.warnings", "value": 0 }, { "name": "fluentd.daemon.errors", "value": 0 } ]'
65
+ buffer_type file
66
+ buffer_path /var/lib/td-agent/buffer/stackdriver*
67
+ disable_retry_limit true
68
+ retry_wait 5s
69
+ flush_interval 1m
70
+ flush_at_shutdown true
71
+ </store>
72
+ </match>
73
+ ```
@@ -0,0 +1,25 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIELzCCAxGgAwIBAgIJAMOoRmNuvAZcMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYD
3
+ VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j
4
+ aXNjbzEVMBMGA1UECgwMSG90c2NoZWR1bGVzMQ4wDAYDVQQLDAVJbmZyYTEfMB0G
5
+ A1UEAwwWaW5mcmEuaG90c2NoZWR1bGVzLmNvbTEjMCEGCSqGSIb3DQEJARYUb3Nz
6
+ QGhvdHNjaGVkdWxlcy5jb20wHhcNMTcwMjE4MDA1NDU4WhcNMjEwMjE4MDA1NDU4
7
+ WjCBpzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
8
+ DVNhbiBGcmFuY2lzY28xFTATBgNVBAoMDEhvdHNjaGVkdWxlczEOMAwGA1UECwwF
9
+ SW5mcmExHzAdBgNVBAMMFmluZnJhLmhvdHNjaGVkdWxlcy5jb20xIzAhBgkqhkiG
10
+ 9w0BCQEWFG9zc0Bob3RzY2hlZHVsZXMuY29tMIIBKDANBgkqhkiG9w0BAQEFAAOC
11
+ ARUAMIIBEAKCAQcAutTytHjHFb5yK/29POqMS3DyxRSRRbKvBus/rEL3reeKDVlf
12
+ eO9a/9U3oUcxHFHeISF9uOBSvL88svxhLqxkKLVA0vMbVgDFoGsOlh93nA5Lmw+H
13
+ SEzG3+Z6JqH8YfAIqVyp1nZcdtC7u8xYpDD65ayjRALLuvOUXORGeqgedlgiwwLp
14
+ 2tZ7A9tCzBZnDjcNenD8zXLCOdRjJiBPq/XQS9h4POWvpom0z+jyUkRj3ojqOoXW
15
+ bKKdXzdZ3s5BSwgxlWJo+lK/50+xLpjJe4mEJwySkrluy8GOG/UR/j+Y4I1j1FbY
16
+ RwT9SUSairjh0zgiDC0LTjAJBIenuxxuM9jhRyoiu+YYVwIDAQABo1AwTjAdBgNV
17
+ HQ4EFgQUtlFsvLIJ59o2GyoRTXKEIPEgnn8wHwYDVR0jBBgwFoAUtlFsvLIJ59o2
18
+ GyoRTXKEIPEgnn8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQcAdELJ
19
+ QdrR55Xak3q5IhLnIdOLJC6ZEdHI2173SSmytInyDX6fe9uZION4I9WCCm/hCp+t
20
+ QILh4feu14iDWmBxzy6F6tiyuEjhaU5Ud9wZ/YDBQhP2AHquoPAufxXZAUFlA5er
21
+ wIYVupToBrWavfbjgRqRHAZ6vwrLwoIiomh2/wv06HLrFmSzj5q6BVp7FFMKDail
22
+ QWzJ4aQl786RMwPa776eVaKQTmQuTUUppvhVq9QdKyxwGPibAYGbYKZwmmtx+BV2
23
+ GJevNV8BSuhh6m2AHCxEzMaD7WKNbewTTgGLUlvppaR9SE2V/yUZ7x1Vp8/mGeO6
24
+ 2Zk648Ep9HVPKmwoVuB75+xEQw==
25
+ -----END CERTIFICATE-----
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'fluent-plugin-stackdriver-v1-metrics'
5
+ gem.version = '0.4.0'
6
+ gem.authors = ['Alex Yamauchi']
7
+ gem.email = ['oss@hotschedules.com']
8
+ gem.homepage = 'https://github.com/bodhi-space/fluent-plugin-stackdriver-v1-metrics'
9
+ gem.summary = %q{A Fluentd buffered output plugin to send metrics to StackDriver using the V1 (pre-Google) API}
10
+ gem.description = gem.summary + '.'
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.require_paths = ['lib']
13
+ gem.license = 'Apache-2.0'
14
+ gem.add_runtime_dependency 'fluentd', '>= 0.10.0'
15
+ gem.add_runtime_dependency 'stackdriver', '< 0.3.0'
16
+ gem.signing_key = File.expand_path('~/certs/oss@hotschedules.com.key') if $0 =~ /gem\z/
17
+ gem.cert_chain = %w[certs/oss@hotschedules.com.cert]
18
+ end
@@ -0,0 +1,96 @@
1
+ module Fluent
2
+ class StackdriverV1MetricsOutput < BufferedOutput
3
+
4
+ Plugin.register_output('stackdriver-v1_metrics', self)
5
+
6
+ def initialize
7
+ super
8
+ require 'stackdriver'
9
+ end
10
+
11
+ config_param :api_key, :string, :default => nil
12
+ config_param :instance_id, :string, :default => nil
13
+ config_param :counter_maps, :hash, :default => {}
14
+ config_param :counter_defaults, :array, :default => []
15
+ config_param :metric_maps, :hash, :default => {}
16
+ config_param :metric_defaults, :array, :default => []
17
+
18
+ def configure(conf)
19
+ super(conf) {
20
+ @api_key = conf.delete('api_key')
21
+ @instance_id = conf.delete('instance_id')
22
+ @counter_maps = conf.delete('counter_maps')
23
+ @counter_defaults = conf.delete('counter_defaults')
24
+ @metric_maps = conf.delete('metric_maps')
25
+ @metric_defaults = conf.delete('metric_defaults')
26
+ }
27
+
28
+ @base_entry = {}
29
+ @base_entry['instance'] = @instance_id if @instance_id
30
+
31
+ end
32
+
33
+ def format(tag, time, record)
34
+ # Everything goes into the buffer in a JSON format.
35
+ { 'tag' => tag, 'time' => time, 'record' => record }.to_json + "\n"
36
+ end
37
+
38
+ def write(chunk)
39
+
40
+ timestamp = Time.now.to_i
41
+ data = []
42
+
43
+ count_data = {}
44
+ metric_data = {}
45
+
46
+ chunk.read.chomp.split("\n").each do |line|
47
+ event = JSON.parse(line)
48
+
49
+ @counter_maps.each do |k,v|
50
+ if eval(k)
51
+ name = eval(v)
52
+ count_data[name] ||= 0
53
+ count_data[name] += 1
54
+ end
55
+ end
56
+
57
+ @metric_maps.each do |k,v|
58
+ if eval(k)
59
+ if eval(v)
60
+ data << @base_entry.merge({ 'collected_at' => event['time'].to_i }).merge(eval(v))
61
+ end
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ count_data.each do |name,value|
68
+ data << @base_entry.merge({
69
+ 'name' => name,
70
+ 'value' => value,
71
+ 'collected_at' => timestamp
72
+ })
73
+ end
74
+
75
+ @counter_defaults.each do |e|
76
+ if not count_data.key?(e['name'])
77
+ data << @base_entry.merge({'collected_at' => timestamp}).merge(e)
78
+ end
79
+ end
80
+
81
+ @metric_defaults.each do |e|
82
+ if not metric_data.key?(e['name'])
83
+ data << @base_entry.merge({'collected_at' => timestamp}).merge(e)
84
+ end
85
+ end
86
+
87
+ if data
88
+ StackDriver.init @api_key
89
+ StackDriver.send_multi_metrics data
90
+ end
91
+
92
+ end
93
+
94
+ end
95
+
96
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-stackdriver-v1-metrics
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Yamauchi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIELzCCAxGgAwIBAgIJAMOoRmNuvAZcMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYD
14
+ VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j
15
+ aXNjbzEVMBMGA1UECgwMSG90c2NoZWR1bGVzMQ4wDAYDVQQLDAVJbmZyYTEfMB0G
16
+ A1UEAwwWaW5mcmEuaG90c2NoZWR1bGVzLmNvbTEjMCEGCSqGSIb3DQEJARYUb3Nz
17
+ QGhvdHNjaGVkdWxlcy5jb20wHhcNMTcwMjE4MDA1NDU4WhcNMjEwMjE4MDA1NDU4
18
+ WjCBpzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
19
+ DVNhbiBGcmFuY2lzY28xFTATBgNVBAoMDEhvdHNjaGVkdWxlczEOMAwGA1UECwwF
20
+ SW5mcmExHzAdBgNVBAMMFmluZnJhLmhvdHNjaGVkdWxlcy5jb20xIzAhBgkqhkiG
21
+ 9w0BCQEWFG9zc0Bob3RzY2hlZHVsZXMuY29tMIIBKDANBgkqhkiG9w0BAQEFAAOC
22
+ ARUAMIIBEAKCAQcAutTytHjHFb5yK/29POqMS3DyxRSRRbKvBus/rEL3reeKDVlf
23
+ eO9a/9U3oUcxHFHeISF9uOBSvL88svxhLqxkKLVA0vMbVgDFoGsOlh93nA5Lmw+H
24
+ SEzG3+Z6JqH8YfAIqVyp1nZcdtC7u8xYpDD65ayjRALLuvOUXORGeqgedlgiwwLp
25
+ 2tZ7A9tCzBZnDjcNenD8zXLCOdRjJiBPq/XQS9h4POWvpom0z+jyUkRj3ojqOoXW
26
+ bKKdXzdZ3s5BSwgxlWJo+lK/50+xLpjJe4mEJwySkrluy8GOG/UR/j+Y4I1j1FbY
27
+ RwT9SUSairjh0zgiDC0LTjAJBIenuxxuM9jhRyoiu+YYVwIDAQABo1AwTjAdBgNV
28
+ HQ4EFgQUtlFsvLIJ59o2GyoRTXKEIPEgnn8wHwYDVR0jBBgwFoAUtlFsvLIJ59o2
29
+ GyoRTXKEIPEgnn8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQcAdELJ
30
+ QdrR55Xak3q5IhLnIdOLJC6ZEdHI2173SSmytInyDX6fe9uZION4I9WCCm/hCp+t
31
+ QILh4feu14iDWmBxzy6F6tiyuEjhaU5Ud9wZ/YDBQhP2AHquoPAufxXZAUFlA5er
32
+ wIYVupToBrWavfbjgRqRHAZ6vwrLwoIiomh2/wv06HLrFmSzj5q6BVp7FFMKDail
33
+ QWzJ4aQl786RMwPa776eVaKQTmQuTUUppvhVq9QdKyxwGPibAYGbYKZwmmtx+BV2
34
+ GJevNV8BSuhh6m2AHCxEzMaD7WKNbewTTgGLUlvppaR9SE2V/yUZ7x1Vp8/mGeO6
35
+ 2Zk648Ep9HVPKmwoVuB75+xEQw==
36
+ -----END CERTIFICATE-----
37
+ date: 2017-02-25 00:00:00.000000000 Z
38
+ dependencies:
39
+ - !ruby/object:Gem::Dependency
40
+ name: fluentd
41
+ requirement: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.10.0
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.10.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: stackdriver
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "<"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.3.0
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.3.0
67
+ description: A Fluentd buffered output plugin to send metrics to StackDriver using
68
+ the V1 (pre-Google) API.
69
+ email:
70
+ - oss@hotschedules.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - ".gitignore"
76
+ - CHANGELOG.md
77
+ - Gemfile
78
+ - LICENSE
79
+ - LICENSE-Apache-2.0.txt
80
+ - README.md
81
+ - certs/oss@hotschedules.com.cert
82
+ - fluent-plugin-stackdriver-v1-metrics.gemspec
83
+ - lib/fluent/plugin/out_stackdriver-v1_metrics.rb
84
+ homepage: https://github.com/bodhi-space/fluent-plugin-stackdriver-v1-metrics
85
+ licenses:
86
+ - Apache-2.0
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.4.8
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: A Fluentd buffered output plugin to send metrics to StackDriver using the
108
+ V1 (pre-Google) API
109
+ test_files: []
Binary file