ruby-kafka 0.5.2.beta3 → 0.5.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: d68ed75fbf6a3af99f593f269f46c28bb1353468
4
- data.tar.gz: 1f7f32e97728d5f262262329952ef763e01d6c34
3
+ metadata.gz: 045d5a61276b8499bdb55c05602625a44f558b38
4
+ data.tar.gz: 5192d0caa0e53cb995ff315aedbb35de61b214f0
5
5
  SHA512:
6
- metadata.gz: 5d697badab0b48c5fc7c0abc33ea9ed55ea3532309aae0f8ce620ab3dab89ac14f7fc3d020cf299575afe9c38f9f7d46f343ad9de1d809dcbddc7ec513fbc19b
7
- data.tar.gz: 481f5ea4a504b96b7610eebca186a3eb791f48655bfe88e268bd01f070dfec3243f4a515a4dd37d79e782f29d7219618d3d5a925c37505102fc3e75cc6fe426c
6
+ metadata.gz: bfa82cc9074c2e8c3e8e82cd1dfe288fae912fc02a96d355ebcf69d0106746749c00b5120b6a7a151b5c8191ed499d52c1ee0543675772f7792d38d83d2b0ced
7
+ data.tar.gz: b03a4e3b7b50c6a0ec879c23a29059ced2f242ae8c5e6e6239afc9e9e083fcc0960b07b03b7ed9cd47c7a3f3c7855fc856448974b9ef5757f6500d741821edba
@@ -0,0 +1 @@
1
+ {"readygo_file_format_version":1,"benchmark_results":[["message serialization decoding",[0.00777734375,0.007609375,0.00721875,0.00836328125,0.007546875,0.0088046875,0.0069414062500000005,0.007550781249999999,0.0072734374999999995,0.009625,0.007867187500000001,0.01226953125,0.0073984375,0.007292968750000001,0.00937890625,0.0073750000000000005]]]}
@@ -4,6 +4,8 @@ Changes and additions to the library will be listed here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## v0.5.2
8
+
7
9
  - Instrument the start of message/batch processing (#496).
8
10
  - Mark `Client#fetch_messages` as stable.
9
11
  - Fix the list topics API (#508).
@@ -12,6 +14,7 @@ Changes and additions to the library will be listed here.
12
14
  - Fix compressed message set offset bug (#506).
13
15
  - Test against multiple versions of Kafka.
14
16
  - Fix double-processing of messages after a consumer exception (#518).
17
+ - Track consumer offsets in Datadog.
15
18
 
16
19
  ## v0.5.1
17
20
 
@@ -0,0 +1,21 @@
1
+ require "kafka"
2
+
3
+ ready "message serialization" do
4
+ before do
5
+ message = Kafka::Protocol::Message.new(
6
+ value: "hello",
7
+ key: "world",
8
+ )
9
+
10
+ @io = StringIO.new
11
+ encoder = Kafka::Protocol::Encoder.new(@io)
12
+ message.encode(encoder)
13
+
14
+ @decoder = Kafka::Protocol::Decoder.new(@io)
15
+ end
16
+
17
+ go "decoding" do
18
+ @io.rewind
19
+ Kafka::Protocol::Message.decode(@decoder)
20
+ end
21
+ end
@@ -294,6 +294,7 @@ module Kafka
294
294
  notification = {
295
295
  topic: batch.topic,
296
296
  partition: batch.partition,
297
+ last_offset: batch.last_offset,
297
298
  offset_lag: batch.offset_lag,
298
299
  highwater_mark_offset: batch.highwater_mark_offset,
299
300
  message_count: batch.messages.count,
@@ -122,6 +122,7 @@ module Kafka
122
122
 
123
123
  class ConsumerSubscriber < StatsdSubscriber
124
124
  def process_message(event)
125
+ offset = event.payload.fetch(:offset)
125
126
  offset_lag = event.payload.fetch(:offset_lag)
126
127
  create_time = event.payload.fetch(:create_time)
127
128
  time_lag = create_time && ((Time.now - create_time) * 1000).to_i
@@ -140,6 +141,7 @@ module Kafka
140
141
  increment("consumer.messages", tags: tags)
141
142
  end
142
143
 
144
+ gauge("consumer.offset", offset, tags: tags)
143
145
  gauge("consumer.lag", offset_lag, tags: tags)
144
146
 
145
147
  # Not all messages have timestamps.
@@ -149,6 +151,7 @@ module Kafka
149
151
  end
150
152
 
151
153
  def process_batch(event)
154
+ offset = event.payload.fetch(:last_offset)
152
155
  lag = event.payload.fetch(:offset_lag)
153
156
  messages = event.payload.fetch(:message_count)
154
157
 
@@ -166,6 +169,7 @@ module Kafka
166
169
  count("consumer.messages", messages, tags: tags)
167
170
  end
168
171
 
172
+ gauge("consumer.offset", offset, tags: tags)
169
173
  gauge("consumer.lag", lag, tags: tags)
170
174
  end
171
175
 
@@ -91,12 +91,9 @@ module Kafka
91
91
 
92
92
  messages = fetched_partition.messages.map {|message|
93
93
  FetchedMessage.new(
94
- value: message.value,
95
- key: message.key,
94
+ message: message,
96
95
  topic: fetched_topic.name,
97
96
  partition: fetched_partition.partition,
98
- offset: message.offset,
99
- create_time: message.create_time,
100
97
  )
101
98
  }
102
99
 
@@ -1,31 +1,35 @@
1
1
  module Kafka
2
2
  class FetchedMessage
3
-
4
- # @return [String] the value of the message.
5
- attr_reader :value
6
-
7
- # @return [String] the key of the message.
8
- attr_reader :key
9
-
10
3
  # @return [String] the name of the topic that the message was written to.
11
4
  attr_reader :topic
12
5
 
13
6
  # @return [Integer] the partition number that the message was written to.
14
7
  attr_reader :partition
15
8
 
9
+ def initialize(message:, topic:, partition:)
10
+ @message = message
11
+ @topic = topic
12
+ @partition = partition
13
+ end
14
+
15
+ # @return [String] the value of the message.
16
+ def value
17
+ @message.value
18
+ end
19
+
20
+ # @return [String] the key of the message.
21
+ def key
22
+ @message.key
23
+ end
24
+
16
25
  # @return [Integer] the offset of the message in the partition.
17
- attr_reader :offset
26
+ def offset
27
+ @message.offset
28
+ end
18
29
 
19
30
  # @return [Time] the timestamp of the message.
20
- attr_reader :create_time
21
-
22
- def initialize(value: nil, key: nil, topic:, partition:, offset:, create_time: nil)
23
- @value = value
24
- @key = key
25
- @topic = topic
26
- @partition = partition
27
- @offset = offset
28
- @create_time = create_time
31
+ def create_time
32
+ @message.create_time
29
33
  end
30
34
  end
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module Kafka
2
- VERSION = "0.5.2.beta3"
2
+ VERSION = "0.5.2"
3
3
  end
@@ -43,5 +43,6 @@ Gem::Specification.new do |spec|
43
43
  spec.add_development_dependency "ruby-prof"
44
44
  spec.add_development_dependency "timecop"
45
45
  spec.add_development_dependency "rubocop", "~> 0.49.1"
46
- spec.add_development_dependency "gssapi", '>=1.2.0'
46
+ spec.add_development_dependency "gssapi", ">= 1.2.0"
47
+ spec.add_development_dependency "stackprof"
47
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2.beta3
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-04 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -262,6 +262,20 @@ dependencies:
262
262
  - - ">="
263
263
  - !ruby/object:Gem::Version
264
264
  version: 1.2.0
265
+ - !ruby/object:Gem::Dependency
266
+ name: stackprof
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
265
279
  description: A client library for the Kafka distributed commit log.
266
280
  email:
267
281
  - daniel.schierbeck@gmail.com
@@ -271,6 +285,7 @@ extra_rdoc_files: []
271
285
  files:
272
286
  - ".circleci/config.yml"
273
287
  - ".gitignore"
288
+ - ".readygo"
274
289
  - ".rspec"
275
290
  - ".rubocop.yml"
276
291
  - ".yardopts"
@@ -281,6 +296,7 @@ files:
281
296
  - Procfile
282
297
  - README.md
283
298
  - Rakefile
299
+ - benchmarks/message_encoding.rb
284
300
  - bin/console
285
301
  - bin/setup
286
302
  - ci/consumer.rb
@@ -369,19 +385,6 @@ files:
369
385
  - lib/ruby-kafka.rb
370
386
  - performance/profile.rb
371
387
  - ruby-kafka.gemspec
372
- - vendor/bundle/bin/bundler
373
- - vendor/bundle/bin/coderay
374
- - vendor/bundle/bin/dotenv
375
- - vendor/bundle/bin/htmldiff
376
- - vendor/bundle/bin/ldiff
377
- - vendor/bundle/bin/pry
378
- - vendor/bundle/bin/rake
379
- - vendor/bundle/bin/rspec
380
- - vendor/bundle/bin/rubocop
381
- - vendor/bundle/bin/ruby-parse
382
- - vendor/bundle/bin/ruby-prof
383
- - vendor/bundle/bin/ruby-prof-check-trace
384
- - vendor/bundle/bin/ruby-rewrite
385
388
  homepage: https://github.com/zendesk/ruby-kafka
386
389
  licenses:
387
390
  - Apache License Version 2.0
@@ -397,9 +400,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
397
400
  version: 2.1.0
398
401
  required_rubygems_version: !ruby/object:Gem::Requirement
399
402
  requirements:
400
- - - ">"
403
+ - - ">="
401
404
  - !ruby/object:Gem::Version
402
- version: 1.3.1
405
+ version: '0'
403
406
  requirements: []
404
407
  rubyforge_project:
405
408
  rubygems_version: 2.6.13
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'bundler' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("bundler", "bundler")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'coderay' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("coderay", "coderay")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'dotenv' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("dotenv", "dotenv")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'htmldiff' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("diff-lcs", "htmldiff")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'ldiff' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("diff-lcs", "ldiff")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'pry' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("pry", "pry")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'rake' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("rake", "rake")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'rspec' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("rspec-core", "rspec")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'rubocop' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("rubocop", "rubocop")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'ruby-parse' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("parser", "ruby-parse")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'ruby-prof' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("ruby-prof", "ruby-prof")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'ruby-prof-check-trace' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("ruby-prof", "ruby-prof-check-trace")
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'ruby-rewrite' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("parser", "ruby-rewrite")