elastic-apm 2.11.0 → 2.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45fe1b55dccff365970dd59f2a4f58d9cb76141fd3651e7ce9c166b796bfce0a
4
- data.tar.gz: 66a2df97b05471613e7d1b5eecdb739ccbf94514b15730cb065153c7128503da
3
+ metadata.gz: 7d21cbf7caa8a07dc2b34131917e7b635b45c21284fade6a1755235b440bef98
4
+ data.tar.gz: '0778604992d95bff8e6790cd0e8ce0bc10dd44ea1b07ef0098a87e58efd8eaa4'
5
5
  SHA512:
6
- metadata.gz: e542f184535be90fee811ceee0fd404f65b59575b0e90a8dc8023807ec5b535f9d1c084b7654f5c59fed9d5521a2cbf5f2bd70dac8691db009be1dd24b07be5f
7
- data.tar.gz: 7d87ebdbbfc32727017f6f0fa8451640ac3fef289366bc3a077899d874bb346a3b94dbadafe96596f2b1a8163c42d79b1b41ce940c6e1fd8fb358fc96767ca84
6
+ metadata.gz: 29a2fd0b89e884d3214bef3ab402d311f76ce2a9263a197bb9b90621ddea93acbfce565672d1b91f4eec5db13e0b67e9633b9ae909c4851e581dd180a76b1738
7
+ data.tar.gz: 8ecf3bce6665417caa94fd2ca3d88c519843cfc62e2649df9e8f5f96b9bff655a0ebdf4b84ceb340cadf4ce792ed12923b86777e66b37761a21ff241456f2a90
@@ -4,6 +4,22 @@ 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.12.0 (2019-10-01)
8
+
9
+ ### Changed
10
+
11
+ - `disabled_spies` renamed to `disabled_instrumentations` with fallback ([#539](https://github.com/elastic/apm-agent-ruby/pull/539))
12
+ - Rename `set_tag` to `set_label` and deprecate `set_tag` ([#543](https://github.com/elastic/apm-agent-ruby/pull/543))
13
+ - Allow non-String label values ([#543](https://github.com/elastic/apm-agent-ruby/pull/543))
14
+
15
+ ### Fixed
16
+
17
+ - Handles a case where stacktrace frames are empty ([#538](https://github.com/elastic/apm-agent-ruby/pull/538))
18
+
19
+ ### Deprecated
20
+
21
+ - Deprecate `set_tag` ([#543](https://github.com/elastic/apm-agent-ruby/pull/543))
22
+
7
23
  ## 2.11.0 (2019-09-23)
8
24
 
9
25
  ### Added
@@ -260,7 +260,7 @@ Returns `[String]` ID of the generated `[ElasticAPM::Error]` object.
260
260
 
261
261
  Add a tag to the current transaction.
262
262
  Tags are basic key-value pairs that are indexed in your Elasticsearch database
263
- and therefore searchable.
263
+ and therefore searchable. The value will always be converted to a String.
264
264
 
265
265
  TIP: Before using custom tags, ensure you understand the different types of
266
266
  {apm-overview-ref-v}/metadata.html[metadata] that are available.
@@ -281,6 +281,35 @@ Returns the set `value`.
281
281
 
282
282
  WARNING: Be aware that tags are indexed in Elasticsearch. Using too many unique keys will result in *https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion[Mapping explosion]*.
283
283
 
284
+ NOTE: This method has been deprecated in favor of `set_label`, which does not convert values to Strings.
285
+
286
+ [float]
287
+ [[api-agent-set-label]]
288
+ ==== `ElasticAPM.set_label`
289
+
290
+ Add a label to the current transaction.
291
+ Labels are basic key-value pairs that are indexed in your Elasticsearch database and therefore searchable.
292
+ The value can be a string, nil, numeric or boolean.
293
+
294
+ TIP: Before using custom labels, ensure you understand the different types of
295
+ {apm-overview-ref-v}/metadata.html[metadata] that are available.
296
+
297
+ [source,ruby]
298
+ ----
299
+ before_action do
300
+ ElasticAPM.set_label(:company_id, current_user.company.id)
301
+ end
302
+ ----
303
+
304
+ Arguments:
305
+
306
+ * `key`: A string key. Note that `.`, `*` or `"` will be converted to `_`.
307
+ * `value`: A value.
308
+
309
+ Returns the set `value`.
310
+
311
+ WARNING: Be aware that labels are indexed in Elasticsearch. Using too many unique keys will result in *https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion[Mapping explosion]*.
312
+
284
313
  [float]
285
314
  [[api-agent-set-custom-context]]
286
315
  ==== `ElasticAPM.set_custom_context`
@@ -249,17 +249,31 @@ Eg. `ELASTIC_APM_CUSTOM_KEY_FILTERS="a,b" # => [/a/, /b/]`
249
249
  [[config-default-tags]]
250
250
  ==== `default_tags`
251
251
 
252
+ [options="header"]
253
+ |============
254
+ | Environment | `Config` key | Default | Example
255
+ | `ELASTIC_APM_DEFAULT_LABELS` | `default_labels` | `{}` | `region=us1`
256
+ |============
257
+
258
+ Add default labels to every transaction. Note that this will eventually be deprecated in favor of `global_labels`.
259
+
260
+ WARNING: Be aware that labels are indexed in Elasticsearch. Using too many unique keys will result in *https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion[Mapping explosion]*.
261
+
262
+ NOTE: `global_labels` are supported as of APM server version 7.2. `default_tags` and `default_labels` will eventually be
263
+ deprecated so please transition to using `global_labels` instead. In the meantime, any `default_labels`
264
+ that are set will override `global_labels`.
265
+
252
266
  [options="header"]
253
267
  |============
254
268
  | Environment | `Config` key | Default | Example
255
269
  | `ELASTIC_APM_DEFAULT_TAGS` | `default_tags` | `{}` | `region=us1`
256
270
  |============
257
271
 
258
- Add default tags to add to every transaction.
272
+ Add default tags to add to every transaction. Note that this option has been deprecated in favor of `default_labels`.
259
273
 
260
274
  WARNING: Be aware that tags are indexed in Elasticsearch. Using too many unique keys will result in *https://www.elastic.co/blog/found-crash-elasticsearch#mapping-explosion[Mapping explosion]*.
261
275
 
262
- NOTE: `global_labels` are supported as of APM server version 7.2. `default_tags` will eventually be
276
+ NOTE: `global_labels` are supported as of APM server version 7.2. `default_tags` and `default_labels` will eventually be
263
277
  deprecated so please transition to using `global_labels` instead. In the meantime, any `default_tags`
264
278
  that are set will override `global_labels`.
265
279
 
@@ -284,19 +298,19 @@ Disables sending payloads to APM Server.
284
298
  Disables the agent's startup message announcing itself.
285
299
 
286
300
  [float]
287
- [[config-disabled-spies]]
288
- ==== `disabled_spies`
301
+ [[config-disabled-instrumentations]]
302
+ ==== `disabled_instrumentations`
289
303
 
290
304
  [options="header"]
291
305
  |============
292
- | Environment | `Config` key | Default
293
- | `ELASTIC_APM_DISABLED_SPIES` | `disabled_spies` | `['json']`
306
+ | Environment | `Config` key | Default
307
+ | `ELASTIC_APM_DISABLED_INSTRUMENTATIONS` | `disabled_instrumentations` | `['json']`
294
308
  |============
295
309
 
296
310
  Elastic APM automatically instruments select third party libraries.
297
311
  Use this option to disable any of these.
298
312
 
299
- Get an array of enabled spies with `ElasticAPM.agent.config.enabled_spies`.
313
+ Get an array of enabled instrumentations with `ElasticAPM.agent.config.enabled_instrumentations`.
300
314
 
301
315
  [float]
302
316
  [[config-environment]]
@@ -66,7 +66,8 @@ module ElasticAPM # rubocop:disable Metrics/ModuleLength
66
66
  # Get a formatted string containing transaction, span, and trace ids.
67
67
  # If a block is provided, the ids are yielded.
68
68
  #
69
- # @yield [String|nil, String|nil, String|nil] The transaction, span, and trace ids.
69
+ # @yield [String|nil, String|nil, String|nil] The transaction, span,
70
+ # and trace ids.
70
71
  # @return [String] Unless block given
71
72
  def log_ids
72
73
  trace_id = (current_transaction || current_span)&.trace_id
@@ -363,8 +364,29 @@ module ElasticAPM # rubocop:disable Metrics/ModuleLength
363
364
  # @param key [String,Symbol] A key
364
365
  # @param value [Object] A value (will be converted to string)
365
366
  # @return [Object] The given value
367
+ # @deprecated See `set_label` instead
366
368
  def set_tag(key, value)
367
- agent&.set_tag(key, value)
369
+ set_label(key, value.to_s)
370
+ end
371
+
372
+ deprecate :set_tag, :set_label
373
+
374
+ # Set a _label_ value for the current transaction
375
+ #
376
+ # @param key [String,Symbol] A key
377
+ # @param value [Object] A value
378
+ # @return [Object] The given value
379
+ def set_label(key, value)
380
+ case value
381
+ when TrueClass,
382
+ FalseClass,
383
+ Numeric,
384
+ NilClass,
385
+ String
386
+ agent&.set_label(key, value)
387
+ else
388
+ agent&.set_label(key, value.to_s)
389
+ end
368
390
  end
369
391
 
370
392
  # Provide further context for the current transaction
@@ -101,7 +101,7 @@ module ElasticAPM
101
101
  instrumenter.start
102
102
  metrics.start
103
103
 
104
- config.enabled_spies.each do |lib|
104
+ config.enabled_instrumentations.each do |lib|
105
105
  debug "Requiring spy: #{lib}"
106
106
  require "elastic_apm/spies/#{lib}"
107
107
  end
@@ -185,8 +185,8 @@ module ElasticAPM
185
185
  instrumenter.end_span
186
186
  end
187
187
 
188
- def set_tag(key, value)
189
- instrumenter.set_tag(key, value)
188
+ def set_label(key, value)
189
+ instrumenter.set_label(key, value)
190
190
  end
191
191
 
192
192
  def set_custom_context(context)
@@ -16,6 +16,7 @@ module ElasticAPM
16
16
  # @api private
17
17
  class Config
18
18
  extend Options
19
+ extend Deprecations
19
20
 
20
21
  DEPRECATED_OPTIONS = %i[
21
22
  compression_level=
@@ -47,9 +48,11 @@ module ElasticAPM
47
48
  option :current_user_username_method, type: :string, default: 'username'
48
49
  option :custom_key_filters, type: :list, default: [], converter: RegexpList.new
49
50
  option :default_tags, type: :dict, default: {}
51
+ option :default_labels, type: :dict, default: {}
50
52
  option :disable_send, type: :bool, default: false
51
53
  option :disable_start_message, type: :bool, default: false
52
- option :disabled_spies, type: :list, default: %w[json]
54
+ option :disabled_instrumentations, type: :list, default: %w[json]
55
+ option :disabled_spies, type: :list, default: []
53
56
  option :environment, type: :string, default: ENV['RAILS_ENV'] || ENV['RACK_ENV']
54
57
  option :framework_name, type: :string
55
58
  option :framework_version, type: :string
@@ -121,7 +124,7 @@ module ElasticAPM
121
124
  end
122
125
 
123
126
  # rubocop:disable Metrics/MethodLength
124
- def available_spies
127
+ def available_instrumentations
125
128
  %w[
126
129
  delayed_job
127
130
  elasticsearch
@@ -140,8 +143,8 @@ module ElasticAPM
140
143
  end
141
144
  # rubocop:enable Metrics/MethodLength
142
145
 
143
- def enabled_spies
144
- available_spies - disabled_spies
146
+ def enabled_instrumentations
147
+ available_instrumentations - disabled_instrumentations
145
148
  end
146
149
 
147
150
  def method_missing(name, *args)
@@ -160,6 +163,32 @@ module ElasticAPM
160
163
  end
161
164
  end
162
165
 
166
+ def use_ssl?
167
+ server_url.start_with?('https')
168
+ end
169
+
170
+ def collect_metrics?
171
+ metrics_interval > 0
172
+ end
173
+
174
+ def span_frames_min_duration?
175
+ span_frames_min_duration != 0
176
+ end
177
+
178
+ def span_frames_min_duration=(value)
179
+ super
180
+ @span_frames_min_duration_us = nil
181
+ end
182
+
183
+ def span_frames_min_duration_us
184
+ @span_frames_min_duration_us ||= span_frames_min_duration * 1_000_000
185
+ end
186
+
187
+ def inspect
188
+ super.split.first + '>'
189
+ end
190
+
191
+ # DEPRECATED
163
192
  # rubocop:disable Metrics/MethodLength
164
193
  def capture_body=(value)
165
194
  if value =~ /(all|transactions|errors|off)/
@@ -185,31 +214,54 @@ module ElasticAPM
185
214
  end
186
215
  # rubocop:enable Metrics/MethodLength
187
216
 
188
- def use_ssl?
189
- server_url.start_with?('https')
217
+ # DEPRECATED
218
+ # The spies methods are only somewhat public and only mentioned briefly in
219
+ # the docs.
220
+
221
+ def disabled_spies=(list)
222
+ self.disabled_instrumentations = list
190
223
  end
191
224
 
192
- def collect_metrics?
193
- metrics_interval > 0
225
+ def disabled_spies
226
+ disabled_instrumentations
194
227
  end
195
228
 
196
- def span_frames_min_duration?
197
- span_frames_min_duration != 0
229
+ def enabled_spies
230
+ enabled_instrumentations
198
231
  end
199
232
 
200
- def span_frames_min_duration=(value)
233
+ def available_spies
234
+ available_instrumentations
235
+ end
236
+
237
+ deprecate :disabled_spies=, :disabled_instrumentations=
238
+ deprecate :disabled_spies, :disabled_instrumentations
239
+ deprecate :enabled_spies, :enabled_instrumentations
240
+ deprecate :available_spies, :available_instrumentations
241
+
242
+ LABELS_AND_TAGS_CONFLICT = 'You have both \'default_labels\' and ' \
243
+ '\'default_tags\' set. \'default_tags\' has been deprecated in favor '\
244
+ 'of \'default_labels\'. Please consider upgrading.'.freeze
245
+
246
+ def default_labels=(labels)
247
+ @options[:default_tags].value.empty? || (raise LABELS_AND_TAGS_CONFLICT)
201
248
  super
202
- @span_frames_min_duration_us = nil
203
249
  end
204
250
 
205
- def span_frames_min_duration_us
206
- @span_frames_min_duration_us ||= span_frames_min_duration * 1_000_000
251
+ # DEPRECATED
252
+
253
+ def default_tags=(tags)
254
+ @options[:default_labels].value.empty? || (raise LABELS_AND_TAGS_CONFLICT)
255
+ super
256
+ @options[:default_labels].set(tags)
207
257
  end
208
258
 
209
- def inspect
210
- super.split.first + '>'
259
+ def default_tags
260
+ default_labels
211
261
  end
212
262
 
263
+ deprecate :default_tags=, :default_labels=
264
+
213
265
  private
214
266
 
215
267
  def load_config_file
@@ -9,9 +9,9 @@ require 'elastic_apm/context/user'
9
9
  module ElasticAPM
10
10
  # @api private
11
11
  class Context
12
- def initialize(custom: {}, tags: {}, user: nil)
12
+ def initialize(custom: {}, labels: {}, user: nil)
13
13
  @custom = custom
14
- @tags = tags
14
+ @labels = labels
15
15
  @user = user || User.new
16
16
  end
17
17
 
@@ -19,10 +19,10 @@ module ElasticAPM
19
19
  attr_accessor :response
20
20
  attr_accessor :user
21
21
  attr_reader :custom
22
- attr_reader :tags
22
+ attr_reader :labels
23
23
 
24
24
  def empty?
25
- return false if tags.any?
25
+ return false if labels.any?
26
26
  return false if custom.any?
27
27
  return false if user.any?
28
28
  return false if request || response
@@ -11,7 +11,7 @@ module ElasticAPM
11
11
  error = Error.new context: context || Context.new
12
12
  error.exception = Error::Exception.new(exception, handled: handled)
13
13
 
14
- Util.reverse_merge!(error.context.tags, @agent.config.default_tags)
14
+ Util.reverse_merge!(error.context.labels, @agent.config.default_labels)
15
15
 
16
16
  if exception.backtrace
17
17
  add_stacktrace error, :exception, exception.backtrace
@@ -49,7 +49,7 @@ module ElasticAPM
49
49
  error.log.stacktrace = stacktrace
50
50
  end
51
51
 
52
- error.culprit = stacktrace.frames.first.function
52
+ error.culprit = stacktrace.frames.first&.function
53
53
  end
54
54
 
55
55
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
@@ -66,7 +66,7 @@ module ElasticAPM
66
66
 
67
67
  return unless transaction.context
68
68
 
69
- Util.reverse_merge!(error.context.tags, transaction.context.tags)
69
+ Util.reverse_merge!(error.context.labels, transaction.context.labels)
70
70
  Util.reverse_merge!(error.context.custom, transaction.context.custom)
71
71
  end
72
72
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
@@ -101,7 +101,7 @@ module ElasticAPM
101
101
  context: context,
102
102
  trace_context: trace_context,
103
103
  sampled: sampled,
104
- tags: config.default_tags
104
+ labels: config.default_labels
105
105
  )
106
106
 
107
107
  transaction.start
@@ -191,11 +191,11 @@ module ElasticAPM
191
191
 
192
192
  # metadata
193
193
 
194
- def set_tag(key, value)
194
+ def set_label(key, value)
195
195
  return unless current_transaction
196
196
 
197
197
  key = key.to_s.gsub(/[\."\*]/, '_').to_sym
198
- current_transaction.context.tags[key] = value.to_s
198
+ current_transaction.context.labels[key] = value
199
199
  end
200
200
 
201
201
  def set_custom_context(context)
@@ -21,9 +21,9 @@ module ElasticAPM
21
21
 
22
22
  TIMEOUT_INTERVAL = 5 # seconds
23
23
 
24
- def initialize(config, tags: nil, &block)
24
+ def initialize(config, labels: nil, &block)
25
25
  @config = config
26
- @tags = tags
26
+ @labels = labels
27
27
  @samplers = [CpuMem, VM].map do |kls|
28
28
  debug "Adding metrics collector '#{kls}'"
29
29
  kls.new(config)
@@ -31,7 +31,7 @@ module ElasticAPM
31
31
  @callback = block
32
32
  end
33
33
 
34
- attr_reader :config, :samplers, :callback, :tags
34
+ attr_reader :config, :samplers, :callback, :labels
35
35
 
36
36
  # rubocop:disable Metrics/MethodLength
37
37
  def start
@@ -76,7 +76,7 @@ module ElasticAPM
76
76
  end
77
77
 
78
78
  def collect_and_send
79
- metricset = Metricset.new(tags: tags, **collect)
79
+ metricset = Metricset.new(labels: labels, **collect)
80
80
  return if metricset.empty?
81
81
 
82
82
  callback.call(metricset)
@@ -3,14 +3,14 @@
3
3
  module ElasticAPM
4
4
  # @api private
5
5
  class Metricset
6
- def initialize(timestamp: Util.micros, tags: nil, **samples)
6
+ def initialize(timestamp: Util.micros, labels: nil, **samples)
7
7
  @timestamp = timestamp
8
- @tags = tags
8
+ @labels = labels
9
9
  @samples = samples
10
10
  end
11
11
 
12
12
  attr_accessor :timestamp
13
- attr_reader :samples, :tags
13
+ attr_reader :samples, :labels
14
14
 
15
15
  def empty?
16
16
  samples.empty?
@@ -23,7 +23,7 @@ module ElasticAPM
23
23
  end
24
24
 
25
25
  # rubocop:disable Metrics/MethodLength
26
- def set_tag(key, val)
26
+ def set_label(key, val)
27
27
  if elastic_span.is_a?(Transaction)
28
28
  case key.to_s
29
29
  when 'type'
@@ -33,10 +33,10 @@ module ElasticAPM
33
33
  when /user\.(\w+)/
34
34
  set_user_value($1, val)
35
35
  else
36
- elastic_span.context.tags[key] = val
36
+ elastic_span.context.labels[key] = val
37
37
  end
38
38
  else
39
- elastic_span.context.tags[key] = val
39
+ elastic_span.context.labels[key] = val
40
40
  end
41
41
  end
42
42
  # rubocop:enable Metrics/MethodLength
@@ -191,7 +191,7 @@ module ElasticAPM
191
191
  child_of: nil,
192
192
  references: nil,
193
193
  start_time: Time.now,
194
- tags: {},
194
+ labels: {},
195
195
  ignore_active_scope: false,
196
196
  finish_on_close: true,
197
197
  **
@@ -201,7 +201,7 @@ module ElasticAPM
201
201
  child_of: child_of,
202
202
  references: references,
203
203
  start_time: start_time,
204
- tags: tags,
204
+ labels: labels,
205
205
  ignore_active_scope: ignore_active_scope
206
206
  )
207
207
  scope = scope_manager.activate(span, finish_on_close: finish_on_close)
@@ -225,7 +225,7 @@ module ElasticAPM
225
225
  child_of: nil,
226
226
  references: nil,
227
227
  start_time: Time.now,
228
- tags: {},
228
+ labels: {},
229
229
  ignore_active_scope: false,
230
230
  **
231
231
  )
@@ -263,8 +263,8 @@ module ElasticAPM
263
263
  span_context ||=
264
264
  SpanContext.from_trace_context(elastic_span.trace_context)
265
265
 
266
- tags.each do |key, value|
267
- elastic_span.context.tags[key] = value
266
+ labels.each do |key, value|
267
+ elastic_span.context.labels[key] = value
268
268
  end
269
269
 
270
270
  elastic_span.start Util.micros(start_time)
@@ -29,7 +29,9 @@ module ElasticAPM
29
29
  end
30
30
 
31
31
  if ElasticAPM.running? &&
32
- !ElasticAPM.agent.config.disabled_spies.include?('action_dispatch')
32
+ !ElasticAPM.agent.config.disabled_instrumentations.include?(
33
+ 'action_dispatch'
34
+ )
33
35
  require 'elastic_apm/spies/action_dispatch'
34
36
  end
35
37
  ElasticAPM.running?
@@ -4,14 +4,14 @@ module ElasticAPM
4
4
  class Span
5
5
  # @api private
6
6
  class Context
7
- def initialize(db: nil, http: nil, tags: {})
7
+ def initialize(db: nil, http: nil, labels: {})
8
8
  @sync = true
9
9
  @db = db && Db.new(db)
10
10
  @http = http && Http.new(http)
11
- @tags = tags
11
+ @labels = labels
12
12
  end
13
13
 
14
- attr_accessor :sync, :db, :http, :tags
14
+ attr_accessor :sync, :db, :http, :labels
15
15
 
16
16
  # @api private
17
17
  class Db
@@ -14,7 +14,8 @@ module ElasticAPM
14
14
  def call(_worker, job, queue)
15
15
  name = SidekiqSpy.name_for(job)
16
16
  transaction = ElasticAPM.start_transaction(name, 'Sidekiq')
17
- ElasticAPM.set_tag(:queue, queue)
17
+ # TODO: Remove #to_s when #set_tag is removed in v3.0
18
+ ElasticAPM.set_label(:queue, queue.to_s)
18
19
 
19
20
  yield
20
21
 
@@ -12,6 +12,8 @@ module ElasticAPM
12
12
  RUBY_VERS_REGEX = %r{ruby(/gems)?[-/](\d+\.)+\d}.freeze
13
13
  JRUBY_ORG_REGEX = %r{org/jruby}.freeze
14
14
 
15
+ GEMS_PATH = defined?(Bundler) ? Bundler.bundle_path.to_s : Gem.dir
16
+
15
17
  def initialize(config)
16
18
  @config = config
17
19
  @cache = Util::LruCache.new(2048, &method(:build_frame))
@@ -64,9 +66,12 @@ module ElasticAPM
64
66
  [file, number, method, module_name]
65
67
  end
66
68
 
69
+ # rubocop:disable Metrics/CyclomaticComplexity
67
70
  def library_frame?(config, abs_path)
68
71
  return false unless abs_path
69
72
 
73
+ return true if abs_path.start_with?(GEMS_PATH)
74
+
70
75
  if abs_path.start_with?(config.__root_path)
71
76
  return true if abs_path.start_with?(config.__root_path + '/vendor')
72
77
  return false
@@ -77,6 +82,7 @@ module ElasticAPM
77
82
 
78
83
  false
79
84
  end
85
+ # rubocop:enable Metrics/CyclomaticComplexity
80
86
 
81
87
  def strip_load_path(path)
82
88
  return nil if path.nil?
@@ -20,7 +20,7 @@ module ElasticAPM
20
20
  type = nil,
21
21
  sampled: true,
22
22
  context: nil,
23
- tags: nil,
23
+ labels: nil,
24
24
  trace_context: nil
25
25
  )
26
26
  @name = name
@@ -29,7 +29,7 @@ module ElasticAPM
29
29
  @sampled = sampled
30
30
 
31
31
  @context = context || Context.new # TODO: Lazy generate this?
32
- Util.reverse_merge!(@context.tags, tags) if tags
32
+ Util.reverse_merge!(@context.labels, labels) if labels
33
33
 
34
34
  @trace_context = trace_context || TraceContext.new(recorded: sampled)
35
35
 
@@ -34,6 +34,16 @@ module ElasticAPM
34
34
  h.each { |k, v| hash[k] = keyword_field(v) }
35
35
  end
36
36
  end
37
+
38
+ def mixed_object(hash)
39
+ return unless hash
40
+
41
+ hash.tap do |h|
42
+ h.each do |k, v|
43
+ hash[k] = v.is_a?(String) ? keyword_field(v) : v
44
+ end
45
+ end
46
+ end
37
47
  end
38
48
 
39
49
  # @api private
@@ -10,7 +10,7 @@ module ElasticAPM
10
10
 
11
11
  {
12
12
  custom: context.custom,
13
- tags: keyword_object(context.tags),
13
+ tags: mixed_object(context.labels),
14
14
  request: build_request(context.request),
15
15
  response: build_response(context.response),
16
16
  user: build_user(context.user)
@@ -9,7 +9,7 @@ module ElasticAPM
9
9
  {
10
10
  metricset: {
11
11
  timestamp: metricset.timestamp.to_i,
12
- tags: keyword_object(metricset.tags),
12
+ tags: keyword_object(metricset.labels),
13
13
  samples: build_samples(metricset.samples)
14
14
  }
15
15
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ElasticAPM
4
- VERSION = '2.11.0'
4
+ VERSION = '2.12.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.11.0
4
+ version: 2.12.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-09-30 00:00:00.000000000 Z
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby