loggregator_emitter 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: de1e992ddcf72616bf70df570893b54568ff9f5e
4
+ data.tar.gz: d4c5ffb3c3190d0746cf298be1badd0d80e745a1
5
+ SHA512:
6
+ metadata.gz: 9dd300112b90955a1cb2be234c141d63252363ef970d7230412a096cc1cbf1770a06bd40c68d1d8e647ee64ad1e80f5fa59df0cf88c12688e06f39a4bc5a877f
7
+ data.tar.gz: 955f3cab33b0e7672f5d5c6e2ed71284907b89d6a506ff07659e582b50c53c963eb56d140fad4fa42ee25ea603d315a3e6c6008dd5e7bdd876c5ab6f85f4a746
@@ -3,7 +3,11 @@ notifications:
3
3
  - cf-loggregator@pivotallabs.com
4
4
  language: ruby
5
5
  rvm:
6
- - 1.9.3
7
- - 2.0.0
8
-
9
- script: 'bundle exec rake'
6
+ - 1.9.3
7
+ - 2.0.0
8
+ script:
9
+ - bundle exec rake nonperformance
10
+ - DISABLE_COVERAGE=true bundle exec rake performance
11
+ env:
12
+ global:
13
+ secure: SqFTUY2M1pyWzBZtQTEvkHwM+H1b8viGUlXhp3YtwqCvSLD5fO7ApsBkuH1RUHOcDZaYa4UYHvulEigIQm5woywosssuJSGdIFL48Us26gqc3iC9rGzbeCyeT0yJug7LicFPKyDpB7zHz0ma1syEquS3PR9SuiLkgIY2D4VmTHY=
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Loggregator Emitter [![Build Status](https://travis-ci.org/cloudfoundry/loggregator_emitter.png?branch=master)](https://travis-ci.org/cloudfoundry/loggregator_emitter)
1
+ # Loggregator Emitter
2
+
3
+ [![Build Status](https://travis-ci.org/cloudfoundry/loggregator_emitter.svg?branch=master)](https://travis-ci.org/cloudfoundry/loggregator_emitter) [![Coverage Status](https://coveralls.io/repos/cloudfoundry/loggregator_emitter/badge.svg?branch=master)](https://coveralls.io/r/cloudfoundry/loggregator_emitter?branch=master) [![Gem Version](https://badge.fury.io/rb/loggregator_emitter.svg)](http://badge.fury.io/rb/loggregator_emitter)
2
4
 
3
5
  ### About
4
6
 
data/Rakefile CHANGED
@@ -3,3 +3,11 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
  task :default => :spec
6
+
7
+ RSpec::Core::RakeTask.new(:performance) do |t|
8
+ t.rspec_opts = "--tag performance"
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new(:nonperformance) do |t|
12
+ t.rspec_opts = "--tag ~performance"
13
+ end
@@ -4,6 +4,8 @@ require 'resolv'
4
4
  module LoggregatorEmitter
5
5
  class Emitter
6
6
 
7
+ UDP_SEND_ERROR = StandardError.new("Error sending message via UDP")
8
+
7
9
  attr_reader :host
8
10
 
9
11
  MAX_MESSAGE_BYTE_SIZE = (9 * 1024) - 512
@@ -92,7 +94,12 @@ module LoggregatorEmitter
92
94
  addrinfo_udp = Addrinfo.udp(@host, @port)
93
95
  s = addrinfo_udp.ipv4?() ? UDPSocket.new : UDPSocket.new(Socket::AF_INET6)
94
96
  s.do_not_reverse_lookup = true
95
- s.sendmsg_nonblock(result, 0, addrinfo_udp)
97
+
98
+ begin
99
+ s.sendmsg_nonblock(result, 0, addrinfo_udp)
100
+ rescue
101
+ raise UDP_SEND_ERROR
102
+ end
96
103
  end
97
104
  end
98
105
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "loggregator_emitter"
5
- spec.version = '3.0.0'
5
+ spec.version = '4.0.0'
6
6
  spec.authors = ["Pivotal"]
7
7
  spec.email = ["cf-eng@pivotallabs.com"]
8
8
  spec.description = "Library to emit data to Loggregator"
@@ -17,9 +17,10 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
19
19
 
20
- spec.add_dependency "beefcake", "~> 0.3.7"
20
+ spec.add_dependency "beefcake", "~> 1.0.0"
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.3"
23
23
  spec.add_development_dependency "rake", "~> 10.1.0"
24
24
  spec.add_development_dependency "rspec", "~> 2.14.1"
25
+ spec.add_development_dependency "coveralls"
25
26
  end
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/fake_loggregator_server"
2
3
  require "loggregator_emitter"
3
4
 
@@ -26,7 +27,7 @@ shared_examples "a performance test" do |fixture, using_server|
26
27
  end
27
28
  end
28
29
 
29
- it "emits #{fixture.name} within a time threshold #{using_server ? 'with' : 'without'} server" do
30
+ it "emits #{fixture.name} within a time threshold #{using_server ? 'with' : 'without'} server", performance: true do
30
31
  start_time = Time.now.to_f
31
32
 
32
33
  iterations.times { @emitter.emit("my_app_id", fixture.message) }
@@ -58,4 +59,4 @@ describe LoggregatorEmitter do
58
59
  it_behaves_like "a performance test", fixture, using_server
59
60
  end
60
61
  end
61
- end
62
+ end
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+ require "spec_helper"
1
3
  require "support/fake_loggregator_server"
2
4
  require "loggregator_emitter"
3
5
 
@@ -94,6 +96,13 @@ describe LoggregatorEmitter do
94
96
  expect(message.log_message.message_type).to eq LogMessage::MessageType::OUT
95
97
  end
96
98
 
99
+ it "gracefully handles failures to send messages" do
100
+ emitter = make_emitter("0.0.0.0")
101
+ UDPSocket.any_instance.stub(:sendmsg_nonblock).and_raise("Operation not permitted - sendmsg(2) (Errno::EPERM)")
102
+
103
+ expect {emitter.emit("my_app_id", "Hello there!")}.to raise_error(LoggregatorEmitter::Emitter::UDP_SEND_ERROR)
104
+ end
105
+
97
106
  it "makes the right protobuffer" do
98
107
  emitter = make_emitter("0.0.0.0")
99
108
 
@@ -193,6 +202,18 @@ describe LoggregatorEmitter do
193
202
  messages = @server.messages
194
203
  expect(messages.length).to eq 4
195
204
  end
205
+
206
+ it "sends messages with unicode characters " do
207
+ emitter = make_emitter("localhost")
208
+ message = "測試".encode("utf-8")
209
+ emitter.send(emit_method, "my_app_id", message)
210
+
211
+ sleep 0.5
212
+
213
+ messages = @server.messages
214
+ expect(messages.length).to eq 1
215
+ expect(messages[0].message.force_encoding("utf-8")).to eq "測試"
216
+ end
196
217
  end
197
218
  end
198
219
 
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require "spec_helper"
3
4
  require "loggregator_emitter"
4
5
 
5
6
  describe Encryption do
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "rspec"
2
3
  require "loggregator_emitter"
3
4
 
@@ -0,0 +1,4 @@
1
+ unless ENV['DISABLE_COVERAGE'] == 'true'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggregator_emitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
5
- prerelease:
4
+ version: 4.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Pivotal
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-16 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: beefcake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.3.7
19
+ version: 1.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 0.3.7
26
+ version: 1.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,11 +62,24 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
77
68
  version: 2.14.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
78
83
  description: Library to emit data to Loggregator
79
84
  email:
80
85
  - cf-eng@pivotallabs.com
@@ -99,38 +104,36 @@ files:
99
104
  - spec/loggregator_emitter/emit_spec.rb
100
105
  - spec/loggregator_emitter/encryption_spec.rb
101
106
  - spec/loggregator_emitter/log_message_extender_spec.rb
107
+ - spec/spec_helper.rb
102
108
  - spec/support/fake_loggregator_server.rb
103
109
  homepage: https://www.github.com/cloudfoundry/loggregator_emitter
104
110
  licenses:
105
111
  - Apache 2.0
112
+ metadata: {}
106
113
  post_install_message:
107
114
  rdoc_options: []
108
115
  require_paths:
109
116
  - lib
110
117
  required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
118
  requirements:
113
- - - ! '>='
119
+ - - '>='
114
120
  - !ruby/object:Gem::Version
115
121
  version: 1.9.3
116
122
  required_rubygems_version: !ruby/object:Gem::Requirement
117
- none: false
118
123
  requirements:
119
- - - ! '>='
124
+ - - '>='
120
125
  - !ruby/object:Gem::Version
121
126
  version: '0'
122
- segments:
123
- - 0
124
- hash: -622288572178698844
125
127
  requirements: []
126
128
  rubyforge_project:
127
- rubygems_version: 1.8.25
129
+ rubygems_version: 2.2.2
128
130
  signing_key:
129
- specification_version: 3
131
+ specification_version: 4
130
132
  summary: Library to emit data to Loggregator
131
133
  test_files:
132
134
  - spec/loggregator_emitter/emit_performance_spec.rb
133
135
  - spec/loggregator_emitter/emit_spec.rb
134
136
  - spec/loggregator_emitter/encryption_spec.rb
135
137
  - spec/loggregator_emitter/log_message_extender_spec.rb
138
+ - spec/spec_helper.rb
136
139
  - spec/support/fake_loggregator_server.rb