elastic-apm 2.4.0 → 2.5.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.

Potentially problematic release.


This version of elastic-apm might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3fb435d6ad1fd7a4e60cadedf93d9058da43310444e2fe4751d340a8a0eb7ed
4
- data.tar.gz: 7e4a452a0ef34cd1d91bb5b9e1e74cd4c14a2d66ed4fe85ee5317682077c193b
3
+ metadata.gz: a2ef17d6e9c0be751b1eec5e6083560d5eed2c3fbeb044adf361563b1f83ca01
4
+ data.tar.gz: b2ef8af13b2308b47149e9f9ac413825a5a23827f51af7a78c258848d99a6670
5
5
  SHA512:
6
- metadata.gz: ad0a3ea9273288644640513a82db7baf1ed5c89f5ff4c1e57246d08d6baa8796d854263170afa887edbc5ab1ce2d73a5d73b8e6d367c58f56efd4d830e4c9be4
7
- data.tar.gz: 0410ba02cd8c06b473fcb428900a5ed4d1eeae16134f187cde4525139edd669e75122cbe7b98d0a98a1639df4863d07d429dd6a3b27696604385e4703edaacb4
6
+ metadata.gz: ea7a58ffc1ed6eac693a32d9312f93e05ec47b047819b0420172a26de8a21bc7422a300fd6b405bbf24b8b40900a9ce6b7c97fc53502130eb641837120681420
7
+ data.tar.gz: b453578df37793a7dfeb6b3383530c652ec477b28303eefe35bf1e7a5ce3ea21fadb82621070c4de6de6d1c3e4acd6bd2023b3d9ec366a688b19ca73c93880e1
data/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ 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.5.0 (2019-03-01)
8
+
9
+ ### Added
10
+
11
+ - Added the option `active` that will prevent the agent from starting if set to `false` ([#338](https://github.com/elastic/apm-agent-ruby/pull/338))
12
+
13
+ ### Fixed
14
+
15
+ - Fix error with `capture_body` and nested request bodies ([#339](https://github.com/elastic/apm-agent-ruby/pull/339))
16
+
7
17
  ## 2.4.0 (2019-02-27)
8
18
 
9
19
  ### Added
data/Jenkinsfile CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env groovy
2
- @Library('apm@v1.0.7') _
2
+ @Library('apm@v1.0.9') _
3
3
 
4
4
  import co.elastic.matrix.*
5
5
  import groovy.transform.Field
@@ -199,6 +199,7 @@ class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
199
199
  */
200
200
  public Closure generateStep(x, y){
201
201
  return {
202
+ steps.sleep steps.randomNumber(min:10, max: 30)
202
203
  steps.node('linux && immutable'){
203
204
  def label = "${tag}:${x}#${y}"
204
205
  try {
@@ -119,6 +119,17 @@ ruby -r securerandom -e 'print SecureRandom.uuid'
119
119
 
120
120
  WARNING: Secret tokens only provide any real security if your APM server use TLS.
121
121
 
122
+ [float]
123
+ [[config-active]]
124
+ ==== `active`
125
+ |============
126
+ | Environment | `Config` key | Default
127
+ | `ELASTIC_APM_ACTIVE` | `active` | `true`
128
+ |============
129
+
130
+ Whether or not to start the agent.
131
+ If `active` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
132
+
122
133
  [float]
123
134
  [[config-api-buffer-size]]
124
135
  ==== `api_buffer_size`
@@ -22,6 +22,7 @@ module ElasticAPM
22
22
  @instance
23
23
  end
24
24
 
25
+ # rubocop:disable Metrics/MethodLength
25
26
  def self.start(config)
26
27
  return @instance if @instance
27
28
 
@@ -30,9 +31,18 @@ module ElasticAPM
30
31
  LOCK.synchronize do
31
32
  return @instance if @instance
32
33
 
34
+ unless config.active?
35
+ config.logger.debug format(
36
+ '%sAgent disabled with active: false',
37
+ Logging::PREFIX
38
+ )
39
+ return
40
+ end
41
+
33
42
  @instance = new(config).start
34
43
  end
35
44
  end
45
+ # rubocop:enable Metrics/MethodLength
36
46
 
37
47
  def self.stop
38
48
  LOCK.synchronize do
@@ -19,6 +19,7 @@ module ElasticAPM
19
19
 
20
20
  server_url: 'http://localhost:8200',
21
21
 
22
+ active: true,
22
23
  api_buffer_size: 256,
23
24
  api_request_size: '750kb',
24
25
  api_request_time: '10s',
@@ -59,6 +60,7 @@ module ElasticAPM
59
60
  'ELASTIC_APM_SERVER_URL' => 'server_url',
60
61
  'ELASTIC_APM_SECRET_TOKEN' => 'secret_token',
61
62
 
63
+ 'ELASTIC_APM_ACTIVE' => [:bool, 'active'],
62
64
  'ELASTIC_APM_API_BUFFER_SIZE' => [:int, 'api_buffer_size'],
63
65
  'ELASTIC_APM_API_REQUEST_SIZE' => [:int, 'api_request_size'],
64
66
  'ELASTIC_APM_API_REQUEST_TIME' => 'api_request_time',
@@ -131,6 +133,7 @@ module ElasticAPM
131
133
  attr_accessor :server_url
132
134
  attr_accessor :secret_token
133
135
 
136
+ attr_accessor :active
134
137
  attr_accessor :api_buffer_size
135
138
  attr_accessor :api_request_size
136
139
  attr_accessor :api_request_time
@@ -176,6 +179,7 @@ module ElasticAPM
176
179
  attr_accessor :view_paths
177
180
  attr_accessor :root_path
178
181
 
182
+ alias :active? :active
179
183
  alias :capture_body? :capture_body
180
184
  alias :capture_headers? :capture_headers
181
185
  alias :capture_env? :capture_env
@@ -17,6 +17,11 @@ module ElasticAPM
17
17
 
18
18
  host = if url_prefix.is_a?(URI) && url_prefix.host
19
19
  url_prefix.host
20
+ elsif url.nil?
21
+ tmp_request = build_request(method) do |req|
22
+ yield(req) if block_given?
23
+ end
24
+ URI(tmp_request.path).host
20
25
  else
21
26
  URI(url).host
22
27
  end
@@ -37,15 +37,26 @@ module ElasticAPM
37
37
  payload
38
38
  end
39
39
 
40
+ # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
40
41
  def strip_from!(obj)
41
42
  return unless obj && obj.is_a?(Hash)
42
43
 
43
44
  obj.each do |k, v|
44
- if filter_key?(k) || filter_value?(v)
45
- obj[k] = FILTERED
45
+ if filter_key?(k)
46
+ next obj[k] = FILTERED
47
+ end
48
+
49
+ case v
50
+ when Hash
51
+ strip_from!(v)
52
+ when String
53
+ if filter_value?(v)
54
+ obj[k] = FILTERED
55
+ end
46
56
  end
47
57
  end
48
58
  end
59
+ # rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity
49
60
 
50
61
  def filter_key?(key)
51
62
  @key_filters.any? { |regex| key.match regex }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ElasticAPM
4
- VERSION = '2.4.0'
4
+ VERSION = '2.5.0'
5
5
  end
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.0
4
+ version: 2.5.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-02-27 00:00:00.000000000 Z
11
+ date: 2019-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby