elastic-apm 4.3.0 → 4.4.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/.ci/jobs/apm-agent-ruby-mbp.yml +1 -0
- data/CHANGELOG.asciidoc +12 -0
- data/Gemfile +1 -0
- data/docs/configuration.asciidoc +25 -1
- data/lib/elastic_apm/agent.rb +2 -2
- data/lib/elastic_apm/config.rb +19 -0
- data/lib/elastic_apm/instrumenter.rb +8 -2
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +1 -1
- data/lib/elastic_apm/metrics.rb +1 -1
- data/lib/elastic_apm/version.rb +1 -1
- data/lib/elastic_apm.rb +5 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bd0b20acebcfa91bc6e5d4e580c6a1a5f8da35b06152a4fe949c76380667e58
|
4
|
+
data.tar.gz: 85935357d8a1831233cb8ab837564b38ff800e29a0cf1891fd4ba6263bb1a0d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eabaee4c14440607bdc5b5a0e53fd8b3844e0756a16cf6ef0da4b2a5431e7c1b441d0ef6329baf7d89f165f44031aa6a8396541930576acf54b254a787994cc
|
7
|
+
data.tar.gz: e601985643738456350d49ba9c261ccc17a0259651830230cf353d20c241403846f73c3ce371ab5b6f1a97b1223ac797ddfc1b764333e51055ff53104becd212
|
data/CHANGELOG.asciidoc
CHANGED
@@ -35,6 +35,18 @@ endif::[]
|
|
35
35
|
[[release-notes-4.x]]
|
36
36
|
=== Ruby Agent version 4.x
|
37
37
|
|
38
|
+
[[release-notes-4.4.0]]
|
39
|
+
==== 4.4.0
|
40
|
+
|
41
|
+
[float]
|
42
|
+
===== Added
|
43
|
+
- Optional span to be ended instead of current span {pull}1039[#1039]
|
44
|
+
- Config option `log_ecs_formatting` {pull}1053[#1053]
|
45
|
+
|
46
|
+
[float]
|
47
|
+
===== Fixed
|
48
|
+
- Fixed detecting Linux on Alpine for CPU/MEM metrics {pull}1057[#1057]
|
49
|
+
|
38
50
|
[[release-notes-4.3.0]]
|
39
51
|
==== 4.3.0
|
40
52
|
|
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
|
data/docs/configuration.asciidoc
CHANGED
@@ -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. Theis is an opt-in field, as they are used are for a multitude of things.
|
505
|
+
Elastic APM can instrument your Rake tasks. Theis 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/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
|
@@ -222,8 +222,14 @@ module ElasticAPM
|
|
222
222
|
# rubocop:enable Metrics/CyclomaticComplexity
|
223
223
|
# rubocop:enable Metrics/PerceivedComplexity
|
224
224
|
|
225
|
-
def end_span
|
226
|
-
|
225
|
+
def end_span(span = nil)
|
226
|
+
if span
|
227
|
+
current_spans.delete(span)
|
228
|
+
else
|
229
|
+
span = current_spans.pop
|
230
|
+
end
|
231
|
+
|
232
|
+
return unless span
|
227
233
|
|
228
234
|
span.done
|
229
235
|
|
data/lib/elastic_apm/metrics.rb
CHANGED
data/lib/elastic_apm/version.rb
CHANGED
data/lib/elastic_apm.rb
CHANGED
@@ -243,9 +243,12 @@ module ElasticAPM
|
|
243
243
|
|
244
244
|
# Ends the current span
|
245
245
|
#
|
246
|
+
# @param span [Span] Optional span to be ended instead of the last span
|
247
|
+
# created, useful for asynchronous environments where multiple spans are created in parallel
|
248
|
+
#
|
246
249
|
# @return [Span]
|
247
|
-
def end_span
|
248
|
-
agent&.end_span
|
250
|
+
def end_span(span = nil)
|
251
|
+
agent&.end_span(span)
|
249
252
|
end
|
250
253
|
|
251
254
|
# rubocop:disable Metrics/ParameterLists
|
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.
|
4
|
+
version: 4.4.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: 2021-
|
11
|
+
date: 2021-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
273
|
- !ruby/object:Gem::Version
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
276
|
+
rubygems_version: 3.2.22
|
277
277
|
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: The official Elastic APM agent for Ruby
|