elastic-apm 3.5.0 → 3.10.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.
- checksums.yaml +4 -4
- data/.ci/Jenkinsfile +286 -183
- data/.ci/docker/jruby/11-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/12-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/13-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/7-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/8-jdk/Dockerfile +40 -0
- data/.ci/docker/jruby/README.md +31 -0
- data/.ci/docker/jruby/run.sh +73 -0
- data/.ci/docker/jruby/test.sh +13 -0
- data/.ci/jobs/defaults.yml +1 -1
- data/.ci/packer_cache.sh +12 -10
- data/.gitignore +3 -1
- data/.rspec +0 -1
- data/.rubocop.yml +13 -1
- data/CHANGELOG.asciidoc +92 -0
- data/CONTRIBUTING.md +6 -4
- data/Gemfile +35 -9
- data/Rakefile +37 -5
- data/bin/run-tests +4 -1
- data/docker-compose.yml +7 -0
- data/docs/api.asciidoc +14 -2
- data/docs/configuration.asciidoc +122 -27
- data/docs/debugging.asciidoc +14 -0
- data/docs/getting-started-rails.asciidoc +2 -0
- data/docs/graphql.asciidoc +23 -0
- data/docs/images/dynamic-config.svg +1 -0
- data/docs/index.asciidoc +6 -1
- data/docs/introduction.asciidoc +2 -1
- data/docs/performance-tuning.asciidoc +106 -0
- data/docs/set-up.asciidoc +5 -2
- data/docs/supported-technologies.asciidoc +68 -1
- data/docs/upgrading.asciidoc +45 -0
- data/elastic-apm.gemspec +17 -0
- data/lib/elastic-apm.rb +17 -0
- data/lib/elastic_apm.rb +29 -0
- data/lib/elastic_apm/agent.rb +48 -2
- data/lib/elastic_apm/central_config.rb +27 -8
- data/lib/elastic_apm/central_config/cache_control.rb +17 -0
- data/lib/elastic_apm/child_durations.rb +17 -0
- data/lib/elastic_apm/config.rb +59 -3
- data/lib/elastic_apm/config/bytes.rb +17 -0
- data/lib/elastic_apm/config/duration.rb +17 -0
- data/lib/elastic_apm/config/options.rb +18 -1
- data/lib/elastic_apm/config/regexp_list.rb +17 -0
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +28 -1
- data/lib/elastic_apm/context.rb +17 -0
- data/lib/elastic_apm/context/request.rb +17 -0
- data/lib/elastic_apm/context/request/socket.rb +17 -0
- data/lib/elastic_apm/context/request/url.rb +17 -0
- data/lib/elastic_apm/context/response.rb +17 -0
- data/lib/elastic_apm/context/user.rb +17 -0
- data/lib/elastic_apm/context_builder.rb +18 -1
- data/lib/elastic_apm/deprecations.rb +17 -0
- data/lib/elastic_apm/error.rb +17 -0
- data/lib/elastic_apm/error/exception.rb +17 -0
- data/lib/elastic_apm/error/log.rb +17 -0
- data/lib/elastic_apm/error_builder.rb +17 -0
- data/lib/elastic_apm/grape.rb +17 -0
- data/lib/elastic_apm/graphql.rb +91 -0
- data/lib/elastic_apm/grpc.rb +99 -0
- data/lib/elastic_apm/instrumenter.rb +29 -4
- data/lib/elastic_apm/internal_error.rb +17 -0
- data/lib/elastic_apm/logging.rb +17 -0
- data/lib/elastic_apm/metadata.rb +17 -0
- data/lib/elastic_apm/metadata/process_info.rb +17 -0
- data/lib/elastic_apm/metadata/service_info.rb +22 -2
- data/lib/elastic_apm/metadata/system_info.rb +22 -3
- data/lib/elastic_apm/metadata/system_info/container_info.rb +45 -4
- data/lib/elastic_apm/metrics.rb +33 -1
- data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
- data/lib/elastic_apm/metrics/metric.rb +17 -0
- data/lib/elastic_apm/metrics/set.rb +17 -0
- data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
- data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
- data/lib/elastic_apm/metrics/vm_set.rb +17 -0
- data/lib/elastic_apm/metricset.rb +17 -0
- data/lib/elastic_apm/middleware.rb +25 -2
- data/lib/elastic_apm/naively_hashable.rb +17 -0
- data/lib/elastic_apm/normalizers.rb +17 -0
- data/lib/elastic_apm/normalizers/grape.rb +17 -0
- data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
- data/lib/elastic_apm/normalizers/rails.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
- data/lib/elastic_apm/opentracing.rb +64 -23
- data/lib/elastic_apm/rails.rb +17 -0
- data/lib/elastic_apm/railtie.rb +17 -0
- data/lib/elastic_apm/resque.rb +29 -0
- data/lib/elastic_apm/sinatra.rb +17 -0
- data/lib/elastic_apm/span.rb +20 -2
- data/lib/elastic_apm/span/context.rb +17 -0
- data/lib/elastic_apm/span/context/db.rb +17 -0
- data/lib/elastic_apm/span/context/destination.rb +37 -4
- data/lib/elastic_apm/span/context/http.rb +17 -0
- data/lib/elastic_apm/span_helpers.rb +17 -0
- data/lib/elastic_apm/spies.rb +33 -14
- data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
- data/lib/elastic_apm/spies/delayed_job.rb +17 -0
- data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
- data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
- data/lib/elastic_apm/spies/faraday.rb +17 -0
- data/lib/elastic_apm/spies/http.rb +17 -0
- data/lib/elastic_apm/spies/json.rb +17 -0
- data/lib/elastic_apm/spies/mongo.rb +18 -1
- data/lib/elastic_apm/spies/net_http.rb +23 -2
- data/lib/elastic_apm/spies/rake.rb +17 -0
- data/lib/elastic_apm/spies/redis.rb +17 -0
- data/lib/elastic_apm/spies/resque.rb +53 -0
- data/lib/elastic_apm/spies/sequel.rb +18 -1
- data/lib/elastic_apm/spies/shoryuken.rb +17 -0
- data/lib/elastic_apm/spies/sidekiq.rb +17 -0
- data/lib/elastic_apm/spies/sinatra.rb +17 -0
- data/lib/elastic_apm/spies/sneakers.rb +17 -0
- data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
- data/lib/elastic_apm/spies/tilt.rb +17 -0
- data/lib/elastic_apm/sql.rb +21 -4
- data/lib/elastic_apm/sql/signature.rb +17 -0
- data/lib/elastic_apm/sql/tokenizer.rb +17 -0
- data/lib/elastic_apm/sql/tokens.rb +17 -0
- data/lib/elastic_apm/sql_summarizer.rb +17 -0
- data/lib/elastic_apm/stacktrace.rb +17 -0
- data/lib/elastic_apm/stacktrace/frame.rb +17 -0
- data/lib/elastic_apm/stacktrace_builder.rb +23 -1
- data/lib/elastic_apm/subscriber.rb +17 -0
- data/lib/elastic_apm/trace_context.rb +51 -11
- data/lib/elastic_apm/trace_context/traceparent.rb +17 -0
- data/lib/elastic_apm/trace_context/tracestate.rb +17 -0
- data/lib/elastic_apm/transaction.rb +33 -5
- data/lib/elastic_apm/transport/base.rb +39 -23
- data/lib/elastic_apm/transport/connection.rb +17 -0
- data/lib/elastic_apm/transport/connection/http.rb +17 -0
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
- data/lib/elastic_apm/transport/filters.rb +17 -0
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +29 -56
- data/lib/elastic_apm/transport/headers.rb +17 -0
- data/lib/elastic_apm/transport/serializers.rb +17 -0
- data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
- data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +20 -1
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
- data/lib/elastic_apm/transport/user_agent.rb +17 -0
- data/lib/elastic_apm/transport/worker.rb +21 -0
- data/lib/elastic_apm/util.rb +17 -0
- data/lib/elastic_apm/util/inflector.rb +17 -0
- data/lib/elastic_apm/util/lru_cache.rb +17 -0
- data/lib/elastic_apm/util/throttle.rb +17 -0
- data/lib/elastic_apm/version.rb +18 -1
- metadata +26 -12
- data/.ci/downstreamTests.groovy +0 -185
- data/.ci/prepare-git-context.sh +0 -27
- data/CHANGELOG.md +0 -1
- data/codecov.yml +0 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9c3bd29131a80fd061ecda5285eaf367f1e5643a5d6bd27b753fb566fa51799
|
|
4
|
+
data.tar.gz: 51b05bac2568d0c55f83444cef9f297400078a7cbcb0fef6c6ef4ce9cfdfe2fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db6319dbfcbe5f2429c72aebb8132bc9d1a35b4ec28aa15ecd1bb06fff4a326ad41f4753a3fb54f6f85635d9429d434f4f30b2ea23013cf7e775cb6f2d3a8a23
|
|
7
|
+
data.tar.gz: 32f64b02b56d214a019279b84bdaa3b04f6d72fac06d664326d0939c16c0b50a05b3654ae87a68a057c17c576679cbc726dd890cde2ac1068dd7a0fbbb05b030
|
data/.ci/Jenkinsfile
CHANGED
|
@@ -5,21 +5,17 @@ import co.elastic.matrix.*
|
|
|
5
5
|
import groovy.transform.Field
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
|
|
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
|
|
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='
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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,173 +94,177 @@ pipeline {
|
|
|
89
94
|
/**
|
|
90
95
|
Execute unit tests.
|
|
91
96
|
*/
|
|
92
|
-
stage('
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
97
|
+
stage('Tests') {
|
|
98
|
+
when {
|
|
99
|
+
beforeAgent true
|
|
100
|
+
expression { return env.ONLY_DOCS == "false" }
|
|
111
101
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
branch "\\d+\\.\\d+"
|
|
120
|
-
branch "v\\d?"
|
|
121
|
-
tag "v\\d+\\.\\d+\\.\\d+*"
|
|
122
|
-
expression { return params.Run_As_Master_Branch }
|
|
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')
|
|
123
109
|
}
|
|
124
|
-
expression { return params.bench_ci }
|
|
125
110
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
agent { label 'metal' }
|
|
130
|
-
steps {
|
|
131
|
-
echo "Cleaning Workspace"
|
|
132
|
-
}
|
|
133
|
-
post {
|
|
134
|
-
always {
|
|
135
|
-
cleanWs()
|
|
136
|
-
}
|
|
111
|
+
post {
|
|
112
|
+
always {
|
|
113
|
+
convergeCoverage()
|
|
137
114
|
}
|
|
138
115
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
withGithubNotify(context: 'Run Benchmarks') {
|
|
146
|
-
deleteDir()
|
|
147
|
-
unstash 'source'
|
|
148
|
-
dir("${BASE_DIR}"){
|
|
149
|
-
script {
|
|
150
|
-
def versions = readYaml(file: ".ci/.jenkins_ruby.yml")
|
|
151
|
-
def benchmarkTask = [:]
|
|
152
|
-
versions['RUBY_VERSION'].each{ v ->
|
|
153
|
-
benchmarkTask[v] = runBenchmark(v)
|
|
154
|
-
}
|
|
155
|
-
parallel(benchmarkTask)
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
116
|
+
}
|
|
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')
|
|
159
122
|
}
|
|
160
123
|
}
|
|
161
124
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def message = 'Failures when running the "Test" stage'
|
|
170
|
-
if (notifyBuildResult.isAnyDownstreamJobFailedWithTimeout(rubyDownstreamJobs)) {
|
|
171
|
-
message += ' related to a timeout issue'
|
|
125
|
+
stage('Integration Tests') {
|
|
126
|
+
agent none
|
|
127
|
+
when {
|
|
128
|
+
beforeAgent true
|
|
129
|
+
anyOf {
|
|
130
|
+
changeRequest()
|
|
131
|
+
expression { return !params.Run_As_Master_Branch }
|
|
172
132
|
}
|
|
173
|
-
|
|
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) ])
|
|
174
142
|
}
|
|
175
143
|
}
|
|
176
144
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
145
|
+
}
|
|
146
|
+
stage('Benchmarks') {
|
|
147
|
+
options { skipDefaultCheckout() }
|
|
148
|
+
when {
|
|
149
|
+
beforeAgent true
|
|
150
|
+
allOf {
|
|
181
151
|
anyOf {
|
|
182
|
-
|
|
183
|
-
|
|
152
|
+
branch 'master'
|
|
153
|
+
branch "\\d+\\.\\d+"
|
|
154
|
+
branch "v\\d?"
|
|
155
|
+
tag pattern: 'v\\d+.*', comparator: "REGEXP"
|
|
156
|
+
expression { return params.Run_As_Master_Branch }
|
|
157
|
+
expression { return env.GITHUB_COMMENT?.contains('benchmark tests') }
|
|
184
158
|
}
|
|
185
|
-
|
|
186
|
-
steps {
|
|
187
|
-
log(level: 'INFO', text: 'Launching Async ITs')
|
|
188
|
-
build(job: env.ITS_PIPELINE, propagate: false, wait: false,
|
|
189
|
-
parameters: [string(name: 'AGENT_INTEGRATION_TEST', value: 'Ruby'),
|
|
190
|
-
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}"),
|
|
191
|
-
string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
|
|
192
|
-
string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
|
|
193
|
-
string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT)]
|
|
194
|
-
)
|
|
195
|
-
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('/','+')}")
|
|
159
|
+
expression { return params.bench_ci }
|
|
196
160
|
}
|
|
197
161
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
162
|
+
stages {
|
|
163
|
+
stage('Clean Workspace') {
|
|
164
|
+
agent { label 'metal' }
|
|
165
|
+
steps {
|
|
166
|
+
echo "Cleaning Workspace"
|
|
167
|
+
}
|
|
168
|
+
post {
|
|
169
|
+
always {
|
|
170
|
+
cleanWs()
|
|
171
|
+
}
|
|
172
|
+
}
|
|
207
173
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
174
|
+
/**
|
|
175
|
+
Run the benchmarks and store the results on ES.
|
|
176
|
+
The result JSON files are also archive into Jenkins.
|
|
177
|
+
*/
|
|
178
|
+
stage('Run Benchmarks') {
|
|
179
|
+
steps {
|
|
180
|
+
withGithubNotify(context: 'Run Benchmarks') {
|
|
181
|
+
deleteDir()
|
|
182
|
+
unstash 'source'
|
|
183
|
+
dir("${BASE_DIR}"){
|
|
214
184
|
script {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
sshagent(['f6c7695a-671e-4f4f-a331-acdce44ff9ba']) {
|
|
220
|
-
sh '.ci/prepare-git-context.sh'
|
|
221
|
-
sh 'gem install rake yard rspec'
|
|
222
|
-
sh 'rake release'
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
185
|
+
def versions = readYaml(file: ".ci/.jenkins_ruby.yml")
|
|
186
|
+
def benchmarkTask = [:]
|
|
187
|
+
versions['RUBY_VERSION'].each{ v ->
|
|
188
|
+
benchmarkTask[v] = runBenchmark(v)
|
|
227
189
|
}
|
|
190
|
+
parallel(benchmarkTask)
|
|
228
191
|
}
|
|
229
192
|
}
|
|
230
193
|
}
|
|
231
194
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
stage('Release') {
|
|
199
|
+
options { skipDefaultCheckout() }
|
|
200
|
+
environment {
|
|
201
|
+
RUBY_DOCKER_TAG = 'ruby:2.6'
|
|
202
|
+
HOME = '/var/lib/jenkins'
|
|
203
|
+
}
|
|
204
|
+
when {
|
|
205
|
+
beforeAgent true
|
|
206
|
+
tag pattern: 'v\\d+.*', comparator: 'REGEXP'
|
|
207
|
+
}
|
|
208
|
+
stages {
|
|
209
|
+
stage('Release') {
|
|
210
|
+
steps {
|
|
211
|
+
deleteDir()
|
|
212
|
+
unstash 'source'
|
|
213
|
+
prepareRelease(){
|
|
214
|
+
sh 'rake release'
|
|
235
215
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// The opbeans pipeline will trigger a release for the release tag
|
|
246
|
-
gitCreateTag(tag: "${env.BRANCH_NAME}")
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
stage('Update Branch') {
|
|
219
|
+
steps {
|
|
220
|
+
deleteDir()
|
|
221
|
+
unstash 'source'
|
|
222
|
+
prepareRelease(){
|
|
223
|
+
catchError(buildResult: 'SUCCESS', message: 'Update branch task failed', stageResult: 'UNSTABLE') {
|
|
224
|
+
sh 'rake release:update_branch'
|
|
247
225
|
}
|
|
248
226
|
}
|
|
249
227
|
}
|
|
228
|
+
post {
|
|
229
|
+
unsuccessful {
|
|
230
|
+
emailext subject: "[${env.REPO}] Syncup post-release stage failed.", to: "${NOTIFY_TO}",
|
|
231
|
+
body: "Please go to ${env.BUILD_URL} to review the logs. Most likely you need to update the branch manually."
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
stage('Opbeans') {
|
|
236
|
+
environment {
|
|
237
|
+
REPO_NAME = "${OPBEANS_REPO}"
|
|
238
|
+
VERSION = "${env.BRANCH_NAME.replaceAll('^v', '')}"
|
|
239
|
+
}
|
|
240
|
+
steps {
|
|
241
|
+
deleteDir()
|
|
242
|
+
// Let's wait for the Gem to be available
|
|
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
|
+
"""
|
|
247
|
+
dir("${OPBEANS_REPO}"){
|
|
248
|
+
git credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba',
|
|
249
|
+
url: "git@github.com:elastic/${OPBEANS_REPO}.git"
|
|
250
|
+
// It's required to transform the tag value to the gem version
|
|
251
|
+
sh script: ".ci/bump-version.sh ${env.VERSION}", label: 'Bump version'
|
|
252
|
+
// The opbeans pipeline will trigger a release for the master branch
|
|
253
|
+
gitPush()
|
|
254
|
+
// The opbeans pipeline will trigger a release for the release tag
|
|
255
|
+
gitCreateTag(tag: "${env.BRANCH_NAME}")
|
|
256
|
+
}
|
|
257
|
+
}
|
|
250
258
|
}
|
|
251
259
|
}
|
|
252
260
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
261
|
+
}
|
|
262
|
+
post {
|
|
263
|
+
cleanup {
|
|
264
|
+
notifyBuildResult()
|
|
257
265
|
}
|
|
258
266
|
}
|
|
267
|
+
}
|
|
259
268
|
|
|
260
269
|
/**
|
|
261
270
|
Run benchmarks for a Ruby version, then report the results to the Elasticsearch server.
|
|
@@ -267,26 +276,64 @@ def runBenchmark(version){
|
|
|
267
276
|
// - docker.elastic.co/observability-ci/jruby:9.2-12-jdk to jruby-9.2-12-jdk
|
|
268
277
|
// - jruby:9.1 to jruby-9.1
|
|
269
278
|
def transformedVersion = version.replaceAll('.*/', '').replaceAll(':', '-')
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
+
}
|
|
278
300
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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)
|
|
290
337
|
}
|
|
291
338
|
}
|
|
292
339
|
}
|
|
@@ -294,23 +341,79 @@ def runBenchmark(version){
|
|
|
294
341
|
}
|
|
295
342
|
}
|
|
296
343
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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}"))
|
|
393
|
+
}
|
|
394
|
+
sh(script: './spec/scripts/coverage_converge.sh')
|
|
395
|
+
cobertura coberturaReportFile: 'coverage/coverage.xml', onlyStable: false
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
def prepareRelease(Closure body){
|
|
400
|
+
dir("${env.BASE_DIR}"){
|
|
401
|
+
docker.image("${env.RUBY_DOCKER_TAG}").inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
|
|
402
|
+
withEnv(["HOME=${env.WORKSPACE}/${env.BASE_DIR ?: ''}"]) {
|
|
403
|
+
rubygemsLogin.withApi(secret: "${env.RELEASE_SECRET}") {
|
|
404
|
+
withGitRelease(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken') {
|
|
405
|
+
sh 'gem install rake yard rspec'
|
|
406
|
+
body()
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
312
410
|
}
|
|
313
|
-
} finally {
|
|
314
|
-
rubyDownstreamJobs["${rubyVersion}"] = buildObject
|
|
315
411
|
}
|
|
316
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
|
+
}
|