elastic-apm 4.6.0 → 4.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/Jenkinsfile +33 -2
- data/.ci/docker/jruby/11-jdk/Dockerfile +3 -0
- data/.ci/docker/jruby/12-jdk/Dockerfile +3 -0
- data/.ci/docker/jruby/13-jdk/Dockerfile +3 -0
- data/.ci/docker/jruby/7-jdk/Dockerfile +3 -0
- data/.ci/docker/jruby/8-jdk/Dockerfile +3 -0
- data/.ci/snapshoty.yml +34 -0
- data/.ci/update-specs.yml +108 -0
- data/.github/workflows/update-specs.yml +30 -0
- data/CHANGELOG.asciidoc +10 -0
- data/Gemfile +2 -0
- data/docker-compose.yml +6 -0
- data/lib/elastic_apm/spies/faraday.rb +23 -0
- data/lib/elastic_apm/trace_context/tracestate.rb +3 -1
- data/lib/elastic_apm/transport/connection/http.rb +9 -3
- data/lib/elastic_apm/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49b381ca37784473aef9bf3462b37eb77b3d263dfd402adf929c866153f81af3
|
4
|
+
data.tar.gz: 51f9290d7cace3428273171484ab6f6526e1309bdb2d27a101d9e74a17f9f619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55c315cf52ce113f032b471f64d6662d4e5b9d85577bf228913da82c3f114cdc1846c70a8078de2fc7e1362c89f2cff2559b6e6b046007667feeb0c194223e75
|
7
|
+
data.tar.gz: 9962145d110f552e1beb449e721389cefe17bb862b3e255f48ef236170fa04523c29654f11fb3e1cc89cc5b8f69e14f0678cab51431b86a501ec016631278992
|
data/.ci/Jenkinsfile
CHANGED
@@ -25,6 +25,7 @@ pipeline {
|
|
25
25
|
OPBEANS_REPO = 'opbeans-ruby'
|
26
26
|
REFERENCE_REPO = '/var/lib/jenkins/.git-references/apm-agent-ruby.git'
|
27
27
|
SLACK_CHANNEL = '#apm-agent-ruby'
|
28
|
+
RUBY_DOCKER_TAG = 'ruby:2.6'
|
28
29
|
}
|
29
30
|
options {
|
30
31
|
timeout(time: 2, unit: 'HOURS')
|
@@ -123,6 +124,37 @@ pipeline {
|
|
123
124
|
}
|
124
125
|
}
|
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
|
+
)
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
126
158
|
stage('Benchmarks') {
|
127
159
|
options { skipDefaultCheckout() }
|
128
160
|
when {
|
@@ -178,7 +210,6 @@ pipeline {
|
|
178
210
|
stage('Release') {
|
179
211
|
options { skipDefaultCheckout() }
|
180
212
|
environment {
|
181
|
-
RUBY_DOCKER_TAG = 'ruby:2.6'
|
182
213
|
HOME = '/var/lib/jenkins'
|
183
214
|
}
|
184
215
|
when {
|
@@ -389,7 +420,7 @@ def convergeCoverage() {
|
|
389
420
|
|
390
421
|
def prepareRelease(Closure body){
|
391
422
|
dir("${env.BASE_DIR}"){
|
392
|
-
docker.image(
|
423
|
+
docker.image(env.RUBY_DOCKER_TAG).inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
|
393
424
|
withEnv(["HOME=${env.WORKSPACE}/${env.BASE_DIR ?: ''}"]) {
|
394
425
|
rubygemsLogin.withApi(secret: "${env.RELEASE_SECRET}") {
|
395
426
|
withGitRelease(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken') {
|
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,16 @@ 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
|
+
|
38
48
|
[[release-notes-4.6.0]]
|
39
49
|
==== 4.6.0
|
40
50
|
|
data/Gemfile
CHANGED
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:
|
@@ -102,6 +102,7 @@ module ElasticAPM
|
|
102
102
|
) do |span|
|
103
103
|
ElasticAPM::Spies.without_net_http do
|
104
104
|
trace_context = span&.trace_context || transaction.trace_context
|
105
|
+
self.response :elastic_apm_middleware, span # middleware
|
105
106
|
|
106
107
|
result = super(method, url, body, headers) do |req|
|
107
108
|
trace_context.apply_headers { |k, v| req[k] = v }
|
@@ -122,6 +123,28 @@ module ElasticAPM
|
|
122
123
|
# rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
123
124
|
|
124
125
|
def install
|
126
|
+
# This middleware class has to be defined here because it inherits from
|
127
|
+
# ::Faraday::Middleware, which isn't defined when this file loads.
|
128
|
+
tracing_middleware = Class.new ::Faraday::Middleware do
|
129
|
+
attr_reader :span
|
130
|
+
|
131
|
+
def initialize(app, span = nil, options = {})
|
132
|
+
super(app)
|
133
|
+
@span = span
|
134
|
+
end
|
135
|
+
|
136
|
+
def on_complete(env)
|
137
|
+
status = env[:status]
|
138
|
+
http = span&.context&.http
|
139
|
+
if http && status
|
140
|
+
http.status_code = status.to_s
|
141
|
+
span.outcome = Span::Outcome.from_http_status(status)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
::Faraday::Response.register_middleware(
|
146
|
+
elastic_apm_middleware: -> { tracing_middleware }
|
147
|
+
)
|
125
148
|
::Faraday::Connection.prepend(Ext)
|
126
149
|
end
|
127
150
|
end
|
@@ -92,6 +92,8 @@ module ElasticAPM
|
|
92
92
|
|
93
93
|
extend Forwardable
|
94
94
|
|
95
|
+
ENTRY_SPLIT_REGEX = /\s*[\n,]+\s*/
|
96
|
+
|
95
97
|
def initialize(entries: {}, sample_rate: nil)
|
96
98
|
@entries = entries
|
97
99
|
|
@@ -140,7 +142,7 @@ module ElasticAPM
|
|
140
142
|
# Rack handles this by joining the headers under the same key,
|
141
143
|
# separated by newlines.
|
142
144
|
# See https://www.rubydoc.info/github/rack/rack/file/SPEC
|
143
|
-
String(str).split(
|
145
|
+
String(str).split(ENTRY_SPLIT_REGEX).flatten
|
144
146
|
end
|
145
147
|
end
|
146
148
|
end
|
@@ -75,7 +75,15 @@ module ElasticAPM
|
|
75
75
|
@closed.make_true
|
76
76
|
|
77
77
|
@wr&.close
|
78
|
-
|
78
|
+
|
79
|
+
if @request&.join(5)
|
80
|
+
@rd&.close
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
84
|
+
@rd&.close
|
85
|
+
|
86
|
+
return if @request.nil?
|
79
87
|
|
80
88
|
error(
|
81
89
|
'%s: APM Server not responding in time, terminating request',
|
@@ -117,8 +125,6 @@ module ElasticAPM
|
|
117
125
|
error(
|
118
126
|
"Couldn't establish connection to APM Server:\n%p", e.inspect
|
119
127
|
)
|
120
|
-
ensure
|
121
|
-
@rd&.close
|
122
128
|
end
|
123
129
|
end
|
124
130
|
end
|
data/lib/elastic_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-01
|
12
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- ".ci/jobs/defaults.yml"
|
83
83
|
- ".ci/linting.groovy"
|
84
84
|
- ".ci/packer_cache.sh"
|
85
|
+
- ".ci/snapshoty.yml"
|
86
|
+
- ".ci/update-specs.yml"
|
85
87
|
- ".github/ISSUE_TEMPLATE/Bug_report.md"
|
86
88
|
- ".github/ISSUE_TEMPLATE/Feature_request.md"
|
87
89
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
@@ -89,6 +91,7 @@ files:
|
|
89
91
|
- ".github/labeler-config.yml"
|
90
92
|
- ".github/workflows/addToProject.yml"
|
91
93
|
- ".github/workflows/labeler.yml"
|
94
|
+
- ".github/workflows/update-specs.yml"
|
92
95
|
- ".gitignore"
|
93
96
|
- ".pre-commit-config.yaml"
|
94
97
|
- ".rspec"
|