elastic-apm 3.7.0 → 3.8.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 +139 -96
- data/.ci/packer_cache.sh +12 -10
- data/.rspec +0 -1
- data/CHANGELOG.asciidoc +16 -0
- data/Gemfile +2 -1
- data/bin/run-tests +4 -1
- data/docker-compose.yml +2 -0
- data/docs/configuration.asciidoc +37 -0
- data/lib/elastic_apm/config.rb +4 -8
- data/lib/elastic_apm/grpc.rb +2 -2
- data/lib/elastic_apm/metadata/service_info.rb +5 -2
- data/lib/elastic_apm/opentracing.rb +47 -23
- data/lib/elastic_apm/spies.rb +16 -14
- data/lib/elastic_apm/spies/elasticsearch.rb +16 -2
- data/lib/elastic_apm/spies/mongo.rb +1 -1
- data/lib/elastic_apm/spies/net_http.rb +6 -2
- data/lib/elastic_apm/spies/sequel.rb +1 -1
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +12 -56
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +27 -20
- data/lib/elastic_apm/version.rb +1 -1
- metadata +3 -3
- data/.ci/downstreamTests.groovy +0 -192
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32d176ac5c22246df60ecc92f1baad37011a872af4e64f842b5a43c699a6ced3
|
4
|
+
data.tar.gz: bf0505e728d8f1bd0bb941574a844a8990d14e13a94a7c9f2a6c2d0f9eb5d35b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d57b6bdbc7e78bea95e197d33f3eef4db7a35b23f9e450c636c3c1e3a5dd75ee8ee195709944ac51d6af7a3ab2451fd19d6139f0dedf9e86a4827732d5097f2a
|
7
|
+
data.tar.gz: 924b9bbf782a0fa4e376137e9a44d10cc01be71455ca7614ab1374c70f0926d174eb1078b985cd60c1693e2e0ec1cdd8446502bd40007359262dcc31241250aa
|
data/.ci/Jenkinsfile
CHANGED
@@ -5,14 +5,10 @@ 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' }
|
@@ -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.')
|
@@ -98,50 +94,53 @@ pipeline {
|
|
98
94
|
/**
|
99
95
|
Execute unit tests.
|
100
96
|
*/
|
101
|
-
stage('
|
102
|
-
options { skipDefaultCheckout() }
|
97
|
+
stage('Tests') {
|
103
98
|
when {
|
104
99
|
beforeAgent true
|
105
100
|
expression { return env.ONLY_DOCS == "false" }
|
106
101
|
}
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
parallel(testTasks)
|
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()
|
120
114
|
}
|
121
115
|
}
|
122
116
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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) ])
|
134
142
|
}
|
135
143
|
}
|
136
|
-
}
|
137
|
-
steps {
|
138
|
-
build(job: env.ITS_PIPELINE, propagate: false, wait: false,
|
139
|
-
parameters: [string(name: 'INTEGRATION_TEST', value: 'Ruby'),
|
140
|
-
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}"),
|
141
|
-
string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
|
142
|
-
string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
|
143
|
-
string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT)])
|
144
|
-
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('/','+')}")
|
145
144
|
}
|
146
145
|
}
|
147
146
|
stage('Benchmarks') {
|
@@ -155,6 +154,7 @@ pipeline {
|
|
155
154
|
branch "v\\d?"
|
156
155
|
tag pattern: 'v\\d+.*', comparator: "REGEXP"
|
157
156
|
expression { return params.Run_As_Master_Branch }
|
157
|
+
expression { return env.GITHUB_COMMENT?.contains('benchmark tests') }
|
158
158
|
}
|
159
159
|
expression { return params.bench_ci }
|
160
160
|
}
|
@@ -195,20 +195,6 @@ pipeline {
|
|
195
195
|
}
|
196
196
|
}
|
197
197
|
}
|
198
|
-
stage('Populate Downstream failures') {
|
199
|
-
when {
|
200
|
-
expression { return rubyTasksFailed }
|
201
|
-
}
|
202
|
-
steps {
|
203
|
-
script {
|
204
|
-
def message = 'Failures when running the "Test" stage'
|
205
|
-
if (notifyBuildResult.isAnyDownstreamJobFailedWithTimeout(rubyDownstreamJobs)) {
|
206
|
-
message += ' related to a timeout issue'
|
207
|
-
}
|
208
|
-
error(message)
|
209
|
-
}
|
210
|
-
}
|
211
|
-
}
|
212
198
|
stage('Release') {
|
213
199
|
options { skipDefaultCheckout() }
|
214
200
|
environment {
|
@@ -272,33 +258,14 @@ pipeline {
|
|
272
258
|
}
|
273
259
|
}
|
274
260
|
}
|
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
|
-
}
|
288
261
|
}
|
289
262
|
post {
|
290
263
|
cleanup {
|
291
|
-
notifyBuildResult(
|
264
|
+
notifyBuildResult()
|
292
265
|
}
|
293
266
|
}
|
294
267
|
}
|
295
268
|
|
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
|
-
|
302
269
|
/**
|
303
270
|
Run benchmarks for a Ruby version, then report the results to the Elasticsearch server.
|
304
271
|
*/
|
@@ -337,26 +304,95 @@ def runBenchmark(version){
|
|
337
304
|
}
|
338
305
|
}
|
339
306
|
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
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)
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}
|
357
340
|
}
|
358
|
-
}
|
359
|
-
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
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
|
360
396
|
}
|
361
397
|
}
|
362
398
|
|
@@ -374,3 +410,10 @@ def prepareRelease(Closure body){
|
|
374
410
|
}
|
375
411
|
}
|
376
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
|
+
}
|
data/.ci/packer_cache.sh
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
|
3
3
|
source /usr/local/bin/bash_standard_lib.sh
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
data/CHANGELOG.asciidoc
CHANGED
@@ -35,7 +35,23 @@ endif::[]
|
|
35
35
|
[[release-notes-3.x]]
|
36
36
|
=== Ruby Agent version 3.x
|
37
37
|
|
38
|
+
[[release-notes-3.8.0]]
|
39
|
+
==== 3.8.0 (2020-06-18)
|
40
|
+
|
41
|
+
[float]
|
42
|
+
===== Added
|
43
|
+
|
44
|
+
- Add the option `capture_elasticsearch_queries` {pull}789[#789]
|
45
|
+
- Add option to skip patching Kernal#require {pull}812[#812]
|
46
|
+
- Add option `service_node_name` {pull}820[#820]
|
47
|
+
|
38
48
|
[float]
|
49
|
+
===== Fixed
|
50
|
+
|
51
|
+
- Allow underscores in hostnames in Net::HTTP spy {pull}804[#804]
|
52
|
+
- Don't change log level on logger object via remote config {pull}809[#809]
|
53
|
+
- Update and fix the Opentracing bridge {pull}791[#791]
|
54
|
+
|
39
55
|
[[release-notes-3.7.0]]
|
40
56
|
==== 3.7.0 (2020-05-14)
|
41
57
|
|
data/Gemfile
CHANGED
@@ -39,7 +39,8 @@ gem 'elasticsearch', require: nil
|
|
39
39
|
gem 'fakeredis', require: nil
|
40
40
|
gem 'faraday', require: nil
|
41
41
|
gem 'graphql', require: nil
|
42
|
-
gem '
|
42
|
+
gem 'google-protobuf', '< 3.12' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '2.5'
|
43
|
+
gem 'grpc' if !defined?(JRUBY_VERSION)
|
43
44
|
gem 'json-schema', require: nil
|
44
45
|
gem 'mongo', require: nil
|
45
46
|
gem 'opentracing', require: nil
|
data/bin/run-tests
CHANGED
@@ -8,7 +8,10 @@ runRspec(){
|
|
8
8
|
if [ -n "${case}" ]; then
|
9
9
|
bn="$(basename ${case} _spec.rb)/"
|
10
10
|
fi
|
11
|
-
bundle exec rspec
|
11
|
+
bundle exec rspec \
|
12
|
+
-f progress \
|
13
|
+
-r yarjuf -f JUnit -o spec/junit-reports/${bn}ruby-agent-junit.xml \
|
14
|
+
${case}
|
12
15
|
}
|
13
16
|
specific_spec=$1
|
14
17
|
|
data/docker-compose.yml
CHANGED
data/docs/configuration.asciidoc
CHANGED
@@ -287,6 +287,16 @@ If your service handles data like this, we advise to only enable this feature wi
|
|
287
287
|
|
288
288
|
Whether or not to attach the request headers to transactions and errors.
|
289
289
|
|
290
|
+
[float]
|
291
|
+
[[config-capture-elasticsearch-queries]]
|
292
|
+
==== `capture_elasticsearch_queries`
|
293
|
+
|============
|
294
|
+
| Environment | `Config` key | Default
|
295
|
+
| `ELASTIC_APM_CAPTURE_ELASTICSEARCH_QUERIES` | `capture_elasticsearch_queries` | `false`
|
296
|
+
|============
|
297
|
+
|
298
|
+
Whether or not to capture the body from requests in Elasticsearch.
|
299
|
+
|
290
300
|
[float]
|
291
301
|
[[config-capture-env]]
|
292
302
|
==== `capture_env`
|
@@ -707,6 +717,23 @@ NOTE: The service name must conform to this regular expression: `^[a-zA-Z0-9 _-]
|
|
707
717
|
In layman's terms: Your service name must only contain characters from the ASCII
|
708
718
|
alphabet, numbers, dashes, underscores and spaces.
|
709
719
|
|
720
|
+
[float]
|
721
|
+
[[config-service-node-name]]
|
722
|
+
==== `service_node_name`
|
723
|
+
|
724
|
+
[options="header"]
|
725
|
+
|============
|
726
|
+
| Environment | `Config` key | Default | Example
|
727
|
+
| `ELASTIC_APM_SERVICE_NODE_NAME` | `service_node_name` | `nil` | `"my-app-1"`
|
728
|
+
|============
|
729
|
+
|
730
|
+
The name of the given service node. This is optional, and if omitted, the APM
|
731
|
+
Server will fall back on `system.container.id` if available, and finally
|
732
|
+
`host.name` if necessary.
|
733
|
+
|
734
|
+
This option allows you to set the node name manually to ensure uniqueness and
|
735
|
+
meaningfulness.
|
736
|
+
|
710
737
|
[float]
|
711
738
|
[[config-service-version]]
|
712
739
|
==== `service_version`
|
@@ -890,3 +917,13 @@ The unit is provided as suffix directly after the number, without any separation
|
|
890
917
|
* `gb` (gigabytes)
|
891
918
|
|
892
919
|
NOTE: we use the power-of-two sizing convention, e.g. `1 kilobyte == 1024 bytes`
|
920
|
+
|
921
|
+
[float]
|
922
|
+
[[special-configuration]]
|
923
|
+
=== Special configuration
|
924
|
+
|
925
|
+
Elastic APM patches `Kernel#require` to auto-detect and instrument supported third party libraries. It does so with the utmost care but in rare cases it can conflict with some libraries.
|
926
|
+
|
927
|
+
To get around this patch, set the environment variable `ELASTIC_APM_SKIP_REQUIRE_PATCH` to `"1"`.
|
928
|
+
|
929
|
+
If you choose to do so, the agent might need some additional tweaking to make sure the third party libraries are picked up and instrumented. Make sure you require the agent _after_ you require your other dependencies.
|