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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97fdc801bf28a576a592e12560541b7803d2ca3d2d58594c8e0756662ff0ce46
4
- data.tar.gz: 30a93912914bb03672659bd451a5f7961ee535e11f2262217dd6a4855c55015c
3
+ metadata.gz: 9768eeeb47c2c8c2eef8cdf95244e88644f2ee9455e8425ff20f184e9caab8ea
4
+ data.tar.gz: edb291080a2cd6d69fca3cc7ce665dd7035a5a521610ccd93b7820fb5c1796c8
5
5
  SHA512:
6
- metadata.gz: 7c7dbd059fae6f6cbcffcea30116e29da453d86284f220f30551bb3cc49d65721799f097e835259259b5aa3afe284311441a5d55d057da666fb6d3a8e23287e1
7
- data.tar.gz: 7715d60ca1acaf47d1c8c5b81ddc3cdda7d259e43855f01ef0897a0f0298c3330331e9a16fff9515d1d14db7a276fc36cec75b590072924bbaf7481eccc2e32d
6
+ metadata.gz: 24f8ed8c4713484642f57a814b9e3a4a2855e9094c10077a5d098f684a86109f0428af77cedb0ef76779b1a47b7dc07722d43846ffb5973c01d43a7648d3313a
7
+ data.tar.gz: aff41fee8f75733a7498c5c112799589bac2e7fd9b6c9b661ef51f75a3fa1e729d4cfafa8773456569f301a88f19f8beb625b33c58bad25ce4dc0f5941c28a3c
@@ -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
- did_print_api_key_warning = false
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 !app.config.respond_to? :optic_api_key
22
- logger.warn "No optic_api_key found in Rails configuration, Optic agent will not run" unless did_print_api_key_warning
23
- did_print_api_key_warning = true
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
- api_key = app.config.optic_api_key
28
- uri = app.config.respond_to?(:optic_uri) ? app.config.optic_uri : "wss://sutrolabs-tikal-api-production.herokuapp.com/cable"
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 #{api_key}" })
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"
@@ -1,5 +1,5 @@
1
1
  module Optic
2
2
  module Rails
3
- VERSION = '0.5.2'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
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.5.2
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-30 00:00:00.000000000 Z
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