elastic-apm 3.6.0 → 3.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/Jenkinsfile +183 -100
  3. data/.ci/jobs/defaults.yml +1 -1
  4. data/.ci/packer_cache.sh +12 -10
  5. data/.rspec +0 -1
  6. data/.rubocop.yml +3 -0
  7. data/CHANGELOG.asciidoc +84 -0
  8. data/Gemfile +22 -1
  9. data/Rakefile +28 -1
  10. data/bin/run-tests +4 -1
  11. data/docker-compose.yml +2 -0
  12. data/docs/configuration.asciidoc +117 -16
  13. data/docs/debugging.asciidoc +14 -0
  14. data/docs/getting-started-rails.asciidoc +2 -0
  15. data/docs/images/dynamic-config.svg +1 -0
  16. data/docs/index.asciidoc +2 -1
  17. data/docs/introduction.asciidoc +2 -1
  18. data/docs/performance-tuning.asciidoc +106 -0
  19. data/docs/set-up.asciidoc +5 -2
  20. data/docs/supported-technologies.asciidoc +18 -1
  21. data/elastic-apm.gemspec +17 -0
  22. data/lib/elastic-apm.rb +17 -0
  23. data/lib/elastic_apm.rb +18 -1
  24. data/lib/elastic_apm/agent.rb +48 -2
  25. data/lib/elastic_apm/central_config.rb +27 -8
  26. data/lib/elastic_apm/central_config/cache_control.rb +17 -0
  27. data/lib/elastic_apm/child_durations.rb +17 -0
  28. data/lib/elastic_apm/config.rb +52 -2
  29. data/lib/elastic_apm/config/bytes.rb +17 -0
  30. data/lib/elastic_apm/config/duration.rb +17 -0
  31. data/lib/elastic_apm/config/options.rb +18 -1
  32. data/lib/elastic_apm/config/regexp_list.rb +17 -0
  33. data/lib/elastic_apm/config/wildcard_pattern_list.rb +28 -1
  34. data/lib/elastic_apm/context.rb +17 -0
  35. data/lib/elastic_apm/context/request.rb +17 -0
  36. data/lib/elastic_apm/context/request/socket.rb +17 -0
  37. data/lib/elastic_apm/context/request/url.rb +17 -0
  38. data/lib/elastic_apm/context/response.rb +17 -0
  39. data/lib/elastic_apm/context/user.rb +17 -0
  40. data/lib/elastic_apm/context_builder.rb +18 -1
  41. data/lib/elastic_apm/deprecations.rb +17 -0
  42. data/lib/elastic_apm/error.rb +17 -0
  43. data/lib/elastic_apm/error/exception.rb +17 -0
  44. data/lib/elastic_apm/error/log.rb +17 -0
  45. data/lib/elastic_apm/error_builder.rb +17 -0
  46. data/lib/elastic_apm/grape.rb +17 -0
  47. data/lib/elastic_apm/graphql.rb +17 -0
  48. data/lib/elastic_apm/grpc.rb +19 -2
  49. data/lib/elastic_apm/instrumenter.rb +29 -4
  50. data/lib/elastic_apm/internal_error.rb +17 -0
  51. data/lib/elastic_apm/logging.rb +17 -0
  52. data/lib/elastic_apm/metadata.rb +17 -0
  53. data/lib/elastic_apm/metadata/process_info.rb +17 -0
  54. data/lib/elastic_apm/metadata/service_info.rb +22 -2
  55. data/lib/elastic_apm/metadata/system_info.rb +22 -3
  56. data/lib/elastic_apm/metadata/system_info/container_info.rb +45 -4
  57. data/lib/elastic_apm/metrics.rb +33 -1
  58. data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
  59. data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
  60. data/lib/elastic_apm/metrics/metric.rb +17 -0
  61. data/lib/elastic_apm/metrics/set.rb +17 -0
  62. data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
  63. data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
  64. data/lib/elastic_apm/metrics/vm_set.rb +17 -0
  65. data/lib/elastic_apm/metricset.rb +17 -0
  66. data/lib/elastic_apm/middleware.rb +25 -2
  67. data/lib/elastic_apm/naively_hashable.rb +17 -0
  68. data/lib/elastic_apm/normalizers.rb +17 -0
  69. data/lib/elastic_apm/normalizers/grape.rb +17 -0
  70. data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
  71. data/lib/elastic_apm/normalizers/rails.rb +17 -0
  72. data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
  73. data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
  74. data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
  75. data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
  76. data/lib/elastic_apm/opentracing.rb +64 -23
  77. data/lib/elastic_apm/rails.rb +17 -0
  78. data/lib/elastic_apm/railtie.rb +17 -0
  79. data/lib/elastic_apm/resque.rb +17 -0
  80. data/lib/elastic_apm/sinatra.rb +17 -0
  81. data/lib/elastic_apm/span.rb +20 -2
  82. data/lib/elastic_apm/span/context.rb +17 -0
  83. data/lib/elastic_apm/span/context/db.rb +17 -0
  84. data/lib/elastic_apm/span/context/destination.rb +17 -0
  85. data/lib/elastic_apm/span/context/http.rb +17 -0
  86. data/lib/elastic_apm/span_helpers.rb +17 -0
  87. data/lib/elastic_apm/spies.rb +33 -14
  88. data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
  89. data/lib/elastic_apm/spies/delayed_job.rb +17 -0
  90. data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
  91. data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
  92. data/lib/elastic_apm/spies/faraday.rb +17 -0
  93. data/lib/elastic_apm/spies/http.rb +17 -0
  94. data/lib/elastic_apm/spies/json.rb +17 -0
  95. data/lib/elastic_apm/spies/mongo.rb +18 -1
  96. data/lib/elastic_apm/spies/net_http.rb +23 -2
  97. data/lib/elastic_apm/spies/rake.rb +17 -0
  98. data/lib/elastic_apm/spies/redis.rb +17 -0
  99. data/lib/elastic_apm/spies/resque.rb +19 -9
  100. data/lib/elastic_apm/spies/sequel.rb +18 -1
  101. data/lib/elastic_apm/spies/shoryuken.rb +17 -0
  102. data/lib/elastic_apm/spies/sidekiq.rb +17 -0
  103. data/lib/elastic_apm/spies/sinatra.rb +17 -0
  104. data/lib/elastic_apm/spies/sneakers.rb +17 -0
  105. data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
  106. data/lib/elastic_apm/spies/tilt.rb +17 -0
  107. data/lib/elastic_apm/sql.rb +17 -0
  108. data/lib/elastic_apm/sql/signature.rb +17 -0
  109. data/lib/elastic_apm/sql/tokenizer.rb +17 -0
  110. data/lib/elastic_apm/sql/tokens.rb +17 -0
  111. data/lib/elastic_apm/sql_summarizer.rb +17 -0
  112. data/lib/elastic_apm/stacktrace.rb +17 -0
  113. data/lib/elastic_apm/stacktrace/frame.rb +17 -0
  114. data/lib/elastic_apm/stacktrace_builder.rb +17 -0
  115. data/lib/elastic_apm/subscriber.rb +17 -0
  116. data/lib/elastic_apm/trace_context.rb +17 -0
  117. data/lib/elastic_apm/trace_context/traceparent.rb +17 -0
  118. data/lib/elastic_apm/trace_context/tracestate.rb +17 -0
  119. data/lib/elastic_apm/transaction.rb +33 -5
  120. data/lib/elastic_apm/transport/base.rb +39 -23
  121. data/lib/elastic_apm/transport/connection.rb +17 -0
  122. data/lib/elastic_apm/transport/connection/http.rb +17 -0
  123. data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
  124. data/lib/elastic_apm/transport/filters.rb +17 -0
  125. data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
  126. data/lib/elastic_apm/transport/filters/secrets_filter.rb +30 -56
  127. data/lib/elastic_apm/transport/headers.rb +17 -0
  128. data/lib/elastic_apm/transport/serializers.rb +17 -0
  129. data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
  130. data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
  131. data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
  132. data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
  133. data/lib/elastic_apm/transport/serializers/span_serializer.rb +17 -0
  134. data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
  135. data/lib/elastic_apm/transport/user_agent.rb +17 -0
  136. data/lib/elastic_apm/transport/worker.rb +21 -0
  137. data/lib/elastic_apm/util.rb +17 -0
  138. data/lib/elastic_apm/util/inflector.rb +17 -0
  139. data/lib/elastic_apm/util/lru_cache.rb +17 -0
  140. data/lib/elastic_apm/util/throttle.rb +17 -0
  141. data/lib/elastic_apm/version.rb +18 -1
  142. metadata +12 -11
  143. data/.ci/downstreamTests.groovy +0 -185
  144. data/.ci/prepare-git-context.sh +0 -27
  145. data/codecov.yml +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e226ecd39fc71213084dffaefbd4343c1d5f5d78a4d8fc91786dca9f5e865533
4
- data.tar.gz: a0289b4872d55be4132b6982da072844ce71b2a6723877626584c1f5e8d7315f
3
+ metadata.gz: a6db74de4a0201f5b5dd7e9f96b7ec383ce3276a56d7f9d57e64617dd7cf1a28
4
+ data.tar.gz: '0319a664e07b2411428134e24ed58f21049acf856cf163c6434fb66934e4cd1f'
5
5
  SHA512:
6
- metadata.gz: 641923b3afdf3c3fe258053a2f2492092aa1af5a35a50c3783b6e7d0d00e6198f8454c95fb4f2eca0a1ea83f59afd552c600ffaed34efa0aeecf44d40b9948cd
7
- data.tar.gz: 427eee529da777c98d4c4c02eb79f5aba46200e92edcac1f31b5bbd38df55f78801d92de063c37a54ffecf2fe3777697495c745f8334d3fdae4509626b1e1350
6
+ metadata.gz: 7bc1dfb374ea6107f07f690d764205f44c00a588eed767d7621b42640bf00f322d5e8b7c6a3d4958b0753b4755722836a05577fcee5b1a15207a355860a1f71b
7
+ data.tar.gz: 780227ecdd4592d5f3aaa87b54824b4ed36dc9686052b51314815ebbf3152855dc5ff186c69deb88b86f2eab1d7aa9e4170bfd1454b2fdca3ab82d513eb0280a
@@ -5,21 +5,17 @@ import co.elastic.matrix.*
5
5
  import groovy.transform.Field
6
6
 
7
7
  /**
8
- This is required to know if there any failures when running the downstream jobs.
8
+ This is the parallel tasks generator,
9
+ it is need as field to store the results of the tests.
9
10
  */
10
- @Field def rubyTasksFailed = false
11
-
12
- /**
13
- This is required to store the build status for the downstream jobs.
14
- */
15
- @Field def rubyDownstreamJobs = [:]
11
+ @Field def rubyTasksGen
16
12
 
17
13
  pipeline {
18
14
  agent { label 'linux && immutable' }
19
15
  environment {
20
16
  REPO = 'apm-agent-ruby'
21
17
  BASE_DIR = "src/github.com/elastic/${env.REPO}"
22
- PIPELINE_LOG_LEVEL='DEBUG'
18
+ PIPELINE_LOG_LEVEL = 'INFO'
23
19
  NOTIFY_TO = credentials('notify-to')
24
20
  JOB_GCS_BUCKET = credentials('gcs-bucket')
25
21
  CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
@@ -42,7 +38,7 @@ pipeline {
42
38
  quietPeriod(10)
43
39
  }
44
40
  triggers {
45
- issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*')
41
+ issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?(?:benchmark\\W+)?tests(?:\\W+please)?.*')
46
42
  }
47
43
  parameters {
48
44
  booleanParam(name: 'Run_As_Master_Branch', defaultValue: false, description: 'Allow to run any steps on a PR, some steps normally only run on master branch.')
@@ -59,14 +55,23 @@ pipeline {
59
55
  deleteDir()
60
56
  gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true, reference: "${env.REFERENCE_REPO}")
61
57
  stash allowEmpty: true, name: 'source', useDefaultExcludes: false
58
+ script {
59
+ dir("${BASE_DIR}"){
60
+ // Skip all the stages except docs for PR's with asciidoc and md changes only
61
+ env.ONLY_DOCS = isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true)
62
+ }
63
+ }
62
64
  }
63
65
  }
64
66
  stage('Sanity checks') {
65
67
  when {
66
68
  beforeAgent true
67
- anyOf {
68
- not { changeRequest() }
69
- expression { return params.Run_As_Master_Branch }
69
+ allOf {
70
+ expression { return env.ONLY_DOCS == "false" }
71
+ anyOf {
72
+ not { changeRequest() }
73
+ expression { return params.Run_As_Master_Branch }
74
+ }
70
75
  }
71
76
  }
72
77
  options { skipDefaultCheckout() }
@@ -89,43 +94,53 @@ pipeline {
89
94
  /**
90
95
  Execute unit tests.
91
96
  */
92
- stage('Test') {
93
- options { skipDefaultCheckout() }
94
- steps {
95
- withGithubNotify(context: 'Tests', tab: 'tests') {
96
- deleteDir()
97
- unstash "source"
98
- dir("${BASE_DIR}"){
99
- script {
100
- def ruby = readYaml(file: '.ci/.jenkins_ruby.yml')
101
- def testTasks = [:]
102
- def i = 0
103
- ruby['RUBY_VERSION'].each{ rubyVersion ->
104
- testTasks[rubyVersion] = { runJob(rubyVersion, i++) }
105
- }
106
- parallel(testTasks)
97
+ stage('Tests') {
98
+ when {
99
+ beforeAgent true
100
+ expression { return env.ONLY_DOCS == "false" }
101
+ }
102
+ failFast false
103
+ parallel {
104
+ stage('Tests') {
105
+ options { skipDefaultCheckout() }
106
+ steps {
107
+ withGithubNotify(context: 'Tests', tab: 'tests') {
108
+ runTests('.ci/.jenkins_framework.yml')
109
+ }
110
+ }
111
+ post {
112
+ always {
113
+ convergeCoverage()
107
114
  }
108
115
  }
109
116
  }
110
- }
111
- }
112
- stage('Integration Tests') {
113
- agent none
114
- when {
115
- beforeAgent true
116
- anyOf {
117
- changeRequest()
118
- expression { return !params.Run_As_Master_Branch }
117
+ stage('Master Tests frameworks') {
118
+ options { skipDefaultCheckout() }
119
+ steps {
120
+ catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE', message: "The tests for the master framework have failed. Let's warn instead.") {
121
+ runTests('.ci/.jenkins_master_framework.yml')
122
+ }
123
+ }
124
+ }
125
+ stage('Integration Tests') {
126
+ agent none
127
+ when {
128
+ beforeAgent true
129
+ anyOf {
130
+ changeRequest()
131
+ expression { return !params.Run_As_Master_Branch }
132
+ }
133
+ }
134
+ steps {
135
+ githubNotify(context: "${env.GITHUB_CHECK_ITS_NAME}", description: "${env.GITHUB_CHECK_ITS_NAME} ...", status: 'PENDING', targetUrl: "${env.JENKINS_URL}search/?q=${env.ITS_PIPELINE.replaceAll('/','+')}")
136
+ build(job: env.ITS_PIPELINE, propagate: false, wait: true,
137
+ parameters: [ string(name: 'INTEGRATION_TEST', value: 'Ruby'),
138
+ string(name: 'BUILD_OPTS', value: "--ruby-agent-version ${env.GIT_BASE_COMMIT} --ruby-agent-version-state ${env.GIT_BUILD_CAUSE} --ruby-agent-repo ${env.CHANGE_FORK?.trim() ?: 'elastic'}/${env.REPO} --opbeans-ruby-agent-branch ${env.GIT_BASE_COMMIT}"),
139
+ string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
140
+ string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
141
+ string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT) ])
142
+ }
119
143
  }
120
- }
121
- steps {
122
- build(job: env.ITS_PIPELINE, propagate: false, wait: false,
123
- parameters: [string(name: 'INTEGRATION_TEST', value: 'Ruby'),
124
- string(name: 'BUILD_OPTS', value: "--ruby-agent-version ${env.GIT_BASE_COMMIT} --ruby-agent-version-state ${env.GIT_BUILD_CAUSE} --ruby-agent-repo ${env.CHANGE_FORK?.trim() ?: 'elastic'}/${env.REPO} --opbeans-ruby-agent-branch ${env.GIT_BASE_COMMIT}"),
125
- string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
126
- string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
127
- string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT)])
128
- githubNotify(context: "${env.GITHUB_CHECK_ITS_NAME}", description: "${env.GITHUB_CHECK_ITS_NAME} ...", status: 'PENDING', targetUrl: "${env.JENKINS_URL}search/?q=${env.ITS_PIPELINE.replaceAll('/','+')}")
129
144
  }
130
145
  }
131
146
  stage('Benchmarks') {
@@ -137,8 +152,9 @@ pipeline {
137
152
  branch 'master'
138
153
  branch "\\d+\\.\\d+"
139
154
  branch "v\\d?"
140
- tag "v\\d+\\.\\d+\\.\\d+*"
155
+ tag pattern: 'v\\d+.*', comparator: "REGEXP"
141
156
  expression { return params.Run_As_Master_Branch }
157
+ expression { return env.GITHUB_COMMENT?.contains('benchmark tests') }
142
158
  }
143
159
  expression { return params.bench_ci }
144
160
  }
@@ -179,20 +195,6 @@ pipeline {
179
195
  }
180
196
  }
181
197
  }
182
- stage('Populate Downstream failures') {
183
- when {
184
- expression { return rubyTasksFailed }
185
- }
186
- steps {
187
- script {
188
- def message = 'Failures when running the "Test" stage'
189
- if (notifyBuildResult.isAnyDownstreamJobFailedWithTimeout(rubyDownstreamJobs)) {
190
- message += ' related to a timeout issue'
191
- }
192
- error(message)
193
- }
194
- }
195
- }
196
198
  stage('Release') {
197
199
  options { skipDefaultCheckout() }
198
200
  environment {
@@ -238,7 +240,10 @@ pipeline {
238
240
  steps {
239
241
  deleteDir()
240
242
  // Let's wait for the Gem to be available
241
- sh "(retry 10 curl --silent --show-error --fail -I https://rubygems.org/gems/elastic-apm/versions/${env.VERSION})"
243
+ sh label: 'Wait for gem', script: """#!/usr/bin/env bash
244
+ source /usr/local/bin/bash_standard_lib.sh
245
+ (retry 10 curl --silent --show-error --fail -I https://rubygems.org/gems/elastic-apm/versions/${env.VERSION})
246
+ """
242
247
  dir("${OPBEANS_REPO}"){
243
248
  git credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba',
244
249
  url: "git@github.com:elastic/${OPBEANS_REPO}.git"
@@ -256,7 +261,7 @@ pipeline {
256
261
  }
257
262
  post {
258
263
  cleanup {
259
- notifyBuildResult(downstreamJobs: rubyDownstreamJobs)
264
+ notifyBuildResult()
260
265
  }
261
266
  }
262
267
  }
@@ -271,26 +276,64 @@ def runBenchmark(version){
271
276
  // - docker.elastic.co/observability-ci/jruby:9.2-12-jdk to jruby-9.2-12-jdk
272
277
  // - jruby:9.1 to jruby-9.1
273
278
  def transformedVersion = version.replaceAll('.*/', '').replaceAll(':', '-')
274
- env.HOME = "${env.WORKSPACE}/${transformedVersion}"
275
- dir("${transformedVersion}"){
276
- deleteDir()
277
- unstash 'source'
278
- dir("${BASE_DIR}"){
279
- retry(2){
280
- sleep randomNumber(min:10, max: 30)
281
- dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
279
+ withEnv(["HOME=${env.WORKSPACE}/${transformedVersion}"]){
280
+ dir("${transformedVersion}"){
281
+ deleteDir()
282
+ unstash 'source'
283
+ dir("${BASE_DIR}"){
284
+ retry(2){
285
+ sleep randomNumber(min:10, max: 30)
286
+ dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
287
+ }
288
+ try{
289
+ sh """./spec/scripts/benchmarks.sh "${version}" "${REFERENCE_REPO}" """
290
+ } catch(e){
291
+ throw e
292
+ } finally {
293
+ archiveArtifacts(
294
+ allowEmptyArchive: true,
295
+ artifacts: "**/benchmark-${transformedVersion}.raw,**/benchmark-${transformedVersion}.error",
296
+ onlyIfSuccessful: false)
297
+ sendBenchmarks(file: "benchmark-${transformedVersion}.bulk",
298
+ index: "benchmark-ruby", archive: true)
299
+ }
282
300
  }
283
- try{
284
- sh """./spec/scripts/benchmarks.sh "${version}" "${REFERENCE_REPO}" """
285
- } catch(e){
286
- throw e
287
- } finally {
288
- archiveArtifacts(
289
- allowEmptyArchive: true,
290
- artifacts: "**/benchmark-${transformedVersion}.raw,**/benchmark-${transformedVersion}.error",
291
- onlyIfSuccessful: false)
292
- sendBenchmarks(file: "benchmark-${transformedVersion}.bulk",
293
- index: "benchmark-ruby", archive: true)
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
308
+
309
+ public RubyParallelTaskGenerator(Map params){
310
+ super(params)
311
+ }
312
+
313
+ /**
314
+ build a clousure that launch and agent and execute the corresponding test script,
315
+ then store the results.
316
+ */
317
+ public Closure generateStep(x, y){
318
+ return {
319
+ steps.sleep steps.randomNumber(min:10, max: 30)
320
+ steps.node('linux && immutable'){
321
+ // Label is transformed to avoid using the internal docker registry in the x coordinate
322
+ // TODO: def label = "${tag}:${x?.drop(x?.lastIndexOf('/')+1)}#${y}"
323
+ def label = "${tag}:${x}#${y}"
324
+ try {
325
+ steps.runScript(label: label, ruby: x, framework: y)
326
+ saveResult(x, y, 1)
327
+ } catch(e){
328
+ saveResult(x, y, 0)
329
+ steps.error("${label} tests failed : ${e.toString()}\n")
330
+ } finally {
331
+ steps.junit(allowEmptyResults: false,
332
+ keepLongStdio: true,
333
+ testResults: "**/spec/junit-reports/**/ruby-agent-junit.xml")
334
+ steps.dir("${steps.env.BASE_DIR}"){
335
+ steps.archiveArtifacts(artifacts: 'coverage/matrix_results/', defaultExcludes: false)
336
+ steps.stash(name: steps.normalise("coverage-${x}-${y}"), includes: 'coverage/matrix_results/', allowEmpty: true)
294
337
  }
295
338
  }
296
339
  }
@@ -298,24 +341,58 @@ def runBenchmark(version){
298
341
  }
299
342
  }
300
343
 
301
- def runJob(String rubyVersion, int sleep = 1){
302
- def buildObject
303
- try {
304
- def quiet = (sleep * randomNumber(min: 2, max: 6)) + 5
305
- buildObject = build(job: "apm-agent-ruby/apm-agent-ruby-downstream/${env.BRANCH_NAME}",
306
- parameters: [
307
- string(name: 'RUBY_VERSION', value: "${rubyVersion}"),
308
- string(name: 'BRANCH_SPECIFIER', value: "${env.GIT_BASE_COMMIT}")
309
- ],
310
- quietPeriod: quiet)
311
- } catch(e) {
312
- rubyTasksFailed = true
313
- buildObject = e
314
- warnError('Downstream Failed') {
315
- error("Downstream job for '${rubyVersion}' failed")
344
+ /**
345
+ Run all the tests for the given file with the frameworks to test
346
+ */
347
+ def runTests(frameworkFile) {
348
+ deleteDir()
349
+ unstash "source"
350
+ dir("${BASE_DIR}"){
351
+ rubyTasksGen = new RubyParallelTaskGenerator(
352
+ xKey: 'RUBY_VERSION',
353
+ yKey: 'FRAMEWORK',
354
+ xFile: ".ci/.jenkins_ruby.yml",
355
+ yFile: frameworkFile,
356
+ exclusionFile: ".ci/.jenkins_exclude.yml",
357
+ tag: "Ruby",
358
+ name: "Ruby",
359
+ steps: this
360
+ )
361
+ def testTasks = rubyTasksGen.generateParallelTests()
362
+ parallel(testTasks)
363
+ }
364
+ }
365
+
366
+ /**
367
+ Run tests for a Ruby version and framework version.
368
+ */
369
+ def runScript(Map params = [:]){
370
+ def label = params.label
371
+ def ruby = params.ruby
372
+ def framework = params.framework
373
+ log(level: 'INFO', text: "${label}")
374
+ retry(2){
375
+ withEnv(["HOME=${env.WORKSPACE}", "PATH=${env.PATH}:${env.WORKSPACE}/bin"]) {
376
+ deleteDir()
377
+ unstash 'source'
378
+ dir("${BASE_DIR}"){
379
+ sleep randomNumber(min:10, max: 30)
380
+ dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
381
+ sh("./spec/scripts/spec.sh ${ruby} ${framework}")
382
+ }
383
+ }
384
+ }
385
+ }
386
+
387
+ def convergeCoverage() {
388
+ deleteDir()
389
+ unstash('source')
390
+ dir("${BASE_DIR}"){
391
+ rubyTasksGen.dumpMatrix('-')?.each {
392
+ unstash(normalise("coverage-${it}"))
316
393
  }
317
- } finally {
318
- rubyDownstreamJobs["${rubyVersion}"] = buildObject
394
+ sh(script: './spec/scripts/coverage_converge.sh')
395
+ cobertura coberturaReportFile: 'coverage/coverage.xml', onlyStable: false
319
396
  }
320
397
  }
321
398
 
@@ -324,8 +401,7 @@ def prepareRelease(Closure body){
324
401
  docker.image("${env.RUBY_DOCKER_TAG}").inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
325
402
  withEnv(["HOME=${env.WORKSPACE}/${env.BASE_DIR ?: ''}"]) {
326
403
  rubygemsLogin.withApi(secret: "${env.RELEASE_SECRET}") {
327
- sshagent(['f6c7695a-671e-4f4f-a331-acdce44ff9ba']) {
328
- sh '.ci/prepare-git-context.sh'
404
+ withGitRelease(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken') {
329
405
  sh 'gem install rake yard rspec'
330
406
  body()
331
407
  }
@@ -334,3 +410,10 @@ def prepareRelease(Closure body){
334
410
  }
335
411
  }
336
412
  }
413
+
414
+ // Transform the versions like:
415
+ // - docker.elastic.co/observability-ci/jruby:9.2-12-jdk to jruby-9.2-12-jdk
416
+ // - jruby:9.1 to jruby-9.1
417
+ def normalise(def what) {
418
+ return what.replaceAll('.*/', '').replaceAll(':', '-')
419
+ }
@@ -17,7 +17,7 @@
17
17
  days-to-keep: '30'
18
18
  concurrent: true
19
19
  node: linux
20
- periodic-folder-trigger: 1d
20
+ periodic-folder-trigger: 1w
21
21
  prune-dead-branches: true
22
22
  publishers:
23
23
  - email:
@@ -2,13 +2,15 @@
2
2
 
3
3
  source /usr/local/bin/bash_standard_lib.sh
4
4
 
5
- grep "-" .ci/.jenkins_ruby.yml | grep -v 'observability-ci' | cut -d'-' -f2- | \
6
- while read -r version;
7
- do
8
- transformedName=${version/:/-}
9
- transformedVersion=$(echo "${version}" | cut -d":" -f2)
10
- imageName="apm-agent-ruby"
11
- registryImageName="docker.elastic.co/observability-ci/${imageName}:${transformedName}"
12
- (retry 2 docker pull "${registryImageName}")
13
- docker tag "${registryImageName}" "${imageName}:${transformedVersion}"
14
- done
5
+ if [ -x "$(command -v docker)" ]; then
6
+ grep "-" .ci/.jenkins_ruby.yml | grep -v 'observability-ci' | cut -d'-' -f2- | \
7
+ while read -r version;
8
+ do
9
+ transformedName=${version/:/-}
10
+ transformedVersion=$(echo "${version}" | cut -d":" -f2)
11
+ imageName="apm-agent-ruby"
12
+ registryImageName="docker.elastic.co/observability-ci/${imageName}:${transformedName}"
13
+ (retry 2 docker pull "${registryImageName}")
14
+ docker tag "${registryImageName}" "${imageName}:${transformedVersion}"
15
+ done
16
+ fi
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --color
2
- --require spec_helper
3
2
  --exclude-pattern spec/integration/**/*_spec.rb
@@ -107,3 +107,6 @@ Style/HashTransformKeys:
107
107
  Style/HashTransformValues:
108
108
  Enabled: true
109
109
 
110
+ Style/FrozenStringLiteralComment:
111
+ Enabled: false
112
+
@@ -35,6 +35,90 @@ endif::[]
35
35
  [[release-notes-3.x]]
36
36
  === Ruby Agent version 3.x
37
37
 
38
+ [[release-notes-3.10.1]]
39
+ ==== 3.10.1 (2020-08-26)
40
+
41
+ [float]
42
+ ===== Fixed
43
+
44
+ - Remove secrets from cookies in errors {pull}863[#863]
45
+
46
+ [[release-notes-3.10.0]]
47
+ ==== 3.10.0 (2020-08-26)
48
+
49
+ [float]
50
+ ===== Added
51
+
52
+ - Config option `transaction_ignore_urls` to replace `ignore_url_patterns` {pull}844[#844]
53
+ - Prepend `(?-i)` to patterns to make them case-sensitive {pull}846[#846]
54
+
55
+ [float]
56
+ ===== Fixed
57
+
58
+ - Reverted {pull}839[#839]
59
+ - Improved Kubernetes pod ID detection {pull}859[#859]
60
+
61
+ [[release-notes-3.9.0]]
62
+ ==== 3.9.0 (2020-08-04)
63
+
64
+ [float]
65
+ ===== Fixed
66
+ - Scrub request body of illegal UTF-8 characters {pull}832[#832]
67
+
68
+ [float]
69
+ ===== Added
70
+
71
+ - Support for DynamoDB {pull}827[#827]
72
+
73
+ [float]
74
+ ===== Fixed
75
+
76
+ - Fix Rails Engine views' paths being reported as absolute {pull}839[#839]
77
+ - Fix an issue when using Elasticsearch spy without a running agent {pull}830[#830]
78
+
79
+ [[release-notes-3.8.0]]
80
+ ==== 3.8.0 (2020-06-18)
81
+
82
+ [float]
83
+ ===== Added
84
+
85
+ - Add the option `capture_elasticsearch_queries` {pull}789[#789]
86
+ - Add option to skip patching Kernal#require {pull}812[#812]
87
+ - Add option `service_node_name` {pull}820[#820]
88
+
89
+ [float]
90
+ ===== Fixed
91
+
92
+ - Allow underscores in hostnames in Net::HTTP spy {pull}804[#804]
93
+ - Don't change log level on logger object via remote config {pull}809[#809]
94
+ - Update and fix the Opentracing bridge {pull}791[#791]
95
+
96
+ [[release-notes-3.7.0]]
97
+ ==== 3.7.0 (2020-05-14)
98
+
99
+ [float]
100
+ ===== Changed
101
+
102
+ - Make config values dynamic so they can be changed via the remote config {pull}747[#747]
103
+ - Log the updated options from central config in addition to cumulative modifications {pull}758[#758]
104
+
105
+ [float]
106
+ ===== Fixed
107
+
108
+ - Ensure that the log level is updated for the config's logger when value is changed {pull}755[#755]
109
+ - Set config `false` values to `false`, not `nil` {pull}761[#761]
110
+ - Ensure that the previously running agent's config is used in `ElasticAPM.restart` {pull}763[#763]
111
+ - Handle the Resque spy's payload class value being a String or Class and update docs {pull}768[#768]
112
+ - Add finalizer on ProxyPipe::Write so Zlib::GzipWriter is properly closed {pull}787[#787]
113
+
114
+ [float]
115
+ ===== Added
116
+
117
+ - Add enabled config option, replacing active {pull}669[#669]
118
+ - Add recording config option {pull}765[#765]
119
+ - Add support for `SuckerPunch` {pull}775[#775]
120
+ - Support forking: Detect forking and restart agent tasks and background threads {pull}783[#783]
121
+
38
122
  [[release-notes-3.6.0]]
39
123
  ==== 3.6.0 (2020-03-10)
40
124