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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d11ab424f832624ca57e0fb3fb89ef91f94266c
4
- data.tar.gz: cb885677c01a2f4c4a72042aae0d0c54c1148c93
3
+ metadata.gz: 0ce03f7fcc76802194c428bfd0bc34088e1097d6
4
+ data.tar.gz: bd41bf9db7265e93f3afe58da7916a5e03b5704e
5
5
  SHA512:
6
- metadata.gz: 4a65c599d300cb4f2b519774a4be78cc04a128961a23ca70a904f278aed37c4ca7a9b993222551f705755045f3b0cb48ea5e17745394c105e1b2931c223a256f
7
- data.tar.gz: ce8338418589aa3a034bed548bd5bbd3afbfa98d78a7cfc6343a350d45daebbfc327d0e7360e60d5e89808885f6320e873ee3b231cafdf286b1d4e63b62e0bd0
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.
@@ -5,6 +5,7 @@ require 'tracebin/health_monitor'
5
5
  require 'tracebin/worker_process_monitor'
6
6
  require 'tracebin/storage'
7
7
  require 'tracebin/reporter'
8
+ require 'tracebin/custom_instrumentation'
8
9
 
9
10
  module Tracebin
10
11
  module Agent
@@ -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
@@ -93,4 +93,16 @@ module Tracebin
93
93
  nil
94
94
  end
95
95
  end
96
+
97
+ class CustomEvent < Event
98
+ private
99
+
100
+ def type
101
+ :other
102
+ end
103
+
104
+ def select_data
105
+ nil
106
+ end
107
+ end
96
108
  end
@@ -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 str
16
+ Time.parse(str).in_time_zone('UTC')
17
17
  end
18
18
 
19
19
  def milliseconds_between(time1, time2)
@@ -1,3 +1,3 @@
1
1
  module Tracebin
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
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.12
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-04-28 00:00:00.000000000 Z
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