fluent-plugin-stackdriver-monitoring 0.0.1 → 0.0.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de841f30d9480113027498e115279a23d3c29a3f
|
4
|
+
data.tar.gz: 744a9b0c65955678fc31e9e2bbcbd64bc8cfb98c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a693d1e6cd876314ac24ee014c1d15748e895b52e5150d0c0b9e55bbf7c4a9e688886b74b46923763ae569f97c966f6dc7036d5c96c620d11064ae5e04f99196
|
7
|
+
data.tar.gz: 18fb5725f580a0607ffed34dcd313110fc22bbec45e4c234960e03fdc7fa420f605d65401aa36d296a300e8a3f94310efc8b8c2054d3fa6de3091227f0245c72
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Sample configuration is below.
|
|
34
34
|
|
35
35
|
- project (string, required)
|
36
36
|
- Set your Stackdriver project id.
|
37
|
-
-
|
37
|
+
- custom_metrics
|
38
38
|
- key (string, required)
|
39
39
|
- Specify field name in your log to send to Stackdriver.
|
40
40
|
- type (string, required)
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.license = 'MIT'
|
7
7
|
gem.homepage = 'https://github.com/mia-0032/fluent-plugin-stackdriver-monitoring'
|
8
8
|
gem.summary = gem.description
|
9
|
-
gem.version = '0.0.
|
9
|
+
gem.version = '0.0.2'
|
10
10
|
gem.authors = ['Yoshihiro MIYAI']
|
11
11
|
gem.email = 'msparrow17@gmail.com'
|
12
12
|
gem.has_rdoc = false
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ['lib']
|
17
17
|
|
18
18
|
gem.add_runtime_dependency 'fluentd', ['>= 0.12.0', '< 2']
|
19
|
-
gem.add_runtime_dependency 'google-cloud-monitoring', '~> 0.
|
19
|
+
gem.add_runtime_dependency 'google-cloud-monitoring', '~> 0.24.0'
|
20
20
|
|
21
21
|
gem.add_development_dependency 'bundler'
|
22
22
|
gem.add_development_dependency 'rake'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'fluent/output'
|
2
2
|
require 'google/api/metric_pb'
|
3
|
-
require 'google/cloud/monitoring/v3/
|
3
|
+
require 'google/cloud/monitoring/v3/metric_service_client'
|
4
4
|
require 'google/protobuf/repeated_field'
|
5
5
|
require 'google/protobuf/timestamp_pb'
|
6
6
|
|
@@ -25,14 +25,14 @@ module Fluent
|
|
25
25
|
raise "custom_metrics.type must start with \"#{TYPE_PREFIX}\""
|
26
26
|
end
|
27
27
|
|
28
|
-
@project_name = Google::Cloud::Monitoring::V3::
|
29
|
-
@metric_name = Google::Cloud::Monitoring::V3::
|
28
|
+
@project_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path @project
|
29
|
+
@metric_name = Google::Cloud::Monitoring::V3::MetricServiceClient.metric_descriptor_path @project, @custom_metrics.type
|
30
30
|
end
|
31
31
|
|
32
32
|
def start
|
33
33
|
super
|
34
34
|
|
35
|
-
@
|
35
|
+
@metric_service_client = Google::Cloud::Monitoring::V3::MetricServiceClient.new
|
36
36
|
@metric_descriptor = create_metric_descriptor
|
37
37
|
end
|
38
38
|
|
@@ -52,14 +52,14 @@ module Fluent
|
|
52
52
|
|
53
53
|
log.debug "Create time series", time: Time.at(time).to_s, value: value, metric_name: @metric_name
|
54
54
|
# Only one point can be written per TimeSeries per request.
|
55
|
-
@
|
55
|
+
@metric_service_client.create_time_series @project_name, [time_series]
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
60
60
|
def create_metric_descriptor
|
61
61
|
begin
|
62
|
-
metric_descriptor = @
|
62
|
+
metric_descriptor = @metric_service_client.get_metric_descriptor(@metric_name)
|
63
63
|
log.info "Succeed to get metric descripter", metric_name: @metric_name
|
64
64
|
return metric_descriptor
|
65
65
|
rescue Google::Gax::RetryError
|
@@ -70,7 +70,7 @@ module Fluent
|
|
70
70
|
metric_descriptor.type = @custom_metrics.type
|
71
71
|
metric_descriptor.metric_kind = @custom_metrics.metric_kind
|
72
72
|
metric_descriptor.value_type = @custom_metrics.value_type
|
73
|
-
metric_descriptor = @
|
73
|
+
metric_descriptor = @metric_service_client.create_metric_descriptor(@project_name, metric_descriptor)
|
74
74
|
log.info "Succeed to create metric descripter", metric_name: @metric_name
|
75
75
|
|
76
76
|
metric_descriptor
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-stackdriver-monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshihiro MIYAI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.24.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.24.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|