consul-templaterb 1.29.0 → 1.30.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d751a91e60648e8c967bd3401a6d1d595c01f95a4da6ca3537dad89247d2755
|
4
|
+
data.tar.gz: 662f076af6864fd541319e0e0ae4c41e6f09cbc96f578d700c403bd315df7420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58c6e86c13d2ca37bbb2d4a82aace1d39c27fe76fd4bbf43372d6131d2e14004cbe9d9b6205e40008ab4ad992a44417651aa3739709eb88881d904d3f4161ba
|
7
|
+
data.tar.gz: 9f0baecd48f648c0f04a49bc4366d8b85f2cf635d4bb9bd0d572dec9edf3e7fc0a3157f103ef31669cb2856827a4da4cbe73644d9071dcd4de5f3ad4d60451c6
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
## (UNRELEASED)
|
4
4
|
|
5
|
+
## 1.30.0 (Dec 18, 2020)
|
6
|
+
|
7
|
+
IMPROVEMENTS:
|
8
|
+
|
9
|
+
* Allow customization to sort nodes in service view in Consul-UI ([#71](https://github.com/criteo/consul-templaterb/pull/71))
|
10
|
+
|
11
|
+
NEW FEATURES:
|
12
|
+
|
13
|
+
* Auto-detection of rate-limit on Consul Side (introduced in Consul 1.6.2+), this feature
|
14
|
+
will work only Consul 1.9+ (see [Consul #7527](https://github.com/hashicorp/consul/issues/7527)).
|
15
|
+
|
5
16
|
## 1.29.0 (Oct 6, 2020)
|
6
17
|
|
7
18
|
IMPROVEMENTS:
|
@@ -225,9 +225,34 @@ module Consul
|
|
225
225
|
retry_in / 2 + Consul::Async::Utilities.random.rand(retry_in)
|
226
226
|
end
|
227
227
|
|
228
|
+
# rubocop:disable Style/ClassVars
|
229
|
+
def _last_429
|
230
|
+
@@_last_429 ||= { count: 0 }
|
231
|
+
end
|
232
|
+
# rubocop:enable Style/ClassVars
|
233
|
+
|
228
234
|
def _handle_error(http, consul_index)
|
229
235
|
retry_in = _compute_retry_in([600, conf.retry_duration + 2**@consecutive_errors].min)
|
230
|
-
|
236
|
+
if http.response_header.status == 429
|
237
|
+
_last_429
|
238
|
+
retry_in = 60 + Consul::Async::Utilities.random.rand(180) if retry_in < 60
|
239
|
+
_last_429[:time] = Time.now.utc
|
240
|
+
_last_429[:count] += 1
|
241
|
+
if (_last_429[:count] % 10) == 1
|
242
|
+
if _last_429[:count] == 1
|
243
|
+
::Consul::Async::Debug.puts_error "Rate limiting detected on Consul side (HTTP 429)!\n\n" \
|
244
|
+
"******************************* CONFIGURATION ISSUE DETECTED *******************************\n" \
|
245
|
+
"* Too many simultaneous connections for Consul agent #{conf.base_url}\n" \
|
246
|
+
"* You should tune 'limits.http_max_conns_per_client' to a higher value.\n" \
|
247
|
+
"* This program will behave badly until you change this.\n" \
|
248
|
+
"* See https://www.consul.io/docs/agent/options.html#http_max_conns_per_client for more info\n" \
|
249
|
+
"********************************************************************************************\n\n"
|
250
|
+
end
|
251
|
+
::Consul::Async::Debug.puts_error "[#{path}] Too many conns to #{conf.base_url}, errors=#{_last_429[:count]} - Retry in #{retry_in}s #{stats.body_bytes_human}"
|
252
|
+
end
|
253
|
+
else
|
254
|
+
::Consul::Async::Debug.puts_error "[#{path}] X-Consul-Index:#{consul_index} - #{http.error} - Retry in #{retry_in}s #{stats.body_bytes_human}"
|
255
|
+
end
|
231
256
|
@consecutive_errors += 1
|
232
257
|
http_result = HttpResponse.new(http)
|
233
258
|
EventMachine.add_timer(retry_in) do
|
data/lib/consul/async/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
SORT_CONSUL_SERVICE_NODES = -> (nodes) { nodes.sort {|a,b| a['Node']['Node'] <=> b['Node']['Node'] } }
|
data/samples/consul-ui/README.md
CHANGED
@@ -94,3 +94,9 @@ This app supports the following environment variables:
|
|
94
94
|
* `EXCLUDE_SERVICES`: comma-separated services to exclude (default: lbl7.*,netsvc-probe.*,consul-probed.*)
|
95
95
|
* `CONSUL_TIMELINE_BUFFER`: number of entries to keep in the timeline. 1000 by default.
|
96
96
|
* `CONSUL_TIMELINE_BLACKLIST`: regexp of services to hide from timeline
|
97
|
+
|
98
|
+
### Preferences
|
99
|
+
|
100
|
+
Some templates allows you to override some behavior through `.preferences.rb` file.
|
101
|
+
In order to do that, rename `.preferences.rb.samples` file to `.preferences.rb`
|
102
|
+
and update lambda defined inside to match targeted behavior.
|
@@ -6,6 +6,19 @@
|
|
6
6
|
# INSTANCE_EXCLUDE_TAG: Exclude instances having the given tag (default: canary)
|
7
7
|
# EXCLUDE_SERVICES: comma-separated services regexps to exclude (default: lbl7.*,netsvc-probe.*,consul-probed.*)
|
8
8
|
|
9
|
+
unless @sort_consul_service_nodes
|
10
|
+
begin
|
11
|
+
target_dir = File.split(File.expand_path(template_info['source']))[0]
|
12
|
+
target = File.join(target_dir, '.preferences.rb')
|
13
|
+
load "#{target}"
|
14
|
+
STDERR.puts "Using #{target} file."
|
15
|
+
@sort_consul_service_nodes = SORT_CONSUL_SERVICE_NODES
|
16
|
+
rescue LoadError
|
17
|
+
STDERR.puts 'Couldn\'t find .preferences.rb file ; default configuration will be used.'
|
18
|
+
@sort_consul_service_nodes = -> (nodes) { nodes.sort {|a,b| a['Node']['Node'] <=> b['Node']['Node'] } }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
9
22
|
service_tag_filter = ENV['SERVICES_TAG_FILTER'] || nil
|
10
23
|
instance_must_tag = ENV['INSTANCE_MUST_TAG'] || service_tag_filter
|
11
24
|
instance_exclude_tag = ENV['INSTANCE_EXCLUDE_TAG']
|
@@ -20,7 +33,7 @@
|
|
20
33
|
if !services_blacklist.any? {|r| r.match(service_name)} && (instance_must_tag.nil? || tags.include?(instance_must_tag))
|
21
34
|
tags_per_service[service_name] = tags.sort
|
22
35
|
the_backends = []
|
23
|
-
service(service_name).
|
36
|
+
@sort_consul_service_nodes.call(service(service_name)).each do |snode|
|
24
37
|
tags_of_instance = snode['Service']['Tags'].sort
|
25
38
|
if (instance_must_tag.nil? || tags_of_instance.include?(instance_must_tag)) && !tags_of_instance.include?(instance_exclude_tag)
|
26
39
|
the_backends << snode if snode['Service']['Port']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul-templaterb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SRE Core Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- samples/all_services_multi_agents.txt.erb
|
182
182
|
- samples/all_templates.erb
|
183
183
|
- samples/checks_in_warning_or_critical_state.yaml.erb
|
184
|
+
- samples/consul-ui/.preferences.rb.samples
|
184
185
|
- samples/consul-ui/README.md
|
185
186
|
- samples/consul-ui/common/footer.html.erb
|
186
187
|
- samples/consul-ui/common/header.html.erb
|