elastic-apm 4.7.3 → 4.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/.ci/.exclude.yml +21 -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/PULL_REQUEST_TEMPLATE.md +2 -2
- data/.github/dependabot.yml +24 -19
- data/.github/workflows/README.md +1 -2
- data/.github/workflows/addToProject.yml +16 -2
- data/.github/workflows/ci.yml +6 -6
- data/.github/workflows/docs-build.yml +19 -0
- data/.github/workflows/docs-cleanup.yml +14 -0
- data/.github/workflows/github-commands-comment.yml +38 -0
- data/.github/workflows/microbenchmark.yml +7 -24
- data/.github/workflows/release.yml +39 -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/Gemfile +13 -0
- data/bin/dev +2 -2
- data/docs/docset.yml +9 -0
- data/docs/reference/advanced-topics.md +12 -0
- data/docs/reference/api-reference.md +422 -0
- data/docs/reference/configuration.md +734 -0
- data/docs/{context.asciidoc → reference/context.md} +21 -21
- data/docs/reference/custom-instrumentation.md +72 -0
- data/docs/{getting-started-rack.asciidoc → reference/getting-started-rack.md} +20 -29
- data/docs/reference/getting-started-rails.md +27 -0
- data/docs/reference/graphql.md +21 -0
- data/docs/reference/index.md +24 -0
- data/docs/{logs.asciidoc → reference/logs.md} +38 -56
- data/docs/reference/metrics.md +199 -0
- data/docs/reference/opentracing-api.md +70 -0
- data/docs/reference/performance-tuning.md +71 -0
- data/docs/reference/set-up-apm-ruby-agent.md +16 -0
- data/docs/reference/supported-technologies.md +128 -0
- data/docs/reference/toc.yml +22 -0
- data/docs/reference/upgrading.md +19 -0
- data/docs/release-notes/index.md +166 -0
- data/docs/release-notes/known-issues.md +24 -0
- data/docs/release-notes/toc.yml +3 -0
- data/lib/elastic_apm/context_builder.rb +5 -2
- data/lib/elastic_apm/spies/sidekiq.rb +2 -1
- data/lib/elastic_apm/stacktrace_builder.rb +3 -3
- data/lib/elastic_apm/version.rb +1 -1
- data/updatecli-compose.yaml +23 -0
- metadata +37 -36
- 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/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
@@ -1,80 +0,0 @@
|
|
1
|
-
[[custom-instrumentation]]
|
2
|
-
=== Custom instrumentation
|
3
|
-
|
4
|
-
When installed and properly configured,
|
5
|
-
ElasticAPM will automatically wrap your app's request/responses in transactions
|
6
|
-
and report its errors.
|
7
|
-
It also wraps each background job if you use Sidekiq or DelayedJob.
|
8
|
-
|
9
|
-
But it is also possible to create your own transactions as well as provide spans for
|
10
|
-
any automatic or custom transaction.
|
11
|
-
|
12
|
-
See <<api-agent-start_transaction,`ElasticAPM.start_transaction`>> and
|
13
|
-
<<api-agent-start_span,`ElasticAPM.start_span`>>.
|
14
|
-
|
15
|
-
[float]
|
16
|
-
==== Helpers
|
17
|
-
|
18
|
-
ElasticAPM includes some nifty helpers if you just want to instrument a regular
|
19
|
-
method.
|
20
|
-
|
21
|
-
[source,ruby]
|
22
|
-
----
|
23
|
-
class Thing
|
24
|
-
include ElasticAPM::SpanHelpers
|
25
|
-
|
26
|
-
def do_the_work
|
27
|
-
# ...
|
28
|
-
end
|
29
|
-
span_method :do_hard_work # takes optional `name` and `type`
|
30
|
-
|
31
|
-
def self.do_all_the_work
|
32
|
-
# ...
|
33
|
-
end
|
34
|
-
span_class_method :do_hard_work, 'Custom name', 'custom.work_thing'
|
35
|
-
end
|
36
|
-
----
|
37
|
-
|
38
|
-
[float]
|
39
|
-
==== Custom span example
|
40
|
-
|
41
|
-
If you are already inside a Transaction (most likely) and you want to instrument
|
42
|
-
some work inside it, add a custom span:
|
43
|
-
|
44
|
-
[source,ruby]
|
45
|
-
----
|
46
|
-
class ThingsController < ApplicationController
|
47
|
-
def index
|
48
|
-
@result_of_work = ElasticAPM.with_span "Heavy work" do
|
49
|
-
do_the_heavy_work
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
----
|
54
|
-
|
55
|
-
[float]
|
56
|
-
==== Custom transaction example
|
57
|
-
|
58
|
-
If you are **not** inside a Transaction already (eg. outside of your common web
|
59
|
-
application) start and manage your own transactions like so:
|
60
|
-
|
61
|
-
[source,ruby]
|
62
|
-
----
|
63
|
-
class Something
|
64
|
-
def do_work
|
65
|
-
transaction = ElasticAPM.start_transaction 'Something#do_work'
|
66
|
-
|
67
|
-
begin
|
68
|
-
Sequel[:users] # many third party libs will be automatically instrumented
|
69
|
-
rescue Exception => e
|
70
|
-
ElasticAPM.report(e)
|
71
|
-
raise
|
72
|
-
ensure
|
73
|
-
ElasticAPM.end_transaction('result')
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
----
|
78
|
-
|
79
|
-
**Note:** If the agent isn't started beforehand this will do nothing.
|
80
|
-
See <<api-agent-start,ElasticAPM.start>>.
|
data/docs/debugging.asciidoc
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
[[debugging]]
|
2
|
-
== Troubleshooting
|
3
|
-
|
4
|
-
Hopefully the agent Just Works™, but depending on your situation the agent might need some tuning.
|
5
|
-
|
6
|
-
First, to learn more about what's going on inside the agent, you can increase the amount of log messages it writes. To do this, set the log level with the option `log_level = 0` -- `0` being the level of most messages, `DEBUG`.
|
7
|
-
|
8
|
-
In your `config/elastic_apm.yml`:
|
9
|
-
|
10
|
-
[source,yaml]
|
11
|
-
----
|
12
|
-
log_level: <%= Logger::DEBUG %>
|
13
|
-
----
|
14
|
-
|
15
|
-
[float]
|
16
|
-
[[debugging-log-messages]]
|
17
|
-
=== Log messages
|
18
|
-
|
19
|
-
[float]
|
20
|
-
[[debugging-errors-queue-full]]
|
21
|
-
==== `Queue is full (256 items), skipping…`
|
22
|
-
|
23
|
-
The agent has an internal queue that holds events after they are done, and before they are safely serialized and sent to APM Server. To avoid using up all of your memory, this queue has a fixed size. Depending on your load and server setup, events may be added to the queue faster than they are consumed, hence the warning.
|
24
|
-
|
25
|
-
Things to consider:
|
26
|
-
|
27
|
-
- Is `server_url` misconfigured or APM Server down? If the agent fails to connect you will also see log messages containing `Connection error` or `Couldn't establish connection to APM Server`.
|
28
|
-
- Experiencing high load? The agent can spawn multiple instances of its Workers that pick off the queue by changing the option `pool_size` (default is `1`).
|
29
|
-
- If you have high load you may also consider setting `transaction_sample_rate` to something smaller than `1.0`. This determines whether to include _spans_ for every _transaction_. If you have enough traffic, skipping some (probably) identical spans won't have a noticeable effect on your data.
|
30
|
-
|
31
|
-
[float]
|
32
|
-
[[disable-agent]]
|
33
|
-
=== Disable the Agent
|
34
|
-
|
35
|
-
In the unlikely event the agent causes disruptions to a production application,
|
36
|
-
you can disable the agent while you troubleshoot.
|
37
|
-
|
38
|
-
If you have access to <<dynamic-configuration,dynamic configuration>>,
|
39
|
-
you can disable the recording of events by setting <<config-recording,`recording`>> to `false`.
|
40
|
-
When changed at runtime from a supported source, there's no need to restart your application.
|
41
|
-
|
42
|
-
If that doesn't work, or you don't have access to dynamic configuration, you can disable the agent by setting
|
43
|
-
<<config-enabled,`enabled`>> to `false`.
|
44
|
-
You'll need to restart your application for the changes to apply.
|
@@ -1,30 +0,0 @@
|
|
1
|
-
ifdef::env-github[]
|
2
|
-
NOTE: For the best reading experience,
|
3
|
-
please view this documentation at
|
4
|
-
https://www.elastic.co/guide/en/apm/agent/ruby/current/introduction.html[elastic.co]
|
5
|
-
endif::[]
|
6
|
-
|
7
|
-
[[getting-started-rails]]
|
8
|
-
=== Getting started with Rails
|
9
|
-
|
10
|
-
[float]
|
11
|
-
==== Setup
|
12
|
-
|
13
|
-
Add the gem to your `Gemfile`:
|
14
|
-
|
15
|
-
[source,ruby]
|
16
|
-
----
|
17
|
-
gem 'elastic-apm'
|
18
|
-
----
|
19
|
-
|
20
|
-
Create a file `config/elastic_apm.yml`:
|
21
|
-
|
22
|
-
[source,yaml]
|
23
|
-
----
|
24
|
-
server_url: http://localhost:8200
|
25
|
-
secret_token: ''
|
26
|
-
----
|
27
|
-
|
28
|
-
Or if you prefer environment variables, skip the file and set `ELASTIC_APM_SERVER_URL` and `ELASTIC_APM_SECRET_TOKEN` in your local or server environment.
|
29
|
-
|
30
|
-
This automatically sets up error logging and performance tracking but of course there are knobs to turn if you'd like to. See <<configuration>>.
|
data/docs/graphql.asciidoc
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
ifdef::env-github[]
|
2
|
-
NOTE: For the best reading experience,
|
3
|
-
please view this documentation at https://www.elastic.co/guide/en/apm/agent/ruby[elastic.co]
|
4
|
-
endif::[]
|
5
|
-
|
6
|
-
[[graphql]]
|
7
|
-
== GraphQL (experimental)
|
8
|
-
|
9
|
-
The agent comes with support for GraphQL based APIs.
|
10
|
-
|
11
|
-
This slightly alters how transactions are named when they relate to GraphQL
|
12
|
-
queries, so they are easier to tell apart and debug.
|
13
|
-
|
14
|
-
To enable GraphQL support, add the included Tracer to your schema:
|
15
|
-
|
16
|
-
[source,ruby]
|
17
|
-
----
|
18
|
-
class MySchema < GraphQL::Schema
|
19
|
-
# ...
|
20
|
-
|
21
|
-
tracer ElasticAPM::GraphQL # <-- include this
|
22
|
-
end
|
23
|
-
----
|
data/docs/index.asciidoc
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
include::{asciidoc-dir}/../../shared/versions/stack/current.asciidoc[]
|
2
|
-
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
|
3
|
-
|
4
|
-
ifdef::env-github[]
|
5
|
-
NOTE: For the best reading experience,
|
6
|
-
please view this documentation at
|
7
|
-
https://www.elastic.co/guide/en/apm/agent/ruby[elastic.co]
|
8
|
-
endif::[]
|
9
|
-
|
10
|
-
= APM Ruby Agent Reference
|
11
|
-
|
12
|
-
include::./introduction.asciidoc[]
|
13
|
-
|
14
|
-
include::./set-up.asciidoc[]
|
15
|
-
|
16
|
-
include::./supported-technologies.asciidoc[]
|
17
|
-
|
18
|
-
include::./configuration.asciidoc[]
|
19
|
-
|
20
|
-
include::./advanced.asciidoc[]
|
21
|
-
|
22
|
-
include::./api.asciidoc[]
|
23
|
-
|
24
|
-
include::./metrics.asciidoc[]
|
25
|
-
|
26
|
-
include::./logs.asciidoc[]
|
27
|
-
|
28
|
-
include::./opentracing.asciidoc[]
|
29
|
-
|
30
|
-
include::./graphql.asciidoc[]
|
31
|
-
|
32
|
-
include::./performance-tuning.asciidoc[]
|
33
|
-
|
34
|
-
include::./debugging.asciidoc[]
|
35
|
-
|
36
|
-
include::./upgrading.asciidoc[]
|
37
|
-
|
38
|
-
include::./release-notes.asciidoc[]
|
data/docs/introduction.asciidoc
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
ifdef::env-github[]
|
2
|
-
NOTE: For the best reading experience,
|
3
|
-
please view this documentation at
|
4
|
-
https://www.elastic.co/guide/en/apm/agent/ruby/current/introduction.html[elastic.co]
|
5
|
-
endif::[]
|
6
|
-
|
7
|
-
[[introduction]]
|
8
|
-
== Introduction
|
9
|
-
|
10
|
-
The Elastic APM Ruby Agent sends performance metrics and error logs to the APM Server.
|
11
|
-
It has built-in support for <<getting-started-rails,Ruby on Rails>> and other
|
12
|
-
<<getting-started-rack,Rack-compatible>> applications.
|
13
|
-
It also offers an API which allows you to instrument any application.
|
14
|
-
|
15
|
-
[float]
|
16
|
-
[[how-it-works]]
|
17
|
-
=== How does the Agent work?
|
18
|
-
|
19
|
-
The agent auto-instruments <<supported-technologies,supported technologies>> and records interesting events,
|
20
|
-
like HTTP requests and database queries. To do this, it uses relevant public APIs when they are provided by the libraries. Otherwise, it carefully wraps the necessary internal methods.
|
21
|
-
This means that for the supported technologies, there are no code changes required.
|
22
|
-
|
23
|
-
The Agent automatically keeps track of queries to your data stores to measure their duration and metadata (like the DB statement),
|
24
|
-
as well as HTTP related information (like the URL, parameters, and headers).
|
25
|
-
|
26
|
-
These events, called Transactions and Spans, are sent to the APM Server.
|
27
|
-
The APM Server converts them to a format suitable for Elasticsearch, and sends them to an Elasticsearch cluster.
|
28
|
-
You can then use the APM app in Kibana to gain insight into latency issues and error culprits within your application.
|
29
|
-
|
30
|
-
[float]
|
31
|
-
[[additional-components]]
|
32
|
-
=== Additional Components
|
33
|
-
|
34
|
-
APM Agents work in conjunction with the {apm-guide-ref}/index.html[APM Server], {ref}/index.html[Elasticsearch], and {kibana-ref}/index.html[Kibana].
|
35
|
-
The {apm-guide-ref}/index.html[APM Guide] provides details on how these components work together,
|
36
|
-
and provides a matrix outlining {apm-guide-ref}/agent-server-compatibility.html[Agent and Server compatibility].
|
data/docs/metrics.asciidoc
DELETED
@@ -1,235 +0,0 @@
|
|
1
|
-
ifdef::env-github[]
|
2
|
-
NOTE: For the best reading experience,
|
3
|
-
please view this documentation at https://www.elastic.co/guide/en/apm/agent/ruby[elastic.co]
|
4
|
-
endif::[]
|
5
|
-
|
6
|
-
[[metrics]]
|
7
|
-
== Metrics
|
8
|
-
|
9
|
-
The Ruby agent tracks various system and application metrics.
|
10
|
-
These metrics will be sent regularly to the APM Server and from there to Elasticsearch.
|
11
|
-
You can adjust the interval by setting <<config-metrics-interval,`metrics_interval`>>.
|
12
|
-
|
13
|
-
The metrics will be stored in the `apm-*` index and have the `processor.event` property set to `metric`.
|
14
|
-
|
15
|
-
[float]
|
16
|
-
[[metrics-system]]
|
17
|
-
=== System metrics
|
18
|
-
|
19
|
-
**Note:** Metrics from the Ruby agent are Linux only for now.
|
20
|
-
|
21
|
-
[float]
|
22
|
-
[[metric-system.cpu.total.norm.pct]]
|
23
|
-
==== `system.cpu.total.norm.pct`
|
24
|
-
|
25
|
-
* *Type:* Float
|
26
|
-
* *Format:* Percent
|
27
|
-
|
28
|
-
The percentage of CPU time in states other than Idle and IOWait,
|
29
|
-
normalised by the number of cores.
|
30
|
-
|
31
|
-
[float]
|
32
|
-
[[metric-system.memory.total]]
|
33
|
-
==== `system.memory.total`
|
34
|
-
|
35
|
-
* *Type:* Long
|
36
|
-
* *Format:* Bytes
|
37
|
-
|
38
|
-
The total memory of the system in bytes.
|
39
|
-
|
40
|
-
[float]
|
41
|
-
[[metric-system.memory.actual.free]]
|
42
|
-
==== `system.memory.actual.free`
|
43
|
-
|
44
|
-
* *Type:* Long
|
45
|
-
* *Format:* Bytes
|
46
|
-
|
47
|
-
Free memory of the system in bytes.
|
48
|
-
|
49
|
-
[float]
|
50
|
-
[[metric-system.process.cpu.total.norm.pct]]
|
51
|
-
==== `system.process.cpu.total.norm.pct`
|
52
|
-
|
53
|
-
* *Type:* Float
|
54
|
-
* *Format:* Percent
|
55
|
-
|
56
|
-
The percentage of CPU time spent by the process since the last event.
|
57
|
-
This value is normalized by the number of CPU cores and it ranges from 0 to 100%.
|
58
|
-
|
59
|
-
[float]
|
60
|
-
[[metric-system.process.memory.size]]
|
61
|
-
==== `system.process.memory.size`
|
62
|
-
|
63
|
-
* *Type:* Long
|
64
|
-
* *Format:* Bytes
|
65
|
-
|
66
|
-
The total virtual memory the process has.
|
67
|
-
|
68
|
-
[float]
|
69
|
-
[[metric-system.process.memory.rss.bytes]]
|
70
|
-
==== `system.process.memory.rss.bytes`
|
71
|
-
|
72
|
-
* *Type:* Long
|
73
|
-
* *Format:* Bytes
|
74
|
-
|
75
|
-
The Resident Set Size,
|
76
|
-
the amount of memory the process occupies in main memory (RAM).
|
77
|
-
|
78
|
-
[float]
|
79
|
-
[[metrics-ruby]]
|
80
|
-
=== Ruby Metrics
|
81
|
-
|
82
|
-
[float]
|
83
|
-
[[metric-ruby.gc.counts]]
|
84
|
-
==== `ruby.gc.count`
|
85
|
-
|
86
|
-
* *Type:* Integer
|
87
|
-
* *Format:* Count
|
88
|
-
|
89
|
-
The number of Garbage Collection runs since the process started.
|
90
|
-
|
91
|
-
[float]
|
92
|
-
[[metric-ruby.threads]]
|
93
|
-
==== `ruby.threads`
|
94
|
-
|
95
|
-
* *Type:* Integer
|
96
|
-
* *Format:* Count
|
97
|
-
|
98
|
-
The number of threads belonging to the current process.
|
99
|
-
|
100
|
-
[float]
|
101
|
-
[[metric-ruby.heap.slots.live]]
|
102
|
-
==== `ruby.heap.slots.live`
|
103
|
-
|
104
|
-
* *Type:* Integer
|
105
|
-
* *Format:* Slots
|
106
|
-
|
107
|
-
Current amount of heap slots that are live.
|
108
|
-
|
109
|
-
**NB:** Not currently supported on JRuby.
|
110
|
-
|
111
|
-
[float]
|
112
|
-
[[metric-ruby.heap.slots.free]]
|
113
|
-
==== `ruby.heap.slots.free`
|
114
|
-
|
115
|
-
* *Type:* Integer
|
116
|
-
* *Format:* Slots
|
117
|
-
|
118
|
-
Current amount of heap slots that are free.
|
119
|
-
|
120
|
-
**NB:** Not currently supported on JRuby.
|
121
|
-
|
122
|
-
[float]
|
123
|
-
[[metrics-ruby.heap.allocations.total]]
|
124
|
-
==== `ruby.heap.allocations.total`
|
125
|
-
|
126
|
-
* *Type:* Integer
|
127
|
-
* *Format:* Objects
|
128
|
-
|
129
|
-
Current amount of allocated objects on the heap.
|
130
|
-
|
131
|
-
**NB:** Not currently supported on JRuby.
|
132
|
-
|
133
|
-
[float]
|
134
|
-
[[metrics-ruby.gc.time]]
|
135
|
-
==== `ruby.gc.time`
|
136
|
-
|
137
|
-
* *Type:* Float
|
138
|
-
* *Format:* Seconds
|
139
|
-
|
140
|
-
The total time spent in garbage collection.
|
141
|
-
|
142
|
-
**NB:** You need to enable Ruby's GC Profiler for this to get reported.
|
143
|
-
You can do this at any time when your application boots by calling `GC::Profiler.enable`.
|
144
|
-
|
145
|
-
[float]
|
146
|
-
[[metrics-jvm-metrics]]
|
147
|
-
=== JVM Metrics
|
148
|
-
|
149
|
-
The following metrics are available when using JRuby. They use the ruby java API to gather metrics via MXBean.
|
150
|
-
|
151
|
-
[float]
|
152
|
-
[[metric-jvm.memory.heap.used]]
|
153
|
-
==== `jvm.memory.heap.used`
|
154
|
-
|
155
|
-
* *Type:* Long
|
156
|
-
* *Format:* Bytes
|
157
|
-
|
158
|
-
The amount of used heap memory in bytes.
|
159
|
-
|
160
|
-
[float]
|
161
|
-
[[metric-jvm.memory.heap.committed]]
|
162
|
-
==== `jvm.memory.heap.committed`
|
163
|
-
|
164
|
-
* *Type:* Long
|
165
|
-
* *Format:* Bytes
|
166
|
-
|
167
|
-
The amount of heap memory in bytes that is committed for the Java virtual machine to use. This amount of memory is
|
168
|
-
guaranteed for the Java virtual machine to use.
|
169
|
-
|
170
|
-
[float]
|
171
|
-
[[metric-jvm.memory.heap.max]]
|
172
|
-
==== `jvm.memory.heap.max`
|
173
|
-
|
174
|
-
* *Type:* Long
|
175
|
-
* *Format:* Bytes
|
176
|
-
|
177
|
-
The amount of heap memory in bytes that is committed for the Java virtual machine to use. This amount of memory is
|
178
|
-
guaranteed for the Java virtual machine to use.
|
179
|
-
|
180
|
-
[float]
|
181
|
-
[[metric-jvm.memory.non_heap.used]]
|
182
|
-
==== `jvm.memory.non_heap.used`
|
183
|
-
|
184
|
-
* *Type:* Long
|
185
|
-
* *Format:* Bytes
|
186
|
-
|
187
|
-
The amount of used non-heap memory in bytes.
|
188
|
-
|
189
|
-
[float]
|
190
|
-
[[metric-jvm.memory.non_heap.committed]]
|
191
|
-
==== `jvm.memory.non_heap.committed`
|
192
|
-
|
193
|
-
* *Type:* Long
|
194
|
-
* *Format:* Bytes
|
195
|
-
|
196
|
-
The amount of non-heap memory in bytes that is committed for the Java virtual machine to use. This amount of memory is
|
197
|
-
guaranteed for the Java virtual machine to use.
|
198
|
-
|
199
|
-
[float]
|
200
|
-
[[metric-jvm.memory.non_heap.max]]
|
201
|
-
==== `jvm.memory.non_heap.max`
|
202
|
-
|
203
|
-
* *Type:* Long
|
204
|
-
* *Format:* Bytes
|
205
|
-
|
206
|
-
The maximum amount of non-heap memory in bytes that can be used for memory management. If the maximum memory size is
|
207
|
-
undefined, the value is -1.
|
208
|
-
|
209
|
-
[float]
|
210
|
-
[[metric-jvm.memory.heap.pool.used]]
|
211
|
-
==== `jvm.memory.heap.pool.used`
|
212
|
-
|
213
|
-
* *Type:* Long
|
214
|
-
* *Format:* Bytes
|
215
|
-
|
216
|
-
The amount of used memory in bytes of the memory pool.
|
217
|
-
|
218
|
-
[float]
|
219
|
-
[[metric-jvm.memory.heap.pool.committed]]
|
220
|
-
==== `jvm.memory.heap.pool.committed`
|
221
|
-
|
222
|
-
* *Type:* Long
|
223
|
-
* *Format:* Bytes
|
224
|
-
|
225
|
-
The amount of memory in bytes that is committed for the memory pool. This amount of memory is guaranteed for this
|
226
|
-
specific pool.
|
227
|
-
|
228
|
-
[float]
|
229
|
-
[[metric-jvm.memory.heap.pool.max]]
|
230
|
-
==== `jvm.memory.heap.pool.max`
|
231
|
-
|
232
|
-
* *Type:* Long
|
233
|
-
* *Format:* Bytes
|
234
|
-
|
235
|
-
The maximum amount of memory in bytes that can be used for the memory pool.
|
data/docs/opentracing.asciidoc
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
ifdef::env-github[]
|
2
|
-
NOTE: For the best reading experience,
|
3
|
-
please view this documentation at https://www.elastic.co/guide/en/apm/agent/ruby[elastic.co]
|
4
|
-
endif::[]
|
5
|
-
|
6
|
-
[[opentracing]]
|
7
|
-
== OpenTracing API
|
8
|
-
|
9
|
-
The Elastic APM OpenTracing bridge allows to create Elastic APM `Transactions` and `Spans`,
|
10
|
-
using the OpenTracing API.
|
11
|
-
In other words,
|
12
|
-
it translates the calls to the OpenTracing API to Elastic APM and thus allows for reusing existing instrumentation.
|
13
|
-
|
14
|
-
The first span of a service will be converted to an Elastic APM `Transaction`,
|
15
|
-
subsequent spans are mapped to Elastic APM `Span`.
|
16
|
-
|
17
|
-
[float]
|
18
|
-
[[operation-modes]]
|
19
|
-
== Operation Modes
|
20
|
-
|
21
|
-
This bridge allows for different operation modes in combination with the Elastic APM Agent.
|
22
|
-
|
23
|
-
- Noop +
|
24
|
-
If no Elastic APM agent is running, the bridge is in noop mode and does not actually record and report spans.
|
25
|
-
- Mix and Match +
|
26
|
-
If you want to leverage the auto instrumentation of Elastic APM,
|
27
|
-
but also want do create custom spans or use the OpenTracing API to add custom tags to the spans created by Elastic APM,
|
28
|
-
you can just do that.
|
29
|
-
The OpenTracing bridge and the standard Elastic APM API interact seamlessly.
|
30
|
-
- Manual instrumentation +
|
31
|
-
If you don't want Elastic APM to auto-instrument known frameworks,
|
32
|
-
but instead only rely on manual instrumentation,
|
33
|
-
disable the auto instrumentation setting the configuration option <<config-instrument,`instrument`>> to `false`.
|
34
|
-
|
35
|
-
[float]
|
36
|
-
[[getting-started]]
|
37
|
-
== Getting started
|
38
|
-
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'`.
|
39
|
-
|
40
|
-
[float]
|
41
|
-
[[init-tracer]]
|
42
|
-
== Set Elastic APM as the global tracer
|
43
|
-
|
44
|
-
[source,ruby]
|
45
|
-
----
|
46
|
-
::OpenTracing.global_tracer = ElasticAPM::OpenTracing::Tracer.new
|
47
|
-
----
|
48
|
-
|
49
|
-
[float]
|
50
|
-
[[elastic-apm-tags]]
|
51
|
-
== Elastic APM specific tags
|
52
|
-
|
53
|
-
Elastic APM defines some tags which are not included in the OpenTracing API but are relevant in the context of Elastic APM.
|
54
|
-
|
55
|
-
- `type` - sets the type of the transaction,
|
56
|
-
for example `request`, `ext` or `db`
|
57
|
-
- `user.id` - sets the user id,
|
58
|
-
appears in the "User" tab in the transaction details in the Elastic APM app
|
59
|
-
- `user.email` - sets the user email,
|
60
|
-
appears in the "User" tab in the transaction details in the Elastic APM app
|
61
|
-
- `user.username` - sets the user name,
|
62
|
-
appears in the "User" tab in the transaction details in the Elastic APM app
|
63
|
-
- `result` - sets the result of the transaction. Overrides the default value of `success`.
|
64
|
-
If the `error` tag is set to `true`, the default value is `error`.
|
65
|
-
|
66
|
-
[float]
|
67
|
-
[[unsupported]]
|
68
|
-
== Caveats
|
69
|
-
Not all features of the OpenTracing API are supported.
|
70
|
-
|
71
|
-
[float]
|
72
|
-
[[propagation]]
|
73
|
-
=== Context propagation
|
74
|
-
This bridge only supports the format `OpenTracing::FORMAT_RACK`, using HTTP headers with capitalized names, prefixed with `HTTP_` as Rack does it.
|
75
|
-
|
76
|
-
`OpenTracing::FORMAT_BINARY` is currently not supported.
|
77
|
-
|
78
|
-
[float]
|
79
|
-
[[references]]
|
80
|
-
=== Span References
|
81
|
-
Currently, this bridge only supports `child_of` references.
|
82
|
-
Other references,
|
83
|
-
like `follows_from` are not supported yet.
|
84
|
-
|
85
|
-
[float]
|
86
|
-
[[baggage]]
|
87
|
-
=== Baggage
|
88
|
-
The `Span.set_baggage` method is not supported.
|
89
|
-
Baggage items are dropped with a warning log message.
|
90
|
-
|
91
|
-
[float]
|
92
|
-
[[opentracing-logs]]
|
93
|
-
=== Logs
|
94
|
-
Logs are currently not supported.
|
@@ -1,106 +0,0 @@
|
|
1
|
-
[[tuning-and-overhead]]
|
2
|
-
== Performance tuning
|
3
|
-
|
4
|
-
Using any APM solution comes with trade-offs, and the Elastic APM Ruby Agent is no different.
|
5
|
-
Instrumenting your code, using timers, recording context data, etc., uses resources—for example:
|
6
|
-
|
7
|
-
* CPU time
|
8
|
-
* Memory
|
9
|
-
* Bandwidth
|
10
|
-
* Elasticsearch storage
|
11
|
-
|
12
|
-
We invest a lot of effort to ensure that the Ruby Agent is suitable for production code
|
13
|
-
and that its overhead remains as low as possible.
|
14
|
-
However, because every application is different, there are some knobs you can turn and tweak to adapt the Agent to your specific needs.
|
15
|
-
|
16
|
-
[float]
|
17
|
-
[[tuning-sample-rate]]
|
18
|
-
=== Transaction sample rate
|
19
|
-
|
20
|
-
By default, the Agent samples every transaction.
|
21
|
-
The easiest way to reduce both the overhead of the agent and storage requirements,
|
22
|
-
is to tell it to do less, i.e., sample fewer transactions.
|
23
|
-
To do this, set the <<config-transaction-sample-rate,`transaction_sample_rate`>>
|
24
|
-
to a value between `0.0` and `1.0`—the percentage of transactions you'd like to randomly sample.
|
25
|
-
The Agent will still record the overall time and result of unsampled transactions,
|
26
|
-
but not context information, tags, or spans.
|
27
|
-
|
28
|
-
[float]
|
29
|
-
[[tuning-frame-context]]
|
30
|
-
=== Collecting frame context
|
31
|
-
|
32
|
-
The Agent automatically captures several lines of source code around each frame location in the stack trace.
|
33
|
-
This enables the APM app to provide greater insight into exactly where an error or span is occurring in your code.
|
34
|
-
This insight does come at a cost—in terms of performance, stack trace collection is the most expensive thing the Agent does.
|
35
|
-
|
36
|
-
There are settings you can modify to control this behavior:
|
37
|
-
|
38
|
-
1. Disable stack trace frame collection for short-duration spans by setting
|
39
|
-
<<config-span-frames-min-duration-ms,`span_frames_min_duration`>> to `0`.
|
40
|
-
|
41
|
-
2. Modify the number of source code lines collected.
|
42
|
-
These settings are divided between app frames, which represent your application code,
|
43
|
-
and library frames, which represent the code of your dependencies.
|
44
|
-
Each of these categories are further split into separate error and span settings.
|
45
|
-
+
|
46
|
-
* <<config-source-lines-error-app-frames, `source_lines_error_app_frames`>>
|
47
|
-
* <<config-source-lines-error-library-frames,`source_lines_error_library_frames`>>
|
48
|
-
* <<config-source-lines-span-app-frames,`source_lines_span_app_frames`>>
|
49
|
-
* <<config-source-lines-span-library-frames,`source_lines_span_library_frames`>>
|
50
|
-
|
51
|
-
3. If you're using the API to create a custom span, you can disable stack trace collection with the
|
52
|
-
<<api-agent-start_span,`include_stacktrace` argument>>.
|
53
|
-
|
54
|
-
Reading source files inside a running application can cause a lot of disk I/O,
|
55
|
-
and sending up source lines for each frame will have a network and storage cost that is quite high.
|
56
|
-
Turning these limits down will prevent storing excessive amounts of data in Elasticsearch.
|
57
|
-
|
58
|
-
[float]
|
59
|
-
[[tuning-queue]]
|
60
|
-
=== Transaction queue
|
61
|
-
|
62
|
-
The Agent does not send every transaction as it happens.
|
63
|
-
Instead, to reduce load on the APM Server, the Agent uses a queue.
|
64
|
-
The queue is flushed periodically, or when it reaches a maximum size.
|
65
|
-
|
66
|
-
While this reduces the load on the APM Server, holding on to transaction data in a queue uses memory.
|
67
|
-
If you notice a large increase in memory use, try adjusting these settings:
|
68
|
-
|
69
|
-
* <<config-api-request-time,`api_request_time`>> to reduce the duration of a single streaming request.
|
70
|
-
This setting is helpful if you have a sustained high number of transactions.
|
71
|
-
* <<config-api-request-size,`api_request_size`>> to reduce the maximum size of one request.
|
72
|
-
This setting can help if you experience transaction peaks (a large number in a short period of time).
|
73
|
-
|
74
|
-
Keep in mind that reducing the value of either setting will cause the agent to send more HTTP requests to the APM Server,
|
75
|
-
potentially causing a higher load.
|
76
|
-
|
77
|
-
[float]
|
78
|
-
[[tuning-max-spans]]
|
79
|
-
=== Spans per transaction
|
80
|
-
|
81
|
-
The number of spans per transaction will influence both how much time the agent spends in each transaction collecting contextual data,
|
82
|
-
and how much storage space is needed in Elasticsearch.
|
83
|
-
In our experience, most _usual_ transactions should have well below 100 spans.
|
84
|
-
In some cases, however, the number of spans can explode—for example:
|
85
|
-
|
86
|
-
* Long-running transactions
|
87
|
-
* Unoptimized code, e.g., doing hundreds of SQL queries in a loop
|
88
|
-
|
89
|
-
To avoid these edge cases which overload both the Agent and the APM Server,
|
90
|
-
the Agent will stop recording spans when a specified limit is reached.
|
91
|
-
This limit is configurable with <<config-transaction-max-spans,`transaction_max_spans`>>.
|
92
|
-
|
93
|
-
[float]
|
94
|
-
[[tuning-body-headers]]
|
95
|
-
=== Capturing headers and request body
|
96
|
-
|
97
|
-
You can configure the Agent to capture headers and request bodies with
|
98
|
-
<<config-capture-headers,`capture_headers`>> and <<config-capture-body,`capture_body`>>.
|
99
|
-
By default, headers are captured and request bodies are not.
|
100
|
-
|
101
|
-
Depending on the nature of your POST requests, capturing request bodies for transactions may introduce noticeable overhead,
|
102
|
-
as well as increased storage use.
|
103
|
-
In most scenarios, we advise against enabling request body capturing for transactions, and only enabling it if necessary for errors.
|
104
|
-
|
105
|
-
Capturing request/response headers has less overhead on the agent than capturing request bodies,
|
106
|
-
but can have an impact on storage use.
|