tracebin 0.0.8 → 0.0.9

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: 632b0078b17a6e931957ef7c68fa6618633bc798
4
- data.tar.gz: e9dfe8944b070c402683a50e5d39664f07c1c5dc
3
+ metadata.gz: 1154bcf6a675e91b8bf67d1996b669ffdb35ff7a
4
+ data.tar.gz: 4e898dbe53ffea1676abfe241a1c8adfb40d5ea7
5
5
  SHA512:
6
- metadata.gz: 7e7873a9d6d04088225e0f39b8d3fa7b6fc92cd202a055a535d828968beda8c2c0f87fec5135e1853c5e975d81294523411263ddcd2f199cf16a32d7d6f3d4e8
7
- data.tar.gz: 47c77b5ccdb964e95e35999e821d646b0a468c074c8d1161f69b6e4638be9265baf60d013003e7b3efac823cf336d753a5e1012ad269d043af3b1abe898827cf
6
+ metadata.gz: 071b0a19683f51231b3f0a7e431f39531ae240111278736e7349637d9f15c3dd6e4a835ca99f2a0b5fea99aee0e1d8a3bf233590ce7981b45deeb1aa33e02a53
7
+ data.tar.gz: 8e74447c51d81cbc755ab936f726f1720af9e4e0e7bd9429f14e2058285f353b075b52f4caa7752822198b65e0c8cf239d904acbc12189baf6a7b000bf0476cc
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # tracebin-ruby
2
2
 
3
+ This is the official Ruby agent for Tracebin, a simple performance monitoring tool for web applications. Go to [traceb.in](https://traceb.in) to get started.
4
+
3
5
  ## Installation
4
6
 
5
7
  Add this line to your application's Gemfile:
@@ -10,15 +12,31 @@ gem 'tracebin'
10
12
 
11
13
  And then execute:
12
14
 
13
- $ bundle
15
+ ```
16
+ $ bundle
17
+ ```
14
18
 
15
- Or install it yourself as:
19
+ Configure the gem to point to this bin:
16
20
 
17
- $ gem install tracebin
21
+ ```ruby
22
+ Tracebin::Agent.configure do |config|
23
+ config.bin_id = '<YOUR BIN ID>'
24
+ end
25
+ ```
18
26
 
19
- ## Usage
27
+ ## Configuration
20
28
 
21
- TODO: Write usage instructions here
29
+ There are several configuration options available for the Tracebin agent. Just set the options in a `configure` block on `Tracebin::Agent`:
30
+
31
+ ```ruby
32
+ Tracebin::Agent.configure do |config|
33
+ config.ignored_paths = ['/assets'] # Put any paths you wish to ignore in an array.
34
+
35
+ if Rails.env.development? || Rails.env.test?
36
+ config.enabled = false # You can completely disable the agent under the conditions of your choosing.
37
+ end
38
+ end
39
+ ```
22
40
 
23
41
  ## Development
24
42
 
@@ -12,6 +12,8 @@ module Tracebin
12
12
  attr_accessor :config, :storage, :logger
13
13
 
14
14
  def start!
15
+ return if started? || !config.enabled
16
+
15
17
  logger.info "TRACEBIN: Starting Tracebin agent..."
16
18
 
17
19
  @subscribers = Subscribers.new
@@ -21,17 +23,22 @@ module Tracebin
21
23
  @reporter = Reporter.new(storage, config, logger)
22
24
 
23
25
  @reporter.start!
26
+ @started = true
24
27
 
25
28
  logger.info "TRACEBIN: Tracebin agent started!"
26
29
  end
27
30
 
28
31
  def stop!
32
+ return unless started?
33
+
29
34
  logger.info "TRACEBIN: Shutting down Tracebin agent..."
30
35
 
31
36
  @health_monitor.stop!
32
37
  @worker_process_monitor.stop!
33
38
  @reporter.stop!
34
39
 
40
+ storage.unload
41
+
35
42
  @started = false
36
43
 
37
44
  logger.info "TRACEBIN: Tracebin agent stopped!"
@@ -4,7 +4,8 @@ module Tracebin
4
4
  log_level: 'info',
5
5
  host: 'https://traceb.in',
6
6
  report_path: 'reports',
7
- ignored_paths: []
7
+ ignored_paths: [],
8
+ enabled: true
8
9
  }.freeze
9
10
 
10
11
  attr_accessor *(DEFAULTS.keys + [:bin_id])
@@ -62,7 +62,7 @@ module Tracebin
62
62
  res
63
63
  rescue Exception => e
64
64
  logger.warn "TRACEBIN: Exception occurred sending data to the server: #{e.message}"
65
- self.stop!
65
+ Tracebin::Agent.stop!
66
66
  end
67
67
 
68
68
  def handle_response(res, payload)
@@ -71,7 +71,7 @@ module Tracebin
71
71
  logger.info 'TRACEBIN: Successfully sent payload to the server.'
72
72
  when Net::HTTPBadRequest
73
73
  logger.warn 'TRACEBIN: App bin ID not found. Please create a new app bin and add it to the config.'
74
- self.stop!
74
+ Tracebin::Agent.stop!
75
75
  else
76
76
  logger.warn 'TRACEBIN: Failed to send data to the server. Will try again in 1 minute.'
77
77
  @storage.add_payload payload
@@ -1,3 +1,3 @@
1
1
  module Tracebin
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracebin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Guillen