elastic-apm 4.5.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 +13 -12
- data/.ci/jobs/apm-agent-ruby-mbp.yml +1 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -5
- data/.pre-commit-config.yaml +2 -2
- data/CHANGELOG.asciidoc +14 -0
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +7 -3
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/docs/api.asciidoc +2 -2
- data/docs/configuration.asciidoc +1 -1
- data/docs/introduction.asciidoc +3 -3
- data/docs/log-correlation.asciidoc +1 -1
- data/docs/upgrading.asciidoc +1 -1
- data/lib/elastic_apm/metrics.rb +1 -4
- data/lib/elastic_apm/spies/elasticsearch.rb +11 -1
- data/lib/elastic_apm/spies/mongo.rb +5 -12
- data/lib/elastic_apm/spies/sns.rb +1 -1
- data/lib/elastic_apm/transport/base.rb +1 -3
- data/lib/elastic_apm/version.rb +1 -1
- 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'
|
@@ -42,7 +42,7 @@ pipeline {
|
|
42
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,7 +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: '^(
|
18
|
+
head-filter-regex: '^(main|PR-.*|[3-9]\.x|v4\.[5-9]+.*|v[5-9]+.*)$'
|
19
19
|
ssh-checkout:
|
20
20
|
credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba
|
21
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,20 @@ 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
|
+
|
38
52
|
[[release-notes-4.5.0]]
|
39
53
|
==== 4.5.0
|
40
54
|
|
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
@@ -46,18 +46,17 @@ 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'
|
49
|
+
gem 'json', '2.6.2' # note: can be unpinned when https://github.com/flori/json/issues/495 is resolved
|
50
50
|
gem 'json-schema', require: nil
|
51
51
|
gem 'mongo', require: nil
|
52
52
|
gem 'opentracing', require: nil
|
53
|
-
gem 'rake', require: nil
|
53
|
+
gem 'rake', '>= 13.0', require: nil
|
54
54
|
gem 'resque', require: nil
|
55
55
|
gem 'sequel', require: nil
|
56
56
|
gem 'shoryuken', require: nil
|
57
57
|
gem 'sidekiq', require: nil
|
58
58
|
gem 'simplecov', require: false
|
59
59
|
gem 'simplecov-cobertura', require: false
|
60
|
-
gem 'sneakers', '~> 2.12', require: nil
|
61
60
|
gem 'sucker_punch', '~> 2.0', require: nil
|
62
61
|
gem 'yard', require: nil
|
63
62
|
gem 'yarjuf'
|
@@ -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
|
|
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/lib/elastic_apm/metrics.rb
CHANGED
@@ -36,8 +36,6 @@ module ElasticAPM
|
|
36
36
|
class Registry
|
37
37
|
include Logging
|
38
38
|
|
39
|
-
TIMEOUT_INTERVAL = 5 # seconds
|
40
|
-
|
41
39
|
def initialize(config, &block)
|
42
40
|
@config = config
|
43
41
|
@callback = block
|
@@ -76,8 +74,7 @@ module ElasticAPM
|
|
76
74
|
|
77
75
|
@timer_task = Concurrent::TimerTask.execute(
|
78
76
|
run_now: true,
|
79
|
-
execution_interval: config.metrics_interval
|
80
|
-
timeout_interval: TIMEOUT_INTERVAL
|
77
|
+
execution_interval: config.metrics_interval
|
81
78
|
) do
|
82
79
|
begin
|
83
80
|
debug 'Collecting metrics'
|
@@ -79,7 +79,11 @@ module ElasticAPM
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def install
|
82
|
-
::
|
82
|
+
if defined?(::Elastic::Transport::Client)
|
83
|
+
::Elastic::Transport::Client.prepend(Ext)
|
84
|
+
elsif defined?(::Elasticsearch::Transport::Client)
|
85
|
+
::Elasticsearch::Transport::Client.prepend(Ext)
|
86
|
+
end
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
@@ -88,5 +92,11 @@ module ElasticAPM
|
|
88
92
|
'elasticsearch-transport',
|
89
93
|
ElasticsearchSpy.new
|
90
94
|
)
|
95
|
+
|
96
|
+
register(
|
97
|
+
'Elastic::Transport::Client',
|
98
|
+
'elastic-transport',
|
99
|
+
ElasticsearchSpy.new
|
100
|
+
)
|
91
101
|
end
|
92
102
|
end
|
@@ -37,14 +37,8 @@ module ElasticAPM
|
|
37
37
|
|
38
38
|
EVENT_KEY = :__elastic_instrumenter_mongo_events_key
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
Thread.current[EVENT_KEY] ||= {}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def initialize
|
47
|
-
@collection = Collection.new
|
40
|
+
def events
|
41
|
+
Thread.current[EVENT_KEY] ||= []
|
48
42
|
end
|
49
43
|
|
50
44
|
def started(event)
|
@@ -78,7 +72,7 @@ module ElasticAPM
|
|
78
72
|
# and the collection name is at the key `collection`
|
79
73
|
collection =
|
80
74
|
if event.command[event.command_name] == 1 ||
|
81
|
-
|
75
|
+
event.command[event.command_name].is_a?(BSON::Int64)
|
82
76
|
event.command[:collection]
|
83
77
|
else
|
84
78
|
event.command[event.command_name]
|
@@ -97,14 +91,13 @@ module ElasticAPM
|
|
97
91
|
context: build_context(event)
|
98
92
|
)
|
99
93
|
|
100
|
-
|
94
|
+
events << span
|
101
95
|
end
|
102
96
|
|
103
97
|
def pop_event(event)
|
104
|
-
span = @collection.events.delete(event.operation_id)
|
105
98
|
return unless (curr = ElasticAPM.current_span)
|
106
99
|
|
107
|
-
curr ==
|
100
|
+
curr == events[-1] && ElasticAPM.end_span(events.pop)
|
108
101
|
end
|
109
102
|
|
110
103
|
def build_context(event)
|
@@ -35,7 +35,6 @@ module ElasticAPM
|
|
35
35
|
include Logging
|
36
36
|
|
37
37
|
WATCHER_EXECUTION_INTERVAL = 5
|
38
|
-
WATCHER_TIMEOUT_INTERVAL = 4
|
39
38
|
WORKER_JOIN_TIMEOUT = 5
|
40
39
|
|
41
40
|
def initialize(config)
|
@@ -112,8 +111,7 @@ module ElasticAPM
|
|
112
111
|
|
113
112
|
def create_watcher
|
114
113
|
@watcher = Concurrent::TimerTask.execute(
|
115
|
-
execution_interval: WATCHER_EXECUTION_INTERVAL
|
116
|
-
timeout_interval: WATCHER_TIMEOUT_INTERVAL
|
114
|
+
execution_interval: WATCHER_EXECUTION_INTERVAL
|
117
115
|
) { ensure_worker_count }
|
118
116
|
end
|
119
117
|
|
data/lib/elastic_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- mikkel@elastic.co
|
44
44
|
executables: []
|
@@ -48,7 +48,7 @@ files:
|
|
48
48
|
- ".ci/.jenkins_codecov.yml"
|
49
49
|
- ".ci/.jenkins_exclude.yml"
|
50
50
|
- ".ci/.jenkins_framework.yml"
|
51
|
-
- ".ci/.
|
51
|
+
- ".ci/.jenkins_main_framework.yml"
|
52
52
|
- ".ci/.jenkins_ruby.yml"
|
53
53
|
- ".ci/Jenkinsfile"
|
54
54
|
- ".ci/docker/jruby/11-jdk/Dockerfile"
|
@@ -258,7 +258,7 @@ licenses:
|
|
258
258
|
- Apache-2.0
|
259
259
|
metadata:
|
260
260
|
source_code_uri: https://github.com/elastic/apm-agent-ruby
|
261
|
-
post_install_message:
|
261
|
+
post_install_message:
|
262
262
|
rdoc_options: []
|
263
263
|
require_paths:
|
264
264
|
- lib
|
@@ -273,8 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
273
|
- !ruby/object:Gem::Version
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
277
|
-
signing_key:
|
276
|
+
rubygems_version: 3.0.3.1
|
277
|
+
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: The official Elastic APM agent for Ruby
|
280
280
|
test_files: []
|