logworm_amqp 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,4 @@
1
- v0.8.6
1
+ v0.8.7
2
2
  Now retrieve amqp_url remotely for better security.
3
3
 
4
4
  v0.8.5
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('logworm_amqp', '0.8.6') do |p|
2
+ Echoe.new('logworm_amqp', '0.8.7') do |p|
3
3
  p.description = "logworm logging tool"
4
4
  p.url = "http://www.logworm.com"
5
5
  p.author = "Pomelo, LLC"
data/lib/base/db.rb CHANGED
@@ -112,7 +112,10 @@ module Logworm
112
112
  def get_amqp_url()
113
113
  if @amqp_url.nil? and (@last_attempt.nil? or (Time.now - @last_attempt) > RETRY_FREQUENCY)
114
114
  begin
115
- @amqp_url = db_call(:get, "#{host_with_protocol}/amqp_url")["url"]
115
+ resp = db_call(:get, "#{host_with_protocol}/amqp_url")
116
+ @amqp_url = resp["url"]
117
+ @stats_freq = resp["stats_freq"]
118
+ puts "Found: #{@amqp_url}, #{@stats_freq}"
116
119
  Minion.amqp_url = @amqp_url
117
120
  rescue
118
121
  @last_attempt = Time.now
@@ -123,7 +126,8 @@ module Logworm
123
126
 
124
127
  def to_amqp(queue, payload)
125
128
  if get_amqp_url
126
- sig= signature(payload.to_json, @token_secret )
129
+ content = payload.to_json
130
+ sig= signature(content, @token_secret )
127
131
  Minion.enqueue(queue, {:payload => content, :consumer_key => @token, :signature => sig,
128
132
  :env => ENV['RACK_ENV'] || "?", :timestamp => Time.now})
129
133
  end
@@ -133,7 +137,7 @@ module Logworm
133
137
  s = Time.now
134
138
  yield if block_given?
135
139
  record_stats((Time.now - s))
136
- push_stats() if (rand(STATS_FREQ) == 1)
140
+ push_stats() if (rand(@stats_freq || 0) == 1)
137
141
  end
138
142
 
139
143
  def record_stats(value)
@@ -144,7 +148,7 @@ module Logworm
144
148
  end
145
149
 
146
150
  def push_stats()
147
- to_amqp("lw.stats", {:avg => (@total_time / @tock), :max => @amqp_max, :min => @amqp_min, :max => @amqp_max})
151
+ to_amqp("lw.stats", {:avg => (@total_time / @tock), :max => @amqp_max, :min => @amqp_min})
148
152
  reset_stats
149
153
  end
150
154
 
@@ -155,7 +159,7 @@ module Logworm
155
159
 
156
160
  def batch_log(entries)
157
161
  recording_stats do
158
- to_amqp("lw.logging", {:entries => entries.to_json})
162
+ to_amqp("lw.logging", {:entries => entries})
159
163
  end
160
164
  end
161
165
 
data/logworm_amqp.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{logworm_amqp}
5
- s.version = "0.8.6"
5
+ s.version = "0.8.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pomelo, LLC"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logworm_amqp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 6
10
- version: 0.8.6
9
+ - 7
10
+ version: 0.8.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pomelo, LLC