optic-rails 0.5.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/optic/rails/railtie.rb +10 -9
- data/lib/optic/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9768eeeb47c2c8c2eef8cdf95244e88644f2ee9455e8425ff20f184e9caab8ea
|
4
|
+
data.tar.gz: edb291080a2cd6d69fca3cc7ce665dd7035a5a521610ccd93b7820fb5c1796c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24f8ed8c4713484642f57a814b9e3a4a2855e9094c10077a5d098f684a86109f0428af77cedb0ef76779b1a47b7dc07722d43846ffb5973c01d43a7648d3313a
|
7
|
+
data.tar.gz: aff41fee8f75733a7498c5c112799589bac2e7fd9b6c9b661ef51f75a3fa1e729d4cfafa8773456569f301a88f19f8beb625b33c58bad25ce4dc0f5941c28a3c
|
data/lib/optic/rails/railtie.rb
CHANGED
@@ -5,12 +5,13 @@ require "logger"
|
|
5
5
|
module Optic
|
6
6
|
module Rails
|
7
7
|
class Railtie < ::Rails::Railtie
|
8
|
+
config.optic = ActiveSupport::OrderedOptions.new
|
9
|
+
|
8
10
|
initializer "optic_rails.launch_client_thread" do |app|
|
9
|
-
# TODO allow log output customization and verbose option
|
10
11
|
logger = Logger.new(STDOUT)
|
11
|
-
logger.level = Logger::WARN
|
12
|
+
logger.level = config.optic.debug ? Logger::DEBUG : Logger::WARN
|
12
13
|
|
13
|
-
|
14
|
+
did_print_project_key_warning = false
|
14
15
|
|
15
16
|
logger.debug "Starting supervisor thread"
|
16
17
|
supervisor = Thread.new do
|
@@ -18,19 +19,19 @@ module Optic
|
|
18
19
|
sleep 5.0
|
19
20
|
|
20
21
|
# Get configuration
|
21
|
-
if !
|
22
|
-
logger.warn "No
|
23
|
-
|
22
|
+
if !config.optic.project_key
|
23
|
+
logger.warn "No optic.project_key found in Rails configuration, Optic agent will not run" unless did_print_project_key_warning
|
24
|
+
did_print_project_key_warning = true
|
24
25
|
next
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
-
uri =
|
28
|
+
project_key = config.optic.project_key
|
29
|
+
uri = config.optic.uri || "wss://sutrolabs-tikal-api-production.herokuapp.com/cable"
|
29
30
|
|
30
31
|
logger.debug "Starting worker thread"
|
31
32
|
worker = Thread.new do
|
32
33
|
EventMachine.run do
|
33
|
-
client = ActionCableClient.new(uri, { channel: "MetricsChannel" }, true, { "Authorization" => "Bearer #{
|
34
|
+
client = ActionCableClient.new(uri, { channel: "MetricsChannel" }, true, { "Authorization" => "Bearer #{project_key}" })
|
34
35
|
|
35
36
|
client.connected do
|
36
37
|
logger.debug "Optic agent connected"
|
data/lib/optic/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optic-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Vaynshtok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: action_cable_client
|