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 +4 -4
- data/.gitignore +17 -1
- data/CHANGELOG.md +10 -0
- data/avro2kafka.gemspec +1 -0
- data/bin/avro2kafka +2 -0
- data/lib/avro2kafka.rb +20 -1
- data/lib/avro2kafka/version.rb +1 -1
- metadata +16 -3
- data/Gemfile.lock +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c34b30a428eeada324bcd0ff95581a7ad6d36b6e
|
4
|
+
data.tar.gz: c83e33109ef559011375a96cef8091bbaf31e181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b44aa4c8f99fa0e5a73dfe18a38c75b0adb57e6a9fe61f6ef93acaf74f4d5987356b442fe07c839950149dcf23effaffbe9f8d949130852528734292531733bd
|
7
|
+
data.tar.gz: aa0dfd3829445da40d34c8b70612dd023f656147ba61f325c39a14bd35870c81f5b89a5734b544e98481c885fd4db9636fa6d7ddce538c43217f1438e2631844
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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
|
|
data/avro2kafka.gemspec
CHANGED
data/bin/avro2kafka
CHANGED
@@ -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")
|
data/lib/avro2kafka.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/avro2kafka/version.rb
CHANGED
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.
|
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-
|
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
|
data/Gemfile.lock
DELETED
@@ -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)
|