pushyd 0.20.1 → 0.21.0

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: c2c2fdf04d821f7426534efaf27cf2d9b22f4dd9
4
- data.tar.gz: 675fc154c60c0e485a998512514f56075442b7f0
3
+ metadata.gz: ba39e2325a7509e30286b4f11a82947c057cf292
4
+ data.tar.gz: da884f2520bc928813fe9f040d4f655ece0d0837
5
5
  SHA512:
6
- metadata.gz: c6a95461c0fc1906ebcc622f8e8d07e3e78c0568d45ab05a472cbcaa87ec07efc9bae8ab4712459331fd904bac65c2e452368b6517277ce15e5399f1a7af58fd
7
- data.tar.gz: d3b4448c9802b03b4913620ea3d2517dffdce669d7146c306322c05b99cda7162ab9ef6da4a23f3fb0b25f1a0a0636feff36ab34411b372fcd0ea716b2920476
6
+ metadata.gz: d1df640a0cf5b6a768f0af39d7e27f4ade48289f4a2ca3549e68744ebc3b05f7478d959d55b69aef56b7c8cda9fb80c3ef4b6d3bb796563c5d86150dc1027428
7
+ data.tar.gz: 01db0c676f7d2a5f6c7f4299a1f6a2551fdf65603b24b8c1f8e11daeb110e955b1c98cba91d1c8ac949cafa25810c85b5faea7ed33de6986bb462e1edd390739
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ log/
7
7
  DOC/
8
8
  .ruby-version
9
9
  local.yml
10
+ /.idea
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pushyd (0.20.1)
4
+ pushyd (0.21.0)
5
5
  api-auth
6
- bmc-daemon-lib (~> 0.3.16)
6
+ bmc-daemon-lib (~> 0.4.3)
7
7
  bunny (~> 2.3)
8
8
  daemons
9
9
  json
@@ -19,8 +19,8 @@ GEM
19
19
  amq-protocol (2.0.1)
20
20
  api-auth (2.0.1)
21
21
  ast (2.3.0)
22
- bmc-daemon-lib (0.3.16)
23
- chamber (~> 2.9)
22
+ bmc-daemon-lib (0.4.3)
23
+ chamber (~> 2.9.1)
24
24
  bunny (2.5.1)
25
25
  amq-protocol (>= 2.0.1)
26
26
  chamber (2.9.1)
@@ -30,7 +30,7 @@ GEM
30
30
  diff-lcs (1.2.5)
31
31
  domain_name (0.5.20160826)
32
32
  unf (>= 0.0.5, < 1.0.0)
33
- hashie (3.4.4)
33
+ hashie (3.4.6)
34
34
  http (2.0.3)
35
35
  addressable (~> 2.3)
36
36
  http-cookie (~> 1.0)
@@ -45,16 +45,16 @@ GEM
45
45
  multi_json (1.12.1)
46
46
  netrc (0.11.0)
47
47
  newrelic_rpm (3.16.2.321)
48
- parser (2.3.1.2)
48
+ parser (2.3.1.4)
49
49
  ast (~> 2.2)
50
50
  powerpack (0.1.1)
51
51
  rainbow (2.1.0)
52
- rake (11.2.2)
52
+ rake (11.3.0)
53
53
  rest-client (1.8.0)
54
54
  http-cookie (>= 1.0.2, < 2.0)
55
55
  mime-types (>= 1.16, < 3.0)
56
56
  netrc (~> 0.7)
57
- rollbar (2.12.0)
57
+ rollbar (2.13.1)
58
58
  multi_json
59
59
  rspec (3.5.0)
60
60
  rspec-core (~> 3.5.0)
@@ -69,14 +69,14 @@ GEM
69
69
  diff-lcs (>= 1.2.0, < 2.0)
70
70
  rspec-support (~> 3.5.0)
71
71
  rspec-support (3.5.0)
72
- rubocop (0.42.0)
72
+ rubocop (0.43.0)
73
73
  parser (>= 2.3.1.1, < 3.0)
74
74
  powerpack (~> 0.1)
75
75
  rainbow (>= 1.99.1, < 3.0)
76
76
  ruby-progressbar (~> 1.7)
77
77
  unicode-display_width (~> 1.0, >= 1.0.1)
78
78
  ruby-progressbar (1.8.1)
79
- terminal-table (1.7.2)
79
+ terminal-table (1.7.3)
80
80
  unicode-display_width (~> 1.1.1)
81
81
  thor (0.19.1)
82
82
  unf (0.1.4)
data/bin/pushyd CHANGED
@@ -75,10 +75,13 @@ monitor: false,
75
75
  }
76
76
  Daemons.run_proc(Conf.generate(:process_name), run_options) do
77
77
  # Load code
78
- puts "--- load code"
78
+ Conf.prepare_newrelic
79
+
80
+ # Load code
81
+ Conf.log :launcher, "load project code"
79
82
  require_relative "../lib/pushyd"
80
83
 
81
84
  # Start daemon
82
- puts "--- start daemon"
85
+ Conf.log :launcher, "start daemon"
83
86
  PushyDaemon::Daemon.run
84
87
  end
@@ -7,8 +7,8 @@ logs:
7
7
  default: "pushyd-default.log"
8
8
  shouter: "pushyd-shouter.log"
9
9
  consumer: "pushyd-consumer.log"
10
- # newrelic: "pushyd-newrelic.log"
11
- # rollbar: "pushyd-rollbar.log"
10
+ newrelic: "pushyd-newrelic.log"
11
+ rollbar: "pushyd-rollbar.log"
12
12
 
13
13
  shout:
14
14
  topic: pushyd
@@ -22,11 +22,13 @@ shout:
22
22
  - deleted
23
23
  - crunched
24
24
 
25
- # newrelic:
26
- # license: ""
27
- # platform: "bigbusiness" # app platform name
28
- # app_name: "rftpd-bigbusiness-dev" # nickname used for naming app
29
- # logfile: null
25
+ newrelic:
26
+ enabled: true
27
+ disabled: false
28
+
29
+ rollbar:
30
+ enabled: true
31
+ disabled: false
30
32
 
31
33
  # rules:
32
34
  # proxy_tests:
@@ -13,13 +13,16 @@ AMQP_MANUAL_ACK = false
13
13
  SHOUTER_SENTAT_DECIMALS = 6
14
14
 
15
15
  # Constants: logger
16
- LOG_HEADER_TIME = "%Y-%m-%d %H:%M:%S"
17
- LOG_HEADER_FORMAT = "%s \t%d\t%-8s %-15s "
18
- LOG_MESSAGE_TRIM = 500
19
- LOG_MESSAGE_TEXT = "%s%s"
20
- LOG_MESSAGE_ARRAY = "%s %s"
21
- LOG_MESSAGE_HASH = "%s %-20s %s\n"
16
+ LOGGER_FORMAT = {
17
+ context: {
18
+ caller: "%-17s",
19
+ rule: "%-20s",
20
+ }
21
+ # array: "PA%s %s",
22
+ # hash: "PH%s %-20s %s",
23
+ }
24
+
22
25
 
23
26
  # Constants: logger app-specific prefix
24
27
  #LOG_PREFIX_FORMAT = "(%-12s) (%-12s)"
25
- LOG_PREFIX_FORMAT = "%-20s "
28
+
@@ -19,7 +19,7 @@ module PushyDaemon
19
19
  @rule_name = rule_name
20
20
 
21
21
  # Prepare logger
22
- @logger = BmcDaemonLib::LoggerPool.instance.get :consumer
22
+ log_pipe :consumer
23
23
 
24
24
  # Create channel, prefetch only one message at a time
25
25
  @channel = @conn.create_channel
@@ -31,8 +31,10 @@ module PushyDaemon
31
31
 
32
32
  protected
33
33
 
34
- def log_prefix
35
- [@rule_name]
34
+ def log_context
35
+ {
36
+ rule: @rule_name
37
+ }
36
38
  end
37
39
 
38
40
  # Handle the reception of a message on a queue
@@ -10,7 +10,7 @@ module PushyDaemon
10
10
  sleep 1
11
11
  end
12
12
 
13
- rescue EndpointConnectionError, ShouterInterrupted => e
13
+ rescue BmcDaemonLib::MqConsumerException, EndpointConnectionError, ShouterInterrupted => e
14
14
  abort "EXITING #{e.class}: #{e.message}"
15
15
  rescue Errno::EACCES, StandardError => e
16
16
  abort "EXITING #{e.class}: #{e.message} \n #{e.backtrace.to_yaml}"
@@ -1,3 +1,2 @@
1
- # Init Rollbar and Newrelic
2
- Conf.prepare_newrelic
1
+ # Init Rollbar
3
2
  Conf.prepare_rollbar
@@ -46,9 +46,11 @@ module PushyDaemon
46
46
 
47
47
  protected
48
48
 
49
- def log_prefix
50
- [nil]
51
- # [self.class.name.split('::').last, :proxy]
49
+ def log_context
50
+ {
51
+ me: :proxy
52
+ }
53
+
52
54
  end
53
55
 
54
56
  def create_shouter
@@ -66,12 +68,11 @@ module PushyDaemon
66
68
  def create_consumers
67
69
  # Get config
68
70
  config_rules = BmcDaemonLib::Conf[:rules]
69
- log_info "create_consumers: #{config_rules.keys.join(', ')}"
70
-
71
71
  if config_rules.nil? || !config_rules.is_a?(Hash)
72
- log_error "prepare: no rules"
72
+ log_error "create_consumers: no rules"
73
73
  return
74
74
  end
75
+ log_info "create_consumers: #{config_rules.keys.join(', ')}"
75
76
 
76
77
  # Subscribe for each and every rule/route
77
78
  config_rules.each do |name, rule|
@@ -109,5 +110,10 @@ module PushyDaemon
109
110
  @consumers << consumer
110
111
  end
111
112
 
113
+
114
+ def consumer_cancelled all={}
115
+ log_error "consumer_cancelled remotely: #{all.inspect}"
116
+ end
117
+
112
118
  end
113
119
  end
@@ -20,7 +20,7 @@ module PushyDaemon
20
20
  @exchange = nil
21
21
 
22
22
  # Prepare logger
23
- @logger = BmcDaemonLib::LoggerPool.instance.get :shouter
23
+ log_pipe :shouter
24
24
 
25
25
  # Check config
26
26
  unless config_shout && config_shout.any? && config_shout.is_a?(Enumerable)
@@ -68,9 +68,11 @@ module PushyDaemon
68
68
 
69
69
  protected
70
70
 
71
- def log_prefix
72
- [nil]
73
- # [self.class.name.split('::').last, :shouter]
71
+ def log_context
72
+ {
73
+ me: :shouter
74
+ }
75
+
74
76
  end
75
77
 
76
78
  private
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.20.1"
4
+ spec.version = "0.21.0"
5
5
 
6
6
  # Project description
7
7
  spec.name = "pushyd"
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  # spec.add_development_dependency "pry"
29
29
 
30
30
  # Runtime dependencies
31
- spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.3.16"
31
+ spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.4.3"
32
32
  spec.add_runtime_dependency "daemons"
33
33
  spec.add_runtime_dependency "json"
34
34
  spec.add_runtime_dependency "bunny", "~> 2.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushyd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-13 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.3.16
89
+ version: 0.4.3
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.3.16
96
+ version: 0.4.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: daemons
99
99
  requirement: !ruby/object:Gem::Requirement