tracebin 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/lib/tracebin/agent.rb +1 -0
- data/lib/tracebin/custom_instrumentation.rb +45 -0
- data/lib/tracebin/events.rb +12 -0
- data/lib/tracebin/helpers.rb +3 -3
- data/lib/tracebin/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ce03f7fcc76802194c428bfd0bc34088e1097d6
|
4
|
+
data.tar.gz: bd41bf9db7265e93f3afe58da7916a5e03b5704e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a1c5bc534e8a1e16a9fb2e1d1969bab44511c613af7e7729cb4f09f26766d352923d72da157602aa92caefdb78d175b75d3dce75e497ea3919a0cd28a7961a
|
7
|
+
data.tar.gz: e8fc1bb10bccdea97441c6f47f57b97c73f4d870c0b8d356a0082be4bf6153ef081ec0bb18a2101700c71a2429beecf881b01cd8c2de30a8f55094f662bf934d
|
data/README.md
CHANGED
@@ -38,6 +38,35 @@ Tracebin::Agent.configure do |config|
|
|
38
38
|
end
|
39
39
|
```
|
40
40
|
|
41
|
+
## Compatibility
|
42
|
+
|
43
|
+
`tracebin-ruby` has instrumentation in place for the following components:
|
44
|
+
|
45
|
+
### Rails
|
46
|
+
|
47
|
+
`tracebin-ruby` is compatible with Rails 4+.
|
48
|
+
|
49
|
+
- ActionController
|
50
|
+
- ActiveRecord
|
51
|
+
- ActionView
|
52
|
+
|
53
|
+
### Background Jobs
|
54
|
+
|
55
|
+
- ActiveJob
|
56
|
+
- Sidekiq
|
57
|
+
- Resque
|
58
|
+
|
59
|
+
### Sinatra
|
60
|
+
|
61
|
+
- Routes (used in place of ActionController)
|
62
|
+
|
63
|
+
### Databases
|
64
|
+
|
65
|
+
If ActiveRecord isn't used, then we've implemented patches for the following database adapters:
|
66
|
+
|
67
|
+
- PG (PostgreSQL)
|
68
|
+
- Mysql2 (MySQL)
|
69
|
+
|
41
70
|
## Development
|
42
71
|
|
43
72
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/tracebin/agent.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'tracebin/events'
|
2
|
+
require 'tracebin/helpers'
|
3
|
+
|
4
|
+
module Tracebin
|
5
|
+
module CustomInstrumentation
|
6
|
+
class << self
|
7
|
+
include Tracebin::Helpers
|
8
|
+
|
9
|
+
def instrument(identifier)
|
10
|
+
unless block_given?
|
11
|
+
raise ArgumentError, 'Tracebin instrumentation must receive a block'
|
12
|
+
end
|
13
|
+
|
14
|
+
start_time = timestamp_string
|
15
|
+
yield
|
16
|
+
end_time = timestamp_string
|
17
|
+
|
18
|
+
event_data = [
|
19
|
+
'custom.tracebin',
|
20
|
+
start_time,
|
21
|
+
end_time,
|
22
|
+
{
|
23
|
+
identifier: identifier
|
24
|
+
}
|
25
|
+
]
|
26
|
+
|
27
|
+
handle_event event_data
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def handle_event(event_data)
|
33
|
+
event = Tracebin::CustomEvent.new event_data
|
34
|
+
Tracebin::Recorder << event
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Module Tracebin
|
40
|
+
class << self
|
41
|
+
def instrument(*args, &block)
|
42
|
+
Tracebin::CustomInstrumentation.instrument *args, &block
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/tracebin/events.rb
CHANGED
data/lib/tracebin/helpers.rb
CHANGED
@@ -5,15 +5,15 @@ module Tracebin
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def time_to_string(time)
|
8
|
-
time.is_a?(String) ? time : time.iso8601(6)
|
8
|
+
time.is_a?(String) ? time : time.in_time_zone('UTC').iso8601(6)
|
9
9
|
end
|
10
10
|
|
11
11
|
def timestamp_string
|
12
|
-
Time.now.iso8601 6
|
12
|
+
Time.now.in_time_zone('UTC').iso8601 6
|
13
13
|
end
|
14
14
|
|
15
15
|
def deserialize_time_string(str)
|
16
|
-
Time.parse
|
16
|
+
Time.parse(str).in_time_zone('UTC')
|
17
17
|
end
|
18
18
|
|
19
19
|
def milliseconds_between(time1, time2)
|
data/lib/tracebin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracebin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Guillen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/tracebin/background_job_instrumentation/sidekiq.rb
|
107
107
|
- lib/tracebin/background_timer.rb
|
108
108
|
- lib/tracebin/config.rb
|
109
|
+
- lib/tracebin/custom_instrumentation.rb
|
109
110
|
- lib/tracebin/events.rb
|
110
111
|
- lib/tracebin/health_monitor.rb
|
111
112
|
- lib/tracebin/helpers.rb
|