ffwd-protobuf 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,121 @@
1
+ # $LICENSE
2
+ # Copyright 2013-2014 Spotify AB. All rights reserved.
3
+ #
4
+ # The contents of this file are licensed under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ require 'ffwd/protocol0.pb'
17
+
18
+ module FFWD
19
+ module Plugin
20
+ module Protobuf
21
+ module Serializer
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ module FFWD::Plugin::Protobuf::Serializer
28
+ module Protocol0
29
+ P = ::FFWD::Protocol0
30
+
31
+ def self.load string
32
+ message = P::Message.new
33
+ message.parse_from_string string
34
+
35
+ if message.has_field?(:event)
36
+ yield :event, receive_event(message.event)
37
+ end
38
+
39
+ if message.has_field?(:metric)
40
+ yield :metric, receive_metric(message.metric)
41
+ end
42
+ end
43
+
44
+ def self.receive_event e
45
+ d = {}
46
+ d[:time] = Time.at(e.time.to_f / 1000) if e.has_field?(:time)
47
+ d[:key] = e.key if e.has_field?(:key)
48
+ d[:value] = e.value if e.has_field?(:value)
49
+ d[:host] = e.host if e.has_field?(:host)
50
+ d[:state] = e.state if e.has_field?(:state)
51
+ d[:description] = e.description if e.has_field?(:description)
52
+ d[:ttl] = e.ttl if e.has_field?(:ttl)
53
+ d[:tags] = from_tags e.tags if e.tags
54
+ d[:attributes] = from_attributes e.attributes if e.attributes
55
+ return d
56
+ end
57
+
58
+ def self.receive_metric m
59
+ d = {}
60
+ d[:proc] = m.host if m.has_field?(:proc)
61
+ d[:time] = Time.at(m.time.to_f / 1000) if m.has_field?(:time)
62
+ d[:key] = m.key if m.has_field?(:key)
63
+ d[:value] = m.value if m.has_field?(:value)
64
+ d[:host] = m.host if m.has_field?(:host)
65
+ d[:tags] = from_tags m.tags if m.tags
66
+ d[:attributes] = from_attributes m.attributes if m.attributes
67
+ return d
68
+ end
69
+
70
+ def self.from_attributes attributes
71
+ Hash[attributes.map{|a| [a.key, a.value]}]
72
+ end
73
+
74
+ def self.from_tags tags
75
+ Array.new tags
76
+ end
77
+
78
+ def self.dump_event event
79
+ e = P::Event.new
80
+ e.time = (event.time.to_f * 1000).to_i if event.time
81
+ e.key = event.key if event.key
82
+ e.value = event.value.to_f if event.value
83
+ e.host = event.host if event.host
84
+ e.state = event.state if event.state
85
+ e.description = event.description if event.description
86
+ e.ttl = event.ttl if event.ttl
87
+ e.tags = to_tags event.tags if event.tags
88
+ e.attributes = to_attributes event.attributes if event.attributes
89
+
90
+ message = P::Message.new
91
+ message.event = e
92
+ message.serialize_to_string
93
+ end
94
+
95
+ def self.dump_metric metric
96
+ m = P::Metric.new
97
+ m.time = (metric.time.to_f * 1000).to_i if metric.time
98
+ m.key = metric.key if metric.key
99
+ m.value = metric.value.to_f if metric.value
100
+ m.host = metric.host if metric.host
101
+ m.tags = to_tags metric.tags if metric.tags
102
+ m.attributes = to_attributes metric.attributes if metric.attributes
103
+
104
+ message = P::Message.new
105
+ message.metric = m
106
+ message.serialize_to_string
107
+ end
108
+
109
+ private
110
+
111
+ def self.to_attributes attributes
112
+ attributes.map do |key, value|
113
+ P::Attribute.new(:key => key.to_s, :value => value.to_s)
114
+ end
115
+ end
116
+
117
+ def self.to_tags tags
118
+ Array.new tags
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,71 @@
1
+ # $LICENSE
2
+ # Copyright 2013-2014 Spotify AB. All rights reserved.
3
+ #
4
+ # The contents of this file are licensed under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ require_relative 'serializer/protocol0'
17
+
18
+ module FFWD::Plugin::Protobuf::Serializer
19
+ VERSIONS = {
20
+ 0 => Protocol0
21
+ }
22
+
23
+ LATEST_VERSION = 0
24
+
25
+ def self.dump_frame string
26
+ [LATEST_VERSION, string.length + 8].pack("NN") + string
27
+ end
28
+
29
+ def self.load_frame string
30
+ if string.length < 8
31
+ raise "Frame too small, expected at least 8 bytes but got #{string.length}"
32
+ end
33
+
34
+ version = string[0..3].unpack("N")[0]
35
+ length = string[4..7].unpack("N")[0]
36
+
37
+ unless impl = VERSIONS[version]
38
+ raise "Unsupported protocol version #{version}, latest is #{LATEST_VERSION}"
39
+ end
40
+
41
+ if length != string.length
42
+ raise "Message length invalid, expected #{length} but got #{string.length}"
43
+ end
44
+
45
+ [impl, string[8..length]]
46
+ end
47
+
48
+ def self.dump_event event
49
+ unless impl = VERSIONS[LATEST_VERSION]
50
+ raise "No implementation for latest version: #{LATEST_VERSION}"
51
+ end
52
+
53
+ dump_frame impl.dump_event event
54
+ end
55
+
56
+ def self.dump_metric metric
57
+ unless impl = VERSIONS[LATEST_VERSION]
58
+ raise "No implementation for latest version: #{LATEST_VERSION}"
59
+ end
60
+
61
+ dump_frame impl.dump_metric metric
62
+ end
63
+
64
+ def self.load string
65
+ impl, string = load_frame string
66
+
67
+ impl.load string do |type, data|
68
+ yield type, data
69
+ end
70
+ end
71
+ end
@@ -16,7 +16,7 @@
16
16
  module FFWD
17
17
  module Plugin
18
18
  module Protobuf
19
- VERSION = "0.1.6"
19
+ VERSION = "0.1.7"
20
20
  end
21
21
  end
22
22
  end
@@ -24,38 +24,17 @@ require 'ffwd/protocol'
24
24
  require 'ffwd/event'
25
25
  require 'ffwd/metric'
26
26
 
27
- require_relative 'protobuf/protocol.pb'
27
+ require_relative 'protobuf/serializer'
28
28
 
29
29
  module FFWD::Plugin::Protobuf
30
30
  include FFWD::Plugin
31
31
  include FFWD::Logging
32
32
 
33
- P = ::FFWD::Plugin::Protobuf::Protocol
34
-
35
33
  register_plugin "protobuf"
36
34
 
37
- module Serializer
38
- def self.dump m
39
- m.serialize_to_string
40
- end
41
-
42
- def self.load string
43
- m = P::Message.new
44
- m.parse_from_string string
45
- return m
46
- end
47
- end
48
-
49
- class Output < FFWD::Handler
50
- include EM::Protocols::ObjectProtocol
51
- include Serializer
52
-
35
+ class OutputUDP < FFWD::Handler
53
36
  def self.plugin_type
54
- "protobuf_out"
55
- end
56
-
57
- def serializer
58
- Serializer
37
+ "protobuf_udp_out"
59
38
  end
60
39
 
61
40
  def send_all events, metrics
@@ -69,56 +48,15 @@ module FFWD::Plugin::Protobuf
69
48
  end
70
49
 
71
50
  def send_event event
72
- message = P::Message.new
73
- e = P::Event.new
74
- e.time = (event.time.to_f * 1000).to_i if event.time
75
- e.key = event.key if event.key
76
- e.value = to_value event.value if event.value
77
- e.host = event.host if event.host
78
- e.source = event.source if event.source
79
- e.state = event.state if event.state
80
- e.description = event.description if event.description
81
- e.ttl = event.ttl if event.ttl
82
- e.tags = to_tags event.tags if event.tags
83
- e.attributes = to_attributes event.attributes if event.attributes
84
- message.event = e
85
- send_object message
51
+ parent.send_data Serializer.dump_event(event)
86
52
  end
87
53
 
88
54
  def send_metric metric
89
- message = P::Message.new
90
- m = P::Metric.new
91
- m.time = (metric.time.to_f * 1000).to_i if metric.time
92
- m.key = metric.key if metric.key
93
- m.value = to_value metric.value if metric.value
94
- m.host = metric.host if metric.host
95
- m.source = metric.source if metric.source
96
- m.tags = to_tags metric.tags if metric.tags
97
- m.attributes = to_attributes metric.attributes if metric.attributes
98
- message.metric = m
99
- send_object message
100
- end
101
-
102
- private
103
-
104
- def to_value value
105
- v = P::Value.new
106
- v.value_d = value
107
- return v
108
- end
109
-
110
- def to_attributes attributes
111
- attributes.map do |key, value|
112
- P::Attribute.new(:key => key, :value => value)
113
- end
114
- end
115
-
116
- def to_tags tags
117
- Array.new tags
55
+ parent.send_data Serializer.dump_metric(metric)
118
56
  end
119
57
  end
120
58
 
121
- class Input < FFWD::Connection
59
+ class InputUDP < FFWD::Connection
122
60
  include FFWD::Logging
123
61
  include EM::Protocols::FrameObjectProtocol
124
62
 
@@ -132,79 +70,35 @@ module FFWD::Plugin::Protobuf
132
70
  "protobuf_in"
133
71
  end
134
72
 
135
- def serializer
136
- Serializer
137
- end
138
-
139
- def receive_object message
140
- if message.has_field?(:event)
141
- receive_event message.event
142
- end
73
+ def receive_data datagram
74
+ Serializer.load(datagram) do |type, data|
75
+ if type == :event
76
+ @core.input.event data
77
+ @bind.increment :received_events
78
+ next
79
+ end
143
80
 
144
- if message.has_field?(:metric)
145
- receive_metric message.metric
81
+ if type == :metric
82
+ @core.input.metric data
83
+ @bind.increment :received_metrics
84
+ next
85
+ end
146
86
  end
147
- end
87
+ rescue => e
88
+ @log.error "Failed to receive data", e
148
89
 
149
- def handle_exception datagram, e
150
- @log.error("Failed to decode protobuf object", e)
151
90
  if @log.debug?
152
- @log.debug("FRAME: " + FFWD.dump2hex(datagram))
91
+ @log.debug("DUMP: " + FFWD.dump2hex(datagram))
153
92
  end
154
93
  end
155
-
156
- def receive_event e
157
- d = {}
158
- d[:time] = Time.at(e.time.to_f / 1000) if e.has_field?(:time)
159
- d[:key] = e.key if e.has_field?(:key)
160
- d[:value] = e.value if e.has_field?(:value)
161
- d[:host] = e.host if e.has_field?(:host)
162
- d[:source] = e.source if e.has_field?(:source)
163
- d[:state] = e.state if e.has_field?(:state)
164
- d[:description] = e.description if e.has_field?(:description)
165
- d[:ttl] = e.ttl if e.has_field?(:ttl)
166
- d[:tags] = from_tags m.tags if m.tags
167
- d[:attributes] = from_attributes m.attributes if m.attributes
168
- @core.input.event d
169
- @bind.increment :received_events
170
- rescue => e
171
- @log.error "Failed to receive event", e
172
- @bind.increment :failed_events
173
- end
174
-
175
- def receive_metric m
176
- d = {}
177
- d[:time] = Time.at(m.time.to_f / 1000) if m.has_field?(:time)
178
- d[:key] = m.key if m.has_field?(:key)
179
- d[:value] = m.value if m.has_field?(:value)
180
- d[:host] = m.host if m.has_field?(:host)
181
- d[:source] = m.source if m.has_field?(:source)
182
- d[:tags] = from_tags m.tags if m.tags
183
- d[:attributes] = from_attributes m.attributes if m.attributes
184
- @core.input.metric d
185
- @bind.increment :received_metrics
186
- rescue => e
187
- @log.error "Failed to receive event", e
188
- @bind.increment :failed_metrics
189
- end
190
-
191
- private
192
-
193
- def from_attributes attributes
194
- Hash[attributes.map{|a| [a.key, a.value]}]
195
- end
196
-
197
- def from_tags tags
198
- Array.new tags
199
- end
200
94
  end
201
95
 
202
96
  DEFAULT_HOST = "localhost"
203
97
  DEFAULT_PORT = 19091
204
98
  DEFAULT_PROTOCOL = 'udp'
205
99
 
206
- OUTPUTS = {:udp => Output}
207
- INPUTS = {:udp => Input}
100
+ OUTPUTS = {:udp => OutputUDP}
101
+ INPUTS = {:udp => InputUDP}
208
102
 
209
103
  def self.setup_output opts, core
210
104
  opts[:host] ||= DEFAULT_HOST
@@ -212,11 +106,11 @@ module FFWD::Plugin::Protobuf
212
106
 
213
107
  protocol = FFWD.parse_protocol(opts[:protocol] || DEFAULT_PROTOCOL)
214
108
 
215
- unless type = OUTPUTS[protocol.family]
109
+ unless handler = OUTPUTS[protocol.family]
216
110
  raise "No type for protocol family: #{protocol.family}"
217
111
  end
218
112
 
219
- protocol.connect opts, core, log, type
113
+ protocol.connect opts, core, log, handler
220
114
  end
221
115
 
222
116
  def self.setup_input opts, core
@@ -0,0 +1,93 @@
1
+ ### Generated by rprotoc. DO NOT EDIT!
2
+ ### <proto file: ./plugins/ffwd-protobuf/proto/protocol0.proto>
3
+ # package FFWD.Protocol0;
4
+ #
5
+ # message Metric {
6
+ # // processor to use for metric.
7
+ # optional string proc = 1;
8
+ # // time in ms when metric was generated.
9
+ # optional int64 time = 2;
10
+ # // key of metric.
11
+ # optional string key = 3;
12
+ # // value of metric.
13
+ # optional double value = 4;
14
+ # // host where metric originated.
15
+ # optional string host = 5;
16
+ # // tags associated to metric.
17
+ # repeated string tags = 6;
18
+ # // attributes associated to metric.
19
+ # repeated Attribute attributes = 7;
20
+ # }
21
+ #
22
+ # message Event {
23
+ # // time in ms when the event was generated.
24
+ # optional int64 time = 1;
25
+ # // key of event.
26
+ # optional string key = 2;
27
+ # // value of event.
28
+ # optional double value = 3;
29
+ # // host where event originated.
30
+ # optional string host = 4;
31
+ # // indicated state of this event.
32
+ # optional string state = 5;
33
+ # // description of event.
34
+ # optional string description = 6;
35
+ # // time this event should be considered valid in seconds.
36
+ # optional int64 ttl = 7;
37
+ # // tags associated to event.
38
+ # repeated string tags = 8;
39
+ # // attributes associated to event.
40
+ # repeated Attribute attributes = 9;
41
+ # }
42
+ #
43
+ # message Attribute {
44
+ # required string key = 1;
45
+ # optional string value = 2;
46
+ # }
47
+ #
48
+ # message Message {
49
+ # optional Metric metric = 1;
50
+ # optional Event event = 2;
51
+ # }
52
+
53
+ require 'protobuf/message/message'
54
+ require 'protobuf/message/enum'
55
+ require 'protobuf/message/service'
56
+ require 'protobuf/message/extend'
57
+
58
+ module FFWD
59
+ module Protocol0
60
+ class Metric < ::Protobuf::Message
61
+ defined_in __FILE__
62
+ optional :string, :proc, 1
63
+ optional :int64, :time, 2
64
+ optional :string, :key, 3
65
+ optional :double, :value, 4
66
+ optional :string, :host, 5
67
+ repeated :string, :tags, 6
68
+ repeated :Attribute, :attributes, 7
69
+ end
70
+ class Event < ::Protobuf::Message
71
+ defined_in __FILE__
72
+ optional :int64, :time, 1
73
+ optional :string, :key, 2
74
+ optional :double, :value, 3
75
+ optional :string, :host, 4
76
+ optional :string, :state, 5
77
+ optional :string, :description, 6
78
+ optional :int64, :ttl, 7
79
+ repeated :string, :tags, 8
80
+ repeated :Attribute, :attributes, 9
81
+ end
82
+ class Attribute < ::Protobuf::Message
83
+ defined_in __FILE__
84
+ required :string, :key, 1
85
+ optional :string, :value, 2
86
+ end
87
+ class Message < ::Protobuf::Message
88
+ defined_in __FILE__
89
+ optional :Metric, :metric, 1
90
+ optional :Event, :event, 2
91
+ end
92
+ end
93
+ end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffwd-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - John-John Tedro
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-04-29 00:00:00.000000000 Z
12
+ date: 2014-05-30 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: ruby_protobuf
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,20 +30,23 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: ffwd
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ! '>='
35
+ - - '='
32
36
  - !ruby/object:Gem::Version
33
- version: '0'
37
+ version: 0.1.7
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ! '>='
43
+ - - '='
39
44
  - !ruby/object:Gem::Version
40
- version: '0'
45
+ version: 0.1.7
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rspec
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec-mocks
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -73,31 +82,34 @@ executables: []
73
82
  extensions: []
74
83
  extra_rdoc_files: []
75
84
  files:
76
- - lib/ffwd/plugin/protobuf.rb
85
+ - lib/ffwd/protocol0.pb.rb
77
86
  - lib/ffwd/plugin/protobuf/version.rb
78
- - lib/ffwd/plugin/protobuf/protocol.pb.rb
87
+ - lib/ffwd/plugin/protobuf/serializer/protocol0.rb
88
+ - lib/ffwd/plugin/protobuf/serializer.rb
89
+ - lib/ffwd/plugin/protobuf.rb
79
90
  homepage: https://github.com/spotify/ffwd
80
91
  licenses:
81
92
  - Apache 2.0
82
- metadata: {}
83
93
  post_install_message:
84
94
  rdoc_options: []
85
95
  require_paths:
86
96
  - lib
87
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
88
99
  requirements:
89
100
  - - ! '>='
90
101
  - !ruby/object:Gem::Version
91
102
  version: '0'
92
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
93
105
  requirements:
94
106
  - - ! '>='
95
107
  - !ruby/object:Gem::Version
96
108
  version: '0'
97
109
  requirements: []
98
110
  rubyforge_project:
99
- rubygems_version: 2.0.3
111
+ rubygems_version: 1.8.23
100
112
  signing_key:
101
- specification_version: 4
113
+ specification_version: 3
102
114
  summary: protobuf reference protocol support for FFWD.
103
115
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTFmZTlmNTgzODA5NGQ3Yjc0Y2M0ZTE4OTFlNWI4ZTFlZWU1NzQyZg==
5
- data.tar.gz: !binary |-
6
- ZTM4MTYxMWI1MzgwY2Q5NDAxMzFjNGJkZTkzNTQ5NTAwY2JlODVkNQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZjBhZDYxZGZjN2ExY2IwZWY1NDFjODk1MDQwN2NlNjM5MmMyODYwY2IyYjk1
10
- YjU4ZDU3NjY2ZTljMmQ0OTQ2NjJmYjY2MmM1OGJiY2Y4NWY1ZmNmNzViYWVh
11
- NzQ2MzlmMjA1NDg4MDc4MDYzMWM3YTIwNzcwODc3MmY3MTk3ZTg=
12
- data.tar.gz: !binary |-
13
- YzU3MTY2Y2Q5MmNmMmUyYTA0Y2U4NWI4NzllMDIzMTRiOTgxNTRhYmM4OTBm
14
- NWY0ZjZjM2FlMGU1NWFiNjI4MDkxYjZkMTk5ZjRmMTU0MmE4N2E4NGM3Mzhk
15
- MWE4YjY3NTcwYTg0MjliYjgxMDJjMmQ3OTVjMWIwZjUxMThhMDM=
@@ -1,105 +0,0 @@
1
- ### Generated by rprotoc. DO NOT EDIT!
2
- ### <proto file: ./proto/protocol.proto>
3
- # package FFWD.Plugin.Protobuf.Protocol;
4
- #
5
- # option java_package = "com.spotify.ffwd";
6
- # option java_outer_classname = "Protocol";
7
- #
8
- # message Metric {
9
- # // time in ms when metric was generated.
10
- # optional int64 time = 1;
11
- # // key of metric.
12
- # optional string key = 2;
13
- # // value of metric.
14
- # optional double value = 3;
15
- # // host where metric originated.
16
- # optional string host = 4;
17
- # // source metric of the metric.
18
- # optional string source = 5;
19
- # // tags associated to metric.
20
- # repeated string tags = 6;
21
- # // attributes associated to metric.
22
- # repeated Attribute attributes = 7;
23
- # }
24
- #
25
- # message Event {
26
- # // time in ms when the event was generated.
27
- # optional int64 time = 1;
28
- # // key of event.
29
- # optional string key = 2;
30
- # // value of event.
31
- # optional double value = 3;
32
- # // host where event originated.
33
- # optional string host = 4;
34
- # // source event (if any).
35
- # optional string source = 5;
36
- # // indicated state of this event.
37
- # optional string state = 6;
38
- # // description of event.
39
- # optional string description = 7;
40
- # // time this event should be considered valid in seconds.
41
- # optional int64 ttl = 8;
42
- # // tags associated to event.
43
- # repeated string tags = 9;
44
- # // attributes associated to event.
45
- # repeated Attribute attributes = 10;
46
- # }
47
- #
48
- # message Attribute {
49
- # required string key = 1;
50
- # optional string value = 2;
51
- # }
52
- #
53
- # message Message {
54
- # optional Metric metric = 1;
55
- # optional Event event = 2;
56
- # }
57
-
58
- require 'protobuf/message/message'
59
- require 'protobuf/message/enum'
60
- require 'protobuf/message/service'
61
- require 'protobuf/message/extend'
62
-
63
- module FFWD
64
- module Plugin
65
- module Protobuf
66
- module Protocol
67
- ::Protobuf::OPTIONS[:"java_package"] = "com.spotify.ffwd"
68
- ::Protobuf::OPTIONS[:"java_outer_classname"] = "Protocol"
69
- class Metric < ::Protobuf::Message
70
- defined_in __FILE__
71
- optional :int64, :time, 1
72
- optional :string, :key, 2
73
- optional :double, :value, 3
74
- optional :string, :host, 4
75
- optional :string, :source, 5
76
- repeated :string, :tags, 6
77
- repeated :Attribute, :attributes, 7
78
- end
79
- class Event < ::Protobuf::Message
80
- defined_in __FILE__
81
- optional :int64, :time, 1
82
- optional :string, :key, 2
83
- optional :double, :value, 3
84
- optional :string, :host, 4
85
- optional :string, :source, 5
86
- optional :string, :state, 6
87
- optional :string, :description, 7
88
- optional :int64, :ttl, 8
89
- repeated :string, :tags, 9
90
- repeated :Attribute, :attributes, 10
91
- end
92
- class Attribute < ::Protobuf::Message
93
- defined_in __FILE__
94
- required :string, :key, 1
95
- optional :string, :value, 2
96
- end
97
- class Message < ::Protobuf::Message
98
- defined_in __FILE__
99
- optional :Metric, :metric, 1
100
- optional :Event, :event, 2
101
- end
102
- end
103
- end
104
- end
105
- end