avro2kafka 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: 1480bbac2f419eee81ef08ca2ff227cff4fb8926
4
- data.tar.gz: 4040db1c73723f00326570b6fd63227cc62f324f
3
+ metadata.gz: c34b30a428eeada324bcd0ff95581a7ad6d36b6e
4
+ data.tar.gz: c83e33109ef559011375a96cef8091bbaf31e181
5
5
  SHA512:
6
- metadata.gz: 33428a0304ec5b01193bb6ec5dd6c7ad9876838059ca0b89ee6892f46689e96c14d0b20b822ea97033d5dbb24b9c6237daf42e98bb857896e9be44bc975d002c
7
- data.tar.gz: 2e9a2aacafb9bc6bdfa65bb6c125a27c17d844e2d1b223145eddec01559cf53f1213923abaf24dbc34e0621112a5ecc1b541ce6e477b96d5a23067006df82b5e
6
+ metadata.gz: b44aa4c8f99fa0e5a73dfe18a38c75b0adb57e6a9fe61f6ef93acaf74f4d5987356b442fe07c839950149dcf23effaffbe9f8d949130852528734292531733bd
7
+ data.tar.gz: aa0dfd3829445da40d34c8b70612dd023f656147ba61f325c39a14bd35870c81f5b89a5734b544e98481c885fd4db9636fa6d7ddce538c43217f1438e2631844
data/.gitignore CHANGED
@@ -1 +1,17 @@
1
- .ruby-version
1
+ /.bundle/
2
+ /.ruby-version
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /feeds/
9
+ /pkg/
10
+ /schema/
11
+ /spec/reports/
12
+ /tmp/
13
+ *.bundle
14
+ *.so
15
+ *.o
16
+ *.a
17
+ mkmf.log
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project are documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## 0.4.0 (2015-11-18)
7
+ Structured logging
8
+
9
+ ### Changed
10
+ * Log in JSON format using Logr (https://github.com/sspinc/logr)
11
+
12
+ ### Added
13
+ * New started_publishing and finished_publishing events
14
+ * New lines_processed metric
15
+
6
16
  ## 0.3.0 (2015-08-27)
7
17
  Improved error reporting
8
18
 
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_runtime_dependency "avro", "~> 1.7"
30
30
  spec.add_runtime_dependency "poseidon", "~> 0.0.5"
31
+ spec.add_runtime_dependency "logr", "~> 0.1.0"
31
32
  end
@@ -41,10 +41,12 @@ begin
41
41
 
42
42
  Avro2Kafka.new(options).publish
43
43
  rescue OptionParser::MissingArgument => ex
44
+ Avro2Kafka.logger.fatal(ex.message)
44
45
  $stderr.puts ex.message
45
46
  $stderr.puts option_parser
46
47
  exit 2
47
48
  rescue Exception => e
49
+ Avro2Kafka.logger.fatal("processing failed: #{e.message}")
48
50
  $stderr.puts 'Uh oh, something went wrong!'
49
51
  $stderr.puts e.message
50
52
  $stderr.puts e.backtrace.join("\n")
@@ -2,10 +2,17 @@ require 'avro2kafka/version'
2
2
  require 'avro2kafka/avro_reader'
3
3
  require 'avro2kafka/kafka_publisher'
4
4
 
5
+ require 'logr'
6
+
5
7
  class Avro2Kafka
6
8
  attr_reader :options
7
9
 
10
+ def self.logger
11
+ @logger ||= Logr::Logger.new('avro2kafka')
12
+ end
13
+
8
14
  def initialize(options)
15
+ @path = ARGV.first
9
16
  @options = options
10
17
  end
11
18
 
@@ -14,9 +21,21 @@ class Avro2Kafka
14
21
  end
15
22
 
16
23
  def publish
24
+ Avro2Kafka.logger.event('started_publishing', { filename: filename, topic: topic }.merge(extra_data))
25
+ .monitored("Started publishing #{filename}", "Started publishing #{filename} to the #{topic} Kafka topic.")
26
+ .info("Started publishing #{filename}")
27
+
17
28
  records = AvroReader.new(reader).read
18
29
  KafkaPublisher.new(**kafka_options).publish(records)
19
- $stderr.puts "Avro file published to #{topic} topic on #{broker_list}!"
30
+
31
+ Avro2Kafka.logger.event('finished_publishing', { filename: filename, topic: topic }.merge(extra_data))
32
+ .monitored("Finished publishing #{filename}", "Finished publishing #{filename} to the #{topic} Kafka topic.")
33
+ .metric('lines_processed', records.count)
34
+ .info("Finished publishing #{filename}")
35
+ end
36
+
37
+ def filename
38
+ File.basename(@path)
20
39
  end
21
40
 
22
41
  def topic
@@ -1,3 +1,3 @@
1
1
  class Avro2Kafka
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avro2kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Marton
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-08-28 00:00:00.000000000 Z
13
+ date: 2015-11-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -110,6 +110,20 @@ dependencies:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
112
  version: 0.0.5
113
+ - !ruby/object:Gem::Dependency
114
+ name: logr
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 0.1.0
120
+ type: :runtime
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 0.1.0
113
127
  description: Publish Avro files to Kafka in JSON format
114
128
  email:
115
129
  - martonpe@secretsaucepartners.com
@@ -125,7 +139,6 @@ files:
125
139
  - ".travis.yml"
126
140
  - CHANGELOG.md
127
141
  - Gemfile
128
- - Gemfile.lock
129
142
  - LICENSE.txt
130
143
  - README.md
131
144
  - Rakefile
@@ -1,48 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- avro2kafka (0.3.0)
5
- avro (~> 1.7)
6
- poseidon (~> 0.0.5)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- avro (1.7.7)
12
- multi_json
13
- bump (0.5.2)
14
- coderay (1.1.0)
15
- diff-lcs (1.2.5)
16
- method_source (0.8.2)
17
- multi_json (1.11.1)
18
- poseidon (0.0.5)
19
- pry (0.10.1)
20
- coderay (~> 1.1.0)
21
- method_source (~> 0.8.1)
22
- slop (~> 3.4)
23
- rake (10.4.2)
24
- rspec (3.2.0)
25
- rspec-core (~> 3.2.0)
26
- rspec-expectations (~> 3.2.0)
27
- rspec-mocks (~> 3.2.0)
28
- rspec-core (3.2.3)
29
- rspec-support (~> 3.2.0)
30
- rspec-expectations (3.2.1)
31
- diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.2.0)
33
- rspec-mocks (3.2.1)
34
- diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.2.0)
36
- rspec-support (3.2.2)
37
- slop (3.6.0)
38
-
39
- PLATFORMS
40
- ruby
41
-
42
- DEPENDENCIES
43
- avro2kafka!
44
- bump (~> 0.5)
45
- bundler (~> 1.6)
46
- pry (~> 0.10)
47
- rake (~> 10.0)
48
- rspec (~> 3.2)