elastic-apm 4.0.0.beta.1 → 4.0.0.beta.2
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/.jenkins_exclude.yml +13 -0
- data/.ci/Jenkinsfile +1 -0
- data/CHANGELOG.asciidoc +17 -0
- data/README.md +12 -0
- data/bin/run-bdd +17 -0
- data/bin/run-tests +1 -1
- data/docs/configuration.asciidoc +59 -67
- data/docs/release-notes.asciidoc +1 -0
- data/docs/upgrading.asciidoc +0 -27
- data/lib/elastic_apm.rb +10 -0
- data/lib/elastic_apm/agent.rb +4 -0
- data/lib/elastic_apm/grpc.rb +2 -4
- data/lib/elastic_apm/normalizers/rails/active_record.rb +1 -1
- data/lib/elastic_apm/span.rb +8 -1
- data/lib/elastic_apm/span/context.rb +2 -1
- data/lib/elastic_apm/span/context/destination.rb +45 -13
- data/lib/elastic_apm/spies/dynamo_db.rb +6 -2
- data/lib/elastic_apm/spies/elasticsearch.rb +5 -3
- data/lib/elastic_apm/spies/http.rb +1 -3
- data/lib/elastic_apm/spies/mongo.rb +5 -3
- data/lib/elastic_apm/spies/net_http.rb +1 -4
- data/lib/elastic_apm/spies/s3.rb +13 -16
- data/lib/elastic_apm/spies/sequel.rb +1 -1
- data/lib/elastic_apm/spies/sns.rb +41 -40
- data/lib/elastic_apm/spies/sqs.rb +5 -3
- data/lib/elastic_apm/sql/tokenizer.rb +19 -3
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +13 -9
- data/lib/elastic_apm/transport/user_agent.rb +3 -2
- data/lib/elastic_apm/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da1239b00118fb2c21b67f917ba1956eec7fe030a69492b7f1d816d75e756130
|
|
4
|
+
data.tar.gz: 708d649fd0d1b1c27a46e0a9e938f75a81a89586f877d456cdf822d2a354d3b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2d683ea3dfcc8ba86eb9e86caf042b3013f2b85cbce87ddf07bd52eff554f2af344ceaf37b3b33bc2ab144e875ded5730b3e6ada3624c3db9fcb5e1942086f1
|
|
7
|
+
data.tar.gz: a345b9b8cc2d03596ce20abe1dce4e5e93391405c25bff926e15dedaf2924ebc8c305b389cf8f838b352385f87bc4d24ed613eaa39c6017fe4152c19d1d47881
|
data/.ci/.jenkins_exclude.yml
CHANGED
|
@@ -34,6 +34,19 @@ exclude:
|
|
|
34
34
|
FRAMEWORK: rails-4.2
|
|
35
35
|
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
|
|
36
36
|
FRAMEWORK: rails-4.2
|
|
37
|
+
# sinatra-1.4 exclusions
|
|
38
|
+
- RUBY_VERSION: ruby:3.0
|
|
39
|
+
FRAMEWORK: sinatra-1.4
|
|
40
|
+
- RUBY_VERSION: ruby:2.7
|
|
41
|
+
FRAMEWORK: sinatra-1.4
|
|
42
|
+
- RUBY_VERSION: jruby:9.2
|
|
43
|
+
FRAMEWORK: sinatra-1.4
|
|
44
|
+
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-13-jdk
|
|
45
|
+
FRAMEWORK: sinatra-1.4
|
|
46
|
+
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-11-jdk
|
|
47
|
+
FRAMEWORK: sinatra-1.4
|
|
48
|
+
- RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
|
|
49
|
+
FRAMEWORK: sinatra-1.4
|
|
37
50
|
|
|
38
51
|
# rails-6.0 and rails-6.1 exclusions
|
|
39
52
|
# Don't test on ruby 2.4
|
data/.ci/Jenkinsfile
CHANGED
|
@@ -389,6 +389,7 @@ def runScript(Map params = [:]){
|
|
|
389
389
|
dir("${BASE_DIR}"){
|
|
390
390
|
sleep randomNumber(min:10, max: 30)
|
|
391
391
|
dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
|
|
392
|
+
sh(label: "Run BDD tests", script: "./spec/scripts/features.sh ${ruby}")
|
|
392
393
|
sh("./spec/scripts/spec.sh ${ruby} ${framework}")
|
|
393
394
|
}
|
|
394
395
|
}
|
data/CHANGELOG.asciidoc
CHANGED
|
@@ -36,6 +36,23 @@ endif::[]
|
|
|
36
36
|
=== Ruby Agent version 4.x
|
|
37
37
|
|
|
38
38
|
[[release-notes-4.0.0]]
|
|
39
|
+
|
|
40
|
+
[float]
|
|
41
|
+
==== 4.0.0.beta.2
|
|
42
|
+
|
|
43
|
+
[float]
|
|
44
|
+
===== Added
|
|
45
|
+
|
|
46
|
+
- Added `set_service` API {pull}1006[#1006]
|
|
47
|
+
|
|
48
|
+
[float]
|
|
49
|
+
===== Fixed
|
|
50
|
+
|
|
51
|
+
- AWS S3 spy accepts symbol bucket names {pull}998[#998]
|
|
52
|
+
- AWS S3 spy passing on blocks {pull}998[#998]
|
|
53
|
+
- SQL scanner now recognizes CQL style comments {pull}1004[#1004]
|
|
54
|
+
|
|
55
|
+
[float]
|
|
39
56
|
==== 4.0.0.beta.1
|
|
40
57
|
|
|
41
58
|
[float]
|
data/README.md
CHANGED
|
@@ -52,15 +52,27 @@ The official Rubygem for [Elastic][] [APM][].
|
|
|
52
52
|
<li>
|
|
53
53
|
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/opentracing.html">OpenTracing API</a>
|
|
54
54
|
</li>
|
|
55
|
+
<li>
|
|
56
|
+
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/graphql.html">GraphQL</a>
|
|
57
|
+
</li>
|
|
55
58
|
<li>
|
|
56
59
|
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/log-correlation.html">Log correlation</a>
|
|
57
60
|
</li>
|
|
61
|
+
<li>
|
|
62
|
+
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/tuning-and-overhead.html">Performance tuning</a>
|
|
63
|
+
</li>
|
|
58
64
|
<li>
|
|
59
65
|
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/debugging.html">Troubleshooting</a>
|
|
60
66
|
</li>
|
|
67
|
+
<li>
|
|
68
|
+
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/upgrading.html">Upgrading</a>
|
|
69
|
+
</li>
|
|
61
70
|
<li class="collapsible">
|
|
62
71
|
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/release-notes.html">Release notes</a>
|
|
63
72
|
<ul>
|
|
73
|
+
<li>
|
|
74
|
+
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/release-notes-4.x.html">Ruby Agent version 4.x</a>
|
|
75
|
+
</li>
|
|
64
76
|
<li>
|
|
65
77
|
<a href="https://www.elastic.co/guide/en/apm/agent/ruby/current/release-notes-3.x.html">Ruby Agent version 3.x</a>
|
|
66
78
|
</li>
|
data/bin/run-bdd
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
specific_feature=$1
|
|
5
|
+
|
|
6
|
+
export CUCUMBER_PUBLISH_QUIET=true
|
|
7
|
+
|
|
8
|
+
if [[ $specific_feature = '' ]]; then
|
|
9
|
+
echo 'Running all features'
|
|
10
|
+
|
|
11
|
+
echo "========================================"
|
|
12
|
+
cucumber
|
|
13
|
+
else
|
|
14
|
+
echo "Running only $specific_feature"
|
|
15
|
+
|
|
16
|
+
cucumber $specific_feature
|
|
17
|
+
fi
|
data/bin/run-tests
CHANGED
data/docs/configuration.asciidoc
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
ifdef::env-github[]
|
|
2
2
|
NOTE: For the best reading experience,
|
|
3
3
|
please view this documentation at
|
|
4
|
-
https://www.elastic.co/guide/en/apm/agent/ruby/current/introduction.html[elastic.co]
|
|
4
|
+
https://www.elastic.co/guide/en/apm/agent/ruby/current/introduction.html[elastic.co].
|
|
5
5
|
endif::[]
|
|
6
6
|
|
|
7
7
|
[[configuration]]
|
|
8
8
|
== Configuration
|
|
9
9
|
|
|
10
10
|
There are several ways to configure how Elastic APM behaves.
|
|
11
|
-
|
|
11
|
+
We recommend using a `config/elastic_apm.yml` file:
|
|
12
12
|
|
|
13
13
|
[source,yaml]
|
|
14
14
|
----
|
|
@@ -24,7 +24,7 @@ When using this method, strings are split by comma, e.g.,
|
|
|
24
24
|
[[configuration-precedence]]
|
|
25
25
|
=== Configuration precedence
|
|
26
26
|
|
|
27
|
-
Options are applied in the following order (last one wins):
|
|
27
|
+
Options are applied in the following order (last one wins):
|
|
28
28
|
|
|
29
29
|
1. Defaults
|
|
30
30
|
2. Arguments to `ElasticAPM.start` / `Config.new`
|
|
@@ -71,7 +71,7 @@ ElasticAPM.start(
|
|
|
71
71
|
)
|
|
72
72
|
----
|
|
73
73
|
|
|
74
|
-
Alternatively,
|
|
74
|
+
Alternatively, use the `ElasticAPM::Sinatra.start` API:
|
|
75
75
|
|
|
76
76
|
[source,ruby]
|
|
77
77
|
----
|
|
@@ -87,7 +87,7 @@ See <<getting-started-rack>>.
|
|
|
87
87
|
[float]
|
|
88
88
|
=== Grape and Rack
|
|
89
89
|
|
|
90
|
-
When using Grape and Rack (without Rails),
|
|
90
|
+
When using Grape and Rack (without Rails), configure when starting
|
|
91
91
|
the agent:
|
|
92
92
|
|
|
93
93
|
[source,ruby]
|
|
@@ -114,7 +114,7 @@ See <<getting-started-rack>>.
|
|
|
114
114
|
| `ELASTIC_APM_CONFIG_FILE` | `config_file` | `config/elastic_apm.yml`
|
|
115
115
|
|============
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
The path to the configuration YAML-file.
|
|
118
118
|
Elastic APM will load config options from this if the file exists.
|
|
119
119
|
The file will be evaluated as ERB, so you can include `ENV` variables like in
|
|
120
120
|
your `database.yml`, eg:
|
|
@@ -150,7 +150,7 @@ and port.
|
|
|
150
150
|
|
|
151
151
|
This string is used to ensure that only your agents can send data to your APM server.
|
|
152
152
|
Both the agents and the APM server have to be configured with the same secret token.
|
|
153
|
-
|
|
153
|
+
Here's an example that generates a secure secret token:
|
|
154
154
|
|
|
155
155
|
[source,bash]
|
|
156
156
|
----
|
|
@@ -170,11 +170,9 @@ WARNING: Secret tokens only provide any real security if your APM server uses TL
|
|
|
170
170
|
|============
|
|
171
171
|
|
|
172
172
|
This base64-encoded string is used to ensure that only your agents can send data to your APM server.
|
|
173
|
-
|
|
174
|
-
documentation for details on how to do that. Please note that this feature is experimental in the
|
|
175
|
-
APM server in version 7.6.
|
|
173
|
+
The API key must be created using the {apm-server-ref-v}/api-key.html[APM server command-line tool].
|
|
176
174
|
|
|
177
|
-
WARNING:
|
|
175
|
+
WARNING: API keys only provide any real security if your APM server uses TLS.
|
|
178
176
|
|
|
179
177
|
[float]
|
|
180
178
|
[[config-api-buffer-size]]
|
|
@@ -184,12 +182,11 @@ WARNING: Api keys only provide any real security if your APM server uses TLS.
|
|
|
184
182
|
| `ELASTIC_APM_API_BUFFER_SIZE` | `api_buffer_size` | `256`
|
|
185
183
|
|============
|
|
186
184
|
|
|
187
|
-
|
|
185
|
+
The maximum amount of objects kept in queue before sending to APM Server.
|
|
188
186
|
|
|
189
|
-
If you hit
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
went wrong.
|
|
187
|
+
If you hit the limit, consider increasing the agent's <<config-pool-size,worker pool size>>.
|
|
188
|
+
If you don't, the agent may have trouble connecting to APM Server.
|
|
189
|
+
The <<config-log-path,logs>> should tell you what went wrong.
|
|
193
190
|
|
|
194
191
|
[float]
|
|
195
192
|
[[config-api-request-size]]
|
|
@@ -202,10 +199,9 @@ went wrong.
|
|
|
202
199
|
| `ELASTIC_APM_API_REQUEST_SIZE` | `api_request_size` | `"750kb"`
|
|
203
200
|
|============
|
|
204
201
|
|
|
205
|
-
|
|
206
|
-
will open a new request.
|
|
202
|
+
The maximum amount of bytes sent over one request to APM Server. The agent will open a new request when this limit is reached.
|
|
207
203
|
|
|
208
|
-
|
|
204
|
+
This must be provided in *<<config-format-size, size format>>*.
|
|
209
205
|
|
|
210
206
|
[float]
|
|
211
207
|
[[config-api-request-time]]
|
|
@@ -218,12 +214,11 @@ It has to be provided in *<<config-format-size, size format>>*.
|
|
|
218
214
|
| `ELASTIC_APM_API_REQUEST_TIME` | `api_request_time` | `"10s"`
|
|
219
215
|
|============
|
|
220
216
|
|
|
221
|
-
|
|
217
|
+
The maximum duration of a single streaming request to APM Server before opening
|
|
222
218
|
a new one.
|
|
223
219
|
|
|
224
|
-
APM Server has its own limit of 30 seconds before it will close requests.
|
|
225
|
-
|
|
226
|
-
It has to be provided in *<<config-format-duration, duration format>>*.
|
|
220
|
+
The APM Server has its own limit of 30 seconds before it will close requests.
|
|
221
|
+
This must be provided in *<<config-format-duration, duration format>>*.
|
|
227
222
|
|
|
228
223
|
[float]
|
|
229
224
|
[[config-breakdown-metrics]]
|
|
@@ -233,8 +228,8 @@ It has to be provided in *<<config-format-duration, duration format>>*.
|
|
|
233
228
|
| `ELASTIC_APM_BREAKDOWN_METRICS` | `breakdown_metrics` | `true`
|
|
234
229
|
|============
|
|
235
230
|
|
|
236
|
-
Enable
|
|
237
|
-
|
|
231
|
+
Enable or disable the tracking and collection of breakdown metrics.
|
|
232
|
+
Setting this to `False` disables the tracking of breakdown metrics, which can reduce the overhead of the agent.
|
|
238
233
|
|
|
239
234
|
NOTE: This feature requires APM Server and Kibana >= 7.3.
|
|
240
235
|
|
|
@@ -249,14 +244,13 @@ NOTE: This feature requires APM Server and Kibana >= 7.3.
|
|
|
249
244
|
| `ELASTIC_APM_CAPTURE_BODY` | `capture_body` | `"off"` | `"all"`
|
|
250
245
|
|============
|
|
251
246
|
|
|
252
|
-
|
|
253
|
-
the Ruby agent can optionally capture the request body (e.g. `POST` variables or JSON data).
|
|
247
|
+
The Ruby agent can optionally capture the request body (e.g. `POST` variables or JSON data) for transactions that are HTTP requests.
|
|
254
248
|
|
|
255
249
|
Possible values: `"errors"`, `"transactions"`, `"all"`, `"off"`.
|
|
256
250
|
|
|
257
251
|
If the request has a body and this setting is disabled, the body will be shown as `[SKIPPED]`.
|
|
258
252
|
|
|
259
|
-
WARNING:
|
|
253
|
+
WARNING: Request bodies often contain sensitive values like passwords and credit card numbers.
|
|
260
254
|
We try to strip sensitive looking data from form bodies but don't touch text bodies like JSON.
|
|
261
255
|
If your service handles data like this, we advise to only enable this feature with care.
|
|
262
256
|
|
|
@@ -272,7 +266,7 @@ If your service handles data like this, we advise to only enable this feature wi
|
|
|
272
266
|
| `ELASTIC_APM_CAPTURE_HEADERS` | `capture_headers` | `true`
|
|
273
267
|
|============
|
|
274
268
|
|
|
275
|
-
|
|
269
|
+
This indicates whether or not to attach the request headers to transactions and errors.
|
|
276
270
|
|
|
277
271
|
[float]
|
|
278
272
|
[[config-capture-elasticsearch-queries]]
|
|
@@ -282,7 +276,7 @@ Whether or not to attach the request headers to transactions and errors.
|
|
|
282
276
|
| `ELASTIC_APM_CAPTURE_ELASTICSEARCH_QUERIES` | `capture_elasticsearch_queries` | `false`
|
|
283
277
|
|============
|
|
284
278
|
|
|
285
|
-
|
|
279
|
+
This indicates whether or not to capture the body from requests in Elasticsearch.
|
|
286
280
|
|
|
287
281
|
[float]
|
|
288
282
|
[[config-capture-env]]
|
|
@@ -292,7 +286,7 @@ Whether or not to capture the body from requests in Elasticsearch.
|
|
|
292
286
|
| `ELASTIC_APM_CAPTURE_ENV` | `capture_env` | `true`
|
|
293
287
|
|============
|
|
294
288
|
|
|
295
|
-
|
|
289
|
+
This indicates whether or not to attach `ENV` from Rack to transactions and errors.
|
|
296
290
|
|
|
297
291
|
[float]
|
|
298
292
|
[[config-central-config]]
|
|
@@ -302,10 +296,10 @@ Whether or not to attach `ENV` from Rack to transactions and errors.
|
|
|
302
296
|
| `ELASTIC_APM_CENTRAL_CONFIG` | `central_config` | `true`
|
|
303
297
|
|============
|
|
304
298
|
|
|
305
|
-
|
|
299
|
+
This enables {apm-app-ref}/agent-configuration.html[APM Agent Configuration via Kibana].
|
|
306
300
|
If set to `true`, the client will poll the APM Server regularly for new agent configuration.
|
|
307
301
|
|
|
308
|
-
Usually APM Server determines how often to poll, but if not the default interval is 5 minutes.
|
|
302
|
+
Usually APM Server determines how often to poll, but if not, set the default interval is 5 minutes.
|
|
309
303
|
|
|
310
304
|
NOTE: This feature requires APM Server v7.3 or later and that the APM Server is configured with `kibana.enabled: true`.
|
|
311
305
|
|
|
@@ -318,7 +312,7 @@ NOTE: This feature requires APM Server v7.3 or later and that the APM Server is
|
|
|
318
312
|
|============
|
|
319
313
|
|
|
320
314
|
Specify the cloud provider for metadata collection.
|
|
321
|
-
|
|
315
|
+
This defaults to `"auto"`, which means the agent uses trial and
|
|
322
316
|
error to collect metadata from all supported cloud providers.
|
|
323
317
|
|
|
324
318
|
Valid options are `"auto"`, `"aws"`, `"gcp"`, `"azure"`, and `"none"`.
|
|
@@ -336,7 +330,7 @@ attempts to collect metadata will only be performed from the chosen provider.
|
|
|
336
330
|
|
|
337
331
|
A comma-separated list of dotted metrics names that should not be sent to the APM Server.
|
|
338
332
|
You can use `*` to match multiple metrics.
|
|
339
|
-
Matching is case
|
|
333
|
+
Matching is not case sensitive.
|
|
340
334
|
|
|
341
335
|
[float]
|
|
342
336
|
[[config-disable-send]]
|
|
@@ -346,7 +340,7 @@ Matching is case-insensitive.
|
|
|
346
340
|
| `ELASTIC_APM_DISABLE_SEND` | `disable_send` | `false`
|
|
347
341
|
|============
|
|
348
342
|
|
|
349
|
-
|
|
343
|
+
This disables sending payloads to APM Server.
|
|
350
344
|
|
|
351
345
|
[float]
|
|
352
346
|
[[config-disable-start-message]]
|
|
@@ -356,7 +350,7 @@ Disables sending payloads to APM Server.
|
|
|
356
350
|
| `ELASTIC_APM_DISABLE_START_MESSAGE` | `disable_start_message` | `false`
|
|
357
351
|
|============
|
|
358
352
|
|
|
359
|
-
|
|
353
|
+
This disables the agents startup message announcing itself.
|
|
360
354
|
|
|
361
355
|
[float]
|
|
362
356
|
[[config-disabled-instrumentations]]
|
|
@@ -368,7 +362,7 @@ Disables the agent's startup message announcing itself.
|
|
|
368
362
|
| `ELASTIC_APM_DISABLE_INSTRUMENTATIONS` | `disable_instrumentations` | `['json']`
|
|
369
363
|
|============
|
|
370
364
|
|
|
371
|
-
Elastic APM automatically instruments select third
|
|
365
|
+
Elastic APM automatically instruments select third-party libraries.
|
|
372
366
|
Use this option to disable any of these.
|
|
373
367
|
|
|
374
368
|
Get an array of enabled instrumentations with `ElasticAPM.agent.config.enabled_instrumentations`.
|
|
@@ -382,7 +376,7 @@ Get an array of enabled instrumentations with `ElasticAPM.agent.config.enabled_i
|
|
|
382
376
|
| `ELASTIC_APM_ENABLED` | `enabled` | `true`
|
|
383
377
|
|============
|
|
384
378
|
|
|
385
|
-
|
|
379
|
+
Indicates whether or not to start the agent.
|
|
386
380
|
If `enabled` is `false`, `ElasticAPM.start` will do nothing and all calls to the root API will return `nil`.
|
|
387
381
|
|
|
388
382
|
[float]
|
|
@@ -399,7 +393,7 @@ The name of the environment this service is deployed in,
|
|
|
399
393
|
e.g. "production" or "staging".
|
|
400
394
|
|
|
401
395
|
Environments allow you to easily filter data on a global level in the APM app.
|
|
402
|
-
|
|
396
|
+
Be consistent when naming environments across agents.
|
|
403
397
|
See {apm-app-ref}/filters.html#environment-selector[environment selector] in the APM app for more information.
|
|
404
398
|
|
|
405
399
|
Defaults to `ENV['RAILS_ENV'] || ENV['RACK_ENV']`.
|
|
@@ -426,7 +420,7 @@ Use this to filter error tracking for specific error constants.
|
|
|
426
420
|
| `ELASTIC_APM_FRAMEWORK_NAME` | `framework_name` | Depending on framework
|
|
427
421
|
|============
|
|
428
422
|
|
|
429
|
-
|
|
423
|
+
The name of the used framework.
|
|
430
424
|
For Rails or Sinatra, this defaults to `Ruby on Rails` and `Sinatra` respectively,
|
|
431
425
|
otherwise defaults to `nil`.
|
|
432
426
|
|
|
@@ -439,7 +433,7 @@ otherwise defaults to `nil`.
|
|
|
439
433
|
| `ELASTIC_APM_FRAMEWORK_VERSION` | `framework_version` | Depending on framework
|
|
440
434
|
|============
|
|
441
435
|
|
|
442
|
-
|
|
436
|
+
The version number of the used framework.
|
|
443
437
|
For Ruby on Rails and Sinatra, this defaults to the used version of the framework,
|
|
444
438
|
otherwise, the default is `nil`.
|
|
445
439
|
|
|
@@ -479,12 +473,12 @@ The host name to use when sending error and transaction data to the APM server.
|
|
|
479
473
|
| `ELASTIC_APM_IGNORE_URL_PATTERNS` | `ignore_url_patterns` | `[]` | `['^/ping', %r{^/admin}]`
|
|
480
474
|
|============
|
|
481
475
|
|
|
482
|
-
Use this option to ignore certain URL patterns
|
|
476
|
+
Use this option to ignore certain URL patterns such as healthchecks or admin sections.
|
|
483
477
|
|
|
484
478
|
_Ignoring_ in this context means _don't wrap in a <<api-transaction,Transaction>>_.
|
|
485
479
|
Errors will still be reported.
|
|
486
480
|
|
|
487
|
-
|
|
481
|
+
Use a comma separated string when setting this option via `ENV`.
|
|
488
482
|
Eg. `ELASTIC_APM_IGNORE_URL_PATTERNS="a,b" # => [/a/, /b/]`
|
|
489
483
|
|
|
490
484
|
[float]
|
|
@@ -496,7 +490,7 @@ Eg. `ELASTIC_APM_IGNORE_URL_PATTERNS="a,b" # => [/a/, /b/]`
|
|
|
496
490
|
| `ELASTIC_APM_INSTRUMENT` | `instrument` | `true` | `0`
|
|
497
491
|
|============
|
|
498
492
|
|
|
499
|
-
Use this option to ignore certain URL patterns
|
|
493
|
+
Use this option to ignore certain URL patterns such as healthchecks or admin sections.
|
|
500
494
|
|
|
501
495
|
[float]
|
|
502
496
|
[[config-instrumented-rake-tasks]]
|
|
@@ -508,7 +502,7 @@ Use this option to ignore certain URL patterns eg. healthchecks or admin section
|
|
|
508
502
|
| `ELASTIC_APM_INSTRUMENTED_RAKE_TASKS` | `instrumented_rake_tasks` | `[]` | `['my_task']`
|
|
509
503
|
|============
|
|
510
504
|
|
|
511
|
-
Elastic APM can instrument your Rake tasks
|
|
505
|
+
Elastic APM can instrument your Rake tasks. Theis is an opt-in field, as they are used are for a multitude of things.
|
|
512
506
|
|
|
513
507
|
[float]
|
|
514
508
|
[[config-log-level]]
|
|
@@ -538,7 +532,7 @@ A path to a log file.
|
|
|
538
532
|
|
|
539
533
|
By default Elastic APM logs to `stdout` or uses `Rails.log` when used with Rails.
|
|
540
534
|
|
|
541
|
-
|
|
535
|
+
This should support both absolute and relative paths. Please be sure the directory exists.
|
|
542
536
|
|
|
543
537
|
[float]
|
|
544
538
|
[[config-logger]]
|
|
@@ -552,7 +546,7 @@ Should support both absolute and relative paths. Just make sure the directory ex
|
|
|
552
546
|
|
|
553
547
|
By default Elastic APM logs to `stdout` or uses `Rails.log` when used with Rails.
|
|
554
548
|
|
|
555
|
-
Use this to provide another logger.
|
|
549
|
+
Use this to provide another logger. This is expected to have the same API as Ruby's built-in `Logger`.
|
|
556
550
|
|
|
557
551
|
[float]
|
|
558
552
|
[[config-metrics-interval]]
|
|
@@ -566,7 +560,7 @@ Use this to provide another logger. Expected to have the same API as Ruby's buil
|
|
|
566
560
|
|
|
567
561
|
Specify the interval for reporting metrics to APM Server.
|
|
568
562
|
The interval should be in seconds,
|
|
569
|
-
or
|
|
563
|
+
or include a time suffix.
|
|
570
564
|
|
|
571
565
|
To disable metrics reporting,
|
|
572
566
|
set the interval to `0`.
|
|
@@ -625,7 +619,7 @@ See https://github.com/httprb/http/wiki/Proxy-Support[Http.rb's docs].
|
|
|
625
619
|
|============
|
|
626
620
|
|
|
627
621
|
Enable or disable the recording of events.
|
|
628
|
-
If set to false
|
|
622
|
+
If set to `false`, then the agent does not create or send any events to the Elastic APM server,
|
|
629
623
|
and instrumentation overhead is minimized. The agent continues to poll the server for configuration changes
|
|
630
624
|
when this option is false.
|
|
631
625
|
|
|
@@ -639,9 +633,9 @@ when this option is false.
|
|
|
639
633
|
| `ELASTIC_APM_SANITIZE_FIELD_NAMES` | `sanitize_field_names` | `"password,passwd,pwd,secret,*key,*token*,*session*,*credit*,*card*,authorization,set-cookie"` | `Auth*tion,abc*,*xyz`
|
|
640
634
|
|============
|
|
641
635
|
|
|
642
|
-
Sometimes it is necessary to sanitize the data sent to Elastic APM
|
|
636
|
+
Sometimes it is necessary to sanitize the data sent to Elastic APM to remove sensitive values.
|
|
643
637
|
|
|
644
|
-
Configure a list of wildcard patterns of field names which should be sanitized. These apply to HTTP headers and bodies
|
|
638
|
+
Configure a list of wildcard patterns of field names which should be sanitized. These apply to HTTP headers and bodies, if they're being captured.
|
|
645
639
|
|
|
646
640
|
Supports the wildcard `*`, which matches zero or more characters.
|
|
647
641
|
Examples: `/foo/*/bar/*/baz*`, `*foo*`.
|
|
@@ -657,16 +651,15 @@ Matching is case insensitive.
|
|
|
657
651
|
| `ELASTIC_APM_SERVICE_NAME` | `service_name` | App's name | `MyApp`
|
|
658
652
|
|============
|
|
659
653
|
|
|
660
|
-
The name of your service.
|
|
661
|
-
This is used to keep all the errors and transactions of your service together and is
|
|
654
|
+
The name of your service. This is used to group the errors and transactions of your service and is
|
|
662
655
|
the primary filter in the Elastic APM user interface.
|
|
663
656
|
|
|
664
657
|
If you're using Ruby on Rails this will default to your app's name.
|
|
665
658
|
If you're using Sinatra it will default to the name of your app's class.
|
|
666
659
|
|
|
667
660
|
NOTE: The service name must conform to this regular expression: `^[a-zA-Z0-9 _-]+$`.
|
|
668
|
-
In
|
|
669
|
-
alphabet, numbers, dashes, underscores and spaces.
|
|
661
|
+
In other words, it must only contain characters from the ASCII
|
|
662
|
+
alphabet, numbers, dashes, underscores, and spaces.
|
|
670
663
|
|
|
671
664
|
[float]
|
|
672
665
|
[[config-service-node-name]]
|
|
@@ -679,11 +672,10 @@ alphabet, numbers, dashes, underscores and spaces.
|
|
|
679
672
|
|============
|
|
680
673
|
|
|
681
674
|
The name of the given service node. This is optional, and if omitted, the APM
|
|
682
|
-
Server will fall back on `system.container.id` if available, and
|
|
675
|
+
Server will fall back on `system.container.id` if available, and
|
|
683
676
|
`host.name` if necessary.
|
|
684
677
|
|
|
685
|
-
This option allows you to set the node name manually to ensure
|
|
686
|
-
meaningfulness.
|
|
678
|
+
This option allows you to set the node name manually to ensure it's unique and meaningful.
|
|
687
679
|
|
|
688
680
|
[float]
|
|
689
681
|
[[config-service-version]]
|
|
@@ -694,8 +686,8 @@ meaningfulness.
|
|
|
694
686
|
| `ELASTIC_APM_SERVICE_VERSION` | `service_version` | `git` sha | A string indicating the version of the deployed service
|
|
695
687
|
|============
|
|
696
688
|
|
|
697
|
-
|
|
698
|
-
|
|
689
|
+
The deployed version of your service.
|
|
690
|
+
This defaults to `git rev-parse --verify HEAD`.
|
|
699
691
|
|
|
700
692
|
[float]
|
|
701
693
|
[[config-source-lines-error-app-frames]]
|
|
@@ -719,7 +711,7 @@ Defaults to `git rev-parse --verify HEAD`.
|
|
|
719
711
|
|============
|
|
720
712
|
|
|
721
713
|
By default, the APM agent collects source code snippets for errors.
|
|
722
|
-
|
|
714
|
+
Use the above settings to modify how many lines of source code are collected.
|
|
723
715
|
|
|
724
716
|
We differ between errors and spans, as well as library frames and app frames.
|
|
725
717
|
|
|
@@ -737,7 +729,7 @@ storage use in your Elasticsearch cluster.
|
|
|
737
729
|
| `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `"5ms"`
|
|
738
730
|
|============
|
|
739
731
|
|
|
740
|
-
Use this to disable
|
|
732
|
+
Use this to disable stack trace frame collection for spans with a duration shorter
|
|
741
733
|
than or equal to the given amount of milleseconds.
|
|
742
734
|
|
|
743
735
|
The default is `"5ms"`.
|
|
@@ -804,7 +796,7 @@ To reduce overhead and storage requirements, you can set the sample rate to a va
|
|
|
804
796
|
between `0.0` and `1.0`.
|
|
805
797
|
We still record overall time and the result for unsampled transactions, but no
|
|
806
798
|
context information, tags, or spans.
|
|
807
|
-
|
|
799
|
+
The sample rate will be rounded to 4 digits of precision.
|
|
808
800
|
|
|
809
801
|
[float]
|
|
810
802
|
[[config-verify-server-cert]]
|
|
@@ -857,14 +849,14 @@ The unit is provided as suffix directly after the number, without any separation
|
|
|
857
849
|
* `mb` (megabytes)
|
|
858
850
|
* `gb` (gigabytes)
|
|
859
851
|
|
|
860
|
-
NOTE:
|
|
852
|
+
NOTE: We use the power-of-two sizing convention, e.g. `1 kilobyte == 1024 bytes`.
|
|
861
853
|
|
|
862
854
|
[float]
|
|
863
855
|
[[special-configuration]]
|
|
864
856
|
=== Special configuration
|
|
865
857
|
|
|
866
|
-
Elastic APM patches `Kernel#require` to auto-detect and instrument supported third
|
|
858
|
+
Elastic APM patches `Kernel#require` to auto-detect and instrument supported third-party libraries. It does so with the utmost care but in rare cases, it can conflict with some libraries.
|
|
867
859
|
|
|
868
860
|
To get around this patch, set the environment variable `ELASTIC_APM_SKIP_REQUIRE_PATCH` to `"1"`.
|
|
869
861
|
|
|
870
|
-
|
|
862
|
+
The agent might need some additional tweaking to make sure the third-party libraries are picked up and instrumented. Make sure you require the agent _after_ you require your other dependencies.
|
data/docs/release-notes.asciidoc
CHANGED
data/docs/upgrading.asciidoc
CHANGED
|
@@ -16,30 +16,3 @@ We love all our products, but sometimes we must say goodbye to a release so that
|
|
|
16
16
|
forward on future development and innovation.
|
|
17
17
|
Our https://www.elastic.co/support/eol[End of life policy] defines how long a given release is considered supported,
|
|
18
18
|
as well as how long a release is considered still in active development or maintenance.
|
|
19
|
-
The table below is a simplified description of this policy.
|
|
20
|
-
|
|
21
|
-
[options="header"]
|
|
22
|
-
|====
|
|
23
|
-
|Agent version |EOL Date |Maintained until
|
|
24
|
-
|3.5.x |2021-07-17 | 3.6
|
|
25
|
-
|3.4.x |2021-07-10 | 3.5
|
|
26
|
-
|3.3.x |2021-06-04 | 3.4
|
|
27
|
-
|3.2.x |2021-05-19 | 3.3
|
|
28
|
-
|3.1.x |2021-04-21 | 3.2
|
|
29
|
-
|3.0.x |2021-04-08 | 3.1
|
|
30
|
-
|2.12.x |2021-04-01 |4.0
|
|
31
|
-
|2.11.x |2021-03-23 |2.12
|
|
32
|
-
|2.10.x |2021-03-03 |2.11
|
|
33
|
-
|2.9.x |2020-12-25 |2.10
|
|
34
|
-
|2.8.x |2020-11-20 |2.9
|
|
35
|
-
|2.7.x |2020-11-07 |2.8
|
|
36
|
-
|2.6.x |2020-09-19 |2.7
|
|
37
|
-
|2.5.x |2020-09-01 |2.6
|
|
38
|
-
|2.4.x |2020-08-27 |2.5
|
|
39
|
-
|2.3.x |2020-07-29 |2.4
|
|
40
|
-
|2.2.x |2020-07-22 |2.3
|
|
41
|
-
|2.1.x |2020-06-04 |2.2
|
|
42
|
-
|2.0.x |2020-05-14 |2.1
|
|
43
|
-
|1.1.x |2020-03-07 |3.0
|
|
44
|
-
|1.0.x |2019-12-29 |1.1
|
|
45
|
-
|====
|
data/lib/elastic_apm.rb
CHANGED
|
@@ -380,6 +380,16 @@ module ElasticAPM
|
|
|
380
380
|
agent&.set_user(user)
|
|
381
381
|
end
|
|
382
382
|
|
|
383
|
+
# Set destination fields on the current span
|
|
384
|
+
#
|
|
385
|
+
# @param address [String] Destination address
|
|
386
|
+
# @param address [String] Destination address
|
|
387
|
+
# @param address [Hash] Destination service
|
|
388
|
+
# @param address [Hash] Destination cloud
|
|
389
|
+
def set_destination(address: nil, port: nil, service: nil, cloud: nil)
|
|
390
|
+
agent&.set_destination(address: address, port: port, service: service, cloud: cloud)
|
|
391
|
+
end
|
|
392
|
+
|
|
383
393
|
# Provide a filter to transform payloads before sending them off
|
|
384
394
|
#
|
|
385
395
|
# @param key [Symbol] Unique filter key
|
data/lib/elastic_apm/agent.rb
CHANGED
|
@@ -227,6 +227,10 @@ module ElasticAPM
|
|
|
227
227
|
instrumenter.set_user(user)
|
|
228
228
|
end
|
|
229
229
|
|
|
230
|
+
def set_destination(address: nil, port: nil, service: nil, cloud: nil)
|
|
231
|
+
current_span&.set_destination(address: nil, port: nil, service: nil, cloud: nil)
|
|
232
|
+
end
|
|
233
|
+
|
|
230
234
|
def build_context(rack_env:, for_type:)
|
|
231
235
|
@context_builder.build(rack_env: rack_env, for_type: for_type)
|
|
232
236
|
end
|
data/lib/elastic_apm/grpc.rb
CHANGED
|
@@ -50,11 +50,9 @@ module ElasticAPM
|
|
|
50
50
|
|
|
51
51
|
split_peer = URI.split(peer)
|
|
52
52
|
destination = ElasticAPM::Span::Context::Destination.new(
|
|
53
|
-
type: TYPE,
|
|
54
|
-
name: SUBTYPE,
|
|
55
|
-
resource: peer,
|
|
56
53
|
address: split_peer[0],
|
|
57
|
-
port: split_peer[6]
|
|
54
|
+
port: split_peer[6],
|
|
55
|
+
service: { type: TYPE, name: SUBTYPE, resource: peer }
|
|
58
56
|
)
|
|
59
57
|
ElasticAPM::Span::Context.new(destination: destination)
|
|
60
58
|
end
|
|
@@ -48,7 +48,7 @@ module ElasticAPM
|
|
|
48
48
|
context =
|
|
49
49
|
Span::Context.new(
|
|
50
50
|
db: { statement: payload[:sql], type: 'sql' },
|
|
51
|
-
destination: { name: subtype, resource: subtype, type: TYPE }
|
|
51
|
+
destination: { service: { name: subtype, resource: subtype, type: TYPE } }
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
[name, TYPE, subtype, ACTION, context]
|
data/lib/elastic_apm/span.rb
CHANGED
|
@@ -131,7 +131,14 @@ module ElasticAPM
|
|
|
131
131
|
started? && !stopped?
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
def set_destination(address: nil, port: nil, service: nil, cloud: nil)
|
|
135
|
+
context.destination = Span::Context::Destination.new(
|
|
136
|
+
address: address,
|
|
137
|
+
port: port,
|
|
138
|
+
service: service,
|
|
139
|
+
cloud: cloud
|
|
140
|
+
)
|
|
141
|
+
end
|
|
135
142
|
|
|
136
143
|
def inspect
|
|
137
144
|
"<ElasticAPM::Span id:#{trace_context&.id}" \
|
|
@@ -23,6 +23,22 @@ module ElasticAPM
|
|
|
23
23
|
# @api private
|
|
24
24
|
class Destination
|
|
25
25
|
|
|
26
|
+
# @api private
|
|
27
|
+
class Service
|
|
28
|
+
class MissingValues < StandardError; end
|
|
29
|
+
|
|
30
|
+
def initialize(name: nil, type: nil, resource: nil)
|
|
31
|
+
@name = name
|
|
32
|
+
@type = type
|
|
33
|
+
@resource = resource
|
|
34
|
+
|
|
35
|
+
# APM Server expects all values for service
|
|
36
|
+
raise MissingValues unless @name && @type && resource
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
attr_accessor :name, :type, :resource
|
|
40
|
+
end
|
|
41
|
+
|
|
26
42
|
# @api private
|
|
27
43
|
class Cloud
|
|
28
44
|
def initialize(region: nil)
|
|
@@ -33,39 +49,37 @@ module ElasticAPM
|
|
|
33
49
|
end
|
|
34
50
|
|
|
35
51
|
def initialize(
|
|
36
|
-
name: nil,
|
|
37
|
-
resource: nil,
|
|
38
|
-
type: nil,
|
|
39
52
|
address: nil,
|
|
40
53
|
port: nil,
|
|
54
|
+
service: nil,
|
|
41
55
|
cloud: nil
|
|
42
56
|
)
|
|
43
|
-
@name = name
|
|
44
|
-
@resource = resource
|
|
45
|
-
@type = type
|
|
46
57
|
@address = address
|
|
47
58
|
@port = port
|
|
48
|
-
@
|
|
59
|
+
@service = build_service(service)
|
|
60
|
+
@cloud = build_cloud(cloud)
|
|
49
61
|
end
|
|
50
62
|
|
|
51
63
|
attr_reader(
|
|
52
|
-
:name,
|
|
53
|
-
:resource,
|
|
54
|
-
:type,
|
|
55
64
|
:address,
|
|
56
65
|
:port,
|
|
66
|
+
:service,
|
|
57
67
|
:cloud
|
|
58
68
|
)
|
|
59
69
|
|
|
60
70
|
def self.from_uri(uri_or_str, type: 'external', port: nil)
|
|
61
71
|
uri = normalize(uri_or_str)
|
|
62
72
|
|
|
63
|
-
new(
|
|
73
|
+
service = Service.new(
|
|
64
74
|
name: only_scheme_and_host(uri),
|
|
65
75
|
resource: "#{uri.host}:#{uri.port}",
|
|
66
|
-
type: type
|
|
76
|
+
type: type
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
new(
|
|
67
80
|
address: uri.hostname,
|
|
68
|
-
port: port || uri.port
|
|
81
|
+
port: port || uri.port,
|
|
82
|
+
service: service
|
|
69
83
|
)
|
|
70
84
|
end
|
|
71
85
|
|
|
@@ -84,6 +98,24 @@ module ElasticAPM
|
|
|
84
98
|
URI(uri_or_str)
|
|
85
99
|
end
|
|
86
100
|
end
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def build_service(service = nil)
|
|
105
|
+
return unless service
|
|
106
|
+
return service if service.is_a?(Service)
|
|
107
|
+
|
|
108
|
+
Service.new(**service)
|
|
109
|
+
rescue Service::MissingValues
|
|
110
|
+
nil # If we are missing any service value, return nothing
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def build_cloud(cloud = nil)
|
|
114
|
+
return unless cloud
|
|
115
|
+
return cloud if cloud.is_a?(Cloud)
|
|
116
|
+
|
|
117
|
+
Cloud.new(**cloud)
|
|
118
|
+
end
|
|
87
119
|
end
|
|
88
120
|
end
|
|
89
121
|
end
|
|
@@ -22,6 +22,7 @@ module ElasticAPM
|
|
|
22
22
|
module Spies
|
|
23
23
|
# @api private
|
|
24
24
|
class DynamoDBSpy
|
|
25
|
+
NAME = 'dynamodb'
|
|
25
26
|
TYPE = 'db'
|
|
26
27
|
SUBTYPE = 'dynamodb'
|
|
27
28
|
|
|
@@ -65,8 +66,11 @@ module ElasticAPM
|
|
|
65
66
|
},
|
|
66
67
|
destination: {
|
|
67
68
|
cloud: cloud,
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
service: {
|
|
70
|
+
name: NAME,
|
|
71
|
+
resource: SUBTYPE,
|
|
72
|
+
type: TYPE
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
)
|
|
72
76
|
|
|
@@ -61,9 +61,11 @@ module ElasticAPM
|
|
|
61
61
|
context = Span::Context.new(
|
|
62
62
|
db: { statement: statement.reduce({}, :merge).to_json },
|
|
63
63
|
destination: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
service: {
|
|
65
|
+
name: SUBTYPE,
|
|
66
|
+
resource: SUBTYPE,
|
|
67
|
+
type: TYPE
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
70
|
)
|
|
69
71
|
|
|
@@ -35,11 +35,9 @@ module ElasticAPM
|
|
|
35
35
|
method = req.verb.to_s.upcase
|
|
36
36
|
host = req.uri.host
|
|
37
37
|
|
|
38
|
-
destination =
|
|
39
|
-
ElasticAPM::Span::Context::Destination.from_uri(req.uri)
|
|
40
38
|
context = ElasticAPM::Span::Context.new(
|
|
41
39
|
http: { url: req.uri, method: method },
|
|
42
|
-
destination:
|
|
40
|
+
destination: ElasticAPM::Span::Context::Destination.from_uri(req.uri)
|
|
43
41
|
)
|
|
44
42
|
|
|
45
43
|
name = "#{method} #{host}"
|
|
@@ -69,13 +69,10 @@ module ElasticAPM
|
|
|
69
69
|
url << "?#{query}" if query
|
|
70
70
|
uri = URI(url)
|
|
71
71
|
|
|
72
|
-
destination =
|
|
73
|
-
ElasticAPM::Span::Context::Destination.from_uri(uri)
|
|
74
|
-
|
|
75
72
|
context =
|
|
76
73
|
ElasticAPM::Span::Context.new(
|
|
77
74
|
http: { url: uri, method: method },
|
|
78
|
-
destination:
|
|
75
|
+
destination: ElasticAPM::Span::Context::Destination.from_uri(uri)
|
|
79
76
|
)
|
|
80
77
|
|
|
81
78
|
ElasticAPM.with_span(
|
data/lib/elastic_apm/spies/s3.rb
CHANGED
|
@@ -41,13 +41,10 @@ module ElasticAPM
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def self.bucket_name(params)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
params[:bucket]
|
|
49
|
-
end
|
|
50
|
-
end
|
|
44
|
+
return unless (bucket = params[:bucket]&.to_s)
|
|
45
|
+
return bucket unless (index = bucket.rindex(AP_REGEX))
|
|
46
|
+
|
|
47
|
+
bucket[index+1..-1]
|
|
51
48
|
end
|
|
52
49
|
|
|
53
50
|
def self.accesspoint_region(params)
|
|
@@ -84,18 +81,18 @@ module ElasticAPM
|
|
|
84
81
|
def self.prepended(mod)
|
|
85
82
|
# Alias all available operations
|
|
86
83
|
mod.api.operation_names.each do |operation_name|
|
|
87
|
-
define_method(operation_name) do |params = {}, options = {}|
|
|
84
|
+
define_method(operation_name) do |params = {}, options = {}, &block|
|
|
88
85
|
bucket_name = ElasticAPM::Spies::S3Spy.bucket_name(params)
|
|
89
|
-
|
|
90
|
-
region: ElasticAPM::Spies::S3Spy.accesspoint_region(params) || config.region
|
|
91
|
-
)
|
|
86
|
+
region = ElasticAPM::Spies::S3Spy.accesspoint_region(params) || config.region
|
|
92
87
|
|
|
93
88
|
context = ElasticAPM::Span::Context.new(
|
|
94
89
|
destination: {
|
|
95
|
-
cloud:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
cloud: { region: region },
|
|
91
|
+
service: {
|
|
92
|
+
resource: bucket_name,
|
|
93
|
+
type: TYPE,
|
|
94
|
+
name: SUBTYPE
|
|
95
|
+
}
|
|
99
96
|
}
|
|
100
97
|
)
|
|
101
98
|
|
|
@@ -107,7 +104,7 @@ module ElasticAPM
|
|
|
107
104
|
context: context
|
|
108
105
|
) do
|
|
109
106
|
ElasticAPM::Spies::S3Spy.without_net_http do
|
|
110
|
-
super(params, options)
|
|
107
|
+
super(params, options, &block)
|
|
111
108
|
end
|
|
112
109
|
end
|
|
113
110
|
end
|
|
@@ -46,7 +46,7 @@ module ElasticAPM
|
|
|
46
46
|
|
|
47
47
|
context = ElasticAPM::Span::Context.new(
|
|
48
48
|
db: { statement: sql, type: 'sql', user: opts[:user] },
|
|
49
|
-
destination: { name: subtype, resource: subtype, type: TYPE }
|
|
49
|
+
destination: { service: { name: subtype, resource: subtype, type: TYPE } }
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
span = ElasticAPM.start_span(
|
|
@@ -64,62 +64,63 @@ module ElasticAPM
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def self.span_context(topic, region)
|
|
67
|
-
cloud = ElasticAPM::Span::Context::Destination::Cloud.new(region: region)
|
|
68
|
-
|
|
69
67
|
ElasticAPM::Span::Context.new(
|
|
70
68
|
message: {
|
|
71
69
|
queue_name: topic
|
|
72
70
|
},
|
|
73
71
|
destination: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
service: {
|
|
73
|
+
resource: [SUBTYPE, topic].compact.join('/'),
|
|
74
|
+
type: TYPE,
|
|
75
|
+
name: SUBTYPE,
|
|
76
|
+
},
|
|
77
|
+
cloud: ElasticAPM::Span::Context::Destination::Cloud.new(region: region)
|
|
78
78
|
}
|
|
79
79
|
)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
# @api private
|
|
83
|
+
module Ext
|
|
84
|
+
def publish(params = {}, options = {})
|
|
85
|
+
unless (transaction = ElasticAPM.current_transaction)
|
|
86
|
+
return super(params, options)
|
|
87
|
+
end
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
topic = ElasticAPM::Spies::SNSSpy.get_topic(params)
|
|
90
|
+
span_name = topic ? "SNS PUBLISH to #{topic}" : 'SNS PUBLISH'
|
|
91
|
+
region = ElasticAPM::Spies::SNSSpy.arn_region(
|
|
92
|
+
params[:topic_arn] || params[:target_arn]
|
|
93
|
+
)
|
|
94
|
+
context = ElasticAPM::Spies::SNSSpy.span_context(
|
|
95
|
+
topic,
|
|
96
|
+
region || config.region
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
ElasticAPM.with_span(
|
|
100
|
+
span_name,
|
|
101
|
+
TYPE,
|
|
102
|
+
subtype: SUBTYPE,
|
|
103
|
+
action: 'publish',
|
|
104
|
+
context: context
|
|
105
|
+
) do |span|
|
|
106
|
+
trace_context = span&.trace_context || transaction.trace_context
|
|
107
|
+
trace_context.apply_headers do |key, value|
|
|
108
|
+
params[:message_attributes] ||= {}
|
|
109
|
+
params[:message_attributes][key] ||= {}
|
|
110
|
+
params[:message_attributes][key][:string_value] = value
|
|
111
|
+
params[:message_attributes][key][:data_type] = 'String'
|
|
89
112
|
end
|
|
90
113
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
region = ElasticAPM::Spies::SNSSpy.arn_region(
|
|
94
|
-
params[:topic_arn] || params[:target_arn]
|
|
95
|
-
)
|
|
96
|
-
context = ElasticAPM::Spies::SNSSpy.span_context(
|
|
97
|
-
topic,
|
|
98
|
-
region || config.region
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
ElasticAPM.with_span(
|
|
102
|
-
span_name,
|
|
103
|
-
TYPE,
|
|
104
|
-
subtype: SUBTYPE,
|
|
105
|
-
action: 'publish',
|
|
106
|
-
context: context
|
|
107
|
-
) do |span|
|
|
108
|
-
trace_context = span&.trace_context || transaction.trace_context
|
|
109
|
-
trace_context.apply_headers do |key, value|
|
|
110
|
-
params[:message_attributes] ||= {}
|
|
111
|
-
params[:message_attributes][key] ||= {}
|
|
112
|
-
params[:message_attributes][key][:string_value] = value
|
|
113
|
-
params[:message_attributes][key][:data_type] = 'String'
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
ElasticAPM::Spies::SNSSpy.without_net_http do
|
|
117
|
-
publish_without_apm(params, options)
|
|
118
|
-
end
|
|
114
|
+
ElasticAPM::Spies::SNSSpy.without_net_http do
|
|
115
|
+
super(params, options)
|
|
119
116
|
end
|
|
120
117
|
end
|
|
121
118
|
end
|
|
122
119
|
end
|
|
120
|
+
|
|
121
|
+
def install
|
|
122
|
+
::Aws::SNS::Client.prepend(Ext)
|
|
123
|
+
end
|
|
123
124
|
end
|
|
124
125
|
|
|
125
126
|
register(
|
|
@@ -57,9 +57,11 @@ module ElasticAPM
|
|
|
57
57
|
queue_name: queue_name
|
|
58
58
|
},
|
|
59
59
|
destination: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
service: {
|
|
61
|
+
resource: [SUBTYPE, queue_name].compact.join('/'),
|
|
62
|
+
type: TYPE,
|
|
63
|
+
name: SUBTYPE
|
|
64
|
+
},
|
|
63
65
|
cloud: cloud
|
|
64
66
|
}
|
|
65
67
|
)
|
|
@@ -69,7 +69,7 @@ module ElasticAPM
|
|
|
69
69
|
when '[' then scan_quoted_indentifier(']')
|
|
70
70
|
when '(' then LPAREN
|
|
71
71
|
when ')' then RPAREN
|
|
72
|
-
when '/' then
|
|
72
|
+
when '/' then scan_bracketed_or_cql_comment
|
|
73
73
|
when '-' then scan_simple_comment
|
|
74
74
|
when "'" then scan_string_literal
|
|
75
75
|
when ALPHA then scan_keyword_or_identifier(possible_keyword: true)
|
|
@@ -185,10 +185,16 @@ module ElasticAPM
|
|
|
185
185
|
IDENT
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
+
def scan_bracketed_or_cql_comment
|
|
189
|
+
case peek_char
|
|
190
|
+
when '*' then scan_bracketed_comment
|
|
191
|
+
when '/' then scan_cql_comment
|
|
192
|
+
else OTHER
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
188
196
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
189
197
|
def scan_bracketed_comment
|
|
190
|
-
return OTHER unless peek_char == '*'
|
|
191
|
-
|
|
192
198
|
nesting = 1
|
|
193
199
|
|
|
194
200
|
while (char = next_char)
|
|
@@ -207,6 +213,16 @@ module ElasticAPM
|
|
|
207
213
|
end
|
|
208
214
|
# rubocop:enable Metrics/CyclomaticComplexity
|
|
209
215
|
|
|
216
|
+
def scan_cql_comment
|
|
217
|
+
return OTHER unless peek_char == '/'
|
|
218
|
+
|
|
219
|
+
while (char = next_char)
|
|
220
|
+
break if char == "\n"
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
COMMENT
|
|
224
|
+
end
|
|
225
|
+
|
|
210
226
|
def scan_simple_comment
|
|
211
227
|
return OTHER unless peek_char == '-'
|
|
212
228
|
|
|
@@ -93,16 +93,20 @@ module ElasticAPM
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def build_destination(destination)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
return unless destination
|
|
97
|
+
|
|
98
|
+
base = {
|
|
99
|
+
address: keyword_field(destination.address),
|
|
100
|
+
port: destination.port
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if service = destination.service
|
|
104
|
+
base[:service] = {
|
|
105
|
+
name: keyword_field(destination.service.name),
|
|
106
|
+
resource: keyword_field(destination.service.resource),
|
|
107
|
+
type: keyword_field(destination.service.type)
|
|
105
108
|
}
|
|
109
|
+
end
|
|
106
110
|
|
|
107
111
|
if cloud = destination.cloud
|
|
108
112
|
base[:cloud] = { region: cloud.region }
|
|
@@ -21,7 +21,8 @@ module ElasticAPM
|
|
|
21
21
|
module Transport
|
|
22
22
|
# @api private
|
|
23
23
|
class UserAgent
|
|
24
|
-
def initialize(config)
|
|
24
|
+
def initialize(config, version: VERSION)
|
|
25
|
+
@version = version
|
|
25
26
|
@built = build(config)
|
|
26
27
|
end
|
|
27
28
|
|
|
@@ -35,7 +36,7 @@ module ElasticAPM
|
|
|
35
36
|
service = Metadata::ServiceInfo.new(config)
|
|
36
37
|
|
|
37
38
|
[
|
|
38
|
-
"elastic-apm-ruby/#{
|
|
39
|
+
"elastic-apm-ruby/#{@version}",
|
|
39
40
|
HTTP::Request::USER_AGENT,
|
|
40
41
|
[
|
|
41
42
|
service.runtime.name,
|
data/lib/elastic_apm/version.rb
CHANGED
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.0.0.beta.
|
|
4
|
+
version: 4.0.0.beta.2
|
|
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-04-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|
|
@@ -95,6 +95,7 @@ files:
|
|
|
95
95
|
- bin/build_docs
|
|
96
96
|
- bin/console
|
|
97
97
|
- bin/dev
|
|
98
|
+
- bin/run-bdd
|
|
98
99
|
- bin/run-tests
|
|
99
100
|
- bin/setup
|
|
100
101
|
- bin/with_framework
|
|
@@ -267,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
267
268
|
- !ruby/object:Gem::Version
|
|
268
269
|
version: 1.3.1
|
|
269
270
|
requirements: []
|
|
270
|
-
rubygems_version: 3.1.
|
|
271
|
+
rubygems_version: 3.1.6
|
|
271
272
|
signing_key:
|
|
272
273
|
specification_version: 4
|
|
273
274
|
summary: The official Elastic APM agent for Ruby
|