config_skeleton 2.1.0 → 2.2.1

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: dadb672b628b814c3962711ce001733dacda07fa75c1b9b418f389719af745b1
4
- data.tar.gz: 32f6f9d54602208c9a8c7402b1e6a12d8f9e2045307b929537d69f09c56adda7
3
+ metadata.gz: 49838a344a63bcd0b3f308dbdc58f4d8a7426733e95c09feb72e5c8fb9fd4a99
4
+ data.tar.gz: 89b2e5c74c73131522ca2a062ed66c1d74fe4f74acfa41b3af6e5b5daa0ef6dc
5
5
  SHA512:
6
- metadata.gz: 0cc9b1b46bbdeaa6c07850cad5dbe60b05d7bfadaf8cfa9d963a794e1320051463c74c94cef78822b7bd115567fed8622b1370068fdba079e3926cebd70b3dba
7
- data.tar.gz: 64fc6ba379d78027b99f575eaa256b305e5dac656e9504d35b697d07c0d3fb5ac89793668d62046f1e500f8c59e3f4cdf47052a4ac62717f856206dd06a9f183
6
+ metadata.gz: d16025a92349c9e413754ff60afbe8e9147a4806ddd73cbe9f8425f2c781bde749b492de996c0eb919836ac6fc6c4e133a82de5c082929a22cb5405d2dccf9a4
7
+ data.tar.gz: a97c7c2713196ffd8720c5734f8b08a850410811e2afc957f098c56e5156040cf091a173c2bc868a4f7be452307887dbbf7f84533aed1975cb77810423285a6a
@@ -4,7 +4,6 @@ on:
4
4
  pull_request:
5
5
  push:
6
6
  branches:
7
- - master
8
7
  - main
9
8
 
10
9
  jobs:
@@ -35,7 +34,7 @@ jobs:
35
34
  run: bundle exec rake test
36
35
 
37
36
  publish:
38
- if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
37
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
39
38
  needs: build
40
39
  runs-on: ubuntu-latest
41
40
 
@@ -43,7 +42,7 @@ jobs:
43
42
  - uses: actions/checkout@v2
44
43
 
45
44
  - name: Release Gem
46
- uses: discourse/publish-rubygems-action@v2-beta
45
+ uses: discourse/publish-rubygems-action@v3
47
46
  env:
48
47
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
49
48
  GIT_EMAIL: team@discourse.org
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "config_skeleton"
5
- s.version = "2.1.0"
5
+ s.version = "2.2.1"
6
6
 
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = "Dynamically generate configs and reload servers"
@@ -164,11 +164,12 @@ class ConfigSkeleton
164
164
  end
165
165
 
166
166
  def self.inherited(klass)
167
+ klass.gauge :"#{klass.service_name}_config_ok", docstring: "Whether the last config change was accepted by the server"
168
+ klass.gauge :"#{klass.service_name}_generation_ok", docstring: "Whether the last config generation completed without error"
167
169
  klass.gauge :"#{klass.service_name}_last_generation_timestamp", docstring: "When the last config generation run was made"
168
170
  klass.gauge :"#{klass.service_name}_last_change_timestamp", docstring: "When the config file was last written to"
169
171
  klass.counter :"#{klass.service_name}_reload_total", docstring: "How many times we've asked the server to reload", labels: [:status]
170
172
  klass.counter :"#{klass.service_name}_signals_total", docstring: "How many signals have been received (and handled)"
171
- klass.gauge :"#{klass.service_name}_config_ok", docstring: "Whether the last config change was accepted by the server"
172
173
 
173
174
  klass.hook_signal("HUP") do
174
175
  logger.info("SIGHUP") { "received SIGHUP, triggering config regeneration" }
@@ -329,6 +330,7 @@ class ConfigSkeleton
329
330
  metrics.last_generation_timestamp.set(0)
330
331
  metrics.last_change_timestamp.set(0)
331
332
  metrics.config_ok.set(0)
333
+ metrics.generation_ok.set(0)
332
334
  end
333
335
 
334
336
  # Write out a config file if one doesn't exist, or do an initial regen run
@@ -337,7 +339,7 @@ class ConfigSkeleton
337
339
  # @return [void]
338
340
  #
339
341
  def write_initial_config
340
- if File.exists?(config_file)
342
+ if File.exist?(config_file)
341
343
  logger.info(logloc) { "Triggering a config regen on startup to ensure config is up-to-date" }
342
344
  regenerate_config
343
345
  else
@@ -431,9 +433,15 @@ class ConfigSkeleton
431
433
  #
432
434
  def instrumented_config_data
433
435
  begin
434
- @config_generation.measure { config_data.tap { metrics.last_generation_timestamp.set(Time.now.to_f) } }
436
+ @config_generation.measure do
437
+ config_data.tap do
438
+ metrics.last_generation_timestamp.set(Time.now.to_f)
439
+ metrics.generation_ok.set(1)
440
+ end
441
+ end
435
442
  rescue => ex
436
443
  log_exception(ex, logloc) { "Call to config_data raised exception" }
444
+ metrics.generation_ok.set(0)
437
445
  nil
438
446
  end
439
447
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  - Discourse Team
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-11 00:00:00.000000000 Z
12
+ date: 2023-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy
@@ -179,7 +179,7 @@ dependencies:
179
179
  - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
- description:
182
+ description:
183
183
  email:
184
184
  - matt.palmer@discourse.org
185
185
  - team@discourse.org
@@ -201,7 +201,7 @@ files:
201
201
  homepage: https://github.com/discourse/config_skeleton
202
202
  licenses: []
203
203
  metadata: {}
204
- post_install_message:
204
+ post_install_message:
205
205
  rdoc_options: []
206
206
  require_paths:
207
207
  - lib
@@ -216,8 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubygems_version: 3.1.4
220
- signing_key:
219
+ rubygems_version: 3.4.10
220
+ signing_key:
221
221
  specification_version: 4
222
222
  summary: Dynamically generate configs and reload servers
223
223
  test_files: []