instana 1.217.1 → 2.1.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.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/instana/base.rb +4 -2
  4. data/lib/instana/instrumentation/action_cable.rb +8 -4
  5. data/lib/instana/instrumentation/action_controller.rb +2 -4
  6. data/lib/instana/instrumentation/action_mailer.rb +1 -1
  7. data/lib/instana/instrumentation/action_view.rb +4 -4
  8. data/lib/instana/instrumentation/active_job.rb +20 -5
  9. data/lib/instana/instrumentation/active_record.rb +1 -1
  10. data/lib/instana/instrumentation/aws_sdk_dynamodb.rb +1 -1
  11. data/lib/instana/instrumentation/aws_sdk_lambda.rb +1 -1
  12. data/lib/instana/instrumentation/aws_sdk_s3.rb +1 -1
  13. data/lib/instana/instrumentation/aws_sdk_sns.rb +1 -1
  14. data/lib/instana/instrumentation/aws_sdk_sqs.rb +1 -1
  15. data/lib/instana/instrumentation/dalli.rb +1 -1
  16. data/lib/instana/instrumentation/excon.rb +2 -2
  17. data/lib/instana/instrumentation/graphql.rb +3 -3
  18. data/lib/instana/instrumentation/grpc.rb +14 -13
  19. data/lib/instana/instrumentation/mongo.rb +3 -3
  20. data/lib/instana/instrumentation/net-http.rb +5 -4
  21. data/lib/instana/instrumentation/rack.rb +36 -4
  22. data/lib/instana/instrumentation/redis.rb +1 -1
  23. data/lib/instana/instrumentation/resque.rb +10 -8
  24. data/lib/instana/instrumentation/rest-client.rb +4 -4
  25. data/lib/instana/instrumentation/sequel.rb +3 -3
  26. data/lib/instana/instrumentation/shoryuken.rb +4 -1
  27. data/lib/instana/instrumentation/sidekiq-client.rb +21 -19
  28. data/lib/instana/instrumentation/sidekiq-worker.rb +22 -21
  29. data/lib/instana/instrumented_logger.rb +1 -1
  30. data/lib/instana/samplers/result.rb +32 -0
  31. data/lib/instana/samplers/samplers.rb +76 -0
  32. data/lib/instana/serverless.rb +4 -2
  33. data/lib/instana/setup.rb +5 -5
  34. data/lib/instana/span_filtering/condition.rb +134 -0
  35. data/lib/instana/span_filtering/configuration.rb +262 -0
  36. data/lib/instana/span_filtering/filter_rule.rb +31 -0
  37. data/lib/instana/span_filtering.rb +62 -0
  38. data/lib/instana/trace/export.rb +36 -0
  39. data/lib/instana/{tracing → trace}/processor.rb +19 -15
  40. data/lib/instana/trace/span.rb +534 -0
  41. data/lib/instana/{tracing → trace}/span_context.rb +17 -8
  42. data/lib/instana/trace/span_kind.rb +51 -0
  43. data/lib/instana/trace/span_limits.rb +63 -0
  44. data/lib/instana/{tracer.rb → trace/tracer.rb} +106 -54
  45. data/lib/instana/trace/tracer_provider.rb +198 -0
  46. data/lib/instana/trace.rb +74 -0
  47. data/lib/instana/util.rb +11 -0
  48. data/lib/instana/version.rb +1 -1
  49. metadata +89 -267
  50. data/.circleci/config.yml +0 -485
  51. data/.codeclimate.yml +0 -23
  52. data/.editorconfig +0 -10
  53. data/.fasterer.yml +0 -23
  54. data/.github/ISSUE_TEMPLATE/bug.yml +0 -39
  55. data/.github/ISSUE_TEMPLATE/config.yml +0 -8
  56. data/.github/workflows/pr_commits_signed_off.yml +0 -16
  57. data/.github/workflows/release-notification-on-slack.yml +0 -34
  58. data/.gitignore +0 -19
  59. data/.rubocop.yml +0 -34
  60. data/.rubocop_todo.yml +0 -1140
  61. data/.tekton/.currency/docs/report.md +0 -20
  62. data/.tekton/.currency/resources/requirements.txt +0 -4
  63. data/.tekton/.currency/resources/table.json +0 -100
  64. data/.tekton/.currency/scripts/generate_report.py +0 -136
  65. data/.tekton/README.md +0 -278
  66. data/.tekton/github-interceptor-secret.yaml +0 -8
  67. data/.tekton/github-pr-eventlistener.yaml +0 -104
  68. data/.tekton/github-pr-pipeline.yaml.part +0 -38
  69. data/.tekton/github-set-status-task.yaml +0 -43
  70. data/.tekton/github-webhook-ingress.yaml +0 -20
  71. data/.tekton/pipeline.yaml +0 -571
  72. data/.tekton/pipelinerun.yaml +0 -21
  73. data/.tekton/ruby-tracer-prepuller.yaml +0 -87
  74. data/.tekton/run_unittests.sh +0 -87
  75. data/.tekton/scheduled-eventlistener.yaml +0 -108
  76. data/.tekton/task.yaml +0 -449
  77. data/.tekton/tekton-triggers-eventlistener-serviceaccount.yaml +0 -29
  78. data/Appraisals +0 -124
  79. data/CONTRIBUTING.md +0 -86
  80. data/Gemfile +0 -17
  81. data/LICENSE +0 -22
  82. data/MAINTAINERS.md +0 -3
  83. data/Rakefile +0 -49
  84. data/bin/announce_release_on_slack.py +0 -103
  85. data/docker-compose.yml +0 -20
  86. data/download.sh +0 -85
  87. data/examples/opentracing.rb +0 -35
  88. data/examples/tracing.rb +0 -84
  89. data/extras/license_header.rb +0 -44
  90. data/gemfiles/.bundle/config +0 -2
  91. data/gemfiles/aws_30.gemfile +0 -21
  92. data/gemfiles/aws_60.gemfile +0 -16
  93. data/gemfiles/cuba_30.gemfile +0 -16
  94. data/gemfiles/cuba_40.gemfile +0 -13
  95. data/gemfiles/dalli_20.gemfile +0 -15
  96. data/gemfiles/dalli_30.gemfile +0 -12
  97. data/gemfiles/dalli_32.gemfile +0 -12
  98. data/gemfiles/excon_0100.gemfile +0 -14
  99. data/gemfiles/excon_021.gemfile +0 -17
  100. data/gemfiles/excon_079.gemfile +0 -17
  101. data/gemfiles/excon_100.gemfile +0 -14
  102. data/gemfiles/graphql_10.gemfile +0 -16
  103. data/gemfiles/graphql_20.gemfile +0 -15
  104. data/gemfiles/grpc_10.gemfile +0 -15
  105. data/gemfiles/mongo_216.gemfile +0 -15
  106. data/gemfiles/mongo_219.gemfile +0 -12
  107. data/gemfiles/net_http_01.gemfile +0 -17
  108. data/gemfiles/rack_16.gemfile +0 -15
  109. data/gemfiles/rack_20.gemfile +0 -15
  110. data/gemfiles/rack_30.gemfile +0 -13
  111. data/gemfiles/rails_42.gemfile +0 -18
  112. data/gemfiles/rails_50.gemfile +0 -19
  113. data/gemfiles/rails_52.gemfile +0 -19
  114. data/gemfiles/rails_60.gemfile +0 -19
  115. data/gemfiles/rails_61.gemfile +0 -20
  116. data/gemfiles/rails_70.gemfile +0 -17
  117. data/gemfiles/rails_71.gemfile +0 -17
  118. data/gemfiles/rails_80.gemfile +0 -17
  119. data/gemfiles/redis_40.gemfile +0 -15
  120. data/gemfiles/redis_50.gemfile +0 -13
  121. data/gemfiles/redis_51.gemfile +0 -13
  122. data/gemfiles/resque_122.gemfile +0 -16
  123. data/gemfiles/resque_1274_3scale.gemfile +0 -17
  124. data/gemfiles/resque_20.gemfile +0 -16
  125. data/gemfiles/rest_client_16.gemfile +0 -17
  126. data/gemfiles/rest_client_20.gemfile +0 -17
  127. data/gemfiles/roda_20.gemfile +0 -16
  128. data/gemfiles/roda_30.gemfile +0 -16
  129. data/gemfiles/rubocop_162.gemfile +0 -6
  130. data/gemfiles/sequel_56.gemfile +0 -16
  131. data/gemfiles/sequel_57.gemfile +0 -16
  132. data/gemfiles/sequel_58.gemfile +0 -16
  133. data/gemfiles/shoryuken_50.gemfile +0 -16
  134. data/gemfiles/shoryuken_60.gemfile +0 -13
  135. data/gemfiles/sidekiq_42.gemfile +0 -15
  136. data/gemfiles/sidekiq_50.gemfile +0 -15
  137. data/gemfiles/sidekiq_60.gemfile +0 -12
  138. data/gemfiles/sidekiq_65.gemfile +0 -12
  139. data/gemfiles/sidekiq_70.gemfile +0 -12
  140. data/gemfiles/sinatra_14.gemfile +0 -15
  141. data/gemfiles/sinatra_22.gemfile +0 -12
  142. data/gemfiles/sinatra_30.gemfile +0 -12
  143. data/gemfiles/sinatra_40.gemfile +0 -12
  144. data/instana.gemspec +0 -48
  145. data/lib/instana/open_tracing/carrier.rb +0 -7
  146. data/lib/instana/open_tracing/instana_tracer.rb +0 -99
  147. data/lib/instana/tracing/span.rb +0 -431
  148. data/lib/opentracing.rb +0 -32
  149. data/log/.keep +0 -0
  150. data/sonar-project.properties +0 -9
  151. data/test/activator_test.rb +0 -50
  152. data/test/backend/agent_test.rb +0 -80
  153. data/test/backend/gc_snapshot_test.rb +0 -11
  154. data/test/backend/host_agent_activation_observer_test.rb +0 -73
  155. data/test/backend/host_agent_lookup_test.rb +0 -78
  156. data/test/backend/host_agent_reporting_observer_test.rb +0 -276
  157. data/test/backend/host_agent_test.rb +0 -89
  158. data/test/backend/process_info_test.rb +0 -83
  159. data/test/backend/request_client_test.rb +0 -39
  160. data/test/backend/serverless_agent_test.rb +0 -83
  161. data/test/benchmarks/bench_id_generation.rb +0 -15
  162. data/test/benchmarks/bench_opentracing.rb +0 -16
  163. data/test/config_test.rb +0 -34
  164. data/test/frameworks/cuba_test.rb +0 -61
  165. data/test/frameworks/roda_test.rb +0 -60
  166. data/test/frameworks/sinatra_test.rb +0 -71
  167. data/test/instana_test.rb +0 -37
  168. data/test/instrumentation/aws_test.rb +0 -241
  169. data/test/instrumentation/dalli_test.rb +0 -325
  170. data/test/instrumentation/excon_test.rb +0 -204
  171. data/test/instrumentation/graphql_test.rb +0 -289
  172. data/test/instrumentation/grpc_test.rb +0 -420
  173. data/test/instrumentation/mongo_test.rb +0 -68
  174. data/test/instrumentation/net_http_test.rb +0 -220
  175. data/test/instrumentation/rack_instrumented_request_test.rb +0 -211
  176. data/test/instrumentation/rack_test.rb +0 -415
  177. data/test/instrumentation/rails_action_cable_test.rb +0 -135
  178. data/test/instrumentation/rails_action_controller_test.rb +0 -218
  179. data/test/instrumentation/rails_action_mailer_test.rb +0 -66
  180. data/test/instrumentation/rails_action_view_test.rb +0 -154
  181. data/test/instrumentation/rails_active_job_test.rb +0 -65
  182. data/test/instrumentation/rails_active_record_database_missing_test.rb +0 -45
  183. data/test/instrumentation/rails_active_record_test.rb +0 -115
  184. data/test/instrumentation/redis_test.rb +0 -152
  185. data/test/instrumentation/resque_test.rb +0 -188
  186. data/test/instrumentation/rest_client_test.rb +0 -107
  187. data/test/instrumentation/sequel_test.rb +0 -105
  188. data/test/instrumentation/shoryuken_test.rb +0 -47
  189. data/test/instrumentation/sidekiq-client_test.rb +0 -169
  190. data/test/instrumentation/sidekiq-worker_test.rb +0 -180
  191. data/test/secrets_test.rb +0 -112
  192. data/test/serverless_test.rb +0 -369
  193. data/test/snapshot/deltable_test.rb +0 -17
  194. data/test/snapshot/docker_container_test.rb +0 -82
  195. data/test/snapshot/fargate_container_test.rb +0 -82
  196. data/test/snapshot/fargate_process_test.rb +0 -35
  197. data/test/snapshot/fargate_task_test.rb +0 -49
  198. data/test/snapshot/google_cloud_run_instance_test.rb +0 -74
  199. data/test/snapshot/google_cloud_run_process_test.rb +0 -33
  200. data/test/snapshot/lambda_function_test.rb +0 -37
  201. data/test/snapshot/ruby_process_test.rb +0 -32
  202. data/test/support/apps/active_record/active_record.rb +0 -24
  203. data/test/support/apps/grpc/boot.rb +0 -23
  204. data/test/support/apps/grpc/grpc_server.rb +0 -84
  205. data/test/support/apps/http_endpoint/boot.rb +0 -28
  206. data/test/support/apps/rails/boot.rb +0 -219
  207. data/test/support/apps/rails/models/block.rb +0 -21
  208. data/test/support/apps/rails/models/block6.rb +0 -21
  209. data/test/support/apps/resque/boot.rb +0 -5
  210. data/test/support/apps/resque/jobs/resque_error_job.rb +0 -22
  211. data/test/support/apps/resque/jobs/resque_fast_job.rb +0 -23
  212. data/test/support/apps/sidekiq/boot.rb +0 -25
  213. data/test/support/apps/sidekiq/jobs/sidekiq_job_1.rb +0 -9
  214. data/test/support/apps/sidekiq/jobs/sidekiq_job_2.rb +0 -10
  215. data/test/support/apps/sidekiq/worker.rb +0 -37
  216. data/test/support/helpers.rb +0 -85
  217. data/test/support/mock_timer.rb +0 -20
  218. data/test/test_helper.rb +0 -69
  219. data/test/tracing/custom_test.rb +0 -226
  220. data/test/tracing/id_management_test.rb +0 -80
  221. data/test/tracing/instrumented_logger_test.rb +0 -39
  222. data/test/tracing/opentracing_test.rb +0 -382
  223. data/test/tracing/processor_test.rb +0 -58
  224. data/test/tracing/span_context_test.rb +0 -22
  225. data/test/tracing/span_test.rb +0 -179
  226. data/test/tracing/tracer_async_test.rb +0 -230
  227. data/test/tracing/tracer_test.rb +0 -352
  228. data/test/util_test.rb +0 -10
@@ -1,20 +0,0 @@
1
- ##### This page is auto-generated. Any change will be overwritten after the next sync. Please apply changes directly to the files in the [ruby tracer](https://github.com/instana/ruby-sensor) repo.
2
- ## Ruby supported packages and versions
3
- | Package name | Support Policy | Beta version | Last Supported Version | Latest version | Up-to-date | Cloud Native |
4
- |:---------------|:-----------------|:---------------|:-------------------------|:-----------------|:-------------|:---------------|
5
- | Cuba | On demand | No | 4.0.3 | 4.0.3 | Yes | No |
6
- | Rack | 45-days | No | 3.1.7 | 3.1.7 | Yes | No |
7
- | Rails | 45-days | No | 7.2.1 | 7.2.1 | Yes | No |
8
- | Rails::API | 45-days | No | 0.4.1 | 0.4.1 | Yes | No |
9
- | Rails LTS | On demand | No | 6.1 | 6.1 | Yes | No |
10
- | Roda | 45-days | No | 3.84.0 | 3.84.0 | Yes | No |
11
- | Sinatra | 45-days | No | 4.0.0 | 4.0.0 | Yes | No |
12
- | Excon | 45-days | No | 0.112.0 | 0.112.0 | Yes | Yes |
13
- | gRPC | 45-days | No | 1.66.0 | 1.66.0 | Yes | No |
14
- | Net::HTTP | 0-day | Yes | 0.4.1 | 0.4.1 | Yes | No |
15
- | Rest-Client | 45-days | No | 2.1.0 | 2.1.0 | Yes | No |
16
- | Dalli | 45-days | No | 3.2.8 | 3.2.8 | Yes | No |
17
- | Resque | 45-days | No | 2.6.0 | 2.6.0 | Yes | Yes |
18
- | Sidekiq | 45-days | No | 7.3.2 | 7.3.2 | Yes | Yes |
19
- | GraphQL | 45-days | No | 2.3.17 | 2.3.17 | Yes | Yes |
20
- | Sequel | 45-days | No | 5.60.0 | 5.84.0 | Yes | No |
@@ -1,4 +0,0 @@
1
- requests
2
- pandas
3
- beautifulsoup4
4
- tabulate
@@ -1,100 +0,0 @@
1
- {
2
- "table": [
3
- {
4
- "Package name": "Cuba",
5
- "Support Policy": "On demand",
6
- "Beta version": "No",
7
- "Cloud Native": "No"
8
- },
9
- {
10
- "Package name": "Rack",
11
- "Support Policy": "45-days",
12
- "Beta version": "No",
13
- "Cloud Native": "No"
14
- },
15
- {
16
- "Package name": "Rails",
17
- "Support Policy": "45-days",
18
- "Beta version": "No",
19
- "Cloud Native": "No"
20
- },
21
- {
22
- "Package name": "Rails::API",
23
- "Support Policy": "45-days",
24
- "Beta version": "No",
25
- "Cloud Native": "No"
26
- },
27
- {
28
- "Package name": "Rails LTS",
29
- "Support Policy": "On demand",
30
- "Beta version": "No",
31
- "Cloud Native": "No"
32
- },
33
- {
34
- "Package name": "Roda",
35
- "Support Policy": "45-days",
36
- "Beta version": "No",
37
- "Cloud Native": "No"
38
- },
39
- {
40
- "Package name": "Sinatra",
41
- "Support Policy": "45-days",
42
- "Beta version": "No",
43
- "Cloud Native": "No"
44
- },
45
- {
46
- "Package name": "Excon",
47
- "Support Policy": "45-days",
48
- "Beta version": "No",
49
- "Cloud Native": "Yes"
50
- },
51
- {
52
- "Package name": "gRPC",
53
- "Support Policy": "45-days",
54
- "Beta version": "No",
55
- "Cloud Native": "No"
56
- },
57
- {
58
- "Package name": "Net::HTTP",
59
- "Support Policy": "0-day",
60
- "Beta version": "Yes",
61
- "Cloud Native": "No"
62
- },
63
- {
64
- "Package name": "Rest-Client",
65
- "Support Policy": "45-days",
66
- "Beta version": "No",
67
- "Cloud Native": "No"
68
- },
69
- {
70
- "Package name": "Dalli",
71
- "Support Policy": "45-days",
72
- "Beta version": "No",
73
- "Cloud Native": "No"
74
- },
75
- {
76
- "Package name": "Resque",
77
- "Support Policy": "45-days",
78
- "Beta version": "No",
79
- "Cloud Native": "Yes"
80
- },
81
- {
82
- "Package name": "Sidekiq",
83
- "Support Policy": "45-days",
84
- "Beta version": "No",
85
- "Cloud Native": "Yes"
86
- },
87
- {
88
- "Package name": "GraphQL",
89
- "Support Policy": "45-days",
90
- "Beta version": "No",
91
- "Cloud Native": "Yes"
92
- },
93
- {
94
- "Package name": "Sequel",
95
- "Support Policy": "45-days",
96
- "Beta version": "No",
97
- "Cloud Native": "Yes"
98
- }
99
- ]
100
- }
@@ -1,136 +0,0 @@
1
- # Standard Libraries
2
- import glob
3
- import re
4
- from json import load
5
-
6
- # Third Party
7
- from requests import get
8
- from pandas import DataFrame
9
- from bs4 import BeautifulSoup
10
-
11
- JSON_FILE = "resources/table.json"
12
- REPORT_FILE = "docs/report.md"
13
- API_V1_ENDPOINT = "https://rubygems.org/api/v1/versions/"
14
-
15
- def get_bundle_install_output():
16
-
17
- libraries_from_logs = {
18
- "cuba": "cuba_40_ruby_3.3.",
19
- "excon": "excon_100_ruby_3.3.",
20
- "graphql": "graphql_20_ruby_3.3.",
21
- "grpc": "grpc_10_ruby_3.3.",
22
- "rack": "rack_30_ruby_3.3.",
23
- "rest-client": "rest_client_20_ruby_3.3.",
24
- "roda": "roda_30_ruby_3.3.",
25
- "sinatra": "sinatra_40_ruby_3.3.",
26
- "net-http": "net_http_01_ruby_3.1.",
27
- "rails": "rails_71_sqlite3_ruby_3.3.",
28
- "dalli": "dalli_32_ruby_3.3.",
29
- "resque": "resque_20_ruby_3.3.",
30
- "sidekiq": "sidekiq_70_ruby_3.3.",
31
- "sequel": "sequel_58_ruby_3.3."
32
- }
33
-
34
- bundle_install_output = ""
35
-
36
- for library, pattern in libraries_from_logs.items():
37
- glob_result = glob.glob(f"../../dep_{pattern}*")
38
- if not glob_result:
39
- print(f"Could not find bundle install log for gem '{library}'.")
40
- continue
41
-
42
- with open(glob_result[0], 'r') as file:
43
- logs = file.read().replace('\n', ' ')
44
-
45
- if "Installing" not in logs:
46
- print( f"Unable to retrieve logs from for gem '{library}'.")
47
- continue
48
-
49
- print(f"Retrieving currency for gem '{library}'.")
50
- match = re.search(f"Installing ({library} [^\s]+)", logs)
51
- bundle_install_output += f"{match[1]}\n"
52
-
53
- return bundle_install_output
54
-
55
-
56
- def get_upstream_version(dependency):
57
- """get the latest version available upstream"""
58
- if dependency != "rails lts":
59
- response = get(f"{API_V1_ENDPOINT}/{dependency}/latest.json")
60
- response_json = response.json()
61
- latest_version = response_json["version"]
62
- else:
63
- url = "https://makandracards.com/railslts/16137-installing-rails-lts/read"
64
- page = get(url)
65
- soup = BeautifulSoup(page.text, "html.parser")
66
- text = soup.findAll("li")[-1].text
67
- pattern = "(\d+\.\d+\.?\d*)"
68
- latest_version = re.search(pattern, text)[1]
69
- return latest_version
70
-
71
-
72
- def get_last_supported_version(bundle_install_output, dependency):
73
- """get up-to-date supported version"""
74
- pattern = r" ([^\s]+)"
75
-
76
- last_supported_version = re.search(dependency + pattern, bundle_install_output, flags=re.I | re.M)
77
-
78
- return last_supported_version[1]
79
-
80
-
81
- def isUptodate(last_supported_version, latest_version):
82
- if last_supported_version == latest_version:
83
- up_to_date = "Yes"
84
- else:
85
- up_to_date = "No"
86
-
87
- return up_to_date
88
-
89
- def main():
90
- # Read the JSON file
91
- with open(JSON_FILE) as file:
92
- data = load(file)
93
-
94
- bundle_install_output = get_bundle_install_output()
95
-
96
- items = data["table"]
97
-
98
- for item in items:
99
- package = item["Package name"]
100
- package = package.lower().replace("::", "-")
101
-
102
- latest_version = get_upstream_version(package)
103
-
104
- if not package in ["rails lts", "rails-api"]:
105
- last_supported_version = get_last_supported_version(bundle_install_output, package)
106
- else:
107
- last_supported_version = latest_version
108
-
109
- up_to_date = isUptodate(last_supported_version, latest_version)
110
-
111
- item.update(
112
- {
113
- "Last Supported Version": last_supported_version,
114
- "Latest version": latest_version,
115
- "Up-to-date": up_to_date,
116
- },
117
- )
118
-
119
- # Create a DataFrame from the list of dictionaries
120
- df = DataFrame(items)
121
- df.insert(len(df.columns) - 1, "Cloud Native", df.pop("Cloud Native"))
122
-
123
- # Convert dataframe to markdown
124
- markdown_table = df.to_markdown(index=False)
125
-
126
- disclaimer = "##### This page is auto-generated. Any change will be overwritten after the next sync. Please apply changes directly to the files in the [ruby tracer](https://github.com/instana/ruby-sensor) repo."
127
- title = "## Ruby supported packages and versions"
128
-
129
- # Combine disclaimer, title, and markdown table with line breaks
130
- final_markdown = disclaimer + "\n" + title + "\n" + markdown_table
131
-
132
- with open(REPORT_FILE, "w") as file:
133
- file.write(final_markdown)
134
-
135
- if __name__ == "__main__":
136
- main()
data/.tekton/README.md DELETED
@@ -1,278 +0,0 @@
1
- # Tekton CI for Instana Ruby Tracer
2
-
3
- ## Basic Tekton setup
4
-
5
- ### Get a cluster
6
-
7
- What you will need:
8
- * Full administrator access
9
- * Enough RAM and CPU on a cluster node to run all the pods of a single Pipelinerun on a single node.
10
- Multiple nodes increase the number of parallel `PipelineRun` instances.
11
- Currently one `PipelineRun` instance is capable of saturating a 8vCPU - 16GB RAM worker node.
12
-
13
- ### Setup Tekton on your cluster
14
-
15
- 1. Install latest stable Tekton Pipeline release
16
- ```bash
17
- kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
18
- ```
19
-
20
- 2. Install Tekton Dashboard Full (the normal is read only, and doesn't allow for example to re-run).
21
-
22
- ````bash
23
- kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/release-full.yaml
24
- ````
25
-
26
- 3. Access the dashboard
27
-
28
- ```bash
29
- kubectl proxy
30
- ```
31
-
32
- Once the proxy is active, navigate your browser to the [dashboard url](
33
- http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/)
34
-
35
- ### Setup the ruby-tracer-ci-pipeline
36
-
37
- ````bash
38
- kubectl apply --filename task.yaml && kubectl apply --filename pipeline.yaml
39
- ````
40
-
41
- ### Run the pipeline manually
42
-
43
- #### From the Dashboard
44
- Navigate your browser to the [pipelineruns section of the dashboard](
45
- http://localhost:8001/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/#/pipelineruns)
46
-
47
- 1. Click `Create`
48
- 2. Select the `Namespace` (where the `Pipeline` resource is created by default it is `default`)
49
- 3. Select the `Pipeline` created in the `pipeline.yaml` right now it is `ruby-tracer-ci-pipeline`
50
- 4. Fill in `Params`. The `revision` should be `master` for the `master` branch
51
- 4. Select the `ServiceAccount` set to `default`
52
- 5. Optionally, enter a `PipelineRun name` for example `my-master-test-pipeline`,
53
- but if you don't then the Dashboard will generate a unique one for you.
54
- 6. As long as [the known issue with Tekton Dashboard Workspace binding](
55
- https://github.com/tektoncd/dashboard/issues/1283), is not resolved.
56
- You have to go to `YAML Mode` and insert the workspace definition at the end of the file,
57
- with the exact same indentation:
58
-
59
- ````yaml
60
- workspaces:
61
- - name: ruby-tracer-ci-pipeline-pvc-$(params.revision)
62
- volumeClaimTemplate:
63
- spec:
64
- accessModes:
65
- - ReadWriteOnce
66
- resources:
67
- requests:
68
- storage: 200Mi
69
-
70
- ````
71
- 7. Click `Create` at the bottom of the page
72
-
73
-
74
- #### From kubectl CLI
75
- As an alternative to using the Dashboard, you can manually edit `pipelinerun.yaml` and create it with:
76
- ````bash
77
- kubectl apply --filename pipelinerun.yaml
78
- ````
79
-
80
- ### Clanup PipelineRun and associated PV resources
81
-
82
- `PipelineRuns` and workspace `PersistentVolume` resources by default are kept indefinitely,
83
- and repeated runs might exhaust the available resources, therefore they need to be cleaned up either
84
- automatically or manually.
85
-
86
- #### Manully from the Dashboard
87
-
88
- Navigate to `PipelineRuns` and check the checkbox next to the pipelinerun
89
- and then click `Delete` in the upper right corner.
90
-
91
- #### Manually from the CLI
92
-
93
- You can use either `kubectl`
94
- ````bash
95
- kubectl get pipelinerun
96
- kubectl delete pipelinerun <selected-pipelinerun-here>
97
- ````
98
-
99
- or `tkn` cli
100
- ````bash
101
- tkn pipelinerun list
102
- tkn pipelinerun delete <selected-pipelinerun-here>
103
- ````
104
-
105
- #### Automatic cleanup with a cronjob
106
-
107
- Install and configure resources from https://github.com/3scale-ops/tekton-pipelinerun-cleaner
108
-
109
-
110
- ## Integrate with GitHub
111
-
112
- ### GitHub PR Trigger & PR Check API integration
113
-
114
- The GitHub integration requires further Tekton Triggers and Interceptors to be installed
115
- ````bash
116
- kubectl apply --filename \
117
- https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml
118
- kubectl apply --filename \
119
- https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml
120
- ````
121
- #### Create a ServiceAccount
122
-
123
- Our future GitHub PR Event listener needs a service account,
124
- `tekton-triggers-eventlistener-serviceaccount` which authorizes it to
125
- perform operations specified in eventlistener `Role` and `ClusteRole`.
126
- Create the service account with the needed role bindings:
127
-
128
- ````bash
129
- kubectl apply --filename tekton-triggers-eventlistener-serviceaccount.yaml
130
- ````
131
-
132
- #### Create the Secret for the GitHub repository webhook
133
-
134
- In order to authorize the incoming webhooks into our cluster, we need to share
135
- a secret between our webhook listener, and the GitHub repo.
136
- Generate a long, strong and random generated token, put it into `github-interceptor-secret.yaml`.
137
- Create the secret resource:
138
- ````bash
139
- kubectl apply --filename github-interceptor-secret.yaml
140
- ````
141
-
142
- #### Create the Task and token to report PR Check status to GitHub
143
-
144
- The GitHub PR specific Tekton pipeline will want to send data to report the `PR Check Status`.
145
- That [GitHub API](https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status
146
- ) requires authentication, and therefore we need a token.
147
- The user which generates the token has to have `Write` access in the target repo,
148
- as part of the organisation. Check the repo access for this repo under
149
- https://github.com/instana/ruby-sensor/settings/access.
150
-
151
- With the proper user:
152
- 1. Navigate to https://github.com/settings/tokens
153
- 2. Click on `Generate new token` dropdown `Generate new token (classic)`.
154
- 3. Fill in `Note` with for example `Tekton commit status`,
155
- 4. Make sure if you set an expiration, than you remember to renew the token after expiry.
156
- 5. Under `Select scopes` find `repo` and below that only select the checkbox next to `repo:status` - `Access commit status`.
157
- click `Generate token`
158
- 6. Create the kubernetes secret with the token:
159
-
160
- ````bash
161
- kubectl create secret generic githubtoken --from-literal token="MY_TOKEN"
162
- ````
163
-
164
- And we also make an HTTP POST with the status update data to GitHub.
165
- This is done in a `Task` called `github-set-status`, create it as such:
166
- ````bash
167
- kubectl apply -f github-set-status-task.yaml
168
- ````
169
-
170
- #### Create the GitHub PR pipeline
171
-
172
- Create the new pipeline, which executes the previously created `ruby-tracer-ci-pipeline`,
173
- removes the currency report tasks and wraps the unittest jobs with GitHub Check status reporting tasks.
174
- As long as [Pipelines in Pipelines](
175
- https://tekton.dev/docs/pipelines/pipelines-in-pipelines/), remains an
176
- unimplemented `alpha` feature in Tekton,
177
- we will need the [yq](https://github.com/mikefarah/yq) (at least `4.0`)
178
- to pull the tasks from our previous `ruby-tracer-ci-pipeline` into the
179
- new pipeline `github-pr-ruby-tracer-ci-pipeline`.
180
-
181
- ````bash
182
- (cat github-pr-pipeline.yaml.part && yq '{"a": {"b": .spec.tasks}}' pipeline.yaml| tail --lines=+3| head --lines=-16) | kubectl apply -f -
183
- ````
184
-
185
- #### Create the GitHub PR Event Listener, TriggerTemplate and TriggerBinding
186
-
187
- Once the new GitHub specific pipeline is created, we need a listener which starts
188
- a new `PipelineRun` based on GitHub events.
189
- For security reasons the listener will only trigger if the PR owner is a
190
- repo owner. PRs from non-repo owners can be allowed in by owners after an initial review
191
- with a comment on the pull request that contains `/ok-to-test`.
192
- More abou this feature in the [tekton triggers documentsion](
193
- https://github.com/tektoncd/triggers/blob/main/docs/interceptors.md#owners-validation-for-pull-requests).
194
-
195
- ````bash
196
- kubectl apply --filename github-pr-eventlistener.yaml
197
- ````
198
-
199
- After this ensure that there is a pod and a service created:
200
-
201
- ````bash
202
- kubectl get pod | grep -i el-github-pr-ruby-eventlistener
203
- kubectl get svc | grep -i el-github-pr-ruby-eventlistener
204
- ````
205
-
206
- Do not continue if any of these missing.
207
-
208
- #### Create the Ingress for the GitHub Webhook to come through
209
-
210
- You will need an ingress controller for this.
211
- On IKS you might want to read these resources:
212
- * [managed ingress](https://cloud.ibm.com/docs/containers?topic=containers-managed-ingress-about)
213
- * Or unmanaged [ingress controller howto](
214
- https://github.com/IBM-Cloud/iks-ingress-controller/blob/master/docs/installation.md
215
- ).
216
-
217
- 1. Check the available `ingressclass` resources on your cluster
218
-
219
- ````bash
220
- kubectl get ingressclass
221
- ````
222
-
223
- * On `IKS` it will be `public-iks-k8s-nginx`.
224
- * On `EKS` with the `ALB` ingress controller, it might be just `alb`
225
- * On self hosted [nginx controller](https://kubernetes.github.io/ingress-nginx/deploy/)
226
- this might just be `nginx`.
227
-
228
- Edit and save the value of `ingressClassName:` in `github-webhook-ingress.yaml`.
229
-
230
- 2. Find out your Ingress domain or subdomain name.
231
-
232
- * On `IKS`, go to `Clusters` select your cluster and then click `Overview`.
233
- The domain name is listed under `Ingress subdomain`.
234
-
235
- and create the resource:
236
-
237
- ````bash
238
- kubectl apply --filename github-webhook-ingress.yaml
239
- ````
240
-
241
- Make sure that you can use the ingress with the `/hooks` path via `https`:
242
- ````bash
243
- curl https://<INGRESS_DOMAIN_NAME>/hooks
244
- ````
245
-
246
- At this point this should respond this:
247
- ```json
248
- {
249
- "eventListener":"github-pr-eventlistener",
250
- "namespace":"default",
251
- "eventListenerUID":"",
252
- "errorMessage":"Invalid event body format : unexpected end of JSON input"
253
- }
254
- ```
255
-
256
- #### Setup the webhook on GitHub
257
-
258
- In the GitHub repo go to `Settings` -> `Webhooks` and click `Add Webhook`.
259
- The fields we need to set are:
260
- * `Payload URL`: `https://<INGRESS_DOMAIN_NAME>/hooks`
261
- * `Content type`: application/json
262
- * `Secret`: XXXXXXX (the secret token from github-interceptor-secret.yaml)
263
-
264
- Under `SSL verification` select the radio button for `Enable SSL verification`.
265
- Under `Which events would you like to trigger this webhook?` select
266
- the radio button for `Let me select individual events.` and thick the checkbox next to
267
- `Pull requests` and ensure that the rest are unthicked.
268
-
269
- Click `Add webhook`.
270
-
271
- If the webhook has been set up correctly, then GitHub sends a ping message.
272
- Ensure that the ping is received from GitHub, and that it is filtered out so
273
- a simple ping event does not trigger any `PipelineRun` unnecessarily.
274
-
275
- ````bash
276
- eventlistener_pod=$(kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep el-github-pr-ruby)
277
- kubectl logs "${eventlistener_pod}" | grep 'event type ping is not allowed'
278
- ````
@@ -1,8 +0,0 @@
1
- apiVersion: v1
2
- kind: Secret
3
- metadata:
4
- name: github-interceptor-secret
5
- type: Opaque
6
- stringData:
7
- # Always use a long, strong and random generated token
8
- secretToken: "<--- TOKEN GOES HERE --->"
@@ -1,104 +0,0 @@
1
- apiVersion: triggers.tekton.dev/v1beta1
2
- kind: TriggerTemplate
3
- metadata:
4
- name: github-pr-ruby-tracer-pipeline-template
5
- spec:
6
- params:
7
- - description: The git branch name
8
- name: git-branch
9
- - description: The git branch name shortened and converted to RFC 1123 subdomain names
10
- name: git-branch-normalized
11
- - description: The full sha of the git commit
12
- name: git-commit-sha
13
- - description: The short 7 digit sha of the git commit
14
- name: git-commit-short-sha
15
- resourcetemplates:
16
- - apiVersion: tekton.dev/v1
17
- kind: PipelineRun
18
- metadata:
19
- # After variable resolution, this has to be maximum 63 character long,
20
- # lower case, RFC 1123 subdomain name. The regex used for validation is
21
- # '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
22
- name: ruby-tracer-pr-$(tt.params.git-branch-normalized)-$(tt.params.git-commit-short-sha)
23
- spec:
24
- timeouts:
25
- pipeline: "2h"
26
- params:
27
- - name: revision
28
- value: $(tt.params.git-branch)
29
- - name: git-commit-sha
30
- value: $(tt.params.git-commit-sha)
31
- pipelineRef:
32
- name: github-pr-ruby-tracer-ci-pipeline
33
- workspaces:
34
- - name: ruby-tracer-ci-pipeline-pvc
35
- volumeClaimTemplate:
36
- spec:
37
- accessModes:
38
- - ReadWriteOnce
39
- resources:
40
- requests:
41
- storage: 200Mi
42
- ---
43
- apiVersion: triggers.tekton.dev/v1beta1
44
- kind: TriggerBinding
45
- metadata:
46
- name: github-pr-ruby-tracer-binding
47
- spec:
48
- params:
49
- - name: git-branch
50
- value: $(body.pull_request.head.ref)
51
- - name: git-branch-normalized
52
- value: $(extensions.git_branch_normalized)
53
- - name: git-commit-sha
54
- value: $(body.pull_request.head.sha)
55
- - name: git-commit-short-sha
56
- value: $(extensions.truncated_sha)
57
- ---
58
- apiVersion: triggers.tekton.dev/v1beta1
59
- kind: EventListener
60
- metadata:
61
- name: github-pr-ruby-eventlistener
62
- spec:
63
- serviceAccountName: tekton-triggers-eventlistener-serviceaccount
64
- triggers:
65
- - name: github-pr-trigger
66
- interceptors:
67
- - name: receive-github-event
68
- ref:
69
- name: "github"
70
- params:
71
- - name: "secretRef"
72
- value:
73
- secretName: github-interceptor-secret
74
- secretKey: secretToken
75
- - name: "eventTypes"
76
- value: ["pull_request"]
77
- - name: filter-irrelevant-events
78
- ref:
79
- name: "cel"
80
- params:
81
- - name: "filter"
82
- # We should not trigger on 'closed', 'assigned', 'unassigned', 'converted_to_draft'
83
- value: "body.action in ['opened', 'synchronize', 'reopened']"
84
- - name: add-truncated-sha
85
- ref:
86
- name: "cel"
87
- params:
88
- - name: "overlays"
89
- value:
90
- - key: truncated_sha
91
- expression: "body.pull_request.head.sha.truncate(7)"
92
- - name: add-normalized-branch-name
93
- ref:
94
- name: "cel"
95
- params:
96
- - name: "overlays"
97
- value:
98
- - key: git_branch_normalized
99
- # The git branch name shortened and converted to RFC 1123 subdomain names
100
- expression: 'body.pull_request.head.ref.truncate(38).lowerAscii().translate("_", "-")'
101
- bindings:
102
- - ref: github-pr-ruby-tracer-binding
103
- template:
104
- ref: github-pr-ruby-tracer-pipeline-template
@@ -1,38 +0,0 @@
1
- apiVersion: tekton.dev/v1
2
- kind: Pipeline
3
- metadata:
4
- name: github-pr-ruby-tracer-ci-pipeline
5
- spec:
6
- params:
7
- - name: revision
8
- type: string
9
- - name: git-commit-sha
10
- type: string
11
- workspaces:
12
- - name: ruby-tracer-ci-pipeline-pvc
13
- tasks:
14
- - name: github-set-check-status-to-pending
15
- taskRef:
16
- kind: Task
17
- name: github-set-status
18
- params:
19
- - name: SHA
20
- value: $(params.git-commit-sha)
21
- - name: STATE
22
- value: pending
23
- - name: REPO
24
- value: instana/ruby-sensor
25
- - name: github-set-check-status-to-success-or-failure
26
- runAfter:
27
- - github-set-check-status-to-pending
28
- - unittest-rails-postgres
29
- taskRef:
30
- kind: Task
31
- name: github-set-status
32
- params:
33
- - name: SHA
34
- value: $(params.git-commit-sha)
35
- - name: STATE
36
- value: success
37
- - name: REPO
38
- value: instana/ruby-sensor