gooddata 1.3.6-java → 2.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +54 -36
  4. data/CHANGELOG.md +37 -1
  5. data/CONTRIBUTING.md +4 -0
  6. data/Gemfile +9 -0
  7. data/Jenkinsfile-chart +14 -0
  8. data/RELEASING.md +5 -8
  9. data/Rakefile +1 -1
  10. data/SDK_VERSION +1 -1
  11. data/bin/run_brick.rb +1 -1
  12. data/bin/test_projects_cleanup.rb +20 -8
  13. data/ci.rake +2 -2
  14. data/k8s/charts/lcm-bricks/Chart.yaml +4 -0
  15. data/k8s/charts/lcm-bricks/templates/prometheus/alertingRules.yaml +96 -0
  16. data/lcm.rake +1 -1
  17. data/lib/gooddata/bricks/middleware/context_logger_decorator.rb +31 -0
  18. data/lib/gooddata/bricks/middleware/context_manager.rb +68 -0
  19. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +15 -9
  20. data/lib/gooddata/bricks/middleware/logger_middleware.rb +20 -0
  21. data/lib/gooddata/bricks/middleware/mask_logger_decorator.rb +35 -5
  22. data/lib/gooddata/client.rb +2 -3
  23. data/lib/gooddata/core/gd_logger.rb +92 -0
  24. data/lib/gooddata/core/logging.rb +24 -7
  25. data/lib/gooddata/core/nil_logger.rb +1 -2
  26. data/lib/gooddata/core/splunk_logger.rb +23 -0
  27. data/lib/gooddata/lcm/actions/synchronize_users.rb +2 -1
  28. data/lib/gooddata/lcm/helpers/check_helper.rb +3 -15
  29. data/lib/gooddata/lcm/helpers/safe_failure_helper.rb +19 -0
  30. data/lib/gooddata/lcm/lcm2.rb +21 -10
  31. data/lib/gooddata/mixins/property_accessor.rb +30 -0
  32. data/lib/gooddata/models/execution.rb +5 -0
  33. data/lib/gooddata/models/project.rb +6 -4
  34. data/lib/gooddata/rest/client.rb +17 -6
  35. data/lib/gooddata/rest/connection.rb +20 -6
  36. data/lib/gooddata/rest/rest_aggregator.rb +46 -0
  37. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a54177e2adc1c26543160590e4cf27fed49b40be834833f6b550e3b2c297ed7a
4
- data.tar.gz: 596a15519faa9097aa38f926a1ddd3a7e5bff16a746c9a38785b2e5e7511d8bc
3
+ metadata.gz: cd55acee57a6b34e84f26e00ef644f3d4315b1440d97c25bf98d9d85b172afee
4
+ data.tar.gz: bce2fb11bada9f728c0ebde2416270ab83ecb7622ab1b34ad08c42d2f564864c
5
5
  SHA512:
6
- metadata.gz: '09aa52e32aa4907a8952b3c9a456d859174cb5a658e16e75f928e7e039b9a7cd91d6b351a2af2f6c99f28f94b084d2324e8ce9cae568133c1cc115ce87306589'
7
- data.tar.gz: 190afaff5791b7b8d2dd85f91834aa27160c2e7e3c28af101548798f2d352a4ec2a8cf803ee78e8ce6d0775d49a90b326434a0f8d21da378412fa11aa4864b21
6
+ metadata.gz: a1efa783034e1d21cabfa3c9e04de178083e8b7ccc21fd1e77eab4d93bb8d2d84c52dc5fe7512e6e0c1d17b109768b41fcb6ffb01e733793d100445358e6f23c
7
+ data.tar.gz: 92df93195c2328f1a58653b0f81d98424a8769bed933a462785a509ad87c335d7e550ca6513d0f234adcaf05fc83de17d4d0659a7112c4598bf1de7a1e17e20a
data/.gitignore CHANGED
@@ -13,6 +13,7 @@ tmtags
13
13
  ## VIM
14
14
  *.swp
15
15
  .tags*
16
+ tags*
16
17
 
17
18
  ## IDEA
18
19
  .idea/
@@ -7,6 +7,8 @@ stages:
7
7
  if: type IN (api, cron)
8
8
  - name: platform-cleanup
9
9
  if: type IN (cron)
10
+ - name: gem-release
11
+ if: branch = master AND type = push
10
12
 
11
13
  git:
12
14
  depth: false # this is needed for pronto
@@ -21,38 +23,38 @@ jobs:
21
23
  git fetch upstream master
22
24
  bundle exec pronto run -c upstream/master --exit-code
23
25
 
24
- - name: unit tests
25
- stage: before-merge
26
- script: bundle exec rake test:unit
27
- rvm:
28
- - 2.2
29
- - 2.3
30
- - 2.4
31
- - 2.5
32
- - jruby-1.7.19
33
- - jruby-9.1.5
34
- - jruby-9.1.7
35
- - jruby-9.1.14
36
-
37
- - name: sdk integration (vcr) tests - base
38
- stage: before-merge
39
- script: bundle exec rake test:sdk
40
- env: VCR_RECORD_MODE=none
41
- rvm: 2.3
42
-
43
- - name: sdk integration (vcr) tests - project
44
- stage: before-merge
45
- script: bundle exec rake test:project
46
- env: VCR_RECORD_MODE=none
47
- rvm: 2.3
48
-
49
- - name: lcm integration (vcr) tests - e2e
50
- stage: before-merge
51
- script: bundle exec rspec spec/lcm/integration/lcm_end_to_end_spec.rb
52
- env:
53
- - VCR_RECORD_MODE=none
54
- - GD_ENV=development
55
- rvm: 2.3
26
+ # - name: unit tests
27
+ # stage: before-merge
28
+ # script: bundle exec rake test:unit
29
+ # rvm:
30
+ # - 2.2
31
+ # - 2.3
32
+ # - 2.4
33
+ # - 2.5
34
+ # - jruby-1.7.19
35
+ # - jruby-9.1.5
36
+ # - jruby-9.1.7
37
+ # - jruby-9.1.14
38
+ #
39
+ # - name: sdk integration (vcr) tests - base
40
+ # stage: before-merge
41
+ # script: bundle exec rake test:sdk
42
+ # env: VCR_RECORD_MODE=none
43
+ # rvm: 2.3
44
+ #
45
+ # - name: sdk integration (vcr) tests - project
46
+ # stage: before-merge
47
+ # script: bundle exec rake test:project
48
+ # env: VCR_RECORD_MODE=none
49
+ # rvm: 2.3
50
+ #
51
+ # - name: lcm integration (vcr) tests - e2e
52
+ # stage: before-merge
53
+ # script: bundle exec rspec spec/lcm/integration/lcm_end_to_end_spec.rb
54
+ # env:
55
+ # - VCR_RECORD_MODE=none
56
+ # - GD_ENV=development
57
+ # rvm: 2.3
56
58
 
57
59
  # AFTER MERGE
58
60
  # staging 1
@@ -71,10 +73,11 @@ jobs:
71
73
  - &lcm-slow-tests
72
74
  name: staging1 - lcm slow tests
73
75
  stage: after-merge
74
- script: |
75
- bundle exec rake -f lcm.rake docker:build
76
- bundle exec rake -f lcm.rake docker:bundle
77
- bundle exec rake -f lcm.rake test:docker:slow
76
+ script:
77
+ - sudo keytool -importcert -alias gooddata-2008 -file "./data/2008.crt" -keystore $JAVA_HOME/jre/lib/security/cacerts -trustcacerts -storepass 'changeit' -noprompt
78
+ - sudo keytool -importcert -alias gooddata-int -file "./data/new_ca.cer" -keystore $JAVA_HOME/jre/lib/security/cacerts -trustcacerts -storepass 'changeit' -noprompt
79
+ - sudo keytool -importcert -alias gooddata-prod -file "data/new_prodgdc_ca.crt" -keystore $JAVA_HOME/jre/lib/security/cacerts -trustcacerts -storepass 'changeit' -noprompt
80
+ - bundle exec rake -f lcm.rake test:slow
78
81
  env:
79
82
  - VCR_ON=false
80
83
  - GD_ENV=staging
@@ -187,6 +190,21 @@ jobs:
187
190
  name: staging3 - test environment clean-up
188
191
  env: GD_ENV=development
189
192
 
193
+ - stage: gem-release
194
+ name: deploy MRI gem
195
+ rvm: 2.3
196
+ deploy:
197
+ provider: rubygems
198
+ gem: gooddata
199
+ api_key: $RUBYGEMS_API_KEY
200
+ - stage: gem-release
201
+ name: deploy JRuby gem
202
+ rvm: jruby-9.1.14
203
+ script:
204
+ - 'echo -e "---\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
205
+ - chmod 0600 ~/.gem/credentials
206
+ - bundle exec rake gem:release
207
+
190
208
  notifications:
191
209
  email:
192
210
  recipients:
@@ -1,4 +1,40 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 2.0.0
3
+
4
+ This is a major version release because the method `.release_info` has been hard-deprecated.
5
+
6
+ - Release gem using travis
7
+ - TMA-1054: Rename monitoring rules definition
8
+ - TMA-1054: alertingRules for prometheus
9
+ - TMA-1295: Fix passing file_name to after block
10
+ - TMA-1295: Don't run slow tests in docker
11
+ - Fix logging connection stats
12
+ - Fix spec file pattern
13
+ - Fix splunk logger test
14
+ - TMA-1284: Fix passing s3 info to config
15
+ - Fail when deprecated release_info called
16
+ - Fix perf cluster appstore name
17
+ - FEATURE: GDP-539 remove of releaseInfo resource
18
+ - Recover schedule helper file
19
+ - Fix load tests
20
+ - Record vcr cassettes
21
+ - Run load tests on the server
22
+ - switched user groups cache from instance variable to param
23
+ - TMA-1060: correct the smoke test to allow testing both dev and stable versions
24
+ - TMA-483 lowering the abusement of user groups resource
25
+ - TMA-807: up to code standards
26
+ - TMA-807: log profiling data to splunk
27
+ - Use latest version of Pronto
28
+ - TMA-1255: subscription spec utilizes project cache
29
+ - BUGFIX: TMA-1230 Log brick execution errors
30
+ - BUGFIX: TMA-1230 Log error message when client disconnecting fails
31
+ - BUGFIX: TMA-1230 Return inner logger class in MaskLoggerDecorator
32
+ - Fix path to version file in docs
33
+ - Fix path to version file in version:bump
34
+ - Mention rake task version:changelog in docs
35
+ - fix: remove containers after run
36
+ - SETI-2444: add missing curl-dev package to docker image
37
+
2
38
  ## 1.3.6
3
39
  - Make path to version file relative
4
40
 
@@ -270,7 +306,7 @@
270
306
 
271
307
  ## 1.1.0
272
308
  - TMA-860: use new roles API (#1169)
273
- - test passed locally
309
+ - test passed locally
274
310
  - Avoid polling idle time in VCR tests
275
311
  - Enable vcr for metric specs
276
312
  - TMA-832: support for pluggable component process type
@@ -1,5 +1,9 @@
1
1
  # Contributing
2
2
 
3
+ ## Pull requests
4
+
5
+ Make pull requests to the `develop` branch. Once all tests are passing on `develop`, we will merge to `master` and release the gem.
6
+
3
7
  ## Tests
4
8
  ### CI setup
5
9
  gooddata-ruby has a robust CI setup in place to ensure easy contributing by both GD employees and outsiders. The CI is based on travis-ci and all of the environment specifics is versioned in .travis.yml
data/Gemfile CHANGED
@@ -1,4 +1,13 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ group 'development' do
4
+ unless RUBY_PLATFORM == 'java'
5
+ # git because https://github.com/prontolabs/pronto/issues/312
6
+ gem 'pronto',
7
+ git: 'https://github.com/prontolabs/pronto',
8
+ ref: '266805b'
9
+ end
10
+ end
11
+
3
12
  # Specify your gem's dependencies in gooddata.gemspec
4
13
  gemspec
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (C) 2007-2019, GoodData(R) Corporation. All rights reserved.
3
+ */
4
+
5
+ @Library('pipelines-shared-libs')
6
+ import com.gooddata.pipeline.Pipeline
7
+
8
+ def config = [
9
+ 'charts': [
10
+ 'lcm-bricks'
11
+ ]
12
+ ]
13
+
14
+ Pipeline.get(this, config).run()
@@ -3,13 +3,10 @@
3
3
  1. `git clone https://github.com/gooddata/gooddata-ruby.git gooddata-ruby`
4
4
  1. `cd gooddata-ruby`
5
5
  1. `git checkout master`
6
- 1. `rvm use ruby`
7
- 1. `bundle install`
8
- 1. bump version in [lib/gooddata/version.rb](lib/gooddata/version.rb)
6
+ 1. optionally check what's changed since last release: `bundle exec rake version:changelog`
7
+ 1. bump version in [SDK_VERSION](SDK_VERSION)
9
8
  1. `bundle exec rake version:bump`
10
- 1. create PR to upstream and have it merged
9
+ 1. create PR to `upstream/develop` and have it merged
11
10
  1. `git push origin tags/{version}`
12
- 1. `rake gem:release`
13
- 1. `rvm use jruby && rm Gemfile.lock && bundle install`
14
- 1. `rake gem:release`
15
- 1. release [cookbook](https://github.com/gooddata/gooddata-ruby-examples)
11
+ 1. once all tests are passing, merge `develop` to `master` and the gem will be released automatically
12
+ 1. release [cookbook](https://github.com/gooddata/gooddata-ruby-doc)
data/Rakefile CHANGED
@@ -179,7 +179,7 @@ namespace :version do
179
179
  require_relative 'lib/gooddata/version'
180
180
  new_version = GoodData::VERSION
181
181
  update_changelog(new_version)
182
- `git add CHANGELOG.md lib/gooddata/version.rb`
182
+ `git add CHANGELOG.md SDK_VERSION`
183
183
  `git commit -m "Bump version to #{new_version}"`
184
184
  `git tag #{new_version}`
185
185
  end
@@ -1 +1 @@
1
- 1.3.6
1
+ 2.0.0
@@ -36,7 +36,7 @@ begin
36
36
  rescue NoMethodError => e
37
37
  log.info "action=#{brick_type}_execution status=error Invalid brick type '#{brick_type}', #{e.message}"
38
38
  raise e
39
- rescue => e
39
+ rescue StandardError => e
40
40
  log.info "action=#{brick_type}_execution status=error #{e.message}"
41
41
  raise e
42
42
  end
@@ -1,10 +1,21 @@
1
- example = 'GD_ENV=testing GD_SPEC_PASSWORD=secret bundle exec ruby bin/test_projects_cleanup.rb'
1
+ require 'optparse'
2
2
 
3
- if ARGV.include?('-h')
4
- puts 'Example:'
5
- puts example
6
- exit 0
7
- end
3
+ example = 'Usage example: GD_ENV=testing GD_SPEC_PASSWORD=secret bundle exec ruby bin/test_projects_cleanup.rb'
4
+
5
+ options = {}
6
+ OptionParser.new do |opts|
7
+ opts.banner = example
8
+ opts.on('-f', '--force', 'Mercilessly deletes matching projects.') do |v|
9
+ options[:force] = v
10
+ end
11
+ opts.on('-d N', '--days N', Integer, 'Number of days to keep projects for.') do |v|
12
+ options[:days] = v
13
+ end
14
+ opts.on_tail("-h", "--help", "Show this message.") do
15
+ puts opts
16
+ exit 0
17
+ end
18
+ end.parse!
8
19
 
9
20
  require 'gooddata'
10
21
  require_relative '../spec/environment/environment'
@@ -72,6 +83,7 @@ def clean_up!(client, force, days)
72
83
  delete_project_by_title(/userprov-e2e-testing/, projects, days, force)
73
84
  delete_ads_by_title(/Development ADS/, client, days, force)
74
85
  delete_ads_by_title(/Production ADS/, client, days, force)
86
+ delete_ads_by_title(/^users brick load test/, client, days, force)
75
87
  end
76
88
 
77
89
  def init_client(username, password, server)
@@ -89,8 +101,8 @@ password = secrets[:password]
89
101
  dev_client = init_client(username, password, "https://#{config[:dev_server]}")
90
102
  prod_client = init_client(username, password, "https://#{config[:prod_server]}")
91
103
 
92
- force = ARGV.include?('-f')
93
- days = 14
104
+ force = options[:force]
105
+ days = options[:days] || 14
94
106
  clean_up!(dev_client, force, days)
95
107
  clean_up!(prod_client, force, days)
96
108
 
data/ci.rake CHANGED
@@ -7,11 +7,11 @@ namespace :docker do
7
7
  desc 'Bundles gems using cache'
8
8
  namespace :bundle do
9
9
  task :ruby do
10
- system('docker-compose run gooddata-ruby bundle')
10
+ system('docker-compose run --rm gooddata-ruby bundle')
11
11
  end
12
12
 
13
13
  task :jruby do
14
- system('docker-compose run gooddata-jruby bundle')
14
+ system('docker-compose run --rm gooddata-jruby bundle')
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,4 @@
1
+ apiVersion: v1
2
+ name: lcm-bricks
3
+ description: LCM Bricks
4
+ version: 1.0.2
@@ -0,0 +1,96 @@
1
+ apiVersion: v1
2
+ kind: ConfigMap
3
+ metadata:
4
+ name: lcm-bricks-monitoring-rules
5
+ namespace: monitoring
6
+ labels:
7
+ app: lcm-bricks
8
+ component: lcm
9
+ team: lcm
10
+ chart: lcm-bricks
11
+ release: {{ .Release.Name }}
12
+ data:
13
+ lcm-bricks-monitoring-rules.yaml: |+
14
+ groups:
15
+ - name: lcm-bricks-monitoring-rules
16
+ rules:
17
+ - record: "container_pod:lcm_pod_container_status_restarts:increase10m"
18
+ expr: increase(kube_pod_container_status_restarts_total{namespace='{{ .Release.Namespace }}'}[10m])
19
+ - alert: "[LCM] Pod has too many restarts on cluster={{ .Values.clusterId }}"
20
+ expr: container_pod:lcm_pod_container_status_restarts:increase10m >= 1
21
+ labels:
22
+ severity: warning
23
+ team: lcm # switch to msf in production
24
+ cluster_id: {{ .Values.clusterId }}
25
+ annotations:
26
+ description: "There is more than 0 restarts of {{`{{ $labels.pod }}`}} pod in the last 10 minutes"
27
+ summary: "{{`{{ $labels.pod }}`}} pod has too many restarts"
28
+ - alert: "[LCM] Pod has too many restarts on cluster={{ .Values.clusterId }}"
29
+ expr: container_pod:lcm_pod_container_status_restarts:increase10m >= 2
30
+ labels:
31
+ severity: critical
32
+ team: lcm # switch to msf in production
33
+ cluster_id: {{ .Values.clusterId }}
34
+ annotations:
35
+ description: "There is more than 1 restart of {{`{{ $labels.pod }}`}} pod in the last 10 minutes"
36
+ summary: "{{`{{ $labels.pod }}`}} pod has too many restarts"
37
+ - record: "container_pod:lcm_pod_container_status_oomkilled:increase10m"
38
+ expr: increase(kube_pod_container_status_terminated_reason{namespace='{{ .Release.Namespace }}', reason='OOMKilled'}[10m])
39
+ - alert: "[LCM] OOMKill occured on cluster={{ .Values.clusterId }}"
40
+ expr: container_pod:lcm_pod_container_status_oomkilled:increase10m >= 1
41
+ labels:
42
+ severity: warning
43
+ team: lcm # switch to msf in production
44
+ cluster_id: {{ .Values.clusterId }}
45
+ annotations:
46
+ description: "{{`{{ $labels.pod }}`}} was OOMKilled in the last 30 minutes. Investigate and/or increase memoryRequest or memoryLimit."
47
+ summary: "{{`{{ $labels.pod }}`}} OOMKill occured"
48
+ - alert: "[LCM] OOMKill occured on cluster={{ .Values.clusterId }}"
49
+ expr: container_pod:lcm_pod_container_status_oomkilled:increase10m >= 2
50
+ labels:
51
+ severity: critical
52
+ team: lcm # switch to msf in production
53
+ cluster_id: {{ .Values.clusterId }}
54
+ annotations:
55
+ description: "{{`{{ $labels.pod }}`}} was OOMKilled in the last 10 minutes. Investigate and/or increase memoryRequest or memoryLimit."
56
+ summary: "{{`{{ $labels.pod }}`}} OOMKill occured"
57
+ - record: "container_pod:lcm_pod_container_status_error:increase10m"
58
+ expr: increase(kube_pod_container_status_terminated_reason{namespace='{{ .Release.Namespace }}', reason!~"Completed|OOMKilled"}[10m])
59
+ - alert: "[LCM] Container exited with error on cluster={{ .Values.clusterId }}"
60
+ expr: container_pod:lcm_pod_container_status_error:increase10m >= 1
61
+ labels:
62
+ severity: warning
63
+ team: lcm # switch to msf in production
64
+ cluster_id: {{ .Values.clusterId }}
65
+ annotations:
66
+ description: "{{`{{ $labels.pod }}`}} container exited with non-zero exit code in the last 10 minutes. Investigate and fix."
67
+ summary: "{{`{{ $labels.pod }}`}} Container exited with error"
68
+ - alert: "[LCM] Container exited with error on cluster={{ .Values.clusterId }}"
69
+ expr: container_pod:lcm_pod_container_status_error:increase10m >= 2
70
+ labels:
71
+ severity: critical
72
+ team: lcm # switch to msf in production
73
+ cluster_id: {{ .Values.clusterId }}
74
+ annotations:
75
+ description: "{{`{{ $labels.pod }}`}} container exited with non-zero exit code in the last 10 minutes. Investigate and fix."
76
+ summary: "{{`{{ $labels.pod }}`}} Container exited with error"
77
+ - alert: "[LCM] Container is being throttled on cluster={{ .Values.clusterId }}"
78
+ expr: rate(container_cpu_cfs_throttled_seconds_total{namespace='{{ .Release.Namespace }}'}[1m]) > 1
79
+ for: 5m
80
+ labels:
81
+ severity: critical
82
+ team: lcm # switch to msf in production
83
+ cluster_id: {{ .Values.clusterId }}
84
+ annotations:
85
+ description: "{{`{{ $labels.pod_name }}`}} container is beeing throttled and probably hit CPU limit. Investigate root cause and increase limit and/or number of replicas if necessary."
86
+ summary: "{{`{{ $labels.pod_name }}`}} Container is being throttled"
87
+ - alert: "[LCM] is doing too much pause GC on cluster={{ .Values.clusterId }}"
88
+ expr: rate(jvm_gc_pause_seconds_sum{kubernetes_namespace='{{ .Release.Namespace }}'}[1m]) > 1
89
+ for: 5m
90
+ labels:
91
+ severity: critical
92
+ team: lcm # switch to msf in production
93
+ cluster_id: {{ .Values.clusterId }}
94
+ annotations:
95
+ description: "{{`{{ $labels.kubernetes_pod_name }}`}} container is spending too much time in pause garbage collector. Investigate root cause and increase heap size and/or number of replicas if necessary."
96
+ summary: "{{`{{ $labels.kubernetes_pod_name }}`}} is doing too much pause GC"
data/lcm.rake CHANGED
@@ -79,7 +79,7 @@ namespace :test do
79
79
  test_cases.each do |test_case|
80
80
  desc "Run #{test_case} tests"
81
81
  RSpec::Core::RakeTask.new(test_case) do |task|
82
- task.pattern = "spec/lcm/#{test_case}/**/*.rb"
82
+ task.pattern = "spec/lcm/#{test_case}/**/*_spec.rb"
83
83
  end
84
84
  end
85
85
 
@@ -0,0 +1,31 @@
1
+ # Copyright (c) 2010-2018 GoodData Corporation. All rights reserved.
2
+ # This source code is licensed under the BSD-style license found in the
3
+ # LICENSE file in the root directory of this source tree.
4
+
5
+ module GoodData
6
+ # Logger decorator with ability to enrich the message with brick context
7
+ module ContextLoggerDecorator
8
+ attr_accessor :context_source
9
+
10
+ # log methods to be decorated
11
+ def add(severity, message = nil, progname = nil)
12
+ super(severity, enrich(message, context_source.context), progname)
13
+ end
14
+
15
+ private
16
+
17
+ # Enrich given message.
18
+ # @param message [String] or [Hash] message to enrich
19
+ # @param context [Hash] context by which the message should be enriched
20
+ # @return masked_message [String] or [Hash] enriched message
21
+ def enrich(message, context)
22
+ if !message
23
+ context
24
+ elsif message.is_a?(Hash)
25
+ context.merge(message)
26
+ else
27
+ context.merge(message: message)
28
+ end
29
+ end
30
+ end
31
+ end