elastic-apm 4.5.1 → 4.6.1

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.ci/.jenkins_exclude.yml +73 -16
  3. data/.ci/.jenkins_framework.yml +3 -2
  4. data/.ci/.jenkins_ruby.yml +1 -1
  5. data/.ci/.jenkins_ruby_benchmarks.yml +6 -0
  6. data/.ci/Jenkinsfile +35 -26
  7. data/.ci/docker/jruby/11-jdk/Dockerfile +3 -0
  8. data/.ci/docker/jruby/12-jdk/Dockerfile +3 -0
  9. data/.ci/docker/jruby/13-jdk/Dockerfile +3 -0
  10. data/.ci/docker/jruby/7-jdk/Dockerfile +3 -0
  11. data/.ci/docker/jruby/8-jdk/Dockerfile +3 -0
  12. data/.ci/snapshoty.yml +34 -0
  13. data/.ci/update-specs.yml +108 -0
  14. data/.github/workflows/update-specs.yml +30 -0
  15. data/CHANGELOG.asciidoc +34 -0
  16. data/Gemfile +10 -3
  17. data/bench/report.rb +1 -1
  18. data/docker-compose.yml +6 -0
  19. data/docs/configuration.asciidoc +6 -4
  20. data/elastic-apm.gemspec +3 -2
  21. data/lib/elastic_apm/central_config.rb +5 -0
  22. data/lib/elastic_apm/config/server_info.rb +50 -0
  23. data/lib/elastic_apm/config.rb +25 -4
  24. data/lib/elastic_apm/error.rb +2 -1
  25. data/lib/elastic_apm/error_builder.rb +1 -0
  26. data/lib/elastic_apm/instrumenter.rb +4 -2
  27. data/lib/elastic_apm/metadata/system_info/container_info.rb +4 -3
  28. data/lib/elastic_apm/metadata/system_info.rb +1 -1
  29. data/lib/elastic_apm/span/context/links.rb +32 -0
  30. data/lib/elastic_apm/span/context/service.rb +55 -0
  31. data/lib/elastic_apm/span/context.rb +19 -3
  32. data/lib/elastic_apm/span.rb +3 -0
  33. data/lib/elastic_apm/span_helpers.rb +2 -2
  34. data/lib/elastic_apm/spies/faraday.rb +23 -0
  35. data/lib/elastic_apm/spies/racecar.rb +77 -0
  36. data/lib/elastic_apm/spies/redis.rb +1 -1
  37. data/lib/elastic_apm/spies/sequel.rb +9 -0
  38. data/lib/elastic_apm/spies/sqs.rb +1 -0
  39. data/lib/elastic_apm/trace_context/tracestate.rb +4 -2
  40. data/lib/elastic_apm/trace_context.rb +1 -1
  41. data/lib/elastic_apm/transport/connection/http.rb +9 -3
  42. data/lib/elastic_apm/transport/serializers/span_serializer.rb +25 -0
  43. data/lib/elastic_apm/version.rb +1 -1
  44. data/lib/elastic_apm.rb +1 -0
  45. metadata +26 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 176cc8d035203774027d36d50769b763761354f3b9627f024ce90e07cd9069e3
4
- data.tar.gz: 19a6d7ed6796133c1b79b2e762718f4be7068e4e5876e13e9e898894fc112900
3
+ metadata.gz: 49b381ca37784473aef9bf3462b37eb77b3d263dfd402adf929c866153f81af3
4
+ data.tar.gz: 51f9290d7cace3428273171484ab6f6526e1309bdb2d27a101d9e74a17f9f619
5
5
  SHA512:
6
- metadata.gz: e2c34d43d849374706b481eabda64190ae0469e6770f068166eae20d42f7b12a54213820fac8a78e9343cca785f68378e9d4212a3fa6235966f6bb2a8517ca2d
7
- data.tar.gz: c19991391535b0ab3087bcdb3bf3d7354a160570fa08a80c313391ab739c9996872e1b68f7ec164223bec2f2f70e643daa6c2ca69adb9549a1255abac5c1f794
6
+ metadata.gz: 55c315cf52ce113f032b471f64d6662d4e5b9d85577bf228913da82c3f114cdc1846c70a8078de2fc7e1362c89f2cff2559b6e6b046007667feeb0c194223e75
7
+ data.tar.gz: 9962145d110f552e1beb449e721389cefe17bb862b3e255f48ef236170fa04523c29654f11fb3e1cc89cc5b8f69e14f0678cab51431b86a501ec016631278992
@@ -1,6 +1,8 @@
1
1
  exclude:
2
2
  # Ruby 2.4
3
- # Only includes rails-5.2, sinatra-2.0
3
+ # Only test on rails-5.2, sinatra-1.4
4
+ - RUBY_VERSION: ruby:2.4
5
+ FRAMEWORK: rails-7.0
4
6
  - RUBY_VERSION: ruby:2.4
5
7
  FRAMEWORK: rails-6.1
6
8
  - RUBY_VERSION: ruby:2.4
@@ -8,11 +10,11 @@ exclude:
8
10
  - RUBY_VERSION: ruby:2.4
9
11
  FRAMEWORK: rails-4.2
10
12
  - RUBY_VERSION: ruby:2.4
11
- FRAMEWORK: sinatra-1.4
13
+ FRAMEWORK: sinatra-2.2
12
14
  - RUBY_VERSION: ruby:2.4
13
15
  FRAMEWORK: grape-1.6
14
16
  - RUBY_VERSION: ruby:2.4
15
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.0
17
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.0
16
18
  - RUBY_VERSION: ruby:2.4
17
19
  FRAMEWORK: rails-main
18
20
  - RUBY_VERSION: ruby:2.4
@@ -21,7 +23,9 @@ exclude:
21
23
  FRAMEWORK: grape-master
22
24
 
23
25
  # rails-4.2 exclusions
24
- # Only test on ruby 2.6, 2.5, 2.4, 2.3
26
+ # Only test on ruby 2.6, 2.5, 2.4
27
+ - RUBY_VERSION: ruby:3.1
28
+ FRAMEWORK: rails-4.2
25
29
  - RUBY_VERSION: ruby:3.0
26
30
  FRAMEWORK: rails-4.2
27
31
  - RUBY_VERSION: ruby:2.7
@@ -35,6 +39,8 @@ exclude:
35
39
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
36
40
  FRAMEWORK: rails-4.2
37
41
  # sinatra-1.4 exclusions
42
+ - RUBY_VERSION: ruby:3.1
43
+ FRAMEWORK: sinatra-1.4
38
44
  - RUBY_VERSION: ruby:3.0
39
45
  FRAMEWORK: sinatra-1.4
40
46
  - RUBY_VERSION: ruby:2.7
@@ -55,7 +61,11 @@ exclude:
55
61
  - RUBY_VERSION: ruby:2.4
56
62
  FRAMEWORK: rails-6.0
57
63
 
58
- # Only test rails master on ruby 2.7 and ruby 3.0
64
+ # Only test rails master on ruby 3.1
65
+ - RUBY_VERSION: ruby:3.0
66
+ FRAMEWORK: rails-main
67
+ - RUBY_VERSION: ruby:2.7
68
+ FRAMEWORK: rails-main
59
69
  - RUBY_VERSION: ruby:2.6
60
70
  FRAMEWORK: rails-main
61
71
  - RUBY_VERSION: ruby:2.5
@@ -71,7 +81,25 @@ exclude:
71
81
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
72
82
  FRAMEWORK: rails-main
73
83
 
74
- # Only test sinatra master on ruby 2.7 and ruby 3.0
84
+ # Only test rails 7.0 on ruby >= 2.7
85
+ - RUBY_VERSION: ruby:2.6
86
+ FRAMEWORK: rails-7.0
87
+ - RUBY_VERSION: ruby:2.5
88
+ FRAMEWORK: rails-7.0
89
+ - RUBY_VERSION: ruby:2.4
90
+ FRAMEWORK: rails-7.0
91
+ - RUBY_VERSION: jruby:9.2
92
+ FRAMEWORK: rails-7.0
93
+ - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-13-jdk
94
+ FRAMEWORK: rails-7.0
95
+ - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-11-jdk
96
+ FRAMEWORK: rails-7.0
97
+ - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
98
+ FRAMEWORK: rails-7.0
99
+
100
+ # Only test sinatra master on ruby 2.7 and ruby 3.1
101
+ - RUBY_VERSION: ruby:3.0
102
+ FRAMEWORK: sinatra-master
75
103
  - RUBY_VERSION: ruby:2.6
76
104
  FRAMEWORK: sinatra-master
77
105
  - RUBY_VERSION: ruby:2.5
@@ -104,31 +132,60 @@ exclude:
104
132
  FRAMEWORK: grape-master
105
133
 
106
134
  # grape 1.5 doesn't support ruby 3.0
135
+ - RUBY_VERSION: ruby:3.1
136
+ FRAMEWORK: grape-1.6
137
+ - RUBY_VERSION: ruby:3.1
138
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
139
+ - RUBY_VERSION: ruby:3.1
140
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
107
141
  - RUBY_VERSION: ruby:3.0
108
142
  FRAMEWORK: grape-1.6
109
143
  - RUBY_VERSION: ruby:3.0
110
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
144
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
111
145
 
112
- # only test ruby 3.0 with rails 6.0 and rails 6.1
146
+ # only test ruby >= 3.0 with rails 6.0 and rails 6.1
147
+ - RUBY_VERSION: ruby:3.1
148
+ FRAMEWORK: rails-5.2
149
+ - RUBY_VERSION: ruby:3.1
150
+ FRAMEWORK: rails-5.1
113
151
  - RUBY_VERSION: ruby:3.0
114
152
  FRAMEWORK: rails-5.2
115
153
  - RUBY_VERSION: ruby:3.0
116
154
  FRAMEWORK: rails-5.1
117
155
 
118
156
  # Unsupported
157
+ # Ruby 2.6
119
158
  - RUBY_VERSION: ruby:2.6
120
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
159
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
160
+ - RUBY_VERSION: ruby:2.6
161
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
162
+ # Ruby 2.5
163
+ - RUBY_VERSION: ruby:2.5
164
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
121
165
  - RUBY_VERSION: ruby:2.5
122
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
166
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
167
+ # Ruby 2.4
123
168
  - RUBY_VERSION: ruby:2.4
124
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
169
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
125
170
  - RUBY_VERSION: ruby:2.4
126
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
171
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
172
+ # JRuby 9.2
173
+ - RUBY_VERSION: jruby:9.2
174
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
127
175
  - RUBY_VERSION: jruby:9.2
128
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
176
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
177
+ # JRuby 9.2-13-jdk
129
178
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-13-jdk
130
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
179
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
180
+ - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-13-jdk
181
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
182
+ # JRuby 9.2-11-jdk
183
+ - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-11-jdk
184
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
131
185
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-11-jdk
132
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
186
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
187
+ # JRuby 9.2-8-jdk
188
+ - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
189
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-6.1
133
190
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
134
- FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
191
+ FRAMEWORK: grape-1.6,sinatra-2.2,rails-7.0
@@ -1,12 +1,13 @@
1
1
  FRAMEWORK:
2
+ - rails-7.0
2
3
  - rails-6.1
3
4
  - rails-6.0
4
5
  - rails-5.2
5
6
  - rails-4.2
6
7
 
7
- - sinatra-2.0
8
+ - sinatra-2.2
8
9
  - sinatra-1.4
9
10
 
10
11
  - grape-1.6
11
12
 
12
- - grape-1.6,sinatra-2.0,rails-6.1
13
+ - grape-1.6,sinatra-2.2,rails-6.1
@@ -1,8 +1,8 @@
1
1
  RUBY_VERSION:
2
+ - ruby:3.1
2
3
  - ruby:3.0
3
4
  - ruby:2.7
4
5
  - ruby:2.6
5
- - ruby:2.5
6
6
  - ruby:2.4
7
7
  - jruby:9.2
8
8
  - docker.elastic.co/observability-ci/jruby:9.2-13-jdk
@@ -0,0 +1,6 @@
1
+ RUBY_VERSION:
2
+ - ruby:3.1
3
+ - ruby:3.0
4
+ - ruby:2.7
5
+ - ruby:2.6
6
+ - jruby:9.2
data/.ci/Jenkinsfile CHANGED
@@ -21,12 +21,11 @@ pipeline {
21
21
  CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
22
22
  DOCKER_REGISTRY = 'docker.elastic.co'
23
23
  DOCKER_SECRET = 'secret/apm-team/ci/docker-registry/prod'
24
- GITHUB_CHECK_ITS_NAME = 'Integration Tests'
25
- ITS_PIPELINE = 'apm-integration-tests-selector-mbp/main'
26
24
  RELEASE_SECRET = 'secret/apm-team/ci/apm-agent-ruby-rubygems-release'
27
25
  OPBEANS_REPO = 'opbeans-ruby'
28
26
  REFERENCE_REPO = '/var/lib/jenkins/.git-references/apm-agent-ruby.git'
29
27
  SLACK_CHANNEL = '#apm-agent-ruby'
28
+ RUBY_DOCKER_TAG = 'ruby:2.6'
30
29
  }
31
30
  options {
32
31
  timeout(time: 2, unit: 'HOURS')
@@ -123,24 +122,36 @@ pipeline {
123
122
  }
124
123
  }
125
124
  }
126
- stage('Integration Tests') {
127
- agent none
128
- when {
129
- beforeAgent true
130
- anyOf {
131
- changeRequest()
132
- expression { return !params.Run_As_Main_Branch }
125
+ }
126
+ }
127
+ stage('Publish snapshot packages') {
128
+ options { skipDefaultCheckout() }
129
+ environment {
130
+ PATH = "${env.WORKSPACE}/.local/bin:${env.WORKSPACE}/bin:${env.PATH}"
131
+ BUCKET_NAME = 'oblt-artifacts'
132
+ DOCKER_REGISTRY = 'docker.elastic.co'
133
+ DOCKER_REGISTRY_SECRET = 'secret/observability-team/ci/docker-registry/prod'
134
+ GCS_ACCOUNT_SECRET = 'secret/observability-team/ci/snapshoty'
135
+ }
136
+ when { branch 'main' }
137
+ steps {
138
+ withGithubNotify(context: 'Publish snapshot packages') {
139
+ deleteDir()
140
+ unstash 'source'
141
+ dir(env.BASE_DIR) {
142
+ script {
143
+ docker.image(env.RUBY_DOCKER_TAG).inside() {
144
+ sh(label: 'install build system', script: 'gem install rake yard rspec')
145
+ sh(label: 'create gem', script: 'rake build')
146
+ }
147
+ snapshoty(
148
+ bucket: env.BUCKET_NAME,
149
+ gcsAccountSecret: env.GCS_ACCOUNT_SECRET,
150
+ dockerRegistry: env.DOCKER_REGISTRY,
151
+ dockerSecret: env.DOCKER_REGISTRY_SECRET
152
+ )
133
153
  }
134
154
  }
135
- steps {
136
- 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('/','+')}")
137
- build(job: env.ITS_PIPELINE, propagate: false, wait: true,
138
- parameters: [ string(name: 'INTEGRATION_TEST', value: 'Ruby'),
139
- 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}"),
140
- string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
141
- string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
142
- string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT) ])
143
- }
144
155
  }
145
156
  }
146
157
  }
@@ -162,13 +173,13 @@ pipeline {
162
173
  }
163
174
  stages {
164
175
  stage('Clean Workspace') {
165
- agent { label 'metal' }
176
+ agent { label 'microbenchmarks-pool' }
166
177
  steps {
167
178
  echo "Cleaning Workspace"
168
179
  }
169
180
  post {
170
181
  always {
171
- cleanWs()
182
+ cleanWs(notFailBuild: true)
172
183
  }
173
184
  }
174
185
  }
@@ -183,7 +194,7 @@ pipeline {
183
194
  unstash 'source'
184
195
  dir("${BASE_DIR}"){
185
196
  script {
186
- def versions = readYaml(file: ".ci/.jenkins_ruby.yml")
197
+ def versions = readYaml(file: ".ci/.jenkins_ruby_benchmarks.yml")
187
198
  def benchmarkTask = [:]
188
199
  versions['RUBY_VERSION'].each{ v ->
189
200
  benchmarkTask[v] = runBenchmark(v)
@@ -199,7 +210,6 @@ pipeline {
199
210
  stage('Release') {
200
211
  options { skipDefaultCheckout() }
201
212
  environment {
202
- RUBY_DOCKER_TAG = 'ruby:2.6'
203
213
  HOME = '/var/lib/jenkins'
204
214
  }
205
215
  when {
@@ -283,7 +293,7 @@ pipeline {
283
293
  */
284
294
  def runBenchmark(version){
285
295
  return {
286
- node('metal'){
296
+ node('microbenchmarks-pool'){
287
297
  // Transform the versions like:
288
298
  // - docker.elastic.co/observability-ci/jruby:9.2-12-jdk to jruby-9.2-12-jdk
289
299
  // - jruby:9.1 to jruby-9.1
@@ -299,8 +309,6 @@ def runBenchmark(version){
299
309
  }
300
310
  try{
301
311
  sh """./spec/scripts/benchmarks.sh "${version}" "${REFERENCE_REPO}" """
302
- } catch(e){
303
- throw e
304
312
  } finally {
305
313
  archiveArtifacts(
306
314
  allowEmptyArchive: true,
@@ -308,6 +316,7 @@ def runBenchmark(version){
308
316
  onlyIfSuccessful: false)
309
317
  sendBenchmarks(file: "benchmark-${transformedVersion}.bulk",
310
318
  index: "benchmark-ruby", archive: true)
319
+ cleanWs(notFailBuild: true)
311
320
  }
312
321
  }
313
322
  }
@@ -411,7 +420,7 @@ def convergeCoverage() {
411
420
 
412
421
  def prepareRelease(Closure body){
413
422
  dir("${env.BASE_DIR}"){
414
- docker.image("${env.RUBY_DOCKER_TAG}").inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
423
+ docker.image(env.RUBY_DOCKER_TAG).inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
415
424
  withEnv(["HOME=${env.WORKSPACE}/${env.BASE_DIR ?: ''}"]) {
416
425
  rubygemsLogin.withApi(secret: "${env.RELEASE_SECRET}") {
417
426
  withGitRelease(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken') {
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
data/.ci/snapshoty.yml ADDED
@@ -0,0 +1,34 @@
1
+ ---
2
+
3
+ # Version of configuration to use
4
+ version: '1.0'
5
+
6
+ # You can define a Google Cloud Account to use
7
+ account:
8
+ # Project id of the service account
9
+ project: '${GCS_PROJECT}'
10
+ # Private key id of the service account
11
+ private_key_id: '${GCS_PRIVATE_KEY_ID}'
12
+ # Private key of the service account
13
+ private_key: '${GCS_PRIVATE_KEY}'
14
+ # Email of the service account
15
+ client_email: '${GCS_CLIENT_EMAIL}'
16
+ # URI token
17
+ token_uri: 'https://oauth2.googleapis.com/token'
18
+
19
+ # List of artifacts
20
+ artifacts:
21
+ # Path to use for artifacts discovery
22
+ - path: './pkg'
23
+ # Files pattern to match
24
+ files_pattern: 'elastic-apm-(?P<app_version>\d+\.\d+\.\d+)\.gem'
25
+ # File layout on GCS bucket
26
+ output_pattern: '{project}/{jenkins_branch_name}/elastic-apm-ruby-{app_version}-{jenkins_git_commit_short}.gem'
27
+ # List of metadata processors to use.
28
+ metadata:
29
+ # Define static custom metadata
30
+ - name: 'custom'
31
+ data:
32
+ project: 'apm-agent-ruby'
33
+ # Add jenkins metadata
34
+ - name: 'jenkins'
@@ -0,0 +1,108 @@
1
+ name: update-specs
2
+
3
+ title: synchronize schema specs
4
+
5
+ scms:
6
+ default:
7
+ kind: github
8
+ spec:
9
+ user: '{{ requiredEnv "GIT_USER" }}'
10
+ email: '{{ requiredEnv "GIT_EMAIL" }}'
11
+ owner: elastic
12
+ repository: apm-agent-ruby
13
+ token: '{{ requiredEnv "GITHUB_TOKEN" }}'
14
+ username: '{{ requiredEnv "GIT_USER" }}'
15
+ branch: main
16
+
17
+ sources:
18
+ sha:
19
+ kind: file
20
+ spec:
21
+ file: 'https://github.com/elastic/apm-data/commit/main.patch'
22
+ matchpattern: "^From\\s([0-9a-f]{40})\\s"
23
+ transformers:
24
+ - findsubmatch:
25
+ pattern: "[0-9a-f]{40}"
26
+ error.json:
27
+ kind: file
28
+ spec:
29
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/error.json
30
+ metadata.json:
31
+ kind: file
32
+ spec:
33
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/metadata.json
34
+ metricset.json:
35
+ kind: file
36
+ spec:
37
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/metricset.json
38
+ span.json:
39
+ kind: file
40
+ spec:
41
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/span.json
42
+ transaction.json:
43
+ kind: file
44
+ spec:
45
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/transaction.json
46
+
47
+
48
+
49
+
50
+
51
+ actions:
52
+ pr:
53
+ kind: "github/pullrequest"
54
+ scmid: default
55
+ sourceid: sha
56
+ spec:
57
+ automerge: false
58
+ draft: false
59
+ labels:
60
+ - "automation"
61
+ description: |-
62
+ ### What
63
+ APM agent json schema automatic sync
64
+ ### Why
65
+ *Changeset*
66
+ * https://github.com/elastic/apm-data/commit/{{ source "sha" }}
67
+
68
+ targets:
69
+ error.json:
70
+ name: error.json
71
+ scmid: default
72
+ sourceid: error.json
73
+ kind: file
74
+ spec:
75
+ file: spec/fixtures/error.json
76
+ forcecreate: true
77
+ metadata.json:
78
+ name: metadata.json
79
+ scmid: default
80
+ sourceid: metadata.json
81
+ kind: file
82
+ spec:
83
+ file: spec/fixtures/metadata.json
84
+ forcecreate: true
85
+ metricset.json:
86
+ name: metricset.json
87
+ scmid: default
88
+ sourceid: metricset.json
89
+ kind: file
90
+ spec:
91
+ file: spec/fixtures/metricset.json
92
+ forcecreate: true
93
+ span.json:
94
+ name: span.json
95
+ scmid: default
96
+ sourceid: span.json
97
+ kind: file
98
+ spec:
99
+ file: spec/fixtures/span.json
100
+ forcecreate: true
101
+ transaction.json:
102
+ name: transaction.json
103
+ scmid: default
104
+ sourceid: transaction.json
105
+ kind: file
106
+ spec:
107
+ file: spec/fixtures/transaction.json
108
+ forcecreate: true
@@ -0,0 +1,30 @@
1
+ name: update-specs
2
+
3
+ on:
4
+ workflow_dispatch: ~
5
+ schedule:
6
+ - cron: '0 6 * * *'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ bump:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - uses: elastic/apm-pipeline-library/.github/actions/updatecli@current
17
+ env:
18
+ BRANCH_NAME: ${{ github.ref_name }}
19
+ with:
20
+ vaultUrl: ${{ secrets.VAULT_ADDR }}
21
+ vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
22
+ vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
23
+ pipeline: ./.ci/update-specs.yml
24
+ - if: failure()
25
+ uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
26
+ with:
27
+ vaultUrl: ${{ secrets.VAULT_ADDR }}
28
+ vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
29
+ vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
30
+ slackChannel: "#apm-agent-ruby"
data/CHANGELOG.asciidoc CHANGED
@@ -35,6 +35,40 @@ endif::[]
35
35
  [[release-notes-4.x]]
36
36
  === Ruby Agent version 4.x
37
37
 
38
+ [[release-notes-4.6.1]]
39
+ ==== 4.6.1
40
+
41
+ [float]
42
+ ===== Fixed
43
+
44
+ - Fix growing number of open file descriptors when HTTP request to APM is never sent {pull}1351[#1351]
45
+ - Fix setting span http status code when Faraday Middleware is used {pull}1368[#1368]
46
+ - Handle whitespace when splitting tracestate entries {pull}1353[#1353]
47
+
48
+ [[release-notes-4.6.0]]
49
+ ==== 4.6.0
50
+
51
+ [float]
52
+ ===== Added
53
+
54
+ - Added transaction_name to reported error to allow grouping by transaction name {pull}1267[#1267]
55
+ - Added ability to query server for version (useful in the future) {pull}1278[#1278]
56
+ - Added instrumentation for https://github.com/zendesk/racecar/ Racecar Kafka library {pull}1284[#1284]
57
+
58
+ ===== Changed
59
+
60
+ - Expanded filtering to sanitize any key that contains the string 'auth' {pull}1266[#1266]
61
+ - Rename `log_ecs_formatting` option to `log_ecs_reformatting`, deprecate old option name {pull}1248[#1248]
62
+ - When the configuration value for `log_path` is set, override the `logger` to point to that path instead of using e.g. Rails logger {pull}1247[#1247]
63
+ - Only send tracestate header for distributed tracing when it has content {pull}1277[#1277]
64
+ - Use the hostname as the Kubernetes pod name in the Container Info metadata if the pod id is parsed from cgroup {pull}1314[#1314]
65
+
66
+ ====== Fixed
67
+
68
+ - Small change to Sidekiq tests to handle new configuration passing method {pull}1283[#1283]
69
+ - Set transaction sample rate to 0 when it's unsampled {pull}1339[#1339]
70
+ - Don't send unsampled transactions to APM server >= 8.0 {pull}1341[#1341]
71
+
38
72
  [[release-notes-4.5.1]]
39
73
  ==== 4.5.1
40
74
 
data/Gemfile CHANGED
@@ -46,11 +46,12 @@ if !defined?(JRUBY_VERSION) && RUBY_VERSION < '2.5'
46
46
  gem 'google-protobuf', '< 3.12'
47
47
  end
48
48
  gem 'grpc' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '3.0'
49
- gem 'json', '2.6.2' # note: can be unpinned when https://github.com/flori/json/issues/495 is resolved
49
+ gem 'json'
50
50
  gem 'json-schema', require: nil
51
51
  gem 'mongo', require: nil
52
52
  gem 'opentracing', require: nil
53
53
  gem 'rake', '>= 13.0', require: nil
54
+ gem 'racecar', require: nil if !defined?(JRUBY_VERSION)
54
55
  gem 'resque', require: nil
55
56
  gem 'sequel', require: nil
56
57
  gem 'shoryuken', require: nil
@@ -77,6 +78,10 @@ frameworks_versions = parsed_frameworks.inject({}) do |frameworks, str|
77
78
  end
78
79
 
79
80
  frameworks_versions.each do |framework, version|
81
+ if framework =='rails' && RUBY_VERSION >= '3.1'
82
+ gem 'net-smtp', require: false
83
+ end
84
+
80
85
  case version
81
86
  when 'master' # sinatra, grape
82
87
  gem framework, github: GITHUB_REPOS.fetch(framework)
@@ -111,12 +116,14 @@ if RUBY_PLATFORM == 'java'
111
116
  end
112
117
  elsif frameworks_versions['rails'] =~ /^(4|5)/
113
118
  gem 'sqlite3', '~> 1.3.6'
119
+ elsif RUBY_VERSION < '2.7'
120
+ gem 'sqlite3', '~> 1.4.4'
114
121
  else
115
122
  gem 'sqlite3'
116
123
  end
117
124
 
118
- # current sneakers only supports >=2.5.0
119
- if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.5.0')
125
+ # sneakers main only supports >=2.5.0
126
+ if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.5.0') && !defined?(JRUBY_VERSION)
120
127
  gem 'sneakers', github: 'jondot/sneakers', ref: 'd761dfe1493', require: nil
121
128
  end
122
129
 
data/bench/report.rb CHANGED
@@ -11,7 +11,7 @@ git_date = `git log -n 1 --pretty="format:%ai"`
11
11
  platform = Gem::Platform.local
12
12
 
13
13
  def doc(payload)
14
- puts({ index: { _index: "benchmark-ruby", _type: "_doc" } }.to_json)
14
+ puts({ index: { _index: "benchmark-ruby" } }.to_json)
15
15
  puts(payload.to_json)
16
16
  end
17
17
 
data/docker-compose.yml CHANGED
@@ -6,6 +6,8 @@ services:
6
6
  image: mongo:latest
7
7
  volumes: ['mongodata:/data/db']
8
8
  ports: ['27017:27017']
9
+ security_opt:
10
+ - no-new-privileges
9
11
 
10
12
  specs:
11
13
  build:
@@ -27,12 +29,16 @@ services:
27
29
  depends_on:
28
30
  - mongodb
29
31
  user: ${USER_ID}
32
+ security_opt:
33
+ - no-new-privileges
30
34
 
31
35
  ruby_rspec:
32
36
  image: apm-agent-ruby:${RUBY_VERSION}
33
37
  environment:
34
38
  MONGODB_URL: 'mongodb:27017'
35
39
  user: ${USER_ID}
40
+ security_opt:
41
+ - no-new-privileges
36
42
 
37
43
  volumes:
38
44
  vendor: