elastic-apm 4.7.3 → 4.9.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/.exclude.yml +27 -82
- data/.ci/.framework.yml +1 -4
- data/.ci/.ruby.yml +1 -1
- data/.ci/updatecli/values.d/apm-data-spec.yml +1 -0
- data/.ci/updatecli/values.d/apm-gherkin.yml +1 -0
- data/.ci/updatecli/values.d/apm-json-specs.yml +1 -0
- data/.ci/updatecli/values.d/scm.yml +10 -0
- data/.ci/updatecli/values.d/update-compose.yml +3 -0
- data/.github/CODEOWNERS +1 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +2 -2
- data/.github/dependabot.yml +22 -19
- data/.github/workflows/README.md +1 -2
- data/.github/workflows/addToProject.yml +43 -12
- data/.github/workflows/ci.yml +6 -6
- data/.github/workflows/docs-build.yml +16 -0
- data/.github/workflows/docs-deploy.yml +16 -0
- data/.github/workflows/docs-preview-cleanup.yml +12 -0
- data/.github/workflows/github-commands-comment.yml +18 -0
- data/.github/workflows/microbenchmark.yml +7 -24
- data/.github/workflows/release.yml +40 -24
- data/.github/workflows/run-matrix.yml +21 -12
- data/.github/workflows/test-reporter.yml +4 -3
- data/.github/workflows/updatecli.yml +45 -13
- data/Dockerfile +38 -12
- data/Gemfile +38 -3
- data/bin/dev +16 -4
- data/bin/run-bdd +2 -2
- data/docker-compose.yml +12 -5
- data/docs/docset.yml +11 -0
- data/docs/reference/advanced-topics.md +18 -0
- data/docs/reference/api-reference.md +428 -0
- data/docs/reference/configuration.md +751 -0
- data/docs/{context.asciidoc → reference/context.md} +27 -21
- data/docs/reference/custom-instrumentation.md +78 -0
- data/docs/{getting-started-rack.asciidoc → reference/getting-started-rack.md} +27 -30
- data/docs/reference/getting-started-rails.md +33 -0
- data/docs/reference/graphql.md +27 -0
- data/docs/reference/index.md +33 -0
- data/docs/{logs.asciidoc → reference/logs.md} +45 -57
- data/docs/reference/metrics.md +205 -0
- data/docs/reference/opentracing-api.md +76 -0
- data/docs/reference/performance-tuning.md +77 -0
- data/docs/reference/set-up-apm-ruby-agent.md +22 -0
- data/docs/reference/supported-technologies.md +134 -0
- data/docs/reference/toc.yml +24 -0
- data/docs/reference/upgrading.md +25 -0
- data/docs/release-notes/index.md +182 -0
- data/docs/release-notes/known-issues.md +29 -0
- data/docs/release-notes/toc.yml +3 -0
- data/elastic-apm.gemspec +2 -2
- data/lib/elastic_apm/central_config.rb +1 -1
- data/lib/elastic_apm/config/round_float_hash_value.rb +35 -0
- data/lib/elastic_apm/config.rb +2 -0
- data/lib/elastic_apm/context_builder.rb +5 -2
- data/lib/elastic_apm/instrumenter.rb +23 -3
- data/lib/elastic_apm/spies/http.rb +1 -1
- data/lib/elastic_apm/spies/sidekiq.rb +2 -1
- data/lib/elastic_apm/stacktrace_builder.rb +3 -3
- data/lib/elastic_apm/transaction.rb +11 -4
- data/lib/elastic_apm/version.rb +1 -1
- data/updatecli-compose.yaml +23 -0
- metadata +49 -37
- data/.ci/snapshoty.yml +0 -33
- data/.ci/updatecli/updatecli.d/update-gherkin-specs.yml +0 -84
- data/.ci/updatecli/updatecli.d/update-json-specs.yml +0 -84
- data/.ci/updatecli/updatecli.d/update-specs.yml +0 -86
- data/.ci/updatecli/values.yml +0 -14
- data/.github/workflows/coverage-reporter.yml +0 -34
- data/.github/workflows/opentelemetry.yml +0 -22
- data/.github/workflows/snapshoty.yml +0 -35
- data/CHANGELOG.asciidoc +0 -990
- data/SECURITY.md +0 -7
- data/docs/advanced.asciidoc +0 -14
- data/docs/api.asciidoc +0 -487
- data/docs/configuration.asciidoc +0 -889
- data/docs/custom-instrumentation.asciidoc +0 -80
- data/docs/debugging.asciidoc +0 -44
- data/docs/getting-started-rails.asciidoc +0 -30
- data/docs/graphql.asciidoc +0 -23
- data/docs/index.asciidoc +0 -38
- data/docs/introduction.asciidoc +0 -36
- data/docs/metrics.asciidoc +0 -235
- data/docs/opentracing.asciidoc +0 -94
- data/docs/performance-tuning.asciidoc +0 -106
- data/docs/redirects.asciidoc +0 -9
- data/docs/release-notes.asciidoc +0 -15
- data/docs/set-up.asciidoc +0 -19
- data/docs/supported-technologies.asciidoc +0 -157
- data/docs/upgrading.asciidoc +0 -18
- /data/docs/{images → reference/images}/dynamic-config.svg +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
mapped_pages:
|
|
3
|
+
- https://www.elastic.co/guide/en/apm/agent/ruby/current/metrics.html
|
|
4
|
+
applies_to:
|
|
5
|
+
stack:
|
|
6
|
+
serverless:
|
|
7
|
+
observability:
|
|
8
|
+
product:
|
|
9
|
+
apm_agent_ruby: ga
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Metrics [metrics]
|
|
13
|
+
|
|
14
|
+
The Ruby agent tracks various system and application metrics. These metrics will be sent regularly to the APM Server and from there to Elasticsearch. You can adjust the interval by setting [`metrics_interval`](/reference/configuration.md#config-metrics-interval).
|
|
15
|
+
|
|
16
|
+
The metrics will be stored in the `apm-*` index and have the `processor.event` property set to `metric`.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## System metrics [metrics-system]
|
|
20
|
+
|
|
21
|
+
**Note:** Metrics from the Ruby agent are Linux only for now.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### `system.cpu.total.norm.pct` [metric-system.cpu.total.norm.pct]
|
|
25
|
+
|
|
26
|
+
* **Type:** Float
|
|
27
|
+
* **Format:** Percent
|
|
28
|
+
|
|
29
|
+
The percentage of CPU time in states other than Idle and IOWait, normalised by the number of cores.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### `system.memory.total` [metric-system.memory.total]
|
|
33
|
+
|
|
34
|
+
* **Type:** Long
|
|
35
|
+
* **Format:** Bytes
|
|
36
|
+
|
|
37
|
+
The total memory of the system in bytes.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### `system.memory.actual.free` [metric-system.memory.actual.free]
|
|
41
|
+
|
|
42
|
+
* **Type:** Long
|
|
43
|
+
* **Format:** Bytes
|
|
44
|
+
|
|
45
|
+
Free memory of the system in bytes.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### `system.process.cpu.total.norm.pct` [metric-system.process.cpu.total.norm.pct]
|
|
49
|
+
|
|
50
|
+
* **Type:** Float
|
|
51
|
+
* **Format:** Percent
|
|
52
|
+
|
|
53
|
+
The percentage of CPU time spent by the process since the last event. This value is normalized by the number of CPU cores and it ranges from 0 to 100%.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### `system.process.memory.size` [metric-system.process.memory.size]
|
|
57
|
+
|
|
58
|
+
* **Type:** Long
|
|
59
|
+
* **Format:** Bytes
|
|
60
|
+
|
|
61
|
+
The total virtual memory the process has.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### `system.process.memory.rss.bytes` [metric-system.process.memory.rss.bytes]
|
|
65
|
+
|
|
66
|
+
* **Type:** Long
|
|
67
|
+
* **Format:** Bytes
|
|
68
|
+
|
|
69
|
+
The Resident Set Size, the amount of memory the process occupies in main memory (RAM).
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## Ruby Metrics [metrics-ruby]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### `ruby.gc.count` [metric-ruby.gc.counts]
|
|
76
|
+
|
|
77
|
+
* **Type:** Integer
|
|
78
|
+
* **Format:** Count
|
|
79
|
+
|
|
80
|
+
The number of Garbage Collection runs since the process started.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### `ruby.threads` [metric-ruby.threads]
|
|
84
|
+
|
|
85
|
+
* **Type:** Integer
|
|
86
|
+
* **Format:** Count
|
|
87
|
+
|
|
88
|
+
The number of threads belonging to the current process.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### `ruby.heap.slots.live` [metric-ruby.heap.slots.live]
|
|
92
|
+
|
|
93
|
+
* **Type:** Integer
|
|
94
|
+
* **Format:** Slots
|
|
95
|
+
|
|
96
|
+
Current amount of heap slots that are live.
|
|
97
|
+
|
|
98
|
+
**NB:** Not currently supported on JRuby.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### `ruby.heap.slots.free` [metric-ruby.heap.slots.free]
|
|
102
|
+
|
|
103
|
+
* **Type:** Integer
|
|
104
|
+
* **Format:** Slots
|
|
105
|
+
|
|
106
|
+
Current amount of heap slots that are free.
|
|
107
|
+
|
|
108
|
+
**NB:** Not currently supported on JRuby.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### `ruby.heap.allocations.total` [metrics-ruby.heap.allocations.total]
|
|
112
|
+
|
|
113
|
+
* **Type:** Integer
|
|
114
|
+
* **Format:** Objects
|
|
115
|
+
|
|
116
|
+
Current amount of allocated objects on the heap.
|
|
117
|
+
|
|
118
|
+
**NB:** Not currently supported on JRuby.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### `ruby.gc.time` [metrics-ruby.gc.time]
|
|
122
|
+
|
|
123
|
+
* **Type:** Float
|
|
124
|
+
* **Format:** Seconds
|
|
125
|
+
|
|
126
|
+
The total time spent in garbage collection.
|
|
127
|
+
|
|
128
|
+
**NB:** You need to enable Ruby’s GC Profiler for this to get reported. You can do this at any time when your application boots by calling `GC::Profiler.enable`.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## JVM Metrics [metrics-jvm-metrics]
|
|
132
|
+
|
|
133
|
+
The following metrics are available when using JRuby. They use the ruby java API to gather metrics via MXBean.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### `jvm.memory.heap.used` [metric-jvm.memory.heap.used]
|
|
137
|
+
|
|
138
|
+
* **Type:** Long
|
|
139
|
+
* **Format:** Bytes
|
|
140
|
+
|
|
141
|
+
The amount of used heap memory in bytes.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### `jvm.memory.heap.committed` [metric-jvm.memory.heap.committed]
|
|
145
|
+
|
|
146
|
+
* **Type:** Long
|
|
147
|
+
* **Format:** Bytes
|
|
148
|
+
|
|
149
|
+
The amount of heap memory in bytes that is committed for the Java virtual machine to use. This amount of memory is guaranteed for the Java virtual machine to use.
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### `jvm.memory.heap.max` [metric-jvm.memory.heap.max]
|
|
153
|
+
|
|
154
|
+
* **Type:** Long
|
|
155
|
+
* **Format:** Bytes
|
|
156
|
+
|
|
157
|
+
The amount of heap memory in bytes that is committed for the Java virtual machine to use. This amount of memory is guaranteed for the Java virtual machine to use.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### `jvm.memory.non_heap.used` [metric-jvm.memory.non_heap.used]
|
|
161
|
+
|
|
162
|
+
* **Type:** Long
|
|
163
|
+
* **Format:** Bytes
|
|
164
|
+
|
|
165
|
+
The amount of used non-heap memory in bytes.
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
### `jvm.memory.non_heap.committed` [metric-jvm.memory.non_heap.committed]
|
|
169
|
+
|
|
170
|
+
* **Type:** Long
|
|
171
|
+
* **Format:** Bytes
|
|
172
|
+
|
|
173
|
+
The amount of non-heap memory in bytes that is committed for the Java virtual machine to use. This amount of memory is guaranteed for the Java virtual machine to use.
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### `jvm.memory.non_heap.max` [metric-jvm.memory.non_heap.max]
|
|
177
|
+
|
|
178
|
+
* **Type:** Long
|
|
179
|
+
* **Format:** Bytes
|
|
180
|
+
|
|
181
|
+
The maximum amount of non-heap memory in bytes that can be used for memory management. If the maximum memory size is undefined, the value is -1.
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
### `jvm.memory.heap.pool.used` [metric-jvm.memory.heap.pool.used]
|
|
185
|
+
|
|
186
|
+
* **Type:** Long
|
|
187
|
+
* **Format:** Bytes
|
|
188
|
+
|
|
189
|
+
The amount of used memory in bytes of the memory pool.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### `jvm.memory.heap.pool.committed` [metric-jvm.memory.heap.pool.committed]
|
|
193
|
+
|
|
194
|
+
* **Type:** Long
|
|
195
|
+
* **Format:** Bytes
|
|
196
|
+
|
|
197
|
+
The amount of memory in bytes that is committed for the memory pool. This amount of memory is guaranteed for this specific pool.
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### `jvm.memory.heap.pool.max` [metric-jvm.memory.heap.pool.max]
|
|
201
|
+
|
|
202
|
+
* **Type:** Long
|
|
203
|
+
* **Format:** Bytes
|
|
204
|
+
|
|
205
|
+
The maximum amount of memory in bytes that can be used for the memory pool.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
mapped_pages:
|
|
3
|
+
- https://www.elastic.co/guide/en/apm/agent/ruby/current/opentracing.html
|
|
4
|
+
applies_to:
|
|
5
|
+
stack:
|
|
6
|
+
serverless:
|
|
7
|
+
observability:
|
|
8
|
+
product:
|
|
9
|
+
apm_agent_ruby: ga
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OpenTracing API [opentracing]
|
|
13
|
+
|
|
14
|
+
The Elastic APM OpenTracing bridge allows to create Elastic APM `Transactions` and `Spans`, using the OpenTracing API. In other words, it translates the calls to the OpenTracing API to Elastic APM and thus allows for reusing existing instrumentation.
|
|
15
|
+
|
|
16
|
+
The first span of a service will be converted to an Elastic APM `Transaction`, subsequent spans are mapped to Elastic APM `Span`.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Operation Modes [operation-modes]
|
|
20
|
+
|
|
21
|
+
This bridge allows for different operation modes in combination with the Elastic APM Agent.
|
|
22
|
+
|
|
23
|
+
* Noop<br> If no Elastic APM agent is running, the bridge is in noop mode and does not actually record and report spans.
|
|
24
|
+
* Mix and Match<br> If you want to leverage the auto instrumentation of Elastic APM, but also want do create custom spans or use the OpenTracing API to add custom tags to the spans created by Elastic APM, you can just do that. The OpenTracing bridge and the standard Elastic APM API interact seamlessly.
|
|
25
|
+
* Manual instrumentation<br> If you don’t want Elastic APM to auto-instrument known frameworks, but instead only rely on manual instrumentation, disable the auto instrumentation setting the configuration option [`instrument`](/reference/configuration.md#config-instrument) to `false`.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Getting started [getting-started]
|
|
29
|
+
|
|
30
|
+
Either `require 'elastic_apm/opentracing'` during the boot of your app or specify the `require:` argument to your `Gemfile`, eg. `gem 'elastic_apm', require: 'elastic_apm/opentracing'`.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Set Elastic APM as the global tracer [init-tracer]
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
::OpenTracing.global_tracer = ElasticAPM::OpenTracing::Tracer.new
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## Elastic APM specific tags [elastic-apm-tags]
|
|
41
|
+
|
|
42
|
+
Elastic APM defines some tags which are not included in the OpenTracing API but are relevant in the context of Elastic APM.
|
|
43
|
+
|
|
44
|
+
* `type` - sets the type of the transaction, for example `request`, `ext` or `db`
|
|
45
|
+
* `user.id` - sets the user id, appears in the "User" tab in the transaction details in the Elastic APM app
|
|
46
|
+
* `user.email` - sets the user email, appears in the "User" tab in the transaction details in the Elastic APM app
|
|
47
|
+
* `user.username` - sets the user name, appears in the "User" tab in the transaction details in the Elastic APM app
|
|
48
|
+
* `result` - sets the result of the transaction. Overrides the default value of `success`. If the `error` tag is set to `true`, the default value is `error`.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Caveats [unsupported]
|
|
52
|
+
|
|
53
|
+
Not all features of the OpenTracing API are supported.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Context propagation [propagation]
|
|
57
|
+
|
|
58
|
+
This bridge only supports the format `OpenTracing::FORMAT_RACK`, using HTTP headers with capitalized names, prefixed with `HTTP_` as Rack does it.
|
|
59
|
+
|
|
60
|
+
`OpenTracing::FORMAT_BINARY` is currently not supported.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Span References [references]
|
|
64
|
+
|
|
65
|
+
Currently, this bridge only supports `child_of` references. Other references, like `follows_from` are not supported yet.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Baggage [baggage]
|
|
69
|
+
|
|
70
|
+
The `Span.set_baggage` method is not supported. Baggage items are dropped with a warning log message.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Logs [opentracing-logs]
|
|
74
|
+
|
|
75
|
+
Logs are currently not supported.
|
|
76
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
mapped_pages:
|
|
3
|
+
- https://www.elastic.co/guide/en/apm/agent/ruby/current/tuning-and-overhead.html
|
|
4
|
+
applies_to:
|
|
5
|
+
stack:
|
|
6
|
+
serverless:
|
|
7
|
+
observability:
|
|
8
|
+
product:
|
|
9
|
+
apm_agent_ruby: ga
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Performance tuning [tuning-and-overhead]
|
|
13
|
+
|
|
14
|
+
Using any APM solution comes with trade-offs, and the Elastic APM Ruby Agent is no different. Instrumenting your code, using timers, recording context data, etc., uses resources—for example:
|
|
15
|
+
|
|
16
|
+
* CPU time
|
|
17
|
+
* Memory
|
|
18
|
+
* Bandwidth
|
|
19
|
+
* Elasticsearch storage
|
|
20
|
+
|
|
21
|
+
We invest a lot of effort to ensure that the Ruby Agent is suitable for production code and that its overhead remains as low as possible. However, because every application is different, there are some knobs you can turn and tweak to adapt the Agent to your specific needs.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Transaction sample rate [tuning-sample-rate]
|
|
25
|
+
|
|
26
|
+
By default, the Agent samples every transaction. The easiest way to reduce both the overhead of the agent and storage requirements, is to tell it to do less, i.e., sample fewer transactions. To do this, set the [`transaction_sample_rate`](/reference/configuration.md#config-transaction-sample-rate) to a value between `0.0` and `1.0`—the percentage of transactions you’d like to randomly sample. The Agent will still record the overall time and result of unsampled transactions, but not context information, tags, or spans.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Collecting frame context [tuning-frame-context]
|
|
30
|
+
|
|
31
|
+
The Agent automatically captures several lines of source code around each frame location in the stack trace. This enables the APM app to provide greater insight into exactly where an error or span is occurring in your code. This insight does come at a cost—in terms of performance, stack trace collection is the most expensive thing the Agent does.
|
|
32
|
+
|
|
33
|
+
There are settings you can modify to control this behavior:
|
|
34
|
+
|
|
35
|
+
1. Disable stack trace frame collection for short-duration spans by setting [`span_frames_min_duration`](/reference/configuration.md#config-span-frames-min-duration-ms) to `0`.
|
|
36
|
+
2. Modify the number of source code lines collected. These settings are divided between app frames, which represent your application code, and library frames, which represent the code of your dependencies. Each of these categories are further split into separate error and span settings.
|
|
37
|
+
|
|
38
|
+
* [`source_lines_error_app_frames`](/reference/configuration.md#config-source-lines-error-app-frames)
|
|
39
|
+
* [`source_lines_error_library_frames`](/reference/configuration.md#config-source-lines-error-library-frames)
|
|
40
|
+
* [`source_lines_span_app_frames`](/reference/configuration.md#config-source-lines-span-app-frames)
|
|
41
|
+
* [`source_lines_span_library_frames`](/reference/configuration.md#config-source-lines-span-library-frames)
|
|
42
|
+
|
|
43
|
+
3. If you’re using the API to create a custom span, you can disable stack trace collection with the [`include_stacktrace` argument](/reference/api-reference.md#api-agent-start_span).
|
|
44
|
+
|
|
45
|
+
Reading source files inside a running application can cause a lot of disk I/O, and sending up source lines for each frame will have a network and storage cost that is quite high. Turning these limits down will prevent storing excessive amounts of data in Elasticsearch.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Transaction queue [tuning-queue]
|
|
49
|
+
|
|
50
|
+
The Agent does not send every transaction as it happens. Instead, to reduce load on the APM Server, the Agent uses a queue. The queue is flushed periodically, or when it reaches a maximum size.
|
|
51
|
+
|
|
52
|
+
While this reduces the load on the APM Server, holding on to transaction data in a queue uses memory. If you notice a large increase in memory use, try adjusting these settings:
|
|
53
|
+
|
|
54
|
+
* [`api_request_time`](/reference/configuration.md#config-api-request-time) to reduce the duration of a single streaming request. This setting is helpful if you have a sustained high number of transactions.
|
|
55
|
+
* [`api_request_size`](/reference/configuration.md#config-api-request-size) to reduce the maximum size of one request. This setting can help if you experience transaction peaks (a large number in a short period of time).
|
|
56
|
+
|
|
57
|
+
Keep in mind that reducing the value of either setting will cause the agent to send more HTTP requests to the APM Server, potentially causing a higher load.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Spans per transaction [tuning-max-spans]
|
|
61
|
+
|
|
62
|
+
The number of spans per transaction will influence both how much time the agent spends in each transaction collecting contextual data, and how much storage space is needed in Elasticsearch. In our experience, most *usual* transactions should have well below 100 spans. In some cases, however, the number of spans can explode—for example:
|
|
63
|
+
|
|
64
|
+
* Long-running transactions
|
|
65
|
+
* Unoptimized code, e.g., doing hundreds of SQL queries in a loop
|
|
66
|
+
|
|
67
|
+
To avoid these edge cases which overload both the Agent and the APM Server, the Agent will stop recording spans when a specified limit is reached. This limit is configurable with [`transaction_max_spans`](/reference/configuration.md#config-transaction-max-spans).
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Capturing headers and request body [tuning-body-headers]
|
|
71
|
+
|
|
72
|
+
You can configure the Agent to capture headers and request bodies with [`capture_headers`](/reference/configuration.md#config-capture-headers) and [`capture_body`](/reference/configuration.md#config-capture-body). By default, headers are captured and request bodies are not.
|
|
73
|
+
|
|
74
|
+
Depending on the nature of your POST requests, capturing request bodies for transactions may introduce noticeable overhead, as well as increased storage use. In most scenarios, we advise against enabling request body capturing for transactions, and only enabling it if necessary for errors.
|
|
75
|
+
|
|
76
|
+
Capturing request/response headers has less overhead on the agent than capturing request bodies, but can have an impact on storage use.
|
|
77
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
mapped_pages:
|
|
3
|
+
- https://www.elastic.co/guide/en/apm/agent/ruby/current/set-up.html
|
|
4
|
+
applies_to:
|
|
5
|
+
stack:
|
|
6
|
+
serverless:
|
|
7
|
+
observability:
|
|
8
|
+
product:
|
|
9
|
+
apm_agent_ruby: ga
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Set up the APM Ruby agent [set-up]
|
|
13
|
+
|
|
14
|
+
To get you off the ground, we’ve prepared guides for setting up the Agent with different frameworks:
|
|
15
|
+
|
|
16
|
+
* [Rails](/reference/getting-started-rails.md)
|
|
17
|
+
* [Rack](/reference/getting-started-rack.md)
|
|
18
|
+
|
|
19
|
+
For custom instrumentation, see the [*API reference*](/reference/api-reference.md).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
mapped_pages:
|
|
3
|
+
- https://www.elastic.co/guide/en/apm/agent/ruby/current/supported-technologies.html
|
|
4
|
+
applies_to:
|
|
5
|
+
stack:
|
|
6
|
+
serverless:
|
|
7
|
+
observability:
|
|
8
|
+
product:
|
|
9
|
+
apm_agent_ruby: ga
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Supported technologies [supported-technologies]
|
|
13
|
+
|
|
14
|
+
The Elastic APM Ruby Agent has built-in support for many frameworks and libraries. Generally, we want to support all of the most popular libraries. If your favorite is missing, feel free to request it in an issue, or better yet, create a pull request.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Ruby [supported-technologies-ruby]
|
|
18
|
+
|
|
19
|
+
We follow Ruby’s own maintenance policy and officially support all currently maintained versions per [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/) < 4.0.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Web Frameworks and Libraries [supported-technologies-web]
|
|
23
|
+
|
|
24
|
+
We have automatic support for Ruby on Rails and all Rack compatible web frameworks.
|
|
25
|
+
|
|
26
|
+
We test against all supported minor versions of Rails, Sinatra, and Grape.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Ruby on Rails [supported-technologies-rails]
|
|
30
|
+
|
|
31
|
+
We currently support Rails >= 4.2 <= 7.2. This follows Rails' own [Security policy](https://rubyonrails.org/security/).
|
|
32
|
+
|
|
33
|
+
See [Getting started with Rails](/reference/getting-started-rails.md).
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Sinatra [supported-technologies-sinatra]
|
|
37
|
+
|
|
38
|
+
We currently support Sinatra >= 1.0 <= 2.2.
|
|
39
|
+
|
|
40
|
+
See [Getting started with Rack](/reference/getting-started-rack.md).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Grape [supported-technologies-grape]
|
|
44
|
+
|
|
45
|
+
We currently support Grape >= 1.2 <= 1.6.
|
|
46
|
+
|
|
47
|
+
See [Grape example](/reference/getting-started-rack.md#getting-started-grape).
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Databases [supported-technologies-databases]
|
|
51
|
+
|
|
52
|
+
We automatically instrument database actions using:
|
|
53
|
+
|
|
54
|
+
* ActiveRecord (>= 4.2 <= 7.2)
|
|
55
|
+
* DynamoDB (>= 1.0 <= 1.158.0)
|
|
56
|
+
* Elasticsearch (>= 0.9 <= 9.2.0)
|
|
57
|
+
* Mongo (>= 2.1 <= 2.22.0)
|
|
58
|
+
* Redis (>= 3.1 <= 5.4.1)
|
|
59
|
+
* Sequel (>= 4.35 <= 5.100.0)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## External HTTP requests [supported-technologies-http]
|
|
63
|
+
|
|
64
|
+
We automatically instrument and add support for distributed tracing to external requests using these libraries:
|
|
65
|
+
|
|
66
|
+
* `net/http`
|
|
67
|
+
* Http.rb (>= 3.0 < 6.0)
|
|
68
|
+
* Faraday (>= 0.2.1 <= 2.14.0)
|
|
69
|
+
|
|
70
|
+
**Note:** These libraries usually assume `localhost` if no `Host` is specified, so the agent does as well.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Background Processing [supported-technologies-backgroud-processing]
|
|
74
|
+
|
|
75
|
+
We automatically instrument background processing using:
|
|
76
|
+
|
|
77
|
+
* DelayedJob (<= 4.2.0)
|
|
78
|
+
* Sidekiq (<= 8.1.0)
|
|
79
|
+
* Shoryuken (<= 6.2.1)
|
|
80
|
+
* Sneakers (2.12.0) (Experimental, see [#676](https://github.com/elastic/apm-agent-ruby/pull/676))
|
|
81
|
+
* Resque (>= 2.0.0 <= 2.7.0)
|
|
82
|
+
* SuckerPunch (>= 2.0.0 <= 3.3.0)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Resque [supported-technologies-resque]
|
|
86
|
+
|
|
87
|
+
To make the agent work with Resque, you need to require `elastic_apm/resque` before you boot your Resque worker process.
|
|
88
|
+
|
|
89
|
+
For example in your `Rakefile`:
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
require 'resque'
|
|
93
|
+
require 'elastic_apm'
|
|
94
|
+
require 'elastic_apm/resque'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
When you start Resque, you should see a series of messages like the following in the Resque logs:
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
I, [XXX #81227] INFO -- : Starting worker main
|
|
101
|
+
D, [XXX #81227] DEBUG -- : Registered signals
|
|
102
|
+
I, [XXX #81227] INFO -- : Running before_first_fork hooks
|
|
103
|
+
D, [XXX #81227] DEBUG -- : Starting ElasticAPM agent
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Also be sure to set the Resque environment variable `RUN_AT_EXIT_HOOKS` to `true`. Otherwise, the fork may be terminated before the agent has a chance to send all the fork’s events to the APM server.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## SuckerPunch [supported-technologies-sucker-punch]
|
|
110
|
+
|
|
111
|
+
Asynchronously executed jobs in SuckerPunch are automatically instrumented.
|
|
112
|
+
|
|
113
|
+
Note that errors raised in the user-defined `JobClass#perform` method will be first handled by the SuckerPunch exception handler before being handled by the agent. The handler is accessed/set via `SuckerPunch.exception_handler` in version 2.0. The agent transaction will be marked as successful unless you re-raise the error in the exception handler. You can also explicitly report the error via [`ElasticAPM.report`](/reference/api-reference.md#api-agent-report) in a custom SuckerPunch exception handler.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## gRPC [supported-technologies-grpc]
|
|
117
|
+
|
|
118
|
+
We automatically instrument gRPC using the `grpc` gem. Note that this is experimental, as the `grpc` gem’s support for `Interceptors` is experimental as of version 1.27.0.
|
|
119
|
+
|
|
120
|
+
To instrument a client, add the `ElasticAPM::GRPC::ClientInterceptor` as an `interceptor` at Stub creation.
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
Helloworld::Greeter::Stub.new(
|
|
124
|
+
'localhost:50051',
|
|
125
|
+
interceptors: [ElasticAPM::GRPC::ClientInterceptor.new]
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
To instrument a server, add the `ElasticAPM::GRPC::ServerInterceptor`.
|
|
130
|
+
|
|
131
|
+
```ruby
|
|
132
|
+
GRPC::RpcServer.new(interceptors: [ElasticAPM::GRPC::ServerInterceptor.new])
|
|
133
|
+
```
|
|
134
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
project: 'APM Ruby agent reference'
|
|
2
|
+
toc:
|
|
3
|
+
- file: index.md
|
|
4
|
+
- file: set-up-apm-ruby-agent.md
|
|
5
|
+
children:
|
|
6
|
+
- file: getting-started-rails.md
|
|
7
|
+
- file: getting-started-rack.md
|
|
8
|
+
- file: supported-technologies.md
|
|
9
|
+
- file: configuration.md
|
|
10
|
+
- file: advanced-topics.md
|
|
11
|
+
children:
|
|
12
|
+
- file: context.md
|
|
13
|
+
- file: custom-instrumentation.md
|
|
14
|
+
- file: api-reference.md
|
|
15
|
+
- file: metrics.md
|
|
16
|
+
- file: logs.md
|
|
17
|
+
- file: opentracing-api.md
|
|
18
|
+
- file: graphql.md
|
|
19
|
+
# TO DO: Not available on master
|
|
20
|
+
# - file: log-correlation.md
|
|
21
|
+
- file: performance-tuning.md
|
|
22
|
+
- file: upgrading.md
|
|
23
|
+
- title: Troubleshooting
|
|
24
|
+
crosslink: docs-content://troubleshoot/observability/apm-agent-ruby/apm-ruby-agent.md
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
mapped_pages:
|
|
3
|
+
- https://www.elastic.co/guide/en/apm/agent/ruby/current/upgrading.html
|
|
4
|
+
applies_to:
|
|
5
|
+
stack:
|
|
6
|
+
serverless:
|
|
7
|
+
observability:
|
|
8
|
+
product:
|
|
9
|
+
apm_agent_ruby: ga
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Upgrading [upgrading]
|
|
13
|
+
|
|
14
|
+
Upgrades between minor versions of the agent, like from 2.1 to 2.2 are always backwards compatible. Upgrades that involve a major version bump often come with some backwards incompatible changes.
|
|
15
|
+
|
|
16
|
+
Before upgrading the agent, be sure to review the:
|
|
17
|
+
|
|
18
|
+
* [Agent release notes](/release-notes/index.md)
|
|
19
|
+
* [Agent and Server compatibility chart](docs-content://solutions/observability/apps/apm-agent-compatibility.md)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## End of life dates [end-of-life-dates]
|
|
23
|
+
|
|
24
|
+
We love all our products, but sometimes we must say goodbye to a release so that we can continue moving forward on future development and innovation. Our [End of life policy](https://www.elastic.co/support/eol) defines how long a given release is considered supported, as well as how long a release is considered still in active development or maintenance.
|
|
25
|
+
|