elastic-apm 3.4.0 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/.jenkins_exclude.yml +39 -20
  3. data/.ci/.jenkins_framework.yml +2 -2
  4. data/.ci/Jenkinsfile +286 -170
  5. data/.ci/docker/jruby/11-jdk/Dockerfile +40 -0
  6. data/.ci/docker/jruby/12-jdk/Dockerfile +40 -0
  7. data/.ci/docker/jruby/13-jdk/Dockerfile +40 -0
  8. data/.ci/docker/jruby/7-jdk/Dockerfile +40 -0
  9. data/.ci/docker/jruby/8-jdk/Dockerfile +40 -0
  10. data/.ci/docker/jruby/README.md +31 -0
  11. data/.ci/docker/jruby/run.sh +73 -0
  12. data/.ci/docker/jruby/test.sh +13 -0
  13. data/.ci/jobs/defaults.yml +1 -1
  14. data/.ci/packer_cache.sh +16 -0
  15. data/.github/ISSUE_TEMPLATE/Bug_report.md +13 -11
  16. data/.github/ISSUE_TEMPLATE/Feature_request.md +8 -8
  17. data/.github/PULL_REQUEST_TEMPLATE.md +51 -5
  18. data/.gitignore +5 -0
  19. data/.rspec +0 -1
  20. data/.rubocop.yml +13 -1
  21. data/CHANGELOG.asciidoc +94 -1
  22. data/CONTRIBUTING.md +6 -48
  23. data/Gemfile +34 -9
  24. data/README.md +62 -13
  25. data/Rakefile +37 -5
  26. data/bin/run-tests +4 -1
  27. data/docker-compose.yml +7 -0
  28. data/docs/api.asciidoc +15 -3
  29. data/docs/configuration.asciidoc +164 -32
  30. data/docs/debugging.asciidoc +14 -0
  31. data/docs/getting-started-rails.asciidoc +2 -0
  32. data/docs/graphql.asciidoc +23 -0
  33. data/docs/images/dynamic-config.svg +1 -0
  34. data/docs/index.asciidoc +6 -1
  35. data/docs/introduction.asciidoc +2 -1
  36. data/docs/performance-tuning.asciidoc +106 -0
  37. data/docs/set-up.asciidoc +5 -2
  38. data/docs/supported-technologies.asciidoc +68 -1
  39. data/docs/upgrading.asciidoc +45 -0
  40. data/elastic-apm.gemspec +17 -0
  41. data/lib/elastic-apm.rb +17 -0
  42. data/lib/elastic_apm.rb +29 -0
  43. data/lib/elastic_apm/agent.rb +49 -2
  44. data/lib/elastic_apm/central_config.rb +27 -8
  45. data/lib/elastic_apm/central_config/cache_control.rb +17 -0
  46. data/lib/elastic_apm/child_durations.rb +17 -0
  47. data/lib/elastic_apm/config.rb +82 -7
  48. data/lib/elastic_apm/config/bytes.rb +17 -0
  49. data/lib/elastic_apm/config/duration.rb +17 -0
  50. data/lib/elastic_apm/config/options.rb +18 -1
  51. data/lib/elastic_apm/config/regexp_list.rb +17 -0
  52. data/lib/elastic_apm/config/wildcard_pattern_list.rb +20 -1
  53. data/lib/elastic_apm/context.rb +17 -0
  54. data/lib/elastic_apm/context/request.rb +17 -0
  55. data/lib/elastic_apm/context/request/socket.rb +17 -0
  56. data/lib/elastic_apm/context/request/url.rb +17 -0
  57. data/lib/elastic_apm/context/response.rb +18 -1
  58. data/lib/elastic_apm/context/user.rb +17 -0
  59. data/lib/elastic_apm/context_builder.rb +17 -0
  60. data/lib/elastic_apm/deprecations.rb +17 -0
  61. data/lib/elastic_apm/error.rb +17 -0
  62. data/lib/elastic_apm/error/exception.rb +17 -0
  63. data/lib/elastic_apm/error/log.rb +17 -0
  64. data/lib/elastic_apm/error_builder.rb +17 -0
  65. data/lib/elastic_apm/grape.rb +17 -0
  66. data/lib/elastic_apm/graphql.rb +91 -0
  67. data/lib/elastic_apm/grpc.rb +99 -0
  68. data/lib/elastic_apm/instrumenter.rb +29 -4
  69. data/lib/elastic_apm/internal_error.rb +17 -0
  70. data/lib/elastic_apm/logging.rb +17 -0
  71. data/lib/elastic_apm/metadata.rb +17 -0
  72. data/lib/elastic_apm/metadata/process_info.rb +17 -0
  73. data/lib/elastic_apm/metadata/service_info.rb +22 -2
  74. data/lib/elastic_apm/metadata/system_info.rb +17 -0
  75. data/lib/elastic_apm/metadata/system_info/container_info.rb +17 -0
  76. data/lib/elastic_apm/metrics.rb +33 -1
  77. data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
  78. data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
  79. data/lib/elastic_apm/metrics/metric.rb +23 -4
  80. data/lib/elastic_apm/metrics/set.rb +17 -0
  81. data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
  82. data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
  83. data/lib/elastic_apm/metrics/vm_set.rb +17 -0
  84. data/lib/elastic_apm/metricset.rb +17 -0
  85. data/lib/elastic_apm/middleware.rb +20 -4
  86. data/lib/elastic_apm/naively_hashable.rb +17 -0
  87. data/lib/elastic_apm/normalizers.rb +17 -0
  88. data/lib/elastic_apm/normalizers/grape.rb +17 -0
  89. data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
  90. data/lib/elastic_apm/normalizers/rails.rb +17 -0
  91. data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
  92. data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
  93. data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
  94. data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
  95. data/lib/elastic_apm/opentracing.rb +66 -24
  96. data/lib/elastic_apm/rails.rb +17 -0
  97. data/lib/elastic_apm/railtie.rb +17 -0
  98. data/lib/elastic_apm/resque.rb +29 -0
  99. data/lib/elastic_apm/sinatra.rb +17 -0
  100. data/lib/elastic_apm/span.rb +17 -0
  101. data/lib/elastic_apm/span/context.rb +17 -0
  102. data/lib/elastic_apm/span/context/db.rb +26 -2
  103. data/lib/elastic_apm/span/context/destination.rb +37 -4
  104. data/lib/elastic_apm/span/context/http.rb +17 -0
  105. data/lib/elastic_apm/span_helpers.rb +17 -0
  106. data/lib/elastic_apm/spies.rb +33 -14
  107. data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
  108. data/lib/elastic_apm/spies/delayed_job.rb +17 -0
  109. data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
  110. data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
  111. data/lib/elastic_apm/spies/faraday.rb +18 -1
  112. data/lib/elastic_apm/spies/http.rb +19 -1
  113. data/lib/elastic_apm/spies/json.rb +17 -0
  114. data/lib/elastic_apm/spies/mongo.rb +18 -1
  115. data/lib/elastic_apm/spies/net_http.rb +25 -3
  116. data/lib/elastic_apm/spies/rake.rb +17 -0
  117. data/lib/elastic_apm/spies/redis.rb +17 -0
  118. data/lib/elastic_apm/spies/resque.rb +53 -0
  119. data/lib/elastic_apm/spies/sequel.rb +31 -4
  120. data/lib/elastic_apm/spies/shoryuken.rb +17 -0
  121. data/lib/elastic_apm/spies/sidekiq.rb +17 -0
  122. data/lib/elastic_apm/spies/sinatra.rb +17 -0
  123. data/lib/elastic_apm/spies/sneakers.rb +17 -0
  124. data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
  125. data/lib/elastic_apm/spies/tilt.rb +17 -0
  126. data/lib/elastic_apm/sql.rb +21 -4
  127. data/lib/elastic_apm/sql/signature.rb +17 -0
  128. data/lib/elastic_apm/sql/tokenizer.rb +17 -0
  129. data/lib/elastic_apm/sql/tokens.rb +17 -0
  130. data/lib/elastic_apm/sql_summarizer.rb +17 -0
  131. data/lib/elastic_apm/stacktrace.rb +17 -0
  132. data/lib/elastic_apm/stacktrace/frame.rb +17 -0
  133. data/lib/elastic_apm/stacktrace_builder.rb +23 -1
  134. data/lib/elastic_apm/subscriber.rb +17 -0
  135. data/lib/elastic_apm/trace_context.rb +85 -49
  136. data/lib/elastic_apm/trace_context/traceparent.rb +113 -0
  137. data/lib/elastic_apm/trace_context/tracestate.rb +43 -0
  138. data/lib/elastic_apm/transaction.rb +33 -5
  139. data/lib/elastic_apm/transport/base.rb +39 -23
  140. data/lib/elastic_apm/transport/connection.rb +17 -0
  141. data/lib/elastic_apm/transport/connection/http.rb +17 -0
  142. data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
  143. data/lib/elastic_apm/transport/filters.rb +17 -0
  144. data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
  145. data/lib/elastic_apm/transport/filters/secrets_filter.rb +29 -53
  146. data/lib/elastic_apm/transport/headers.rb +17 -0
  147. data/lib/elastic_apm/transport/serializers.rb +17 -0
  148. data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
  149. data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
  150. data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
  151. data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
  152. data/lib/elastic_apm/transport/serializers/span_serializer.rb +22 -2
  153. data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
  154. data/lib/elastic_apm/transport/user_agent.rb +17 -0
  155. data/lib/elastic_apm/transport/worker.rb +17 -0
  156. data/lib/elastic_apm/util.rb +17 -0
  157. data/lib/elastic_apm/util/inflector.rb +17 -0
  158. data/lib/elastic_apm/util/lru_cache.rb +17 -0
  159. data/lib/elastic_apm/util/throttle.rb +17 -0
  160. data/lib/elastic_apm/version.rb +18 -1
  161. metadata +29 -12
  162. data/.ci/downstreamTests.groovy +0 -185
  163. data/.ci/prepare-git-context.sh +0 -27
  164. data/CHANGELOG.md +0 -1
  165. data/codecov.yml +0 -32
@@ -1,185 +0,0 @@
1
- #!/usr/bin/env groovy
2
- @Library('apm@current') _
3
-
4
- import co.elastic.matrix.*
5
- import groovy.transform.Field
6
-
7
- /**
8
- This is the parallel tasks generator,
9
- it is need as field to store the results of the tests.
10
- */
11
- @Field def rubyTasksGen
12
-
13
- pipeline {
14
- agent { label 'linux && immutable' }
15
- environment {
16
- REPO="git@github.com:elastic/apm-agent-ruby.git"
17
- BASE_DIR="src/github.com/elastic/apm-agent-ruby"
18
- PIPELINE_LOG_LEVEL='INFO'
19
- NOTIFY_TO = credentials('notify-to')
20
- JOB_GCS_BUCKET = credentials('gcs-bucket')
21
- JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
22
- DOCKER_REGISTRY = 'docker.elastic.co'
23
- DOCKER_SECRET = 'secret/apm-team/ci/docker-registry/prod'
24
- CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
25
- }
26
- options {
27
- timeout(time: 2, unit: 'HOURS')
28
- buildDiscarder(logRotator(numToKeepStr: '300', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
29
- timestamps()
30
- ansiColor('xterm')
31
- disableResume()
32
- durabilityHint('PERFORMANCE_OPTIMIZED')
33
- rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
34
- quietPeriod(10)
35
- }
36
- parameters {
37
- string(name: 'RUBY_VERSION', defaultValue: "ruby:2.6", description: "Ruby version to test")
38
- string(name: 'BRANCH_SPECIFIER', defaultValue: "master", description: "Git branch/tag to use")
39
- }
40
- stages {
41
- /**
42
- Checkout the code and stash it, to use it on other stages.
43
- */
44
- stage('Checkout') {
45
- options { skipDefaultCheckout() }
46
- steps {
47
- deleteDir()
48
- gitCheckout(basedir: "${BASE_DIR}",
49
- branch: "${params.BRANCH_SPECIFIER}",
50
- repo: "${REPO}",
51
- credentialsId: "${JOB_GIT_CREDENTIALS}")
52
- stash allowEmpty: true, name: 'source', useDefaultExcludes: false
53
- }
54
- }
55
- stage('Test') {
56
- options { skipDefaultCheckout() }
57
- steps {
58
- runTests('.ci/.jenkins_framework.yml')
59
- }
60
- }
61
- stage('Master Test') {
62
- options { skipDefaultCheckout() }
63
- steps {
64
- catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE', message: "The tests for the master framework have failed. Let's warn instead.") {
65
- runTests('.ci/.jenkins_master_framework.yml')
66
- }
67
- }
68
- }
69
- }
70
- post {
71
- cleanup {
72
- script{
73
- if(rubyTasksGen?.results){
74
- writeJSON(file: 'results.json', json: toJSON(rubyTasksGen.results), pretty: 2)
75
- def mapResults = ["Ruby": rubyTasksGen.results]
76
- def processor = new ResultsProcessor()
77
- processor.processResults(mapResults)
78
- archiveArtifacts allowEmptyArchive: true, artifacts: 'results.json,results.html', defaultExcludes: false
79
- catchError(buildResult: 'SUCCESS') {
80
- def datafile = readFile(file: "results.json")
81
- def json = getVaultSecret(secret: 'secret/apm-team/ci/jenkins-stats-cloud')
82
- sendDataToElasticsearch(es: json.data.url, data: datafile, restCall: '/jenkins-builds-ruby-test-results/_doc/')
83
- }
84
- }
85
- }
86
- notifyBuildResult()
87
- }
88
- }
89
- }
90
-
91
- /**
92
- Parallel task generator for the integration tests.
93
- */
94
- class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
95
-
96
- public RubyParallelTaskGenerator(Map params){
97
- super(params)
98
- }
99
-
100
- /**
101
- build a clousure that launch and agent and execute the corresponding test script,
102
- then store the results.
103
- */
104
- public Closure generateStep(x, y){
105
- return {
106
- steps.sleep steps.randomNumber(min:10, max: 30)
107
- steps.node('linux && immutable'){
108
- // Label is transformed to avoid using the internal docker registry in the x coordinate
109
- // TODO: def label = "${tag}:${x?.drop(x?.lastIndexOf('/')+1)}#${y}"
110
- def label = "${tag}:${x}#${y}"
111
- try {
112
- steps.runScript(label: label, ruby: x, framework: y)
113
- saveResult(x, y, 1)
114
- } catch(e){
115
- saveResult(x, y, 0)
116
- steps.error("${label} tests failed : ${e.toString()}\n")
117
- } finally {
118
- steps.junit(allowEmptyResults: true,
119
- keepLongStdio: true,
120
- 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
- }
126
- }
127
- }
128
- }
129
- }
130
-
131
- /**
132
- Run tests for a Ruby version and framework version.
133
- */
134
- def runScript(Map params = [:]){
135
- def label = params.label
136
- def ruby = params.ruby
137
- def framework = params.framework
138
- log(level: 'INFO', text: "${label}")
139
- env.HOME = "${env.WORKSPACE}"
140
- env.PATH = "${env.PATH}:${env.WORKSPACE}/bin"
141
- deleteDir()
142
- unstash 'source'
143
- dir("${BASE_DIR}"){
144
- retry(2){
145
- sleep randomNumber(min:10, max: 30)
146
- dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
147
- sh("./spec/scripts/spec.sh ${ruby} ${framework}")
148
- }
149
- }
150
- }
151
-
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
- /**
164
- Run all the tests for the given ruby version and file with the frameworks to test
165
- */
166
- def runTests(frameworkFile) {
167
- deleteDir()
168
- unstash "source"
169
- dir("${BASE_DIR}"){
170
- script {
171
- rubyTasksGen = new RubyParallelTaskGenerator(
172
- xVersions: [ "${params.RUBY_VERSION}" ],
173
- xKey: 'RUBY_VERSION',
174
- yKey: 'FRAMEWORK',
175
- yFile: frameworkFile,
176
- exclusionFile: '.ci/.jenkins_exclude.yml',
177
- tag: 'Ruby',
178
- name: 'Ruby',
179
- steps: this
180
- )
181
- def mapPatallelTasks = rubyTasksGen.generateParallelTests()
182
- parallel(mapPatallelTasks)
183
- }
184
- }
185
- }
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -exo pipefail
3
-
4
- # Enable git+ssh. Env variables are created on the fly with the gitCheckout
5
- git config remote.origin.url "git@github.com:${ORG_NAME}/${REPO_NAME}.git"
6
-
7
- # Enable to fetch branches when cloning with a detached and shallow clone
8
- git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
9
-
10
- # Force the git user details when pushing using the last commit details
11
- USER_MAIL=$(git log -1 --pretty=format:'%ae')
12
- USER_NAME=$(git log -1 --pretty=format:'%an')
13
- git config user.email "${USER_MAIL}"
14
- git config user.name "${USER_NAME}"
15
-
16
- # Checkout the branch as it's detached based by default.
17
- # See https://issues.jenkins-ci.org/browse/JENKINS-33171
18
- git fetch --all
19
- git checkout "${BRANCH_NAME}"
20
-
21
- # Checkout the master branch to be able to rebase the *.x branch
22
- git checkout master
23
-
24
- # Ensure the master branch points to the original commit to avoid commit injection
25
- # when running the release pipeline.
26
- # used GIT_BASE_COMMIT instead GIT_COMMIT to support the MultiBranchPipelines.
27
- git reset --hard "${GIT_BASE_COMMIT}"
@@ -1 +0,0 @@
1
- Release notes are now available in our documentation at ([elastic.co](https://www.elastic.co/guide/en/apm/agent/ruby/current/release-notes.html))
@@ -1,32 +0,0 @@
1
- # Enable coverage report message for diff on commit
2
- # Docs can be found here: https://docs.codecov.io/v4.3.0/docs/commit-status
3
- coverage:
4
- status:
5
- project:
6
- default:
7
- target: 80%
8
- threshold: 1
9
- base: auto
10
- branches: null
11
- if_no_uploads: error
12
- if_not_found: success
13
- if_ci_failed: error
14
- only_pulls: false
15
- flags: null
16
- paths: null
17
- patch:
18
- default:
19
- target: auto
20
- # Allows PRs without tests, overall stats count
21
- threshold: 100
22
- base: auto
23
- branches: null
24
- if_no_uploads: error
25
- if_not_found: success
26
- if_ci_failed: error
27
- only_pulls: false
28
- flags: null
29
- paths: null
30
-
31
- # Disable comments on Pull Requests
32
- comment: false