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 +4 -4
- data/README.md +23 -5
- data/lib/tracebin/agent.rb +7 -0
- data/lib/tracebin/config.rb +2 -1
- data/lib/tracebin/reporter.rb +2 -2
- data/lib/tracebin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1154bcf6a675e91b8bf67d1996b669ffdb35ff7a
|
4
|
+
data.tar.gz: 4e898dbe53ffea1676abfe241a1c8adfb40d5ea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
14
18
|
|
15
|
-
|
19
|
+
Configure the gem to point to this bin:
|
16
20
|
|
17
|
-
|
21
|
+
```ruby
|
22
|
+
Tracebin::Agent.configure do |config|
|
23
|
+
config.bin_id = '<YOUR BIN ID>'
|
24
|
+
end
|
25
|
+
```
|
18
26
|
|
19
|
-
##
|
27
|
+
## Configuration
|
20
28
|
|
21
|
-
|
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
|
|
data/lib/tracebin/agent.rb
CHANGED
@@ -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!"
|
data/lib/tracebin/config.rb
CHANGED
data/lib/tracebin/reporter.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
data/lib/tracebin/version.rb
CHANGED