log_weasel 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +47 -0
- data/LICENSE +20 -0
- data/README.md +21 -0
- data/Rakefile +11 -0
- data/lib/log_weasel/transaction.rb +21 -0
- data/lib/log_weasel/version.rb +5 -0
- data/lib/log_weasel.rb +1 -0
- data/log_weasel.gemspec +26 -0
- data/spec/log_weasel/transaction_spec.rb +54 -0
- data/spec/spec_helper.rb +9 -0
- metadata +133 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create ruby-1.9.2-p0@log_weasel
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
log_weasel (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (3.0.4)
|
10
|
+
diff-lcs (1.1.2)
|
11
|
+
json (1.4.6)
|
12
|
+
mocha (0.9.11)
|
13
|
+
rake
|
14
|
+
rack (1.2.1)
|
15
|
+
rake (0.8.7)
|
16
|
+
redis (2.1.1)
|
17
|
+
redis-namespace (0.10.0)
|
18
|
+
redis (< 3.0.0)
|
19
|
+
resque (1.13.0)
|
20
|
+
json (~> 1.4.6)
|
21
|
+
redis-namespace (>= 0.10.0)
|
22
|
+
sinatra (>= 0.9.2)
|
23
|
+
vegas (~> 0.1.2)
|
24
|
+
rspec (2.5.0)
|
25
|
+
rspec-core (~> 2.5.0)
|
26
|
+
rspec-expectations (~> 2.5.0)
|
27
|
+
rspec-mocks (~> 2.5.0)
|
28
|
+
rspec-core (2.5.1)
|
29
|
+
rspec-expectations (2.5.0)
|
30
|
+
diff-lcs (~> 1.1.2)
|
31
|
+
rspec-mocks (2.5.0)
|
32
|
+
sinatra (1.1.2)
|
33
|
+
rack (~> 1.1)
|
34
|
+
tilt (~> 1.2)
|
35
|
+
tilt (1.2.2)
|
36
|
+
vegas (0.1.8)
|
37
|
+
rack (>= 1.0.0)
|
38
|
+
|
39
|
+
PLATFORMS
|
40
|
+
ruby
|
41
|
+
|
42
|
+
DEPENDENCIES
|
43
|
+
activesupport (~> 3.0)
|
44
|
+
log_weasel!
|
45
|
+
mocha
|
46
|
+
resque (~> 1.0)
|
47
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Carbon Five Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Log Weasel
|
2
|
+
|
3
|
+
Instrument Rails and Resque with shared transaction IDs so that you trace execution across instances. This particularly handy if you're using a system like <a href="http://www.splunk.com">Splunk</a> to manage your log files across many applications and application instances.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add log_weasel to your Gemfile:
|
8
|
+
|
9
|
+
<pre>
|
10
|
+
gem 'log_weasel'
|
11
|
+
</pre>
|
12
|
+
|
13
|
+
Use bundler to install it:
|
14
|
+
|
15
|
+
<pre>
|
16
|
+
bundle install
|
17
|
+
</pre>
|
18
|
+
|
19
|
+
## LICENSE
|
20
|
+
|
21
|
+
Released under the MIT License. See the LICENSE file for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module LogWeasel
|
2
|
+
module Transaction
|
3
|
+
|
4
|
+
def self.create(key = nil)
|
5
|
+
Thread.current[:manilla_transaction_id] = "#{key ? "#{key}_" : ""}#{SecureRandom.hex(10)}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.destroy
|
9
|
+
Thread.current[:manilla_transaction_id] = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.id=(id)
|
13
|
+
Thread.current[:manilla_transaction_id] = id
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.id
|
17
|
+
Thread.current[:manilla_transaction_id]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/lib/log_weasel.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'log_weasel/transaction'
|
data/log_weasel.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "log_weasel/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "log_weasel"
|
7
|
+
s.version = Log::Weasel::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Alon Salant"]
|
10
|
+
s.email = ["alon@salant.org"]
|
11
|
+
s.homepage = "http://github.com/carbonfive/log_weasel"
|
12
|
+
s.summary = "log_weasel-#{Log::Weasel::VERSION}"
|
13
|
+
s.description = %q{Instrument Rails and Resque with shared transaction IDs so that you trace execution across instances.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "log_weasel"
|
16
|
+
|
17
|
+
s.add_development_dependency('rspec')
|
18
|
+
s.add_development_dependency('mocha')
|
19
|
+
s.add_development_dependency('resque', ['~> 1.0'])
|
20
|
+
s.add_development_dependency('activesupport', ['~> 3.0'])
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
|
+
s.require_paths = ["lib"]
|
26
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/secure_random'
|
4
|
+
|
5
|
+
describe LogWeasel::Transaction do
|
6
|
+
|
7
|
+
describe ".id" do
|
8
|
+
|
9
|
+
it "is nil if not created" do
|
10
|
+
LogWeasel::Transaction.id.should be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".id=" do
|
16
|
+
before do
|
17
|
+
LogWeasel::Transaction.id = "1234"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "sets the id" do
|
21
|
+
LogWeasel::Transaction.id.should == "1234"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe ".create" do
|
27
|
+
before do
|
28
|
+
SecureRandom.stubs(:hex).returns('94b2')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'creates a transaction id with no key' do
|
32
|
+
id = LogWeasel::Transaction.create
|
33
|
+
id.should == '94b2'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'creates a transaction id with a key' do
|
37
|
+
id = LogWeasel::Transaction.create 'KEY'
|
38
|
+
id.should == 'KEY_94b2'
|
39
|
+
LogWeasel::Transaction.id.should == id
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ".destroy" do
|
45
|
+
before do
|
46
|
+
LogWeasel::Transaction.create
|
47
|
+
end
|
48
|
+
|
49
|
+
it "removes transaction id" do
|
50
|
+
LogWeasel::Transaction.destroy
|
51
|
+
LogWeasel::Transaction.id.should be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: log_weasel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Alon Salant
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-02-11 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
prerelease: false
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: mocha
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
version: "0"
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: resque
|
48
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 1
|
55
|
+
- 0
|
56
|
+
version: "1.0"
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id003
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: activesupport
|
62
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 3
|
69
|
+
- 0
|
70
|
+
version: "3.0"
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: *id004
|
74
|
+
description: Instrument Rails and Resque with shared transaction IDs so that you trace execution across instances.
|
75
|
+
email:
|
76
|
+
- alon@salant.org
|
77
|
+
executables: []
|
78
|
+
|
79
|
+
extensions: []
|
80
|
+
|
81
|
+
extra_rdoc_files: []
|
82
|
+
|
83
|
+
files:
|
84
|
+
- .gitignore
|
85
|
+
- .rvmrc
|
86
|
+
- Gemfile
|
87
|
+
- Gemfile.lock
|
88
|
+
- LICENSE
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- lib/log_weasel.rb
|
92
|
+
- lib/log_weasel/transaction.rb
|
93
|
+
- lib/log_weasel/version.rb
|
94
|
+
- log_weasel.gemspec
|
95
|
+
- spec/log_weasel/transaction_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
has_rdoc: true
|
98
|
+
homepage: http://github.com/carbonfive/log_weasel
|
99
|
+
licenses: []
|
100
|
+
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 1895836361551623115
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
version: "0"
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 1895836361551623115
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
124
|
+
requirements: []
|
125
|
+
|
126
|
+
rubyforge_project: log_weasel
|
127
|
+
rubygems_version: 1.3.7
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: log_weasel-0.0.1
|
131
|
+
test_files:
|
132
|
+
- spec/log_weasel/transaction_spec.rb
|
133
|
+
- spec/spec_helper.rb
|