instana 1.210.1 → 1.212.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +85 -38
- data/.github/ISSUE_TEMPLATE/bug.yml +1 -1
- data/.github/ISSUE_TEMPLATE/config.yml +1 -1
- data/.github/workflows/release-notification-on-slack.yml +34 -0
- data/Gemfile +3 -8
- data/README.md +4 -8
- data/Rakefile +21 -2
- data/bin/announce_release_on_slack.py +103 -0
- data/download.sh +85 -0
- data/gemfiles/aws_30.gemfile +7 -6
- data/gemfiles/aws_60.gemfile +19 -0
- data/gemfiles/coverage_merge.gemfile +9 -0
- data/gemfiles/cuba_30.gemfile +1 -1
- data/gemfiles/cuba_40.gemfile +1 -1
- data/gemfiles/dalli_20.gemfile +1 -1
- data/gemfiles/dalli_30.gemfile +1 -1
- data/gemfiles/dalli_32.gemfile +1 -1
- data/gemfiles/excon_02.gemfile +3 -2
- data/gemfiles/excon_021.gemfile +3 -1
- data/gemfiles/excon_079.gemfile +3 -2
- data/gemfiles/excon_100.gemfile +3 -2
- data/gemfiles/graphql_10.gemfile +1 -1
- data/gemfiles/graphql_20.gemfile +1 -1
- data/gemfiles/grpc_10.gemfile +1 -1
- data/gemfiles/mongo_216.gemfile +2 -2
- data/gemfiles/mongo_219.gemfile +15 -0
- data/gemfiles/net_http_01.gemfile +3 -2
- data/gemfiles/rack_16.gemfile +1 -1
- data/gemfiles/rack_20.gemfile +1 -1
- data/gemfiles/rack_30.gemfile +16 -0
- data/gemfiles/rails_42.gemfile +1 -1
- data/gemfiles/rails_50.gemfile +1 -1
- data/gemfiles/rails_52.gemfile +1 -1
- data/gemfiles/rails_60.gemfile +1 -1
- data/gemfiles/rails_61.gemfile +1 -1
- data/gemfiles/rails_70.gemfile +2 -2
- data/gemfiles/rails_71.gemfile +19 -0
- data/gemfiles/redis_40.gemfile +1 -1
- data/gemfiles/resque_122.gemfile +1 -1
- data/gemfiles/resque_20.gemfile +2 -2
- data/gemfiles/rest_client_16.gemfile +3 -2
- data/gemfiles/rest_client_20.gemfile +3 -2
- data/gemfiles/roda_20.gemfile +1 -1
- data/gemfiles/roda_30.gemfile +2 -2
- data/gemfiles/shoryuken_50.gemfile +2 -2
- data/gemfiles/shoryuken_60.gemfile +16 -0
- data/gemfiles/sidekiq_42.gemfile +1 -1
- data/gemfiles/sidekiq_50.gemfile +2 -2
- data/gemfiles/sidekiq_60.gemfile +2 -2
- data/gemfiles/sidekiq_65.gemfile +15 -0
- data/gemfiles/sidekiq_70.gemfile +2 -2
- data/gemfiles/sinatra_14.gemfile +2 -2
- data/gemfiles/sinatra_22.gemfile +15 -0
- data/gemfiles/sinatra_30.gemfile +15 -0
- data/lib/instana/activator.rb +20 -9
- data/lib/instana/activators/sidekiq_client.rb +1 -2
- data/lib/instana/activators/sidekiq_worker.rb +1 -2
- data/lib/instana/backend/serverless_agent.rb +1 -1
- data/lib/instana/instrumentation/sidekiq-client.rb +11 -2
- data/lib/instana/instrumentation/sidekiq-worker.rb +11 -2
- data/lib/instana/version.rb +1 -1
- data/test/activator_test.rb +20 -0
- data/test/backend/host_agent_reporting_observer_test.rb +5 -3
- data/test/instrumentation/aws_test.rb +5 -4
- data/test/instrumentation/rack_test.rb +13 -2
- data/test/instrumentation/rails_action_controller_test.rb +5 -1
- data/test/instrumentation/rails_action_view_test.rb +5 -1
- data/test/instrumentation/rails_active_record_database_missing_test.rb +5 -3
- data/test/instrumentation/sidekiq-client_test.rb +2 -18
- data/test/instrumentation/sidekiq-worker_test.rb +3 -45
- data/test/support/apps/http_endpoint/boot.rb +1 -1
- data/test/support/apps/sidekiq/worker.rb +8 -8
- data/test/test_helper.rb +8 -4
- data/test/tracing/custom_test.rb +64 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 332da83974279a02e0ebc35086a412aa2f8640d4e40dd38957bec22c0f8a9ed8
|
4
|
+
data.tar.gz: cb3528e5f55e0c76e5069c0d801033d800af6c184101484690d9ead1b9cf7088
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f372d7417bda356f6051fc6d8fb1ceb6f85537ac4c6841a9247f966350c9574335bf8c4fdc567b1c78d54ad95a8f3d0ce53b14126e964bb249c68d648616d11
|
7
|
+
data.tar.gz: 44ebe7c9b5716b7d323a619561c3732ba8b1145a600601ebbb6c797444db89a82486f94580ac2b20335f3f4877abaf35274abe9a14b740500c894c2b3aecffab
|
data/.circleci/config.yml
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
version: 2.1
|
2
2
|
|
3
|
+
library_gemfile: &library_gemfile
|
4
|
+
gemfile:
|
5
|
+
- "./gemfiles/aws_30.gemfile"
|
6
|
+
- "./gemfiles/aws_60.gemfile"
|
7
|
+
- "./gemfiles/cuba_30.gemfile"
|
8
|
+
- "./gemfiles/cuba_40.gemfile"
|
9
|
+
- "./gemfiles/dalli_20.gemfile"
|
10
|
+
- "./gemfiles/dalli_30.gemfile"
|
11
|
+
- "./gemfiles/dalli_32.gemfile"
|
12
|
+
- "./gemfiles/excon_02.gemfile"
|
13
|
+
- "./gemfiles/excon_079.gemfile"
|
14
|
+
- "./gemfiles/excon_100.gemfile"
|
15
|
+
- "./gemfiles/graphql_10.gemfile"
|
16
|
+
- "./gemfiles/graphql_20.gemfile"
|
17
|
+
- "./gemfiles/grpc_10.gemfile"
|
18
|
+
- "./gemfiles/net_http_01.gemfile"
|
19
|
+
- "./gemfiles/rack_16.gemfile"
|
20
|
+
- "./gemfiles/rack_20.gemfile"
|
21
|
+
- "./gemfiles/rack_30.gemfile"
|
22
|
+
- "./gemfiles/redis_40.gemfile"
|
23
|
+
- "./gemfiles/rest_client_16.gemfile"
|
24
|
+
- "./gemfiles/rest_client_20.gemfile"
|
25
|
+
- "./gemfiles/resque_122.gemfile"
|
26
|
+
- "./gemfiles/resque_20.gemfile"
|
27
|
+
- "./gemfiles/roda_20.gemfile"
|
28
|
+
- "./gemfiles/roda_30.gemfile"
|
29
|
+
- "./gemfiles/sidekiq_42.gemfile"
|
30
|
+
- "./gemfiles/sidekiq_50.gemfile"
|
31
|
+
- "./gemfiles/sidekiq_60.gemfile"
|
32
|
+
- "./gemfiles/sidekiq_65.gemfile"
|
33
|
+
- "./gemfiles/sidekiq_70.gemfile"
|
34
|
+
- "./gemfiles/sinatra_14.gemfile"
|
35
|
+
- "./gemfiles/sinatra_22.gemfile"
|
36
|
+
- "./gemfiles/sinatra_30.gemfile"
|
37
|
+
- "./gemfiles/shoryuken_50.gemfile"
|
38
|
+
- "./gemfiles/shoryuken_60.gemfile"
|
39
|
+
- "./gemfiles/mongo_216.gemfile"
|
40
|
+
- "./gemfiles/mongo_219.gemfile"
|
3
41
|
executors:
|
4
42
|
ruby_27:
|
5
43
|
docker:
|
@@ -174,33 +212,55 @@ commands:
|
|
174
212
|
bundler --version
|
175
213
|
bundle config set path './vendor/bundle'
|
176
214
|
- run:
|
177
|
-
name: Install
|
215
|
+
name: Install Dependencies
|
178
216
|
command: |
|
179
217
|
bundle check || bundle install
|
180
218
|
run_sonarqube:
|
181
219
|
steps:
|
182
220
|
- run:
|
183
|
-
name: Install Java
|
221
|
+
name: Install Java for the SonarQube tool
|
184
222
|
command: |
|
185
223
|
sudo apt-get update
|
186
224
|
sudo apt-get install openjdk-11-jdk
|
225
|
+
- run:
|
226
|
+
name: Install dependencies for coverage merge
|
227
|
+
command: |
|
228
|
+
bundler --version
|
229
|
+
bundle config set path './vendor/bundle'
|
230
|
+
bundle check || bundle install
|
231
|
+
environment:
|
232
|
+
BUNDLE_GEMFILE: './gemfiles/coverage_merge.gemfile'
|
233
|
+
- run:
|
234
|
+
name: Fetching partial coverage reports from workflow jobs
|
235
|
+
command: |
|
236
|
+
./download.sh
|
237
|
+
- run:
|
238
|
+
name: Merging partial coverage reports for reporting
|
239
|
+
command: |
|
240
|
+
bundle exec rake coverage:merge_reports --trace
|
241
|
+
environment:
|
242
|
+
BUNDLE_GEMFILE: './gemfiles/coverage_merge.gemfile'
|
187
243
|
- run:
|
188
244
|
name: Run SonarQube to capture coverage
|
189
245
|
command: |
|
190
|
-
wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.
|
246
|
+
wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.1.3023.zip
|
191
247
|
unzip -d /tmp /tmp/sonar-scanner-cli.zip
|
192
248
|
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
|
193
|
-
/tmp/sonar-scanner-4.
|
249
|
+
/tmp/sonar-scanner-4.8.1.3023/bin/sonar-scanner \
|
194
250
|
-Dsonar.host.url="${SONARQUBE_URL}" \
|
195
251
|
-Dsonar.login="${SONARQUBE_LOGIN}" \
|
196
252
|
-Dsonar.pullrequest.key="${CIRCLE_PR_NUMBER}" \
|
197
253
|
-Dsonar.pullrequest.branch="${CIRCLE_BRANCH}"
|
198
254
|
else
|
199
|
-
/tmp/sonar-scanner-4.
|
255
|
+
/tmp/sonar-scanner-4.8.1.3023/bin/sonar-scanner \
|
200
256
|
-Dsonar.host.url="${SONARQUBE_URL}" \
|
201
257
|
-Dsonar.login="${SONARQUBE_LOGIN}" \
|
202
258
|
-Dsonar.branch.name="${CIRCLE_BRANCH}"
|
203
259
|
fi
|
260
|
+
- store_artifacts:
|
261
|
+
path: partial_coverage_results
|
262
|
+
- store_artifacts:
|
263
|
+
path: coverage
|
204
264
|
run_tests:
|
205
265
|
steps:
|
206
266
|
- run:
|
@@ -210,6 +270,8 @@ commands:
|
|
210
270
|
bundle exec rake
|
211
271
|
- store_test_results:
|
212
272
|
path: ~/project/_junit
|
273
|
+
- store_artifacts:
|
274
|
+
path: coverage
|
213
275
|
run_rubocop:
|
214
276
|
steps:
|
215
277
|
- run:
|
@@ -262,6 +324,10 @@ jobs:
|
|
262
324
|
- checkout
|
263
325
|
- setup
|
264
326
|
- run_rubocop
|
327
|
+
report_coverage:
|
328
|
+
executor: ruby_32
|
329
|
+
steps:
|
330
|
+
- checkout
|
265
331
|
- run_sonarqube
|
266
332
|
publish:
|
267
333
|
executor: ruby_27
|
@@ -290,46 +356,16 @@ workflows:
|
|
290
356
|
- ruby_30
|
291
357
|
- ruby_31
|
292
358
|
- ruby_32
|
293
|
-
|
359
|
+
libraries_ruby_3:
|
294
360
|
jobs:
|
295
361
|
- test_apprisal:
|
296
362
|
matrix:
|
297
363
|
parameters:
|
298
364
|
stack:
|
299
|
-
- ruby_27
|
300
365
|
- ruby_30
|
301
366
|
- ruby_31
|
302
367
|
- ruby_32
|
303
|
-
|
304
|
-
- "./gemfiles/aws_30.gemfile"
|
305
|
-
- "./gemfiles/cuba_30.gemfile"
|
306
|
-
- "./gemfiles/cuba_40.gemfile"
|
307
|
-
- "./gemfiles/dalli_20.gemfile"
|
308
|
-
- "./gemfiles/dalli_30.gemfile"
|
309
|
-
- "./gemfiles/dalli_32.gemfile"
|
310
|
-
- "./gemfiles/excon_02.gemfile"
|
311
|
-
- "./gemfiles/excon_079.gemfile"
|
312
|
-
- "./gemfiles/excon_100.gemfile"
|
313
|
-
- "./gemfiles/graphql_10.gemfile"
|
314
|
-
- "./gemfiles/graphql_20.gemfile"
|
315
|
-
- "./gemfiles/grpc_10.gemfile"
|
316
|
-
- "./gemfiles/net_http_01.gemfile"
|
317
|
-
- "./gemfiles/rack_16.gemfile"
|
318
|
-
- "./gemfiles/rack_20.gemfile"
|
319
|
-
- "./gemfiles/redis_40.gemfile"
|
320
|
-
- "./gemfiles/rest_client_16.gemfile"
|
321
|
-
- "./gemfiles/rest_client_20.gemfile"
|
322
|
-
- "./gemfiles/resque_122.gemfile"
|
323
|
-
- "./gemfiles/resque_20.gemfile"
|
324
|
-
- "./gemfiles/roda_20.gemfile"
|
325
|
-
- "./gemfiles/roda_30.gemfile"
|
326
|
-
- "./gemfiles/sidekiq_42.gemfile"
|
327
|
-
- "./gemfiles/sidekiq_50.gemfile"
|
328
|
-
- "./gemfiles/sidekiq_60.gemfile"
|
329
|
-
- "./gemfiles/sidekiq_70.gemfile"
|
330
|
-
- "./gemfiles/sinatra_14.gemfile"
|
331
|
-
- "./gemfiles/shoryuken_50.gemfile"
|
332
|
-
- "./gemfiles/mongo_216.gemfile"
|
368
|
+
<<: *library_gemfile
|
333
369
|
exclude:
|
334
370
|
# Currently rest-client 1.6 gemfile pulls in mime-types 2.99.3
|
335
371
|
# and adaptation to mime-type 3.0 is only available in rest-client 2.0:
|
@@ -349,7 +385,14 @@ workflows:
|
|
349
385
|
# https://www.ruby-lang.org/en/news/2022/11/11/ruby-3-2-0-preview3-released/
|
350
386
|
- stack: ruby_32
|
351
387
|
gemfile: "./gemfiles/sinatra_14.gemfile"
|
352
|
-
|
388
|
+
libraries_ruby_2:
|
389
|
+
jobs:
|
390
|
+
- test_apprisal:
|
391
|
+
matrix:
|
392
|
+
parameters:
|
393
|
+
stack:
|
394
|
+
- ruby_27
|
395
|
+
<<: *library_gemfile
|
353
396
|
rails_ruby_2:
|
354
397
|
jobs:
|
355
398
|
- test_apprisal:
|
@@ -381,3 +424,7 @@ workflows:
|
|
381
424
|
gemfile:
|
382
425
|
- "./gemfiles/rails_61.gemfile"
|
383
426
|
- "./gemfiles/rails_70.gemfile"
|
427
|
+
- "./gemfiles/rails_71.gemfile"
|
428
|
+
report_coverage:
|
429
|
+
jobs:
|
430
|
+
- report_coverage
|
@@ -6,7 +6,7 @@ body:
|
|
6
6
|
- type: markdown
|
7
7
|
attributes:
|
8
8
|
value: |
|
9
|
-
Thank you for taking the time to fill out this report. Remember that these issues are public and if you need to discuss implementation specific issues securely, please [use our support portal](https://
|
9
|
+
Thank you for taking the time to fill out this report. Remember that these issues are public and if you need to discuss implementation specific issues securely, please [use our support portal](https://www.ibm.com/mysupport).
|
10
10
|
- type: textarea
|
11
11
|
id: problem-description
|
12
12
|
attributes:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
blank_issues_enabled: false
|
2
2
|
contact_links:
|
3
3
|
- name: Instana Support Portal
|
4
|
-
url: https://
|
4
|
+
url: https://www.ibm.com/mysupport
|
5
5
|
about: Please ask questions related to your installation there.
|
6
6
|
- name: Feature Requests
|
7
7
|
 url: https://automation-management.ideas.ibm.com/?project=INSTANA
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Slack Post
|
2
|
+
on:
|
3
|
+
workflow_dispatch: # Manual trigger
|
4
|
+
inputs:
|
5
|
+
github_ref:
|
6
|
+
description: 'Manually provided value for GITHUB_RELEASE_TAG of a release'
|
7
|
+
required: true
|
8
|
+
type: string
|
9
|
+
|
10
|
+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
|
11
|
+
release:
|
12
|
+
types: [published]
|
13
|
+
jobs:
|
14
|
+
build:
|
15
|
+
name: Slack Post
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
steps:
|
18
|
+
- name: 'Checkout the needed file only ./bin/announce_release_on_slack.py'
|
19
|
+
uses: actions/checkout@v3
|
20
|
+
- run: |
|
21
|
+
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
|
22
|
+
export GITHUB_RELEASE_TAG=${{ inputs.github_ref }}
|
23
|
+
else # release event
|
24
|
+
export GITHUB_RELEASE_TAG=$(basename ${GITHUB_REF})
|
25
|
+
fi
|
26
|
+
echo "New release published ${GITHUB_RELEASE_TAG}"
|
27
|
+
pip3 install PyGithub
|
28
|
+
echo $PWD
|
29
|
+
ls -lah
|
30
|
+
./bin/announce_release_on_slack.py
|
31
|
+
env:
|
32
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
33
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
34
|
+
SLACK_CHANNEL_ID_RELEASES: ${{ secrets.SLACK_CHANNEL_ID_RELEASES }}
|
data/Gemfile
CHANGED
@@ -4,20 +4,15 @@
|
|
4
4
|
source 'https://rubygems.org'
|
5
5
|
|
6
6
|
gem 'rake'
|
7
|
-
gem 'minitest', '5.
|
7
|
+
gem 'minitest', '5.20.0'
|
8
8
|
gem 'minitest-reporters'
|
9
9
|
gem 'webmock'
|
10
10
|
gem 'puma'
|
11
11
|
|
12
12
|
gem 'rubocop', '~> 1.9'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
gem 'rack', '<3.0.0', '~> 1.6'
|
17
|
-
else
|
18
|
-
gem 'rack', '<3.0.0'
|
19
|
-
# gem 'rackup'
|
20
|
-
end
|
14
|
+
gem 'rack'
|
15
|
+
gem 'rackup'
|
21
16
|
gem 'rack-test'
|
22
17
|
|
23
18
|
gem 'simplecov', '~> 0.21.2'
|
data/README.md
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
<div align="center">
|
2
|
-
<img src="https://disznc.s3.amazonaws.com/Ruby-Dashboard-2020-02-10-at-2.31.36-PM.png"/>
|
3
|
-
</div>
|
4
|
-
|
5
1
|
# Instana
|
6
2
|
|
7
3
|
The `instana` gem provides Ruby metrics and traces (request, queue & cross-host) for [Instana](https://www.instana.com/).
|
@@ -46,21 +42,21 @@ The `instana` gem is a zero configuration tool that will automatically collect k
|
|
46
42
|
|
47
43
|
## Configuration
|
48
44
|
|
49
|
-
Although the gem has no configuration required for out of the box metrics and tracing, components can be configured if needed. See our [Configuration](https://
|
45
|
+
Although the gem has no configuration required for out of the box metrics and tracing, components can be configured if needed. See our [Configuration](https://www.ibm.com/docs/en/instana-observability/current?topic=ruby-configuration-configuring-instana-gem) page.
|
50
46
|
|
51
47
|
## Tracing
|
52
48
|
|
53
|
-
This Ruby gem provides a simple API for tracing and also supports [OpenTracing](http://opentracing.io/). See the [Ruby Tracing SDK](https://
|
49
|
+
This Ruby gem provides a simple API for tracing and also supports [OpenTracing](http://opentracing.io/). See the [Ruby Tracing SDK](https://www.ibm.com/docs/en/instana-observability/current?topic=ruby-tracing-sdk) and [OpenTracing](https://www.ibm.com/docs/en/instana-observability/current?topic=ruby-opentracing) pages for details.
|
54
50
|
|
55
51
|
## Documentation
|
56
52
|
|
57
|
-
You can find more documentation covering supported components and minimum versions in the Instana [documentation portal](https://
|
53
|
+
You can find more documentation covering supported components and minimum versions in the Instana [documentation portal](https://www.ibm.com/docs/en/instana-observability/current?topic=technologies-monitoring-ruby).
|
58
54
|
|
59
55
|
## Want End User Monitoring (EUM)?
|
60
56
|
|
61
57
|
Instana provides deep end user monitoring that links server side traces with browser events to give you a complete view from server to browser.
|
62
58
|
|
63
|
-
See the [End User Monitoring](/
|
59
|
+
See the [End User Monitoring](https://www.ibm.com/docs/en/instana-observability/current?topic=instana-monitoring-websites) page for more information.
|
64
60
|
|
65
61
|
## Development
|
66
62
|
|
data/Rakefile
CHANGED
@@ -13,11 +13,11 @@ Rake::TestTask.new(:test) do |t|
|
|
13
13
|
|
14
14
|
t.libs << "test"
|
15
15
|
t.libs << "lib"
|
16
|
-
|
16
|
+
|
17
17
|
if ENV['APPRAISAL_INITIALIZED']
|
18
18
|
appraised_group = File.basename(ENV['BUNDLE_GEMFILE']).split(/_[0-9]+\./).first
|
19
19
|
suite_files = Dir['test/{instrumentation,frameworks}/*_test.rb']
|
20
|
-
|
20
|
+
|
21
21
|
t.test_files = suite_files.select { |f| File.basename(f).start_with?(appraised_group) }
|
22
22
|
else
|
23
23
|
t.test_files = Dir[
|
@@ -27,4 +27,23 @@ Rake::TestTask.new(:test) do |t|
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
namespace :coverage do
|
31
|
+
task :merge_reports do
|
32
|
+
require 'simplecov'
|
33
|
+
require 'simplecov_json_formatter'
|
34
|
+
|
35
|
+
SimpleCov.start do
|
36
|
+
enable_coverage :branch
|
37
|
+
SimpleCov.collate Dir["partial_coverage_results/.resultset-*.json"] do
|
38
|
+
formatter SimpleCov::Formatter::MultiFormatter.new(
|
39
|
+
[
|
40
|
+
SimpleCov::Formatter::SimpleFormatter,
|
41
|
+
SimpleCov::Formatter::JSONFormatter
|
42
|
+
]
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
30
49
|
task :default => :test
|
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
|
3
|
+
# (c) Copyright IBM Corp. 2023
|
4
|
+
|
5
|
+
import json
|
6
|
+
import logging
|
7
|
+
import os
|
8
|
+
import re
|
9
|
+
import requests
|
10
|
+
import sys
|
11
|
+
|
12
|
+
from github import Github
|
13
|
+
|
14
|
+
|
15
|
+
def ensure_environment_variables_are_present():
|
16
|
+
required_env_vars = ('GITHUB_RELEASE_TAG', 'GITHUB_TOKEN',
|
17
|
+
'SLACK_BOT_TOKEN', 'SLACK_CHANNEL_ID_RELEASES')
|
18
|
+
|
19
|
+
for v in required_env_vars:
|
20
|
+
if not os.environ.get(v):
|
21
|
+
logging.fatal("A required environment variable is missing: %s", v)
|
22
|
+
sys.exit(1)
|
23
|
+
|
24
|
+
|
25
|
+
def get_gh_release_info_text_with_token(release_tag, access_token):
|
26
|
+
g = Github(access_token)
|
27
|
+
repo_name = "instana/ruby-sensor"
|
28
|
+
repo = g.get_repo(repo_name)
|
29
|
+
release = repo.get_release(release_tag)
|
30
|
+
|
31
|
+
logging.info("GH Release fetched successfully %s", release)
|
32
|
+
|
33
|
+
msg = (
|
34
|
+
f":mega: :package: A new version is released in {repo_name}\n"
|
35
|
+
f"Name: {release.title}\n"
|
36
|
+
f"Tag: {release.tag_name}\n"
|
37
|
+
f"Created at: {release.created_at}\n"
|
38
|
+
f"Published at: {release.published_at}\n"
|
39
|
+
f"{release.body}\n")
|
40
|
+
|
41
|
+
logging.info(msg)
|
42
|
+
return msg
|
43
|
+
|
44
|
+
|
45
|
+
def reformat_github_md_to_slack_markup(msg):
|
46
|
+
# Based on:
|
47
|
+
# https://github.com/atomist/slack-messages/blob
|
48
|
+
# /c938c67e957345ba6a0015ca3ace1fd779d0979c/lib/Markdown.ts#LL111C1-L116C44
|
49
|
+
|
50
|
+
msg = re.sub(r'^(\s*)[-*](\s+)', r'\1•\2', msg, flags=re.MULTILINE)
|
51
|
+
msg = re.sub(r'(\*|_)\1(\S|\S.*?\S)\1\1(?!\1)', r'<bdmkd>\2</bdmkd>', msg)
|
52
|
+
msg = re.sub(r'(\*|_)(?!\1)(\S|\S.*?\S)\1(?!\1)', r'<itmkd>\2</itmkd>', msg)
|
53
|
+
msg = msg.replace('<bdmkd>', '*').replace('<itmkd>', '_')
|
54
|
+
msg = re.sub(r'^([#]+)\s+([\S ]+)$', r'*\2*', msg, flags=re.MULTILINE)
|
55
|
+
|
56
|
+
# TODO: The message text has to have a partial entity encoding
|
57
|
+
# https://api.slack.com/reference/surfaces/formatting#escaping
|
58
|
+
# Validate it if we can?
|
59
|
+
# A naive replace like this is not enough, because
|
60
|
+
# it might already be encoded and then we would encode again.
|
61
|
+
#s = s.replace('&', '&')
|
62
|
+
#s = s.replace('<', '<')
|
63
|
+
#s = s.replace('>', '>')
|
64
|
+
|
65
|
+
# Use the tester here:
|
66
|
+
# https://api.slack.com/methods/chat.postMessage/test
|
67
|
+
return msg
|
68
|
+
|
69
|
+
|
70
|
+
def post_on_slack_channel(slack_token, slack_channel_id, message_text):
|
71
|
+
api_url = "https://slack.com/api/chat.postMessage"
|
72
|
+
|
73
|
+
headers = {"Authorization": f"Bearer {slack_token}",
|
74
|
+
"Content-Type": "application/json"}
|
75
|
+
body = {"channel": slack_channel_id, "text": message_text}
|
76
|
+
|
77
|
+
response = requests.post(api_url, headers=headers, data=json.dumps(body))
|
78
|
+
response_data = json.loads(response.text)
|
79
|
+
|
80
|
+
if response_data["ok"]:
|
81
|
+
logging.info("Message sent successfully!")
|
82
|
+
else:
|
83
|
+
logging.fatal("Error sending message: %s", response_data['error'])
|
84
|
+
|
85
|
+
|
86
|
+
def main():
|
87
|
+
# Setting this globally to DEBUG will also debug PyGithub,
|
88
|
+
# which will produce even more log output
|
89
|
+
logging.basicConfig(level=logging.INFO)
|
90
|
+
ensure_environment_variables_are_present()
|
91
|
+
|
92
|
+
msg = get_gh_release_info_text_with_token(os.environ['GITHUB_RELEASE_TAG'],
|
93
|
+
os.environ['GITHUB_TOKEN'])
|
94
|
+
|
95
|
+
slack_formatted_msg = reformat_github_md_to_slack_markup(msg)
|
96
|
+
|
97
|
+
post_on_slack_channel(os.environ['SLACK_BOT_TOKEN'],
|
98
|
+
os.environ['SLACK_CHANNEL_ID_RELEASES'],
|
99
|
+
slack_formatted_msg)
|
100
|
+
|
101
|
+
|
102
|
+
if __name__ == "__main__":
|
103
|
+
main()
|
data/download.sh
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
if [[ -z ${CIRCLE_TOKEN} ]]
|
4
|
+
then
|
5
|
+
echo "ERROR: The CIRCLE_TOKEN variable is missing"
|
6
|
+
exit 255
|
7
|
+
fi
|
8
|
+
|
9
|
+
PROJECT_SLUG='https://circleci.com/api/v2/project/gh/instana/ruby-sensor'
|
10
|
+
PIPELINE_SLUG='https://circleci.com/api/v2/pipeline/'
|
11
|
+
WORKFLOW_SLUG='https://circleci.com/api/v2/workflow/'
|
12
|
+
|
13
|
+
echo "Getting Pipeline ID"
|
14
|
+
PIPELINE_ID=$(curl -s \
|
15
|
+
-H "Circle-Token: ${CIRCLE_TOKEN}" \
|
16
|
+
"${PROJECT_SLUG}/job/${CIRCLE_BUILD_NUM}" \
|
17
|
+
| jq -rj '.pipeline.id')
|
18
|
+
|
19
|
+
|
20
|
+
echo "Received Pipeline ID is: ${PIPELINE_ID}"
|
21
|
+
|
22
|
+
echo "Getting Workflows for Pipeline ID"
|
23
|
+
WORKFLOW_IDS=$(curl -s \
|
24
|
+
-H "Circle-Token: ${CIRCLE_TOKEN}" \
|
25
|
+
"${PIPELINE_SLUG}/${PIPELINE_ID}/workflow" \
|
26
|
+
| jq -r '.items[] | select(.name!="report_coverage") | .id')
|
27
|
+
|
28
|
+
echo "Received Workflow IDs are: ${WORKFLOW_IDS}"
|
29
|
+
|
30
|
+
for workflow_id in ${WORKFLOW_IDS}
|
31
|
+
do
|
32
|
+
echo "Waiting for workflow ${workflow_id} to finish"
|
33
|
+
while true
|
34
|
+
do
|
35
|
+
STATUS=$(curl -s \
|
36
|
+
-H "Circle-Token: ${CIRCLE_TOKEN}" \
|
37
|
+
"${WORKFLOW_SLUG}/${workflow_id}" \
|
38
|
+
| jq -r '.status')
|
39
|
+
if [[ ${STATUS} != "running" && ${STATUS} != "on_hold" ]]
|
40
|
+
then
|
41
|
+
break
|
42
|
+
else
|
43
|
+
echo "Workflow ${workflow_id} has not finished yet. Status is: ${STATUS}"
|
44
|
+
sleep 10
|
45
|
+
fi
|
46
|
+
done
|
47
|
+
|
48
|
+
if [[ "${STATUS}" != "success" ]]
|
49
|
+
then
|
50
|
+
echo "ERROR: Workflow ${workflow_id} did not succeed! Status is: ${STATUS}"
|
51
|
+
exit 254
|
52
|
+
else
|
53
|
+
echo "Workflow ${workflow_id} has finished successfully! Status is: ${STATUS}"
|
54
|
+
fi
|
55
|
+
done
|
56
|
+
|
57
|
+
|
58
|
+
echo "All workflows have successfully finished, downloading artifacts."
|
59
|
+
|
60
|
+
mkdir partial_coverage_results
|
61
|
+
for workflow_id in ${WORKFLOW_IDS}
|
62
|
+
do
|
63
|
+
JOB_NUMBERS=$(curl -s \
|
64
|
+
-H "Circle-Token: ${CIRCLE_TOKEN}" \
|
65
|
+
"${WORKFLOW_SLUG}/${workflow_id}/job" \
|
66
|
+
| jq -r '.items[] | .job_number' \
|
67
|
+
| tr '\n' ' ')
|
68
|
+
|
69
|
+
for job in ${JOB_NUMBERS}
|
70
|
+
do
|
71
|
+
ARTIFACT_DOWNLOAD_LINK=$(curl -s \
|
72
|
+
-H "Circle-Token: ${CIRCLE_TOKEN}" \
|
73
|
+
"${PROJECT_SLUG}/${job}/artifacts" \
|
74
|
+
| jq -r \
|
75
|
+
'.items[] | select(.path=="coverage/.resultset.json") | .url')
|
76
|
+
#'.items[] | select(.path=="coverage/coverage.json" or .path=="coverage/.resultset.json") | .url')
|
77
|
+
curl -s \
|
78
|
+
-L \
|
79
|
+
-H "Circle-Token: ${CIRCLE_TOKEN}" \
|
80
|
+
"${ARTIFACT_DOWNLOAD_LINK}" \
|
81
|
+
-o partial_coverage_results/.resultset-${job}.json
|
82
|
+
done
|
83
|
+
done
|
84
|
+
|
85
|
+
echo "All artifacts have been successfully downloaded."
|
data/gemfiles/aws_30.gemfile
CHANGED
@@ -6,17 +6,18 @@
|
|
6
6
|
source "https://rubygems.org"
|
7
7
|
|
8
8
|
gem "rake"
|
9
|
-
gem "minitest", "5.
|
9
|
+
gem "minitest", "5.20.0"
|
10
10
|
gem "minitest-reporters"
|
11
11
|
gem "webmock"
|
12
|
+
gem "webrick"
|
12
13
|
gem "puma"
|
13
14
|
gem "rubocop", "~> 1.9"
|
14
15
|
gem "rack-test"
|
15
16
|
gem "simplecov", "~> 0.21.2"
|
16
|
-
gem "aws-sdk-dynamodb", "
|
17
|
-
gem "aws-sdk-s3", "
|
18
|
-
gem "aws-sdk-sns", "
|
19
|
-
gem "aws-sdk-sqs", "
|
20
|
-
gem "aws-sdk-lambda", "
|
17
|
+
gem "aws-sdk-dynamodb", ">= 1.59", "< 1.99"
|
18
|
+
gem "aws-sdk-s3", ">= 1.59", "< 1.60"
|
19
|
+
gem "aws-sdk-sns", ">= 1.38", "< 1.59"
|
20
|
+
gem "aws-sdk-sqs", ">= 1.36", "< 1.59"
|
21
|
+
gem "aws-sdk-lambda", ">= 1.62", "< 1.80"
|
21
22
|
|
22
23
|
gemspec path: "../"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2023
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake"
|
6
|
+
gem "minitest", "5.20.0"
|
7
|
+
gem "minitest-reporters"
|
8
|
+
gem "webmock"
|
9
|
+
gem "puma"
|
10
|
+
gem "rubocop", "~> 1.9"
|
11
|
+
gem "rack-test"
|
12
|
+
gem "simplecov", "~> 0.21.2"
|
13
|
+
gem "aws-sdk-dynamodb", ">= 1.90"
|
14
|
+
gem "aws-sdk-s3", ">= 1.127"
|
15
|
+
gem "aws-sdk-sns", ">= 1.63"
|
16
|
+
gem "aws-sdk-sqs", ">= 1.59"
|
17
|
+
gem "aws-sdk-lambda", ">= 1.101"
|
18
|
+
|
19
|
+
gemspec path: "../"
|
data/gemfiles/cuba_30.gemfile
CHANGED
data/gemfiles/cuba_40.gemfile
CHANGED
data/gemfiles/dalli_20.gemfile
CHANGED
data/gemfiles/dalli_30.gemfile
CHANGED