elastic-apm 4.3.0 → 4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/.jenkins_exclude.yml +23 -23
- data/.ci/.jenkins_framework.yml +2 -2
- data/.ci/{.jenkins_master_framework.yml → .jenkins_main_framework.yml} +0 -0
- data/.ci/Jenkinsfile +14 -13
- data/.ci/docker/jruby/11-jdk/Dockerfile +1 -1
- data/.ci/docker/jruby/12-jdk/Dockerfile +1 -1
- data/.ci/docker/jruby/13-jdk/Dockerfile +1 -1
- data/.ci/docker/jruby/7-jdk/Dockerfile +1 -1
- data/.ci/docker/jruby/8-jdk/Dockerfile +1 -1
- data/.ci/jobs/apm-agent-ruby-mbp.yml +1 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -5
- data/.pre-commit-config.yaml +2 -2
- data/CHANGELOG.asciidoc +42 -0
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +11 -7
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/docs/api.asciidoc +2 -2
- data/docs/configuration.asciidoc +27 -3
- data/docs/introduction.asciidoc +3 -3
- data/docs/log-correlation.asciidoc +1 -1
- data/docs/upgrading.asciidoc +1 -1
- data/elastic-apm.gemspec +8 -8
- data/lib/elastic_apm/agent.rb +2 -2
- data/lib/elastic_apm/config.rb +19 -0
- data/lib/elastic_apm/context/request/socket.rb +1 -2
- data/lib/elastic_apm/fields.rb +29 -19
- data/lib/elastic_apm/instrumenter.rb +21 -19
- data/lib/elastic_apm/metadata/service_info.rb +1 -1
- data/lib/elastic_apm/metadata/system_info.rb +2 -1
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +4 -1
- data/lib/elastic_apm/metrics/metric.rb +2 -0
- data/lib/elastic_apm/metrics.rb +2 -5
- data/lib/elastic_apm/span/context/destination.rb +2 -2
- data/lib/elastic_apm/span.rb +8 -16
- data/lib/elastic_apm/spies/dynamo_db.rb +8 -3
- data/lib/elastic_apm/spies/elasticsearch.rb +11 -1
- data/lib/elastic_apm/spies/mongo.rb +7 -6
- data/lib/elastic_apm/spies/s3.rb +10 -1
- data/lib/elastic_apm/spies/sns.rb +1 -1
- data/lib/elastic_apm/transport/base.rb +1 -3
- data/lib/elastic_apm/transport/serializers/context_serializer.rb +1 -2
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +6 -2
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +4 -4
- data/lib/elastic_apm/transport/user_agent.rb +12 -6
- data/lib/elastic_apm/version.rb +1 -1
- data/lib/elastic_apm.rb +5 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 176cc8d035203774027d36d50769b763761354f3b9627f024ce90e07cd9069e3
|
4
|
+
data.tar.gz: 19a6d7ed6796133c1b79b2e762718f4be7068e4e5876e13e9e898894fc112900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2c34d43d849374706b481eabda64190ae0469e6770f068166eae20d42f7b12a54213820fac8a78e9343cca785f68378e9d4212a3fa6235966f6bb2a8517ca2d
|
7
|
+
data.tar.gz: c19991391535b0ab3087bcdb3bf3d7354a160570fa08a80c313391ab739c9996872e1b68f7ec164223bec2f2f70e643daa6c2ca69adb9549a1255abac5c1f794
|
data/.ci/.jenkins_exclude.yml
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
exclude:
|
2
|
-
# Ruby 2.
|
2
|
+
# Ruby 2.4
|
3
3
|
# Only includes rails-5.2, sinatra-2.0
|
4
|
-
- RUBY_VERSION: ruby:2.
|
4
|
+
- RUBY_VERSION: ruby:2.4
|
5
5
|
FRAMEWORK: rails-6.1
|
6
|
-
- RUBY_VERSION: ruby:2.
|
6
|
+
- RUBY_VERSION: ruby:2.4
|
7
7
|
FRAMEWORK: rails-6.0
|
8
|
-
- RUBY_VERSION: ruby:2.
|
8
|
+
- RUBY_VERSION: ruby:2.4
|
9
9
|
FRAMEWORK: rails-4.2
|
10
|
-
- RUBY_VERSION: ruby:2.
|
10
|
+
- RUBY_VERSION: ruby:2.4
|
11
11
|
FRAMEWORK: sinatra-1.4
|
12
|
-
- RUBY_VERSION: ruby:2.
|
13
|
-
FRAMEWORK: grape-1.
|
14
|
-
- RUBY_VERSION: ruby:2.
|
15
|
-
FRAMEWORK: grape-1.
|
16
|
-
- RUBY_VERSION: ruby:2.
|
12
|
+
- RUBY_VERSION: ruby:2.4
|
13
|
+
FRAMEWORK: grape-1.6
|
14
|
+
- RUBY_VERSION: ruby:2.4
|
15
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.0
|
16
|
+
- RUBY_VERSION: ruby:2.4
|
17
17
|
FRAMEWORK: rails-main
|
18
|
-
- RUBY_VERSION: ruby:2.
|
18
|
+
- RUBY_VERSION: ruby:2.4
|
19
19
|
FRAMEWORK: sinatra-master
|
20
|
-
- RUBY_VERSION: ruby:2.
|
20
|
+
- RUBY_VERSION: ruby:2.4
|
21
21
|
FRAMEWORK: grape-master
|
22
22
|
|
23
23
|
# rails-4.2 exclusions
|
@@ -105,9 +105,9 @@ exclude:
|
|
105
105
|
|
106
106
|
# grape 1.5 doesn't support ruby 3.0
|
107
107
|
- RUBY_VERSION: ruby:3.0
|
108
|
-
FRAMEWORK: grape-1.
|
108
|
+
FRAMEWORK: grape-1.6
|
109
109
|
- RUBY_VERSION: ruby:3.0
|
110
|
-
FRAMEWORK: grape-1.
|
110
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
111
111
|
|
112
112
|
# only test ruby 3.0 with rails 6.0 and rails 6.1
|
113
113
|
- RUBY_VERSION: ruby:3.0
|
@@ -117,18 +117,18 @@ exclude:
|
|
117
117
|
|
118
118
|
# Unsupported
|
119
119
|
- RUBY_VERSION: ruby:2.6
|
120
|
-
FRAMEWORK: grape-1.
|
120
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
121
121
|
- RUBY_VERSION: ruby:2.5
|
122
|
-
FRAMEWORK: grape-1.
|
122
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
123
|
+
- RUBY_VERSION: ruby:2.4
|
124
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
123
125
|
- RUBY_VERSION: ruby:2.4
|
124
|
-
FRAMEWORK: grape-1.
|
125
|
-
- RUBY_VERSION: ruby:2.3
|
126
|
-
FRAMEWORK: grape-1.5,sinatra-2.0,rails-6.1
|
126
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
127
127
|
- RUBY_VERSION: jruby:9.2
|
128
|
-
FRAMEWORK: grape-1.
|
128
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
129
129
|
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-13-jdk
|
130
|
-
FRAMEWORK: grape-1.
|
130
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
131
131
|
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-11-jdk
|
132
|
-
FRAMEWORK: grape-1.
|
132
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
133
133
|
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
|
134
|
-
FRAMEWORK: grape-1.
|
134
|
+
FRAMEWORK: grape-1.6,sinatra-2.0,rails-6.1
|
data/.ci/.jenkins_framework.yml
CHANGED
File without changes
|
data/.ci/Jenkinsfile
CHANGED
@@ -22,7 +22,7 @@ pipeline {
|
|
22
22
|
DOCKER_REGISTRY = 'docker.elastic.co'
|
23
23
|
DOCKER_SECRET = 'secret/apm-team/ci/docker-registry/prod'
|
24
24
|
GITHUB_CHECK_ITS_NAME = 'Integration Tests'
|
25
|
-
ITS_PIPELINE = 'apm-integration-tests-selector-mbp/
|
25
|
+
ITS_PIPELINE = 'apm-integration-tests-selector-mbp/main'
|
26
26
|
RELEASE_SECRET = 'secret/apm-team/ci/apm-agent-ruby-rubygems-release'
|
27
27
|
OPBEANS_REPO = 'opbeans-ruby'
|
28
28
|
REFERENCE_REPO = '/var/lib/jenkins/.git-references/apm-agent-ruby.git'
|
@@ -39,10 +39,10 @@ pipeline {
|
|
39
39
|
quietPeriod(10)
|
40
40
|
}
|
41
41
|
triggers {
|
42
|
-
issueCommentTrigger(
|
42
|
+
issueCommentTrigger("(${obltGitHubComments()}|^run benchmark tests)")
|
43
43
|
}
|
44
44
|
parameters {
|
45
|
-
booleanParam(name: '
|
45
|
+
booleanParam(name: 'Run_As_Main_Branch', defaultValue: false, description: 'Allow to run any steps on a PR, some steps normally only run on main branch.')
|
46
46
|
booleanParam(name: 'bench_ci', defaultValue: true, description: 'Enable run benchmarks.')
|
47
47
|
}
|
48
48
|
stages {
|
@@ -71,7 +71,7 @@ pipeline {
|
|
71
71
|
expression { return env.ONLY_DOCS == "false" }
|
72
72
|
anyOf {
|
73
73
|
not { changeRequest() }
|
74
|
-
expression { return params.
|
74
|
+
expression { return params.Run_As_Main_Branch }
|
75
75
|
}
|
76
76
|
}
|
77
77
|
}
|
@@ -115,11 +115,11 @@ pipeline {
|
|
115
115
|
}
|
116
116
|
}
|
117
117
|
}
|
118
|
-
stage('
|
118
|
+
stage('Main Tests frameworks') {
|
119
119
|
options { skipDefaultCheckout() }
|
120
120
|
steps {
|
121
|
-
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE', message: "The tests for the
|
122
|
-
runTests('.ci/.
|
121
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE', message: "The tests for the main framework have failed. Let's warn instead.") {
|
122
|
+
runTests('.ci/.jenkins_main_framework.yml')
|
123
123
|
}
|
124
124
|
}
|
125
125
|
}
|
@@ -129,7 +129,7 @@ pipeline {
|
|
129
129
|
beforeAgent true
|
130
130
|
anyOf {
|
131
131
|
changeRequest()
|
132
|
-
expression { return !params.
|
132
|
+
expression { return !params.Run_As_Main_Branch }
|
133
133
|
}
|
134
134
|
}
|
135
135
|
steps {
|
@@ -150,11 +150,11 @@ pipeline {
|
|
150
150
|
beforeAgent true
|
151
151
|
allOf {
|
152
152
|
anyOf {
|
153
|
-
branch '
|
153
|
+
branch 'main'
|
154
154
|
branch "\\d+\\.\\d+"
|
155
155
|
branch "v\\d?"
|
156
156
|
tag pattern: 'v\\d+.*', comparator: "REGEXP"
|
157
|
-
expression { return params.
|
157
|
+
expression { return params.Run_As_Main_Branch }
|
158
158
|
expression { return env.GITHUB_COMMENT?.contains('benchmark tests') }
|
159
159
|
}
|
160
160
|
expression { return params.bench_ci }
|
@@ -256,11 +256,12 @@ pipeline {
|
|
256
256
|
(retry 10 curl --silent --show-error --fail -I https://rubygems.org/gems/elastic-apm/versions/${env.VERSION})
|
257
257
|
"""
|
258
258
|
dir("${OPBEANS_REPO}"){
|
259
|
-
git
|
260
|
-
url: "git@github.com:elastic/${OPBEANS_REPO}.git"
|
259
|
+
git(credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba',
|
260
|
+
url: "git@github.com:elastic/${OPBEANS_REPO}.git",
|
261
|
+
branch: 'main')
|
261
262
|
// It's required to transform the tag value to the gem version
|
262
263
|
sh script: ".ci/bump-version.sh ${env.VERSION}", label: 'Bump version'
|
263
|
-
// The opbeans pipeline will trigger a release for the
|
264
|
+
// The opbeans pipeline will trigger a release for the main branch
|
264
265
|
gitPush()
|
265
266
|
// The opbeans pipeline will trigger a release for the release tag
|
266
267
|
gitCreateTag(tag: "${env.BRANCH_NAME}")
|
@@ -15,6 +15,7 @@
|
|
15
15
|
repo: apm-agent-ruby
|
16
16
|
repo-owner: elastic
|
17
17
|
credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken
|
18
|
+
head-filter-regex: '^(main|PR-.*|[3-9]\.x|v4\.[5-9]+.*|v[5-9]+.*)$'
|
18
19
|
ssh-checkout:
|
19
20
|
credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba
|
20
21
|
build-strategies:
|
@@ -34,16 +34,16 @@ Add a checklist of things that are required to be reviewed in order to have the
|
|
34
34
|
List here all the items you have verified BEFORE sending this PR. Please DO NOT remove any item, striking through those that do not apply. (Just in case, strikethrough uses two tildes. ~~Scratch this.~~)
|
35
35
|
-->
|
36
36
|
|
37
|
-
- [ ] I have signed the [Contributor License Agreement](https://www.elastic.co/contributor-agreement/).
|
37
|
+
- [ ] I have signed the [Contributor License Agreement](https://www.elastic.co/contributor-agreement/).
|
38
38
|
- [ ] My code follows the style guidelines of this project (See `.rubocop.yml`)
|
39
|
-
- [ ] I have rebased my changes on top of the latest
|
39
|
+
- [ ] I have rebased my changes on top of the latest main branch
|
40
40
|
<!--
|
41
|
-
Update your local repository with the most recent code from the main repo, and rebase your branch on top of the latest
|
41
|
+
Update your local repository with the most recent code from the main repo, and rebase your branch on top of the latest main branch. We prefer your initial changes to be squashed into a single commit. Later, if we ask you to make changes, add them as separate commits. This makes them easier to review.
|
42
42
|
-->
|
43
43
|
- [ ] I have added tests that prove my fix is effective or that my feature works
|
44
|
-
- [ ] New and existing [**unit** tests](https://github.com/elastic/apm-agent-ruby/blob/
|
44
|
+
- [ ] New and existing [**unit** tests](https://github.com/elastic/apm-agent-ruby/blob/main/CONTRIBUTING.md#testing) pass locally with my changes
|
45
45
|
<!--
|
46
|
-
Run the test suite to make sure that nothing is broken. See https://github.com/elastic/apm-agent-ruby/blob/
|
46
|
+
Run the test suite to make sure that nothing is broken. See https://github.com/elastic/apm-agent-ruby/blob/main/CONTRIBUTING.md#testing for details.
|
47
47
|
-->
|
48
48
|
- [ ] I have made corresponding changes to the documentation
|
49
49
|
- [ ] I have updated [CHANGELOG.asciidoc](CHANGELOG.asciidoc)
|
data/.pre-commit-config.yaml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
repos:
|
2
|
-
- repo:
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3
3
|
rev: v2.2.3
|
4
4
|
hooks:
|
5
5
|
- id: check-case-conflict
|
@@ -9,7 +9,7 @@ repos:
|
|
9
9
|
- id: check-yaml
|
10
10
|
- id: check-xml
|
11
11
|
|
12
|
-
- repo:
|
12
|
+
- repo: https://github.com/elastic/apm-pipeline-library
|
13
13
|
rev: current
|
14
14
|
hooks:
|
15
15
|
- id: check-bash-syntax
|
data/CHANGELOG.asciidoc
CHANGED
@@ -35,6 +35,48 @@ endif::[]
|
|
35
35
|
[[release-notes-4.x]]
|
36
36
|
=== Ruby Agent version 4.x
|
37
37
|
|
38
|
+
[[release-notes-4.5.1]]
|
39
|
+
==== 4.5.1
|
40
|
+
|
41
|
+
[float]
|
42
|
+
===== Changed
|
43
|
+
|
44
|
+
- Update elasticsearch spy to use new transport gem name {pull}1257[#1257]
|
45
|
+
- Standardize placeholder for phone numbers as [PHONENUMBER] per https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-aws.md {pull}1246[#1246]
|
46
|
+
|
47
|
+
===== Fixed
|
48
|
+
|
49
|
+
- Fixed dependencies to allow CI to build successfully {pull}1259[#1259]
|
50
|
+
- Fixed warnings related to TimeTask timeouts {pull}1255[#1255]
|
51
|
+
|
52
|
+
[[release-notes-4.5.0]]
|
53
|
+
==== 4.5.0
|
54
|
+
|
55
|
+
[float]
|
56
|
+
===== Changed
|
57
|
+
|
58
|
+
- Stop collecting the field `http.request.socket.encrypted` {pull}1181[#1181]
|
59
|
+
|
60
|
+
[float]
|
61
|
+
===== Fixed
|
62
|
+
|
63
|
+
- Fixed MongoDB spy thread safety {pull}1202[#1202]
|
64
|
+
- Fixed span context fields for DynamoDB instrumentation {pull}1178[#1178]
|
65
|
+
- Fixed span context fields for S3 instrumentation {pull}1179[#1179]
|
66
|
+
- Update user agent info to match spec {pull}1182[#1182]
|
67
|
+
|
68
|
+
[[release-notes-4.4.0]]
|
69
|
+
==== 4.4.0
|
70
|
+
|
71
|
+
[float]
|
72
|
+
===== Added
|
73
|
+
- Optional span to be ended instead of current span {pull}1039[#1039]
|
74
|
+
- Config option `log_ecs_formatting` {pull}1053[#1053]
|
75
|
+
|
76
|
+
[float]
|
77
|
+
===== Fixed
|
78
|
+
- Fixed detecting Linux on Alpine for CPU/MEM metrics {pull}1057[#1057]
|
79
|
+
|
38
80
|
[[release-notes-4.3.0]]
|
39
81
|
==== 4.3.0
|
40
82
|
|
data/CONTRIBUTING.md
CHANGED
@@ -20,7 +20,7 @@ or that there are particular issues that you should know about before implementi
|
|
20
20
|
|
21
21
|
### Workflow
|
22
22
|
|
23
|
-
All feature development and most bug fixes hit the
|
23
|
+
All feature development and most bug fixes hit the main branch first.
|
24
24
|
Pull requests should be reviewed by someone with commit access.
|
25
25
|
Once approved, the author of the pull request,
|
26
26
|
or reviewer if the author does not have commit access,
|
@@ -42,7 +42,7 @@ To release a new version:
|
|
42
42
|
|
43
43
|
1. Update `VERSION` in `lib/elastic_apm/version.rb` according to the changes (major, minor, patch).
|
44
44
|
1. Update `CHANGELOG.md` to reflect the new version – change _Unreleased_ section to _Version (release date)_.
|
45
|
-
1. For Majors: Add a new row to the EOL table in `docs/upgrading.asciidoc`. The EOL date is the release date plus 18 months.
|
45
|
+
1. For Majors: Add a new row to the EOL table in `docs/upgrading.asciidoc`. The EOL date is the release date plus 18 months.
|
46
46
|
1. Make a new commit with the changes above, with a message in the style of `vX.X.X`.
|
47
47
|
1. Run `rake release`. This will...
|
48
48
|
1. Tag the current commit as new version.
|
data/Gemfile
CHANGED
@@ -37,6 +37,7 @@ gem 'aws-sdk-s3', require: nil
|
|
37
37
|
gem 'aws-sdk-sqs', require: nil
|
38
38
|
gem 'aws-sdk-sns', require: nil
|
39
39
|
gem 'azure-storage-table', require: nil if RUBY_VERSION < '3.0'
|
40
|
+
gem 'ecs-logging', require: 'ecs_logging/logger'
|
40
41
|
gem 'elasticsearch', require: nil
|
41
42
|
gem 'fakeredis', require: nil
|
42
43
|
gem 'faraday', require: nil
|
@@ -45,26 +46,21 @@ if !defined?(JRUBY_VERSION) && RUBY_VERSION < '2.5'
|
|
45
46
|
gem 'google-protobuf', '< 3.12'
|
46
47
|
end
|
47
48
|
gem 'grpc' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '3.0'
|
48
|
-
gem 'json'
|
49
|
+
gem 'json', '2.6.2' # note: can be unpinned when https://github.com/flori/json/issues/495 is resolved
|
49
50
|
gem 'json-schema', require: nil
|
50
51
|
gem 'mongo', require: nil
|
51
52
|
gem 'opentracing', require: nil
|
52
|
-
gem 'rake', require: nil
|
53
|
+
gem 'rake', '>= 13.0', require: nil
|
53
54
|
gem 'resque', require: nil
|
54
55
|
gem 'sequel', require: nil
|
55
56
|
gem 'shoryuken', require: nil
|
56
57
|
gem 'sidekiq', require: nil
|
57
58
|
gem 'simplecov', require: false
|
58
59
|
gem 'simplecov-cobertura', require: false
|
59
|
-
gem 'sneakers', '~> 2.12', require: nil
|
60
60
|
gem 'sucker_punch', '~> 2.0', require: nil
|
61
61
|
gem 'yard', require: nil
|
62
62
|
gem 'yarjuf'
|
63
63
|
|
64
|
-
# See issue #6547 in the JRuby repo. When that bug is fixed,
|
65
|
-
# we can use the latest version of the i18n gem.
|
66
|
-
gem 'i18n', '< 1.8.8'
|
67
|
-
|
68
64
|
## Install Framework
|
69
65
|
GITHUB_REPOS = {
|
70
66
|
'grape' => 'ruby-grape/grape',
|
@@ -100,6 +96,9 @@ if frameworks_versions.key?('rails')
|
|
100
96
|
end
|
101
97
|
|
102
98
|
if RUBY_PLATFORM == 'java'
|
99
|
+
# See issue #6547 in the JRuby repo. It is fixed in JRuby 9.3
|
100
|
+
gem 'i18n', '< 1.8.8' if JRUBY_VERSION < '9.3'
|
101
|
+
|
103
102
|
case rails = frameworks_versions['rails']
|
104
103
|
when 'main'
|
105
104
|
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', glob: 'activerecord-jdbcsqlite3-adapter/*.gemspec'
|
@@ -116,6 +115,11 @@ else
|
|
116
115
|
gem 'sqlite3'
|
117
116
|
end
|
118
117
|
|
118
|
+
# current sneakers only supports >=2.5.0
|
119
|
+
if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.5.0')
|
120
|
+
gem 'sneakers', github: 'jondot/sneakers', ref: 'd761dfe1493', require: nil
|
121
|
+
end
|
122
|
+
|
119
123
|
group :bench do
|
120
124
|
gem 'ruby-prof', require: nil, platforms: %i[ruby]
|
121
125
|
gem 'stackprof', require: nil, platforms: %i[ruby]
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Elastic APM agent for Ruby
|
4
4
|
|
5
|
-
[![Jenkins](https://apm-ci.elastic.co/buildStatus/icon?job=apm-agent-ruby/apm-agent-ruby-mbp/
|
5
|
+
[![Jenkins](https://apm-ci.elastic.co/buildStatus/icon?job=apm-agent-ruby/apm-agent-ruby-mbp/main)](https://apm-ci.elastic.co/job/apm-agent-ruby/job/apm-agent-ruby-mbp/job/main/) [![Gem](https://img.shields.io/gem/v/elastic-apm.svg)](https://rubygems.org/gems/elastic-apm)
|
6
6
|
|
7
7
|
The official Rubygem for [Elastic][] [APM][].
|
8
8
|
|
data/Rakefile
CHANGED
data/docs/api.asciidoc
CHANGED
@@ -334,7 +334,7 @@ Labels are basic key-value pairs that are indexed in your Elasticsearch database
|
|
334
334
|
The value can be a string, nil, numeric or boolean.
|
335
335
|
|
336
336
|
TIP: Before using custom labels, ensure you understand the different types of
|
337
|
-
{apm-
|
337
|
+
{apm-guide-ref}/data-model-metadata.html[metadata] that are available.
|
338
338
|
|
339
339
|
[source,ruby]
|
340
340
|
----
|
@@ -361,7 +361,7 @@ Use this to further specify a context that will help you track or diagnose what'
|
|
361
361
|
going on inside your app.
|
362
362
|
|
363
363
|
TIP: Before using custom context, ensure you understand the different types of
|
364
|
-
{apm-
|
364
|
+
{apm-guide-ref}/data-model-metadata.html[metadata] that are available.
|
365
365
|
|
366
366
|
If called several times during a transaction the custom context will be destructively
|
367
367
|
merged with `merge!`.
|
data/docs/configuration.asciidoc
CHANGED
@@ -170,7 +170,7 @@ WARNING: Secret tokens only provide any real security if your APM server uses TL
|
|
170
170
|
|============
|
171
171
|
|
172
172
|
This base64-encoded string is used to ensure that only your agents can send data to your APM server.
|
173
|
-
The API key must be created using the {apm-
|
173
|
+
The API key must be created using the {apm-guide-ref}/api-key.html[APM server command-line tool].
|
174
174
|
|
175
175
|
WARNING: API keys only provide any real security if your APM server uses TLS.
|
176
176
|
|
@@ -240,7 +240,7 @@ NOTE: This feature requires APM Server and Kibana >= 7.3.
|
|
240
240
|
<<dynamic-configuration, image:./images/dynamic-config.svg[] >>
|
241
241
|
|
242
242
|
|============
|
243
|
-
| Environment | `Config` key | Default | Example
|
243
|
+
| Environment | `Config` key | Default | Example
|
244
244
|
| `ELASTIC_APM_CAPTURE_BODY` | `capture_body` | `"off"` | `"all"`
|
245
245
|
|============
|
246
246
|
|
@@ -502,7 +502,31 @@ Use this option to ignore certain URL patterns such as healthchecks or admin sec
|
|
502
502
|
| `ELASTIC_APM_INSTRUMENTED_RAKE_TASKS` | `instrumented_rake_tasks` | `[]` | `['my_task']`
|
503
503
|
|============
|
504
504
|
|
505
|
-
Elastic APM can instrument your Rake tasks.
|
505
|
+
Elastic APM can instrument your Rake tasks. This is an opt-in field, as they are used are for a multitude of things.
|
506
|
+
|
507
|
+
[float]
|
508
|
+
[[config-log-ecs-formatting]]
|
509
|
+
==== `log_ecs_formatting`
|
510
|
+
|
511
|
+
[options="header"]
|
512
|
+
|============
|
513
|
+
| Environment | `Config` key | Default
|
514
|
+
| `ELASTIC_APM_LOG_ECS_FORMATTING` | `log_ecs_formatting` | `off`
|
515
|
+
|============
|
516
|
+
|
517
|
+
This is an experimental option that configures the agent to use the logger from the `ecs-logging` gem. The two
|
518
|
+
valid options are `off` and `override`.
|
519
|
+
|
520
|
+
Setting this option to `override` will set the agent logger to a `EcsLogging::Logger` instance and all logged output
|
521
|
+
will be in ECS-compatible json.
|
522
|
+
|
523
|
+
The `ecs-logging` gem must be installed before the agent is started. If `log_ecs_formatting` is set to `override`,
|
524
|
+
the agent will attempt to require the gem and if it cannot be loaded, it will fall back to using the standard Ruby
|
525
|
+
`::Logger` and log the load error.
|
526
|
+
|
527
|
+
Note that if you're using Rails, the agent will ignore this option and use the Rails logger. If you want to use a
|
528
|
+
`EcsLogging::Logger` when using Rails, set the agent's logger config option explicitly to a `EcsLogging::Logger`
|
529
|
+
instance.
|
506
530
|
|
507
531
|
[float]
|
508
532
|
[[config-log-level]]
|
data/docs/introduction.asciidoc
CHANGED
@@ -31,6 +31,6 @@ You can then use the APM app in Kibana to gain insight into latency issues and e
|
|
31
31
|
[[additional-components]]
|
32
32
|
=== Additional Components
|
33
33
|
|
34
|
-
APM Agents work in conjunction with the {apm-
|
35
|
-
The {apm-
|
36
|
-
and provides a matrix outlining {apm-
|
34
|
+
APM Agents work in conjunction with the {apm-guide-ref}/index.html[APM Server], {ref}/index.html[Elasticsearch], and {kibana-ref}/index.html[Kibana].
|
35
|
+
The {apm-guide-ref}/index.html[APM Guide] provides details on how these components work together,
|
36
|
+
and provides a matrix outlining {apm-guide-ref}/agent-server-compatibility.html[Agent and Server compatibility].
|
@@ -118,4 +118,4 @@ PUT _ingest/pipeline/extract_trace_id
|
|
118
118
|
}
|
119
119
|
----
|
120
120
|
|
121
|
-
Please see {apm-
|
121
|
+
Please see {apm-guide-ref}/log-correlation.html[Observability integrations] for more information.
|
data/docs/upgrading.asciidoc
CHANGED
@@ -6,7 +6,7 @@ Upgrades that involve a major version bump often come with some backwards incomp
|
|
6
6
|
Before upgrading the agent, be sure to review the:
|
7
7
|
|
8
8
|
* <<release-notes,Agent release notes>>
|
9
|
-
* {apm-
|
9
|
+
* {apm-guide-ref}/agent-server-compatibility.html[Agent and Server compatibility chart]
|
10
10
|
|
11
11
|
[float]
|
12
12
|
[[end-of-life-dates]]
|
data/elastic-apm.gemspec
CHANGED
@@ -20,15 +20,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
20
20
|
require 'elastic_apm/version'
|
21
21
|
|
22
22
|
Gem::Specification.new do |spec|
|
23
|
-
spec.name
|
24
|
-
spec.version
|
25
|
-
spec.authors
|
26
|
-
spec.email
|
23
|
+
spec.name = 'elastic-apm'
|
24
|
+
spec.version = ElasticAPM::VERSION
|
25
|
+
spec.authors = ['Mikkel Malmberg']
|
26
|
+
spec.email = ['mikkel@elastic.co']
|
27
27
|
|
28
|
-
spec.summary
|
29
|
-
spec.homepage
|
30
|
-
spec.metadata
|
31
|
-
spec.license
|
28
|
+
spec.summary = 'The official Elastic APM agent for Ruby'
|
29
|
+
spec.homepage = 'https://github.com/elastic/apm-agent-ruby'
|
30
|
+
spec.metadata = { 'source_code_uri' => 'https://github.com/elastic/apm-agent-ruby' }
|
31
|
+
spec.license = 'Apache-2.0'
|
32
32
|
spec.required_ruby_version = ">= 2.3.0"
|
33
33
|
|
34
34
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
data/lib/elastic_apm/agent.rb
CHANGED
data/lib/elastic_apm/config.rb
CHANGED
@@ -70,6 +70,7 @@ module ElasticAPM
|
|
70
70
|
option :ignore_url_patterns, type: :list, default: [], converter: RegexpList.new
|
71
71
|
option :instrument, type: :bool, default: true
|
72
72
|
option :instrumented_rake_tasks, type: :list, default: []
|
73
|
+
option :log_ecs_formatting, type: :string, default: 'off'
|
73
74
|
option :log_level, type: :int, default: Logger::INFO, converter: LogLevelMap.new
|
74
75
|
option :log_path, type: :string
|
75
76
|
option :metrics_interval, type: :int, default: '30s', converter: Duration.new
|
@@ -246,11 +247,29 @@ module ElasticAPM
|
|
246
247
|
end
|
247
248
|
|
248
249
|
def build_logger
|
250
|
+
if self.log_ecs_formatting == 'override'
|
251
|
+
begin
|
252
|
+
return build_ecs_logger
|
253
|
+
rescue LoadError
|
254
|
+
logger.info "Attempted to use EcsLogging::Logger but the gem couldn't be " \
|
255
|
+
"loaded so a ::Logger was created instead. Check if you have the `ecs-logging` " \
|
256
|
+
"gem installed and attempt to start the agent again."
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
249
260
|
Logger.new(log_path == '-' ? $stdout : log_path).tap do |logger|
|
250
261
|
logger.level = log_level
|
251
262
|
end
|
252
263
|
end
|
253
264
|
|
265
|
+
def build_ecs_logger
|
266
|
+
require 'ecs_logging/logger'
|
267
|
+
|
268
|
+
::EcsLogging::Logger.new(log_path == '-' ? $stdout : log_path).tap do |logger|
|
269
|
+
logger.level = log_level
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
254
273
|
def app_type?(app)
|
255
274
|
if defined?(::Rails::Application) && app.is_a?(::Rails::Application)
|
256
275
|
return :rails
|