elastic-apm 3.6.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/Jenkinsfile +72 -32
  3. data/.ci/downstreamTests.groovy +27 -20
  4. data/.ci/jobs/defaults.yml +1 -1
  5. data/.rubocop.yml +3 -0
  6. data/CHANGELOG.asciidoc +27 -0
  7. data/Gemfile +18 -0
  8. data/Rakefile +28 -1
  9. data/docs/configuration.asciidoc +80 -16
  10. data/docs/getting-started-rails.asciidoc +2 -0
  11. data/docs/images/dynamic-config.svg +1 -0
  12. data/docs/index.asciidoc +2 -1
  13. data/docs/introduction.asciidoc +2 -1
  14. data/docs/performance-tuning.asciidoc +106 -0
  15. data/docs/set-up.asciidoc +5 -2
  16. data/docs/supported-technologies.asciidoc +16 -0
  17. data/elastic-apm.gemspec +17 -0
  18. data/lib/elastic-apm.rb +17 -0
  19. data/lib/elastic_apm.rb +18 -1
  20. data/lib/elastic_apm/agent.rb +48 -2
  21. data/lib/elastic_apm/central_config.rb +27 -8
  22. data/lib/elastic_apm/central_config/cache_control.rb +17 -0
  23. data/lib/elastic_apm/child_durations.rb +17 -0
  24. data/lib/elastic_apm/config.rb +47 -2
  25. data/lib/elastic_apm/config/bytes.rb +17 -0
  26. data/lib/elastic_apm/config/duration.rb +17 -0
  27. data/lib/elastic_apm/config/options.rb +18 -1
  28. data/lib/elastic_apm/config/regexp_list.rb +17 -0
  29. data/lib/elastic_apm/config/wildcard_pattern_list.rb +17 -0
  30. data/lib/elastic_apm/context.rb +17 -0
  31. data/lib/elastic_apm/context/request.rb +17 -0
  32. data/lib/elastic_apm/context/request/socket.rb +17 -0
  33. data/lib/elastic_apm/context/request/url.rb +17 -0
  34. data/lib/elastic_apm/context/response.rb +17 -0
  35. data/lib/elastic_apm/context/user.rb +17 -0
  36. data/lib/elastic_apm/context_builder.rb +17 -0
  37. data/lib/elastic_apm/deprecations.rb +17 -0
  38. data/lib/elastic_apm/error.rb +17 -0
  39. data/lib/elastic_apm/error/exception.rb +17 -0
  40. data/lib/elastic_apm/error/log.rb +17 -0
  41. data/lib/elastic_apm/error_builder.rb +17 -0
  42. data/lib/elastic_apm/grape.rb +17 -0
  43. data/lib/elastic_apm/graphql.rb +17 -0
  44. data/lib/elastic_apm/grpc.rb +17 -0
  45. data/lib/elastic_apm/instrumenter.rb +29 -4
  46. data/lib/elastic_apm/internal_error.rb +17 -0
  47. data/lib/elastic_apm/logging.rb +17 -0
  48. data/lib/elastic_apm/metadata.rb +17 -0
  49. data/lib/elastic_apm/metadata/process_info.rb +17 -0
  50. data/lib/elastic_apm/metadata/service_info.rb +17 -0
  51. data/lib/elastic_apm/metadata/system_info.rb +17 -0
  52. data/lib/elastic_apm/metadata/system_info/container_info.rb +17 -0
  53. data/lib/elastic_apm/metrics.rb +33 -1
  54. data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
  55. data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
  56. data/lib/elastic_apm/metrics/metric.rb +17 -0
  57. data/lib/elastic_apm/metrics/set.rb +17 -0
  58. data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
  59. data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
  60. data/lib/elastic_apm/metrics/vm_set.rb +17 -0
  61. data/lib/elastic_apm/metricset.rb +17 -0
  62. data/lib/elastic_apm/middleware.rb +17 -0
  63. data/lib/elastic_apm/naively_hashable.rb +17 -0
  64. data/lib/elastic_apm/normalizers.rb +17 -0
  65. data/lib/elastic_apm/normalizers/grape.rb +17 -0
  66. data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
  67. data/lib/elastic_apm/normalizers/rails.rb +17 -0
  68. data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
  69. data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
  70. data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
  71. data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
  72. data/lib/elastic_apm/opentracing.rb +17 -0
  73. data/lib/elastic_apm/rails.rb +17 -0
  74. data/lib/elastic_apm/railtie.rb +17 -0
  75. data/lib/elastic_apm/resque.rb +17 -0
  76. data/lib/elastic_apm/sinatra.rb +17 -0
  77. data/lib/elastic_apm/span.rb +17 -0
  78. data/lib/elastic_apm/span/context.rb +17 -0
  79. data/lib/elastic_apm/span/context/db.rb +17 -0
  80. data/lib/elastic_apm/span/context/destination.rb +17 -0
  81. data/lib/elastic_apm/span/context/http.rb +17 -0
  82. data/lib/elastic_apm/span_helpers.rb +17 -0
  83. data/lib/elastic_apm/spies.rb +17 -0
  84. data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
  85. data/lib/elastic_apm/spies/delayed_job.rb +17 -0
  86. data/lib/elastic_apm/spies/elasticsearch.rb +17 -0
  87. data/lib/elastic_apm/spies/faraday.rb +17 -0
  88. data/lib/elastic_apm/spies/http.rb +17 -0
  89. data/lib/elastic_apm/spies/json.rb +17 -0
  90. data/lib/elastic_apm/spies/mongo.rb +17 -0
  91. data/lib/elastic_apm/spies/net_http.rb +17 -0
  92. data/lib/elastic_apm/spies/rake.rb +17 -0
  93. data/lib/elastic_apm/spies/redis.rb +17 -0
  94. data/lib/elastic_apm/spies/resque.rb +19 -9
  95. data/lib/elastic_apm/spies/sequel.rb +17 -0
  96. data/lib/elastic_apm/spies/shoryuken.rb +17 -0
  97. data/lib/elastic_apm/spies/sidekiq.rb +17 -0
  98. data/lib/elastic_apm/spies/sinatra.rb +17 -0
  99. data/lib/elastic_apm/spies/sneakers.rb +17 -0
  100. data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
  101. data/lib/elastic_apm/spies/tilt.rb +17 -0
  102. data/lib/elastic_apm/sql.rb +17 -0
  103. data/lib/elastic_apm/sql/signature.rb +17 -0
  104. data/lib/elastic_apm/sql/tokenizer.rb +17 -0
  105. data/lib/elastic_apm/sql/tokens.rb +17 -0
  106. data/lib/elastic_apm/sql_summarizer.rb +17 -0
  107. data/lib/elastic_apm/stacktrace.rb +17 -0
  108. data/lib/elastic_apm/stacktrace/frame.rb +17 -0
  109. data/lib/elastic_apm/stacktrace_builder.rb +17 -0
  110. data/lib/elastic_apm/subscriber.rb +17 -0
  111. data/lib/elastic_apm/trace_context.rb +17 -0
  112. data/lib/elastic_apm/trace_context/traceparent.rb +17 -0
  113. data/lib/elastic_apm/trace_context/tracestate.rb +17 -0
  114. data/lib/elastic_apm/transaction.rb +33 -5
  115. data/lib/elastic_apm/transport/base.rb +39 -23
  116. data/lib/elastic_apm/transport/connection.rb +17 -0
  117. data/lib/elastic_apm/transport/connection/http.rb +17 -0
  118. data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
  119. data/lib/elastic_apm/transport/filters.rb +17 -0
  120. data/lib/elastic_apm/transport/filters/secrets_filter.rb +17 -0
  121. data/lib/elastic_apm/transport/headers.rb +17 -0
  122. data/lib/elastic_apm/transport/serializers.rb +17 -0
  123. data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
  124. data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
  125. data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +17 -0
  126. data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
  127. data/lib/elastic_apm/transport/serializers/span_serializer.rb +17 -0
  128. data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
  129. data/lib/elastic_apm/transport/user_agent.rb +17 -0
  130. data/lib/elastic_apm/transport/worker.rb +17 -0
  131. data/lib/elastic_apm/util.rb +17 -0
  132. data/lib/elastic_apm/util/inflector.rb +17 -0
  133. data/lib/elastic_apm/util/lru_cache.rb +17 -0
  134. data/lib/elastic_apm/util/throttle.rb +17 -0
  135. data/lib/elastic_apm/version.rb +18 -1
  136. metadata +5 -5
  137. data/.ci/prepare-git-context.sh +0 -27
  138. 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: 86463e0604357bc3c88e3507de76b0a2e92ba2a1311aab220b6b092df9523319
4
+ data.tar.gz: 97b3fcbc28f6b46de4e72f536b314380884f6dd192747258f861bf060aa588ab
5
5
  SHA512:
6
- metadata.gz: 641923b3afdf3c3fe258053a2f2492092aa1af5a35a50c3783b6e7d0d00e6198f8454c95fb4f2eca0a1ea83f59afd552c600ffaed34efa0aeecf44d40b9948cd
7
- data.tar.gz: 427eee529da777c98d4c4c02eb79f5aba46200e92edcac1f31b5bbd38df55f78801d92de063c37a54ffecf2fe3777697495c745f8334d3fdae4509626b1e1350
6
+ metadata.gz: 56a3b688bf4646a11888677fad884937b9f83b04b2cb47d5740f9cb0ce3e1c754abbe861e4888418f6ec168695f940d8ac24c4de3461c61a2d4f7360953d3f30
7
+ data.tar.gz: 9743b2bc369dfedf3ff28893062171bb1af0a2af201f845701966409ab4c0063a4584257f445fabc6c14eba8a170ddbac9e5fe391554be53652f801cf2d482d5
@@ -19,7 +19,7 @@ pipeline {
19
19
  environment {
20
20
  REPO = 'apm-agent-ruby'
21
21
  BASE_DIR = "src/github.com/elastic/${env.REPO}"
22
- PIPELINE_LOG_LEVEL='DEBUG'
22
+ PIPELINE_LOG_LEVEL = 'INFO'
23
23
  NOTIFY_TO = credentials('notify-to')
24
24
  JOB_GCS_BUCKET = credentials('gcs-bucket')
25
25
  CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
@@ -59,14 +59,23 @@ pipeline {
59
59
  deleteDir()
60
60
  gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true, reference: "${env.REFERENCE_REPO}")
61
61
  stash allowEmpty: true, name: 'source', useDefaultExcludes: false
62
+ script {
63
+ dir("${BASE_DIR}"){
64
+ // Skip all the stages except docs for PR's with asciidoc and md changes only
65
+ env.ONLY_DOCS = isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true)
66
+ }
67
+ }
62
68
  }
63
69
  }
64
70
  stage('Sanity checks') {
65
71
  when {
66
72
  beforeAgent true
67
- anyOf {
68
- not { changeRequest() }
69
- expression { return params.Run_As_Master_Branch }
73
+ allOf {
74
+ expression { return env.ONLY_DOCS == "false" }
75
+ anyOf {
76
+ not { changeRequest() }
77
+ expression { return params.Run_As_Master_Branch }
78
+ }
70
79
  }
71
80
  }
72
81
  options { skipDefaultCheckout() }
@@ -91,6 +100,10 @@ pipeline {
91
100
  */
92
101
  stage('Test') {
93
102
  options { skipDefaultCheckout() }
103
+ when {
104
+ beforeAgent true
105
+ expression { return env.ONLY_DOCS == "false" }
106
+ }
94
107
  steps {
95
108
  withGithubNotify(context: 'Tests', tab: 'tests') {
96
109
  deleteDir()
@@ -113,9 +126,12 @@ pipeline {
113
126
  agent none
114
127
  when {
115
128
  beforeAgent true
116
- anyOf {
117
- changeRequest()
118
- expression { return !params.Run_As_Master_Branch }
129
+ allOf {
130
+ expression { return env.ONLY_DOCS == "false" }
131
+ anyOf {
132
+ changeRequest()
133
+ expression { return !params.Run_As_Master_Branch }
134
+ }
119
135
  }
120
136
  }
121
137
  steps {
@@ -137,7 +153,7 @@ pipeline {
137
153
  branch 'master'
138
154
  branch "\\d+\\.\\d+"
139
155
  branch "v\\d?"
140
- tag "v\\d+\\.\\d+\\.\\d+*"
156
+ tag pattern: 'v\\d+.*', comparator: "REGEXP"
141
157
  expression { return params.Run_As_Master_Branch }
142
158
  }
143
159
  expression { return params.bench_ci }
@@ -238,7 +254,10 @@ pipeline {
238
254
  steps {
239
255
  deleteDir()
240
256
  // 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})"
257
+ sh label: 'Wait for gem', script: """#!/usr/bin/env bash
258
+ source /usr/local/bin/bash_standard_lib.sh
259
+ (retry 10 curl --silent --show-error --fail -I https://rubygems.org/gems/elastic-apm/versions/${env.VERSION})
260
+ """
242
261
  dir("${OPBEANS_REPO}"){
243
262
  git credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba',
244
263
  url: "git@github.com:elastic/${OPBEANS_REPO}.git"
@@ -253,6 +272,19 @@ pipeline {
253
272
  }
254
273
  }
255
274
  }
275
+ stage('Coverage converge') {
276
+ when {
277
+ beforeAgent true
278
+ expression { return env.ONLY_DOCS == "false" }
279
+ }
280
+ steps{
281
+ dir("${BASE_DIR}"){
282
+ unpack_artifacts(rubyDownstreamJobs)
283
+ sh(script: "./spec/scripts/coverage_converge.sh")
284
+ cobertura coberturaReportFile: "coverage/coverage.xml"
285
+ }
286
+ }
287
+ }
256
288
  }
257
289
  post {
258
290
  cleanup {
@@ -261,6 +293,12 @@ pipeline {
261
293
  }
262
294
  }
263
295
 
296
+ def unpack_artifacts(builds) {
297
+ builds.values().each() { build ->
298
+ copyArtifacts(projectName: "apm-agent-ruby/apm-agent-ruby-downstream/${env.BRANCH_NAME}", selector: specific(buildNumber: build.number.toString()))
299
+ }
300
+ }
301
+
264
302
  /**
265
303
  Run benchmarks for a Ruby version, then report the results to the Elasticsearch server.
266
304
  */
@@ -271,26 +309,27 @@ def runBenchmark(version){
271
309
  // - docker.elastic.co/observability-ci/jruby:9.2-12-jdk to jruby-9.2-12-jdk
272
310
  // - jruby:9.1 to jruby-9.1
273
311
  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}")
282
- }
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)
312
+ withEnv(["HOME=${env.WORKSPACE}/${transformedVersion}"]){
313
+ dir("${transformedVersion}"){
314
+ deleteDir()
315
+ unstash 'source'
316
+ dir("${BASE_DIR}"){
317
+ retry(2){
318
+ sleep randomNumber(min:10, max: 30)
319
+ dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
320
+ }
321
+ try{
322
+ sh """./spec/scripts/benchmarks.sh "${version}" "${REFERENCE_REPO}" """
323
+ } catch(e){
324
+ throw e
325
+ } finally {
326
+ archiveArtifacts(
327
+ allowEmptyArchive: true,
328
+ artifacts: "**/benchmark-${transformedVersion}.raw,**/benchmark-${transformedVersion}.error",
329
+ onlyIfSuccessful: false)
330
+ sendBenchmarks(file: "benchmark-${transformedVersion}.bulk",
331
+ index: "benchmark-ruby", archive: true)
332
+ }
294
333
  }
295
334
  }
296
335
  }
@@ -300,12 +339,14 @@ def runBenchmark(version){
300
339
 
301
340
  def runJob(String rubyVersion, int sleep = 1){
302
341
  def buildObject
342
+ def branch = env.CHANGE_ID?.trim() ? env.CHANGE_TARGET : env.BRANCH_NAME
303
343
  try {
304
344
  def quiet = (sleep * randomNumber(min: 2, max: 6)) + 5
305
345
  buildObject = build(job: "apm-agent-ruby/apm-agent-ruby-downstream/${env.BRANCH_NAME}",
306
346
  parameters: [
307
347
  string(name: 'RUBY_VERSION', value: "${rubyVersion}"),
308
- string(name: 'BRANCH_SPECIFIER', value: "${env.GIT_BASE_COMMIT}")
348
+ string(name: 'BRANCH_SPECIFIER', value: "${env.GIT_BASE_COMMIT}"),
349
+ string(name: 'MERGE_TARGET', value: "${branch}")
309
350
  ],
310
351
  quietPeriod: quiet)
311
352
  } catch(e) {
@@ -324,8 +365,7 @@ def prepareRelease(Closure body){
324
365
  docker.image("${env.RUBY_DOCKER_TAG}").inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
325
366
  withEnv(["HOME=${env.WORKSPACE}/${env.BASE_DIR ?: ''}"]) {
326
367
  rubygemsLogin.withApi(secret: "${env.RELEASE_SECRET}") {
327
- sshagent(['f6c7695a-671e-4f4f-a331-acdce44ff9ba']) {
328
- sh '.ci/prepare-git-context.sh'
368
+ withGitRelease(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken') {
329
369
  sh 'gem install rake yard rspec'
330
370
  body()
331
371
  }
@@ -36,6 +36,7 @@ pipeline {
36
36
  parameters {
37
37
  string(name: 'RUBY_VERSION', defaultValue: "ruby:2.6", description: "Ruby version to test")
38
38
  string(name: 'BRANCH_SPECIFIER', defaultValue: "master", description: "Git branch/tag to use")
39
+ string(name: 'MERGE_TARGET', defaultValue: "master", description: "Git branch/tag where to merge this code")
39
40
  }
40
41
  stages {
41
42
  /**
@@ -43,12 +44,31 @@ pipeline {
43
44
  */
44
45
  stage('Checkout') {
45
46
  options { skipDefaultCheckout() }
47
+ when {
48
+ beforeAgent true
49
+ not {
50
+ tag pattern: 'v\\d+.*', comparator: "REGEXP"
51
+ }
52
+ }
46
53
  steps {
47
54
  deleteDir()
48
55
  gitCheckout(basedir: "${BASE_DIR}",
49
56
  branch: "${params.BRANCH_SPECIFIER}",
50
57
  repo: "${REPO}",
51
- credentialsId: "${JOB_GIT_CREDENTIALS}")
58
+ credentialsId: "${JOB_GIT_CREDENTIALS}",
59
+ mergeTarget: "${params.MERGE_TARGET}")
60
+ stash allowEmpty: true, name: 'source', useDefaultExcludes: false
61
+ }
62
+ }
63
+ stage('Checkout tag') {
64
+ options { skipDefaultCheckout() }
65
+ when {
66
+ beforeAgent true
67
+ tag pattern: 'v\\d+.*', comparator: "REGEXP"
68
+ }
69
+ steps {
70
+ deleteDir()
71
+ gitCheckout(basedir: "${BASE_DIR}")
52
72
  stash allowEmpty: true, name: 'source', useDefaultExcludes: false
53
73
  }
54
74
  }
@@ -83,7 +103,7 @@ pipeline {
83
103
  }
84
104
  }
85
105
  }
86
- notifyBuildResult()
106
+ notifyBuildResult(prComment: false)
87
107
  }
88
108
  }
89
109
  }
@@ -118,16 +138,11 @@ class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
118
138
  steps.junit(allowEmptyResults: true,
119
139
  keepLongStdio: true,
120
140
  testResults: "**/spec/junit-reports/**/ruby-agent-junit.xml")
121
- if (steps.isCodecovEnabled(x, y)) {
122
- steps.codecov(repo: "${steps.env.REPO}", basedir: "${steps.env.BASE_DIR}",
123
- secret: "${steps.env.CODECOV_SECRET}")
124
- }
125
141
  }
126
142
  }
127
143
  }
128
144
  }
129
145
  }
130
-
131
146
  /**
132
147
  Run tests for a Ruby version and framework version.
133
148
  */
@@ -145,21 +160,13 @@ def runScript(Map params = [:]){
145
160
  sleep randomNumber(min:10, max: 30)
146
161
  dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
147
162
  sh("./spec/scripts/spec.sh ${ruby} ${framework}")
163
+ script{
164
+ archiveArtifacts(artifacts: "coverage/matrix_results/", defaultExcludes: false)
165
+ }
148
166
  }
149
167
  }
150
168
  }
151
169
 
152
- /**
153
- * Whether the given ruby version and framework are in charge of sending the
154
- * codecov results. It does require the workspace.
155
- */
156
- def isCodecovEnabled(ruby, framework){
157
- dir(BASE_DIR){
158
- def codecovVersions = readYaml(file: '.ci/.jenkins_codecov.yml')
159
- return codecovVersions['ENABLED'].any { it.trim() == "${ruby?.trim()}#${framework?.trim()}" }
160
- }
161
- }
162
-
163
170
  /**
164
171
  Run all the tests for the given ruby version and file with the frameworks to test
165
172
  */
@@ -178,8 +185,8 @@ def runTests(frameworkFile) {
178
185
  name: 'Ruby',
179
186
  steps: this
180
187
  )
181
- def mapPatallelTasks = rubyTasksGen.generateParallelTests()
182
- parallel(mapPatallelTasks)
188
+ def mapParallelTasks = rubyTasksGen.generateParallelTests()
189
+ parallel(mapParallelTasks)
183
190
  }
184
191
  }
185
192
  }
@@ -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:
@@ -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,33 @@ endif::[]
35
35
  [[release-notes-3.x]]
36
36
  === Ruby Agent version 3.x
37
37
 
38
+ [float]
39
+ [[release-notes-3.7.0]]
40
+ ==== 3.7.0 (2020-05-14)
41
+
42
+ [float]
43
+ ===== Changed
44
+
45
+ - Make config values dynamic so they can be changed via the remote config {pull}747[#747]
46
+ - Log the updated options from central config in addition to cumulative modifications {pull}758[#758]
47
+
48
+ [float]
49
+ ===== Fixed
50
+
51
+ - Ensure that the log level is updated for the config's logger when value is changed {pull}755[#755]
52
+ - Set config `false` values to `false`, not `nil` {pull}761[#761]
53
+ - Ensure that the previously running agent's config is used in `ElasticAPM.restart` {pull}763[#763]
54
+ - Handle the Resque spy's payload class value being a String or Class and update docs {pull}768[#768]
55
+ - Add finalizer on ProxyPipe::Write so Zlib::GzipWriter is properly closed {pull}787[#787]
56
+
57
+ [float]
58
+ ===== Added
59
+
60
+ - Add enabled config option, replacing active {pull}669[#669]
61
+ - Add recording config option {pull}765[#765]
62
+ - Add support for `SuckerPunch` {pull}775[#775]
63
+ - Support forking: Detect forking and restart agent tasks and background threads {pull}783[#783]
64
+
38
65
  [[release-notes-3.6.0]]
39
66
  ==== 3.6.0 (2020-03-10)
40
67
 
data/Gemfile CHANGED
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  # frozen_string_literal: true
2
19
 
3
20
  source 'https://rubygems.org'
@@ -34,6 +51,7 @@ gem 'sidekiq', require: nil
34
51
  gem 'simplecov', require: false
35
52
  gem 'simplecov-cobertura', require: false
36
53
  gem 'sneakers', '~> 2.12', require: nil
54
+ gem 'sucker_punch', '~> 2.0', require: nil
37
55
  gem 'yard', require: nil
38
56
  gem 'yarjuf'
39
57
 
data/Rakefile CHANGED
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  # frozen_string_literal: true
2
19
 
3
20
  require 'bundler/gem_tasks'
@@ -7,7 +24,7 @@ Update `3.x` branch to be at released commit and push it to GitHub.
7
24
  """
8
25
  namespace :release do
9
26
  task :update_branch do
10
- `echo hi && false && git checkout 3.x &&
27
+ `git checkout 3.x &&
11
28
  git rebase master &&
12
29
  git push origin 3.x &&
13
30
  git checkout master`
@@ -22,3 +39,13 @@ YARD::Rake::YardocTask.new
22
39
  task docs: :yard
23
40
 
24
41
  task default: :spec
42
+
43
+ namespace :coverage do
44
+ desc "Collates all result sets generated by the different test runners"
45
+ task :report do
46
+ require 'simplecov'
47
+ require 'simplecov-cobertura'
48
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
49
+ SimpleCov.collate Dir["coverage/matrix_results/**/.resultset.json"]
50
+ end
51
+ end
@@ -8,9 +8,7 @@ endif::[]
8
8
  == Configuration
9
9
 
10
10
  There are several ways to configure how Elastic APM behaves.
11
-
12
- The recommended way to configure Elastic APM is to create a file
13
- `config/elastic_apm.yml` and specify options in there:
11
+ The recommended way is to specify options in a `config/elastic_apm.yml` file:
14
12
 
15
13
  [source,yaml]
16
14
  ----
@@ -18,17 +16,38 @@ server_url: 'http://localhost:8200'
18
16
  secret_token: <%= ENV["VERY_SECRET_TOKEN"] %>
19
17
  ----
20
18
 
19
+ Some options can be set with `ENV` variables.
20
+ When using this method, strings are split by comma, e.g.,
21
+ `ELASTIC_APM_SANITIZE_FIELD_NAMES="a,b" # => [/a/, /b/]`.
22
+
23
+ [float]
24
+ [[configuration-precedence]]
25
+ === Configuration precedence
26
+
21
27
  Options are applied in the following order (last one wins):
22
28
 
23
29
  1. Defaults
24
30
  2. Arguments to `ElasticAPM.start` / `Config.new`
25
- 3. Config file eg. `config/elastic_apm.yml`
31
+ 3. Config file, e.g., `config/elastic_apm.yml`
26
32
  4. Environment variables
33
+ 5. {apm-app-ref}/agent-configuration.html[Central configuration]
34
+ (supported options are marked with <<dynamic-configuration, image:./images/dynamic-config.svg[] >>)
35
+
36
+ [float]
37
+ [[dynamic-configuration]]
38
+ === Dynamic configuration
39
+
40
+ Configuration options marked with the image:./images/dynamic-config.svg[] badge can be changed at runtime
41
+ when set from a supported source.
42
+
43
+ The Agent supports {apm-app-ref}/agent-configuration.html[Central configuration],
44
+ which allows you to fine-tune certain configurations via the APM app.
45
+ This feature is enabled in the Agent by default, with <<config-central-config>>.
27
46
 
28
47
  [float]
29
48
  === Ruby on Rails
30
49
 
31
- When using Rails it's also possible to specify options inside
50
+ When using Rails, it's possible to specify options inside
32
51
  `config/application.rb`:
33
52
 
34
53
  [source,ruby]
@@ -40,7 +59,7 @@ config.elastic_apm.service_name = 'MyApp'
40
59
  [float]
41
60
  === Sinatra and Rack
42
61
 
43
- When using APM with Sinatra and Rack you can configure it when starting
62
+ When using Sinatra and Rack, you can configure when starting
44
63
  the agent:
45
64
 
46
65
  [source,ruby]
@@ -52,7 +71,7 @@ ElasticAPM.start(
52
71
  )
53
72
  ----
54
73
 
55
- Alternatively, you can use the `ElasticAPM::Sinatra.start` API.
74
+ Alternatively, you can use the `ElasticAPM::Sinatra.start` API:
56
75
 
57
76
  [source,ruby]
58
77
  ----
@@ -68,7 +87,7 @@ See <<getting-started-rack>>.
68
87
  [float]
69
88
  === Grape and Rack
70
89
 
71
- When using APM with Grape and Rack (without Rails), you can configure it when starting
90
+ When using Grape and Rack (without Rails), you can configure when starting
72
91
  the agent:
73
92
 
74
93
  [source,ruby]
@@ -85,12 +104,6 @@ See <<getting-started-rack>>.
85
104
  [float]
86
105
  === Options
87
106
 
88
- Some options can be set with `ENV` variables and all of them may be set in
89
- your source code.
90
-
91
- When setting values for lists using `ENV` variables, strings are split by comma
92
- eg `ELASTIC_APM_SANITIZE_FIELD_NAMES="a,b" # => [/a/, /b/]`.
93
-
94
107
  [float]
95
108
  [[config-config-file]]
96
109
  ==== `config_file`
@@ -165,7 +178,7 @@ WARNING: Api keys only provide any real security if your APM server uses TLS.
165
178
 
166
179
  [float]
167
180
  [[config-active]]
168
- ==== `active`
181
+ ==== `active` deprecated:[3.7.0,See <<config-enabled>> instead.]
169
182
  |============
170
183
  | Environment | `Config` key | Default
171
184
  | `ELASTIC_APM_ACTIVE` | `active` | `true`
@@ -174,6 +187,8 @@ WARNING: Api keys only provide any real security if your APM server uses TLS.
174
187
  Whether or not to start the agent.
175
188
  If `active` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
176
189
 
190
+ NOTE: This option is being removed. See <<config-enabled>> instead.
191
+
177
192
  [float]
178
193
  [[config-api-buffer-size]]
179
194
  ==== `api_buffer_size`
@@ -192,6 +207,9 @@ went wrong.
192
207
  [float]
193
208
  [[config-api-request-size]]
194
209
  ==== `api_request_size`
210
+
211
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
212
+
195
213
  |============
196
214
  | Environment | `Config` key | Default
197
215
  | `ELASTIC_APM_API_REQUEST_SIZE` | `api_request_size` | `"750kb"`
@@ -205,6 +223,9 @@ It has to be provided in *<<config-format-size, size format>>*.
205
223
  [float]
206
224
  [[config-api-request-time]]
207
225
  ==== `api_request_time`
226
+
227
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
228
+
208
229
  |============
209
230
  | Environment | `Config` key | Default
210
231
  | `ELASTIC_APM_API_REQUEST_TIME` | `api_request_time` | `"10s"`
@@ -233,6 +254,9 @@ NOTE: This feature requires APM Server and Kibana >= 7.3.
233
254
  [float]
234
255
  [[config-capture-body]]
235
256
  ==== `capture_body`
257
+
258
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
259
+
236
260
  |============
237
261
  | Environment | `Config` key | Default | Example |
238
262
  | `ELASTIC_APM_CAPTURE_BODY` | `capture_body` | `"off"` | `"all"`
@@ -253,6 +277,9 @@ If your service handles data like this, we advise to only enable this feature wi
253
277
  [float]
254
278
  [[config-capture-headers]]
255
279
  ==== `capture_headers`
280
+
281
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
282
+
256
283
  |============
257
284
  | Environment | `Config` key | Default
258
285
  | `ELASTIC_APM_CAPTURE_HEADERS` | `capture_headers` | `true`
@@ -278,7 +305,7 @@ Whether or not to attach `ENV` from Rack to transactions and errors.
278
305
  | `ELASTIC_APM_CENTRAL_CONFIG` | `central_config` | `true`
279
306
  |============
280
307
 
281
- Enable {apm-app-ref}/agent-configuration.html[APM Agent Configuration via Kibana].
308
+ Enables {apm-app-ref}/agent-configuration.html[APM Agent Configuration via Kibana].
282
309
  If set to `true`, the client will poll the APM Server regularly for new agent configuration.
283
310
 
284
311
  Usually APM Server determines how often to poll, but if not the default interval is 5 minutes.
@@ -383,6 +410,18 @@ Use this option to disable any of these.
383
410
 
384
411
  Get an array of enabled instrumentations with `ElasticAPM.agent.config.enabled_instrumentations`.
385
412
 
413
+ [float]
414
+ [[config-enabled]]
415
+ ==== `enabled`
416
+ [options="header"]
417
+ |============
418
+ | Environment | `Config` key | Default
419
+ | `ELASTIC_APM_ENABLED` | `enabled` | `true`
420
+ |============
421
+
422
+ Whether or not to start the agent.
423
+ If `enabled` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
424
+
386
425
  [float]
387
426
  [[config-environment]]
388
427
  ==== `environment`
@@ -514,6 +553,8 @@ Elastic APM can instrument your Rake tasks but given that they are used for a mu
514
553
  [[config-log-level]]
515
554
  ==== `log_level`
516
555
 
556
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
557
+
517
558
  [options="header"]
518
559
  |============
519
560
  | Environment | `Config` key | Default
@@ -610,6 +651,23 @@ There are also `ENV` version of these following the same pattern of putting `ELA
610
651
 
611
652
  See https://github.com/httprb/http/wiki/Proxy-Support[Http.rb's docs].
612
653
 
654
+ [float]
655
+ [[config-recording]]
656
+ ==== `recording`
657
+
658
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
659
+
660
+ [options="header"]
661
+ |============
662
+ | Environment | `Config` key | Default
663
+ | `ELASTIC_APM_RECORDING` | `recording` | `true`
664
+ |============
665
+
666
+ Enable or disable the recording of events.
667
+ If set to false, then the agent does not create or send any events to the Elastic APM server,
668
+ and instrumentation overhead is minimized. The agent continues to poll the server for configuration changes
669
+ when this option is false.
670
+
613
671
  [float]
614
672
  [[config-sanitize-field-names]]
615
673
  ==== `sanitize_field_names`
@@ -694,6 +752,8 @@ storage use in your Elasticsearch cluster.
694
752
  [[config-span-frames-min-duration-ms]]
695
753
  ==== `span_frames_min_duration`
696
754
 
755
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
756
+
697
757
  |============
698
758
  | Environment | `Config` key | Default
699
759
  | `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `"5ms"`
@@ -737,6 +797,8 @@ The maximum number of stack trace lines per span/error.
737
797
  [[config-transaction-max-spans]]
738
798
  ==== `transaction_max_spans`
739
799
 
800
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
801
+
740
802
  |============
741
803
  | Environment | `Config` key | Default
742
804
  | `ELASTIC_APM_TRANSACTION_MAX_SPANS` | `transaction_max_spans` | `500`
@@ -752,6 +814,8 @@ too much work for such edge cases.
752
814
  [[config-transaction-sample-rate]]
753
815
  ==== `transaction_sample_rate`
754
816
 
817
+ <<dynamic-configuration, image:./images/dynamic-config.svg[] >>
818
+
755
819
  |============
756
820
  | Environment | `Config` key | Default
757
821
  | `ELASTIC_APM_TRANSACTION_SAMPLE_RATE` | `transaction_sample_rate` | `1.0`