elastic-apm 2.7.0 → 2.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/.gitignore +1 -0
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTING.md +2 -2
- data/Jenkinsfile +19 -6
- data/README.md +1 -1
- data/docs/api.asciidoc +2 -5
- data/lib/elastic_apm/config.rb +3 -0
- data/lib/elastic_apm/railtie.rb +1 -1
- data/lib/elastic_apm/stacktrace_builder.rb +1 -1
- data/lib/elastic_apm/transport/connection.rb +14 -2
- data/lib/elastic_apm/transport/filters.rb +3 -1
- data/lib/elastic_apm/transport/serializers/context_serializer.rb +1 -1
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +1 -1
- data/lib/elastic_apm/transport/worker.rb +4 -1
- data/lib/elastic_apm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2395fecd3ead993ac77f072d0b552e0814d2eb09ae985ba3d0b22e7168a9f005
|
|
4
|
+
data.tar.gz: 20e07d3f8444b83bc424de8b7772547c41eba90ac8561d406599cfb36854ebd9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 341eff39abd1c021aaa61967a56482ada41ac9d94f6dda54a2b480cbaff2844768ffaea7c54c8e2781211cf8209a2b8309631a3360b63bad15c7554fa9705ca6
|
|
7
|
+
data.tar.gz: 4158a60e93bd55f6cd28274e734943e1f5984c4ce963be7ad65be8fa508419f92227e18e12cc46c6813793f4b8baf490bdd52eb240e1a6c6f567057fe254a7ee
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 2.8.0 (2019-05-20)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- The option `stack_trace_limit` ([#424](https://github.com/elastic/apm-agent-ruby/pull/424))
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Use standardized User-Agent ([#419](https://github.com/elastic/apm-agent-ruby/pull/419))
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- `error.culprit` is properly truncated to 1024 characters ([#418](https://github.com/elastic/apm-agent-ruby/pull/418))
|
|
20
|
+
- Force convert `transaction.context.response.status_code` to integer ([#423](https://github.com/elastic/apm-agent-ruby/pull/423))
|
|
21
|
+
|
|
7
22
|
## 2.7.0 (2019-05-07)
|
|
8
23
|
|
|
9
24
|
### Added
|
data/CONTRIBUTING.md
CHANGED
|
@@ -74,10 +74,10 @@ should "Squash and merge".
|
|
|
74
74
|
|
|
75
75
|
To do a full test run, use either `bundle exec rspec` or `rake spec`. Individual specs should also run as expected. The Mongo test needs a Mongo instance running, but will start one itself if Docker is installed.
|
|
76
76
|
|
|
77
|
-
To test other platform, use the Docker setup and scripts like `spec.sh
|
|
77
|
+
To test other platform, use the Docker setup and scripts like `spec.sh RUBY_DOCKER_IMAGE FRAMEWORK`.
|
|
78
78
|
|
|
79
79
|
```sh
|
|
80
|
-
$ spec/scripts/spec.sh ruby
|
|
80
|
+
$ spec/scripts/spec.sh ruby:2.6 rails-5.2
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
### Releasing
|
data/Jenkinsfile
CHANGED
|
@@ -18,6 +18,8 @@ pipeline {
|
|
|
18
18
|
NOTIFY_TO = credentials('notify-to')
|
|
19
19
|
JOB_GCS_BUCKET = credentials('gcs-bucket')
|
|
20
20
|
CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
|
|
21
|
+
DOCKER_REGISTRY = 'docker.elastic.co'
|
|
22
|
+
DOCKER_SECRET = 'secret/apm-team/ci/docker-registry/prod'
|
|
21
23
|
}
|
|
22
24
|
options {
|
|
23
25
|
timeout(time: 2, unit: 'HOURS')
|
|
@@ -185,11 +187,11 @@ pipeline {
|
|
|
185
187
|
Parallel task generator for the integration tests.
|
|
186
188
|
*/
|
|
187
189
|
class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
|
|
188
|
-
|
|
190
|
+
|
|
189
191
|
public RubyParallelTaskGenerator(Map params){
|
|
190
192
|
super(params)
|
|
191
193
|
}
|
|
192
|
-
|
|
194
|
+
|
|
193
195
|
/**
|
|
194
196
|
build a clousure that launch and agent and execute the corresponding test script,
|
|
195
197
|
then store the results.
|
|
@@ -198,13 +200,15 @@ class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
|
|
|
198
200
|
return {
|
|
199
201
|
steps.sleep steps.randomNumber(min:10, max: 30)
|
|
200
202
|
steps.node('linux && immutable'){
|
|
203
|
+
// Label is transformed to avoid using the internal docker registry in the x coordinate
|
|
204
|
+
// TODO: def label = "${tag}:${x?.drop(x?.lastIndexOf('/')+1)}#${y}"
|
|
201
205
|
def label = "${tag}:${x}#${y}"
|
|
202
206
|
try {
|
|
203
207
|
steps.runScript(label: label, ruby: x, framework: y)
|
|
204
208
|
saveResult(x, y, 1)
|
|
205
209
|
} catch(e){
|
|
206
210
|
saveResult(x, y, 0)
|
|
207
|
-
error("${label} tests failed : ${e.toString()}\n")
|
|
211
|
+
steps.error("${label} tests failed : ${e.toString()}\n")
|
|
208
212
|
} finally {
|
|
209
213
|
steps.junit(allowEmptyResults: false,
|
|
210
214
|
keepLongStdio: true,
|
|
@@ -232,6 +236,7 @@ def runScript(Map params = [:]){
|
|
|
232
236
|
dir("${BASE_DIR}"){
|
|
233
237
|
retry(2){
|
|
234
238
|
sleep randomNumber(min:10, max: 30)
|
|
239
|
+
dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
|
|
235
240
|
sh("./spec/scripts/spec.sh ${ruby} ${framework}")
|
|
236
241
|
}
|
|
237
242
|
}
|
|
@@ -243,17 +248,25 @@ def runScript(Map params = [:]){
|
|
|
243
248
|
def runBenchmark(version){
|
|
244
249
|
return {
|
|
245
250
|
node('metal'){
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
// Transform the versions like:
|
|
252
|
+
// - docker.elastic.co/observability-ci/jruby:9.2-12-jdk to jruby-9.2-12-jdk
|
|
253
|
+
// - jruby:9.1 to jruby-9.1
|
|
254
|
+
def transformedVersion = version.replaceAll('.*/', '').replaceAll(':', '-')
|
|
255
|
+
env.HOME = "${env.WORKSPACE}/${transformedVersion}"
|
|
256
|
+
dir("${transformedVersion}"){
|
|
248
257
|
deleteDir()
|
|
249
258
|
unstash 'source'
|
|
250
259
|
dir("${BASE_DIR}"){
|
|
260
|
+
retry(2){
|
|
261
|
+
sleep randomNumber(min:10, max: 30)
|
|
262
|
+
dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
|
|
263
|
+
}
|
|
251
264
|
try{
|
|
252
265
|
sh "./spec/scripts/benchmarks.sh ${version}"
|
|
253
266
|
} catch(e){
|
|
254
267
|
throw e
|
|
255
268
|
} finally {
|
|
256
|
-
sendBenchmarks(file: "benchmark-${
|
|
269
|
+
sendBenchmarks(file: "benchmark-${transformedVersion}.bulk",
|
|
257
270
|
index: "benchmark-ruby", archive: true)
|
|
258
271
|
}
|
|
259
272
|
}
|
data/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The official Rubygem for [Elastic][] [APM][].
|
|
|
11
11
|
|
|
12
12
|
## Documentation
|
|
13
13
|
|
|
14
|
-
[Full documentation at
|
|
14
|
+
[Full documentation at elastic.co](https://www.elastic.co/guide/en/apm/agent/ruby/2.x/index.html).
|
|
15
15
|
|
|
16
16
|
<ul>
|
|
17
17
|
<li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/2.x/introduction.html">Introduction</a></li>
|
data/docs/api.asciidoc
CHANGED
|
@@ -111,7 +111,7 @@ ElasticAPM.with_transaction 'Do things' do |transaction|
|
|
|
111
111
|
end
|
|
112
112
|
----
|
|
113
113
|
|
|
114
|
-
Arguments:
|
|
114
|
+
Arguments:
|
|
115
115
|
|
|
116
116
|
* `name`: A name for your transaction. Transactions are grouped by name. **Required**.
|
|
117
117
|
* `type`: A `type` for your transaction eg. `db.postgresql.sql`.
|
|
@@ -234,6 +234,7 @@ Arguments:
|
|
|
234
234
|
Returns `[ElasticAPM::Error]`.
|
|
235
235
|
|
|
236
236
|
[float]
|
|
237
|
+
[[api-context]]
|
|
237
238
|
=== Context
|
|
238
239
|
|
|
239
240
|
[float]
|
|
@@ -395,7 +396,3 @@ See the {apm-rum-ref}[JavaScript RUM agent documentation] for more information.
|
|
|
395
396
|
|
|
396
397
|
- `name`: String
|
|
397
398
|
- `type`: String
|
|
398
|
-
|
|
399
|
-
[float]
|
|
400
|
-
[[api-context]]
|
|
401
|
-
=== Context
|
data/lib/elastic_apm/config.rb
CHANGED
|
@@ -49,6 +49,7 @@ module ElasticAPM
|
|
|
49
49
|
source_lines_span_app_frames: 5,
|
|
50
50
|
source_lines_span_library_frames: 0,
|
|
51
51
|
span_frames_min_duration: '5ms',
|
|
52
|
+
stack_trace_limit: 999_999,
|
|
52
53
|
transaction_max_spans: 500,
|
|
53
54
|
transaction_sample_rate: 1.0,
|
|
54
55
|
verify_server_cert: true,
|
|
@@ -103,6 +104,7 @@ module ElasticAPM
|
|
|
103
104
|
'ELASTIC_APM_SOURCE_LINES_SPAN_LIBRARY_FRAMES' =>
|
|
104
105
|
[:int, 'source_lines_span_library_frames'],
|
|
105
106
|
'ELASTIC_APM_SPAN_FRAMES_MIN_DURATION' => 'span_frames_min_duration',
|
|
107
|
+
'ELASTIC_APM_STACK_TRACE_LIMIT' => [:int, 'stack_trace_limit'],
|
|
106
108
|
'ELASTIC_APM_TRANSACTION_MAX_SPANS' => [:int, 'transaction_max_spans'],
|
|
107
109
|
'ELASTIC_APM_TRANSACTION_SAMPLE_RATE' =>
|
|
108
110
|
[:float, 'transaction_sample_rate'],
|
|
@@ -180,6 +182,7 @@ module ElasticAPM
|
|
|
180
182
|
attr_accessor :source_lines_error_library_frames
|
|
181
183
|
attr_accessor :source_lines_span_app_frames
|
|
182
184
|
attr_accessor :source_lines_span_library_frames
|
|
185
|
+
attr_accessor :stack_trace_limit
|
|
183
186
|
attr_accessor :transaction_max_spans
|
|
184
187
|
attr_accessor :transaction_sample_rate
|
|
185
188
|
attr_accessor :verify_server_cert
|
data/lib/elastic_apm/railtie.rb
CHANGED
|
@@ -33,9 +33,9 @@ module ElasticAPM
|
|
|
33
33
|
|
|
34
34
|
def initialize(config, metadata)
|
|
35
35
|
@config = config
|
|
36
|
+
@headers = build_headers(metadata)
|
|
36
37
|
@metadata = JSON.fast_generate(metadata)
|
|
37
38
|
@url = config.server_url + '/intake/v2/events'
|
|
38
|
-
@headers = build_headers
|
|
39
39
|
@ssl_context = build_ssl_context
|
|
40
40
|
@mutex = Mutex.new
|
|
41
41
|
end
|
|
@@ -108,16 +108,28 @@ module ElasticAPM
|
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
-
def build_headers
|
|
111
|
+
def build_headers(metadata)
|
|
112
112
|
(
|
|
113
113
|
@config.http_compression? ? GZIP_HEADERS : HEADERS
|
|
114
114
|
).dup.tap do |headers|
|
|
115
|
+
headers['User-Agent'] = build_user_agent(metadata)
|
|
116
|
+
|
|
115
117
|
if (token = @config.secret_token)
|
|
116
118
|
headers['Authorization'] = "Bearer #{token}"
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
end
|
|
120
122
|
|
|
123
|
+
def build_user_agent(metadata)
|
|
124
|
+
runtime = metadata.dig(:metadata, :service, :runtime)
|
|
125
|
+
|
|
126
|
+
[
|
|
127
|
+
"elastic-apm-ruby/#{VERSION}",
|
|
128
|
+
HTTP::Request::USER_AGENT,
|
|
129
|
+
[runtime[:name], runtime[:version]].join('/')
|
|
130
|
+
].join(' ')
|
|
131
|
+
end
|
|
132
|
+
|
|
121
133
|
def build_ssl_context
|
|
122
134
|
return unless @config.use_ssl? && @config.server_ca_cert
|
|
123
135
|
|
|
@@ -6,6 +6,8 @@ module ElasticAPM
|
|
|
6
6
|
module Transport
|
|
7
7
|
# @api private
|
|
8
8
|
module Filters
|
|
9
|
+
SKIP = :skip
|
|
10
|
+
|
|
9
11
|
def self.new(config)
|
|
10
12
|
Container.new(config)
|
|
11
13
|
end
|
|
@@ -27,7 +29,7 @@ module ElasticAPM
|
|
|
27
29
|
def apply!(payload)
|
|
28
30
|
@filters.reduce(payload) do |result, (_key, filter)|
|
|
29
31
|
result = filter.call(result)
|
|
30
|
-
break if result.nil?
|
|
32
|
+
break SKIP if result.nil?
|
|
31
33
|
result
|
|
32
34
|
end
|
|
33
35
|
end
|
|
@@ -58,7 +58,10 @@ module ElasticAPM
|
|
|
58
58
|
|
|
59
59
|
def serialize_and_filter(resource)
|
|
60
60
|
serialized = serializers.serialize(resource)
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
# if a filter returns nil, it means skip the event
|
|
63
|
+
return nil if @filters.apply!(serialized) == Filters::SKIP
|
|
64
|
+
|
|
62
65
|
JSON.fast_generate(serialized)
|
|
63
66
|
rescue Exception
|
|
64
67
|
error format('Failed converting event to JSON: %s', resource.inspect)
|
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: 2.
|
|
4
|
+
version: 2.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mikkel Malmberg
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-05-
|
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|