prefab-cloud-ruby 1.3.0 → 1.3.2

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: 55134a75669f459bbb12d50cfa6e221937a5c00f53ca365e609f0cb436b24aff
4
- data.tar.gz: f3507032152e1dfe7b48156e5b8795d3bfd9262e077fab18923fef7cbeb78e34
3
+ metadata.gz: 51803ee8ef4be86a0dbe2a7cbf678ea24c91eb5f023c37cc66ed9477d0132ae7
4
+ data.tar.gz: 43106c26d3dcb9c3736ef5d6b1ff69e90525cc34098d74406e183eff8c536222
5
5
  SHA512:
6
- metadata.gz: 839db6777d5e6c3a76d34b7812787e8241779b2ede48d4ffddbf5e96bb493494e8d30e980582a5d06518e8f64f789287417ac5e6abc66c7789e17082992c83fb
7
- data.tar.gz: fd26b0d5ceb02a17724ede1a3329bda2a1ca7ee1c8d49e0776c61498bfe7e1b41ca81158e395192c4c73c35970824e5eb2d319b241a9489e0e215febe9ea2bb6
6
+ metadata.gz: 3051706d0c390715de78a1fb2e8c02eb030801bb8923498a4fb12e6b3ec47c3a18b67fabae5bc3d189ed6fd3f7cd5d4589f5159f1474af61ce2b38444e524ac3
7
+ data.tar.gz: 7398e9212e21f4a10d5093b7b5c572e1f7f938b3a805bb41c694c38246123a1d464f67cbe86e04ea0581c8c830e1100429378c6d7c24351618a5e4b97c063e3c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 1.3.2 - 2023-11-15
6
+ - Send back cloud.prefab logging telemetry (#160)
7
+
8
+ ## 1.3.1 - 2023-11-14
9
+ - Improve path of rails.controller logging & fix strong param include (#159)
10
+
5
11
  ## 1.3.0 - 2023-11-13
6
12
  - Less logging when wifi is off and we load from cache (#157)
7
13
  - Alpha: Add Provided & Secret Support (#152)
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ gem 'ld-eventsource'
8
8
  gem 'uuid'
9
9
 
10
10
  gem 'activesupport', '>= 4'
11
+ gem 'actionpack', '>= 4'
11
12
 
12
13
  group :development do
13
14
  gem 'benchmark-ips'
data/Gemfile.lock CHANGED
@@ -1,6 +1,22 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
+ actionpack (7.1.2)
5
+ actionview (= 7.1.2)
6
+ activesupport (= 7.1.2)
7
+ nokogiri (>= 1.8.5)
8
+ racc
9
+ rack (>= 2.2.4)
10
+ rack-session (>= 1.0.1)
11
+ rack-test (>= 0.6.3)
12
+ rails-dom-testing (~> 2.2)
13
+ rails-html-sanitizer (~> 1.6)
14
+ actionview (7.1.2)
15
+ activesupport (= 7.1.2)
16
+ builder (~> 3.1)
17
+ erubi (~> 1.11)
18
+ rails-dom-testing (~> 2.2)
19
+ rails-html-sanitizer (~> 1.6)
4
20
  activesupport (7.1.2)
5
21
  base64
6
22
  bigdecimal
@@ -20,6 +36,7 @@ GEM
20
36
  builder (3.2.4)
21
37
  concurrent-ruby (1.1.10)
22
38
  connection_pool (2.4.1)
39
+ crass (1.0.6)
23
40
  descendants_tracker (0.0.4)
24
41
  thread_safe (~> 0.3, >= 0.3.1)
25
42
  docile (1.3.5)
@@ -27,6 +44,7 @@ GEM
27
44
  unf (>= 0.0.5, < 1.0.0)
28
45
  drb (2.2.0)
29
46
  ruby2_keywords
47
+ erubi (1.12.0)
30
48
  faraday (1.3.0)
31
49
  faraday-net_http (~> 1.0)
32
50
  multipart-post (>= 1.2, < 3)
@@ -81,6 +99,9 @@ GEM
81
99
  llhttp-ffi (0.3.1)
82
100
  ffi-compiler (~> 1.0)
83
101
  rake (~> 13.0)
102
+ loofah (2.21.4)
103
+ crass (~> 1.0.2)
104
+ nokogiri (>= 1.12.0)
84
105
  macaddr (1.7.2)
85
106
  systemu (~> 2.6.5)
86
107
  mini_portile2 (2.8.2)
@@ -109,6 +130,17 @@ GEM
109
130
  public_suffix (4.0.6)
110
131
  racc (1.7.0)
111
132
  rack (3.0.6.1)
133
+ rack-session (2.0.0)
134
+ rack (>= 3.0.0)
135
+ rack-test (2.1.0)
136
+ rack (>= 1.3)
137
+ rails-dom-testing (2.2.0)
138
+ activesupport (>= 5.0.0)
139
+ minitest
140
+ nokogiri (>= 1.6)
141
+ rails-html-sanitizer (1.6.0)
142
+ loofah (~> 2.21)
143
+ nokogiri (~> 1.14)
112
144
  rake (13.0.6)
113
145
  rchardet (1.8.0)
114
146
  rdoc (6.3.3)
@@ -134,6 +166,7 @@ PLATFORMS
134
166
  ruby
135
167
 
136
168
  DEPENDENCIES
169
+ actionpack (>= 4)
137
170
  activesupport (>= 4)
138
171
  benchmark-ips
139
172
  bundler
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.2
@@ -28,6 +28,7 @@ module Prefab
28
28
  payload.delete(:headers)
29
29
  payload.delete(:request)
30
30
  payload.delete(:response)
31
+ payload[:req_path] = payload.delete(:path)
31
32
  params = payload[:params]
32
33
 
33
34
  if params.kind_of?(Hash) || params.kind_of?(::ActionController::Parameters)
@@ -56,8 +56,6 @@ module Prefab
56
56
  path_loc = get_loc_path(loc)
57
57
  path = @prefix + path_loc
58
58
 
59
- @log_path_aggregator&.push(path_loc, severity)
60
-
61
59
  log(message, path, progname, severity, log_context, &block)
62
60
  end
63
61
 
@@ -73,6 +71,8 @@ module Prefab
73
71
 
74
72
  def log(message, path, progname, severity, log_context={})
75
73
  severity ||= ::Logger::UNKNOWN
74
+ @log_path_aggregator&.push(path, severity)
75
+
76
76
  return true if @logdev.nil? || severity < level_of(path) || @silences[local_log_id]
77
77
 
78
78
  progname = @progname if progname.nil?
@@ -44,6 +44,7 @@ require 'prefab/context'
44
44
  require 'prefab/logger_client'
45
45
  require 'active_support/deprecation'
46
46
  require 'active_support'
47
+ require 'action_controller/metal/strong_parameters'
47
48
  require 'prefab/log_subscribers/action_controller_subscriber'
48
49
  require 'prefab/client'
49
50
  require 'prefab/config_client_presenter'
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: prefab-cloud-ruby 1.3.0 ruby lib
5
+ # stub: prefab-cloud-ruby 1.3.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "prefab-cloud-ruby".freeze
9
- s.version = "1.3.0"
9
+ s.version = "1.3.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Jeff Dwyer".freeze]
14
- s.date = "2023-11-13"
14
+ s.date = "2023-11-15"
15
15
  s.description = "Feature Flags, Live Config, and Dynamic Log Levels as a service".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
17
  s.executables = ["console".freeze]
@@ -130,6 +130,7 @@ Gem::Specification.new do |s|
130
130
  s.add_runtime_dependency(%q<ld-eventsource>.freeze, [">= 0"])
131
131
  s.add_runtime_dependency(%q<uuid>.freeze, [">= 0"])
132
132
  s.add_runtime_dependency(%q<activesupport>.freeze, [">= 4"])
133
+ s.add_runtime_dependency(%q<actionpack>.freeze, [">= 4"])
133
134
  s.add_development_dependency(%q<benchmark-ips>.freeze, [">= 0"])
134
135
  s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
135
136
  s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.4.9"])
@@ -143,6 +144,7 @@ Gem::Specification.new do |s|
143
144
  s.add_dependency(%q<ld-eventsource>.freeze, [">= 0"])
144
145
  s.add_dependency(%q<uuid>.freeze, [">= 0"])
145
146
  s.add_dependency(%q<activesupport>.freeze, [">= 4"])
147
+ s.add_dependency(%q<actionpack>.freeze, [">= 4"])
146
148
  s.add_dependency(%q<benchmark-ips>.freeze, [">= 0"])
147
149
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
148
150
  s.add_dependency(%q<juwelier>.freeze, ["~> 2.4.9"])
@@ -5,13 +5,42 @@ require 'test_helper'
5
5
  class TestActionController < Minitest::Test
6
6
  def setup
7
7
  super
8
+ end
9
+
10
+ def test_load
8
11
  new_client(config: log_level_config("log-level.rails.controller", "INFO"))
9
12
  @subscriber = Prefab::LogSubscribers::ActionControllerSubscriber.new
13
+ @subscriber.process_action(event)
14
+ assert_logged ['INFO 2023-08-09 15:18:12 -0400: rails.controller.request 200 MyController#index action=index controller=MyController db_runtime=0.05 format=application/html method=GET params={"p1"=>"v1"} req_path=/my?p1=v1 status=200 view_runtime=0.02']
10
15
  end
11
16
 
12
- def test_load
17
+ def test_json
18
+ new_client(config: log_level_config("log-level.rails.controller", "INFO"), log_formatter: Prefab::Options::JSON_LOG_FORMATTER)
19
+ @subscriber = Prefab::LogSubscribers::ActionControllerSubscriber.new
20
+ event = ActiveSupport::Notifications::Event.new(
21
+ 'process_action.action_controller',
22
+ Time.now,
23
+ Time.now,
24
+ 99,
25
+ path: '/original_path',
26
+ )
27
+ @subscriber.process_action(event)
28
+ assert_logged ["{\"severity\":\"INFO\",\"datetime\":\"2023-08-09 15:18:12 -0400\",\"path\":\"rails.controller.request\",\"message\":\" #\",\"req_path\":\"/original_path\"}"]
29
+
30
+ end
31
+
32
+ def test_funny_params
33
+ new_client(config: log_level_config("log-level.rails.controller", "INFO"))
34
+ @subscriber = Prefab::LogSubscribers::ActionControllerSubscriber.new
35
+ event = ActiveSupport::Notifications::Event.new(
36
+ 'process_action.action_controller',
37
+ Time.now,
38
+ Time.now,
39
+ 99,
40
+ params: "foo"
41
+ )
13
42
  @subscriber.process_action(event)
14
- assert_logged ['INFO 2023-08-09 15:18:12 -0400: rails.controller.request 200 MyController#index action=index controller=MyController db_runtime=0.05 format=application/html method=GET params={"p1"=>"v1"} path=/my?p1=v1 status=200 view_runtime=0.02']
43
+ assert_logged ['INFO 2023-08-09 15:18:12 -0400: rails.controller.request # params=foo']
15
44
  end
16
45
 
17
46
 
@@ -34,19 +63,19 @@ class TestActionController < Minitest::Test
34
63
  end
35
64
 
36
65
  def log_level_config(path, level)
37
- PrefabProto::Config.new(
38
- id: 123,
39
- key: path,
40
- config_type: PrefabProto::ConfigType::LOG_LEVEL,
41
- rows: [
42
- PrefabProto::ConfigRow.new(
43
- values: [
44
- PrefabProto::ConditionalValue.new(
45
- value: PrefabProto::ConfigValue.new(log_level: level)
46
- )
47
- ]
48
- )
49
- ]
50
- )
66
+ PrefabProto::Config.new(
67
+ id: 123,
68
+ key: path,
69
+ config_type: PrefabProto::ConfigType::LOG_LEVEL,
70
+ rows: [
71
+ PrefabProto::ConfigRow.new(
72
+ values: [
73
+ PrefabProto::ConditionalValue.new(
74
+ value: PrefabProto::ConfigValue.new(log_level: level)
75
+ )
76
+ ]
77
+ )
78
+ ]
79
+ )
51
80
  end
52
81
  end
@@ -34,22 +34,19 @@ class TestLogPathAggregator < Minitest::Test
34
34
  client.log_path_aggregator.send(:sync)
35
35
  end
36
36
 
37
- assert_equal [[
38
- '/api/v1/known-loggers',
39
- PrefabProto::Loggers.new(
40
- loggers: [PrefabProto::Logger.new(logger_name: 'test.test_log_path_aggregator.test_sync',
41
- infos: 2, errors: 3)],
42
- start_at: Prefab::TimeHelpers.now_in_ms,
43
- end_at: Prefab::TimeHelpers.now_in_ms,
44
- instance_hash: client.instance_hash,
45
- namespace: 'this.is.a.namespace'
46
- )
47
- ]], requests
37
+ assert_equal '/api/v1/known-loggers', requests[0][0]
38
+ sent_logger = requests[0][1]
39
+ assert_equal 'this.is.a.namespace', sent_logger.namespace
40
+ assert_equal Prefab::TimeHelpers.now_in_ms, sent_logger.start_at
41
+ assert_equal Prefab::TimeHelpers.now_in_ms, sent_logger.end_at
42
+ assert_equal client.instance_hash, sent_logger.instance_hash
43
+ assert_includes sent_logger.loggers, PrefabProto::Logger.new(logger_name: 'test.test_log_path_aggregator.test_sync', infos: 2, errors: 3)
44
+ assert_includes sent_logger.loggers, PrefabProto::Logger.new(logger_name: 'cloud.prefab.client.client', debugs: 1) # spot test that internal logging is here too
48
45
 
49
46
  assert_logged [
50
- 'WARN 2023-08-09 15:18:12 -0400: cloud.prefab.client.configclient No success loading checkpoints',
51
- 'ERROR 2023-08-09 15:18:12 -0400: test.test_log_path_aggregator.test_sync here is a message'
52
- ]
47
+ 'WARN 2023-08-09 15:18:12 -0400: cloud.prefab.client.configclient No success loading checkpoints',
48
+ 'ERROR 2023-08-09 15:18:12 -0400: test.test_log_path_aggregator.test_sync here is a message'
49
+ ]
53
50
  end
54
51
  end
55
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prefab-cloud-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-13 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -114,6 +114,20 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '4'
117
+ - !ruby/object:Gem::Dependency
118
+ name: actionpack
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '4'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '4'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: benchmark-ips
119
133
  requirement: !ruby/object:Gem::Requirement