elastic-apm 4.6.2 → 4.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/.exclude.yml +193 -0
- data/.ci/.ruby.yml +10 -0
- data/.ci/scripts/bench.sh +52 -0
- data/.ci/scripts/install-build-system.sh +5 -0
- data/.ci/snapshoty.yml +2 -3
- data/.ci/updatecli.d/update-gherkin-specs.yml +126 -0
- data/.ci/updatecli.d/update-json-specs.yml +130 -0
- data/.ci/{update-specs.yml → updatecli.d/update-specs.yml} +10 -0
- data/.github/dependabot.yml +17 -1
- data/.github/workflows/README.md +58 -0
- data/.github/workflows/ci-docs.yml +20 -0
- data/.github/workflows/ci.yml +70 -0
- data/.github/workflows/coverage-reporter.yml +34 -0
- data/.github/workflows/microbenchmark.yml +48 -0
- data/.github/workflows/opentelemetry.yml +27 -0
- data/.github/workflows/release.yml +71 -0
- data/.github/workflows/run-matrix.yml +56 -0
- data/.github/workflows/snapshoty.yml +35 -0
- data/.github/workflows/test-reporter.yml +24 -0
- data/.github/workflows/{update-specs.yml → updatecli.yml} +2 -4
- data/.pre-commit-config.yaml +0 -2
- data/CHANGELOG.asciidoc +32 -0
- data/Gemfile +16 -3
- data/README.md +1 -1
- data/bench/rubyprof.rb +1 -0
- data/bin/run-tests +10 -1
- data/docker-compose.yml +4 -1
- data/docs/configuration.asciidoc +6 -5
- data/docs/index.asciidoc +2 -2
- data/docs/{log-correlation.asciidoc → logs.asciidoc} +29 -2
- data/docs/opentracing.asciidoc +1 -1
- data/docs/redirects.asciidoc +9 -0
- data/lib/elastic_apm/context_builder.rb +6 -3
- data/lib/elastic_apm/metadata/cloud_info.rb +9 -7
- data/lib/elastic_apm/metrics.rb +24 -20
- data/lib/elastic_apm/span_helpers.rb +6 -6
- data/lib/elastic_apm/spies/action_dispatch.rb +11 -3
- data/lib/elastic_apm/spies/faraday.rb +8 -1
- data/lib/elastic_apm/version.rb +1 -1
- metadata +25 -19
- data/.ci/.jenkins_exclude.yml +0 -191
- data/.ci/.jenkins_ruby.yml +0 -10
- data/.ci/.jenkins_ruby_benchmarks.yml +0 -6
- data/.ci/Jenkinsfile +0 -450
- data/.ci/jobs/apm-agent-ruby-downstream.yml +0 -38
- data/.ci/jobs/apm-agent-ruby-linting-mbp.yml +0 -39
- data/.ci/jobs/apm-agent-ruby-mbp.yml +0 -43
- data/.ci/jobs/apm-agent-ruby.yml +0 -4
- data/.ci/jobs/defaults.yml +0 -24
- data/.ci/linting.groovy +0 -32
- data/.ci/packer_cache.sh +0 -16
- /data/.ci/{.jenkins_codecov.yml → .codecov.yml} +0 -0
- /data/.ci/{.jenkins_framework.yml → .framework.yml} +0 -0
- /data/.ci/{.jenkins_main_framework.yml → .main_framework.yml} +0 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
name: ci
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
paths-ignore:
|
6
|
+
- "**/*.asciidoc"
|
7
|
+
- "**/*.md"
|
8
|
+
push:
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
paths-ignore:
|
12
|
+
- "**/*.asciidoc"
|
13
|
+
- "**/*.md"
|
14
|
+
|
15
|
+
permissions:
|
16
|
+
contents: read
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
sanity-checks:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
steps:
|
22
|
+
- uses: elastic/apm-pipeline-library/.github/actions/pre-commit@current
|
23
|
+
|
24
|
+
# Invokes the actual matrix workflow with the provided files.
|
25
|
+
matrix:
|
26
|
+
uses: ./.github/workflows/run-matrix.yml
|
27
|
+
with:
|
28
|
+
versionsFile: .ci/.ruby.yml
|
29
|
+
frameworksFile: .ci/.framework.yml
|
30
|
+
excludedFile: .ci/.exclude.yml
|
31
|
+
|
32
|
+
# Invokes the actual matrix workflow with the provided files.
|
33
|
+
# In this case it's for the main frameworks.
|
34
|
+
matrix-main-frameworks:
|
35
|
+
uses: ./.github/workflows/run-matrix.yml
|
36
|
+
with:
|
37
|
+
versionsFile: .ci/.ruby.yml
|
38
|
+
frameworksFile: .ci/.main_framework.yml
|
39
|
+
excludedFile: .ci/.exclude.yml
|
40
|
+
|
41
|
+
package:
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@v3
|
45
|
+
- uses: ruby/setup-ruby@v1
|
46
|
+
with:
|
47
|
+
ruby-version: 2.6
|
48
|
+
- name: Install build system
|
49
|
+
run: .ci/scripts/install-build-system.sh
|
50
|
+
- name: Create gem
|
51
|
+
run: rake build
|
52
|
+
- uses: actions/upload-artifact@v3
|
53
|
+
with:
|
54
|
+
name: package
|
55
|
+
path: ./pkg/**/*
|
56
|
+
|
57
|
+
all:
|
58
|
+
if: always()
|
59
|
+
runs-on: ubuntu-latest
|
60
|
+
needs:
|
61
|
+
- sanity-checks
|
62
|
+
- matrix
|
63
|
+
- matrix-main-frameworks
|
64
|
+
- package
|
65
|
+
steps:
|
66
|
+
- id: check
|
67
|
+
uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
|
68
|
+
with:
|
69
|
+
needs: ${{ toJSON(needs) }}
|
70
|
+
- run: ${{ steps.check.outputs.isSuccess }}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
## Workflow to process coverage report
|
3
|
+
## For now the coverage is not reported. This workflow is just here as preparation for
|
4
|
+
## https://github.com/elastic/observability-robots/issues/1546
|
5
|
+
name: coverage-reporter
|
6
|
+
on:
|
7
|
+
workflow_run:
|
8
|
+
workflows:
|
9
|
+
- test
|
10
|
+
types:
|
11
|
+
- completed
|
12
|
+
|
13
|
+
permissions:
|
14
|
+
contents: read
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
report:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v3
|
21
|
+
- name: Download artifacts
|
22
|
+
run: >
|
23
|
+
gh run download ${{ github.event.workflow_run.id }}
|
24
|
+
--name coverage
|
25
|
+
--repo "${GITHUB_REPOSITORY}"
|
26
|
+
--dir coverage
|
27
|
+
env:
|
28
|
+
GH_TOKEN: ${{ github.token }}
|
29
|
+
- run: ls -l coverage/matrix_results
|
30
|
+
# - run: ./spec/scripts/coverage_converge.sh
|
31
|
+
# - uses: actions/upload-artifact@v3
|
32
|
+
# with:
|
33
|
+
# name: coverage-report
|
34
|
+
# path: coverage/coverage.xml
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: microbenchmark
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
paths-ignore:
|
9
|
+
- '**.md'
|
10
|
+
- '**.asciidoc'
|
11
|
+
|
12
|
+
# limit the access of the generated GITHUB_TOKEN
|
13
|
+
permissions:
|
14
|
+
contents: read
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
microbenchmark:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
# wait up to 1 hour
|
20
|
+
timeout-minutes: 60
|
21
|
+
steps:
|
22
|
+
- id: buildkite
|
23
|
+
name: Run buildkite pipeline
|
24
|
+
uses: elastic/apm-pipeline-library/.github/actions/buildkite@current
|
25
|
+
with:
|
26
|
+
vaultUrl: ${{ secrets.VAULT_ADDR }}
|
27
|
+
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
|
28
|
+
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
|
29
|
+
pipeline: apm-agent-microbenchmark
|
30
|
+
triggerMessage: "${{ github.repository }}@${{ github.ref_name }}"
|
31
|
+
waitFor: true
|
32
|
+
printBuildLogs: true
|
33
|
+
buildEnvVars: |
|
34
|
+
script=.ci/scripts/bench.sh
|
35
|
+
repo=apm-agent-ruby
|
36
|
+
sha=${{ github.sha }}
|
37
|
+
BRANCH_NAME=${{ github.ref_name }}
|
38
|
+
|
39
|
+
- if: ${{ failure() }}
|
40
|
+
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
|
41
|
+
with:
|
42
|
+
url: ${{ secrets.VAULT_ADDR }}
|
43
|
+
roleId: ${{ secrets.VAULT_ROLE_ID }}
|
44
|
+
secretId: ${{ secrets.VAULT_SECRET_ID }}
|
45
|
+
channel: "#apm-agent-ruby"
|
46
|
+
message: |
|
47
|
+
:ghost: [${{ github.repository }}] microbenchmark *${{ github.ref_name }}* failed to run in Buildkite.
|
48
|
+
Build: (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
name: OpenTelemetry Export Trace
|
3
|
+
|
4
|
+
on:
|
5
|
+
workflow_run:
|
6
|
+
workflows:
|
7
|
+
- Auto Assign to Project(s)
|
8
|
+
- Issue Labeler
|
9
|
+
- ci
|
10
|
+
- coverage-reporter
|
11
|
+
- microbenchmark
|
12
|
+
- release
|
13
|
+
- run-matrix
|
14
|
+
- snapshoty
|
15
|
+
- test-reporter
|
16
|
+
- updatecli
|
17
|
+
types: [completed]
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
otel-export-trace:
|
21
|
+
runs-on: ubuntu-latest
|
22
|
+
steps:
|
23
|
+
- uses: elastic/apm-pipeline-library/.github/actions/opentelemetry@current
|
24
|
+
with:
|
25
|
+
vaultUrl: ${{ secrets.VAULT_ADDR }}
|
26
|
+
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
|
27
|
+
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- "v[0-9]+*"
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: write
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
release:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v3
|
16
|
+
- uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: 2.6
|
19
|
+
- uses: hashicorp/vault-action@v2.4.2
|
20
|
+
with:
|
21
|
+
url: ${{ secrets.VAULT_ADDR }}
|
22
|
+
method: approle
|
23
|
+
roleId: ${{ secrets.VAULT_ROLE_ID }}
|
24
|
+
secretId: ${{ secrets.VAULT_SECRET_ID }}
|
25
|
+
secrets: |
|
26
|
+
secret/apm-team/ci/apm-agent-ruby-rubygems-release apiKey | API_KEY ;
|
27
|
+
- name: RubyGems login
|
28
|
+
run: |
|
29
|
+
RUBY_HOME="${HOME}/.gem"
|
30
|
+
RUBY_CREDENTIALS_FILE="${RUBY_HOME}/credentials"
|
31
|
+
mkdir -p "${RUBY_HOME}"
|
32
|
+
echo '---' > "${RUBY_CREDENTIALS_FILE}"
|
33
|
+
echo ":rubygems_api_key: ${API_KEY}" >> "${RUBY_CREDENTIALS_FILE}"
|
34
|
+
chmod 0600 "${RUBY_CREDENTIALS_FILE}"
|
35
|
+
- name: Install build system
|
36
|
+
run: .ci/scripts/install-build-system.sh
|
37
|
+
- run: rake release
|
38
|
+
update-branch:
|
39
|
+
needs:
|
40
|
+
- release
|
41
|
+
runs-on: ubuntu-latest
|
42
|
+
steps:
|
43
|
+
- uses: actions/checkout@v3
|
44
|
+
- uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
ruby-version: 2.6
|
47
|
+
- name: Setup Git
|
48
|
+
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
|
49
|
+
- name: Install build system
|
50
|
+
run: .ci/scripts/install-build-system.sh
|
51
|
+
- run: rake release:update_branch
|
52
|
+
|
53
|
+
status:
|
54
|
+
if: always()
|
55
|
+
runs-on: ubuntu-latest
|
56
|
+
needs:
|
57
|
+
- release
|
58
|
+
- update-branch
|
59
|
+
steps:
|
60
|
+
- id: check
|
61
|
+
uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
|
62
|
+
with:
|
63
|
+
needs: ${{ toJSON(needs) }}
|
64
|
+
- run: ${{ steps.check.outputs.isSuccess }}
|
65
|
+
- if: always()
|
66
|
+
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
|
67
|
+
with:
|
68
|
+
vaultUrl: ${{ secrets.VAULT_ADDR }}
|
69
|
+
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
|
70
|
+
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
|
71
|
+
slackChannel: "#apm-agent-ruby"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
# Runs the tests based on the provided files in ci.yml
|
3
|
+
name: run-matrix
|
4
|
+
|
5
|
+
on:
|
6
|
+
workflow_call:
|
7
|
+
inputs:
|
8
|
+
versionsFile:
|
9
|
+
required: true
|
10
|
+
type: string
|
11
|
+
frameworksFile:
|
12
|
+
required: true
|
13
|
+
type: string
|
14
|
+
excludedFile:
|
15
|
+
required: true
|
16
|
+
type: string
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
create-test-matrix:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
outputs:
|
22
|
+
matrix: ${{ steps.generate.outputs.matrix }}
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v3
|
25
|
+
- id: generate
|
26
|
+
uses: elastic/apm-pipeline-library/.github/actions/version-framework@current
|
27
|
+
with:
|
28
|
+
versionsFile: ${{ inputs.versionsFile }}
|
29
|
+
frameworksFile: ${{ inputs.frameworksFile }}
|
30
|
+
excludedFile: ${{ inputs.excludedFile }}
|
31
|
+
test:
|
32
|
+
needs:
|
33
|
+
- create-test-matrix
|
34
|
+
runs-on: ubuntu-latest
|
35
|
+
strategy:
|
36
|
+
fail-fast: false
|
37
|
+
max-parallel: 20
|
38
|
+
matrix: ${{ fromJSON(needs.create-test-matrix.outputs.matrix) }}
|
39
|
+
steps:
|
40
|
+
- uses: actions/checkout@v3
|
41
|
+
- name: Run BDD tests
|
42
|
+
run: ./spec/scripts/features.sh ${{ matrix.version }}
|
43
|
+
- name: Run test
|
44
|
+
run: ./spec/scripts/spec.sh ${{ matrix.version }} ${{ matrix.framework }}
|
45
|
+
env:
|
46
|
+
JUNIT_PREFIX: ${{ matrix.version }}-${{ matrix.framework }}
|
47
|
+
- if: success() || failure()
|
48
|
+
uses: actions/upload-artifact@v3
|
49
|
+
with:
|
50
|
+
name: test-results
|
51
|
+
path: "**/spec/junit-reports/**/*ruby-agent-junit.xml"
|
52
|
+
- if: success() || failure()
|
53
|
+
uses: actions/upload-artifact@v3
|
54
|
+
with:
|
55
|
+
name: coverage
|
56
|
+
path: "coverage/"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: snapshoty
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_run:
|
5
|
+
workflows:
|
6
|
+
- ci
|
7
|
+
types:
|
8
|
+
- completed
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
|
12
|
+
permissions:
|
13
|
+
contents: read
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
publish:
|
17
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v3
|
21
|
+
- name: Download artifacts
|
22
|
+
run: >
|
23
|
+
gh run download ${{ github.event.workflow_run.id }}
|
24
|
+
--name package
|
25
|
+
--repo "${GITHUB_REPOSITORY}"
|
26
|
+
--dir pkg
|
27
|
+
env:
|
28
|
+
GH_TOKEN: ${{ github.token }}
|
29
|
+
- name: Publish snapshot
|
30
|
+
uses: elastic/apm-pipeline-library/.github/actions/snapshoty-simple@current
|
31
|
+
with:
|
32
|
+
config: '.ci/snapshoty.yml'
|
33
|
+
vaultUrl: ${{ secrets.VAULT_ADDR }}
|
34
|
+
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
|
35
|
+
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
## Workflow to process the JUnit test results and add a report to the checks.
|
3
|
+
name: test-reporter
|
4
|
+
on:
|
5
|
+
workflow_run:
|
6
|
+
workflows:
|
7
|
+
- ci
|
8
|
+
types:
|
9
|
+
- completed
|
10
|
+
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
checks: write
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
report:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
- uses: elastic/apm-pipeline-library/.github/actions/test-report@current
|
20
|
+
with:
|
21
|
+
artifact: test-results
|
22
|
+
name: test-report
|
23
|
+
path: "**/*ruby-agent-junit.xml"
|
24
|
+
reporter: java-junit
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: updatecli
|
2
2
|
|
3
3
|
on:
|
4
4
|
workflow_dispatch: ~
|
@@ -14,13 +14,11 @@ jobs:
|
|
14
14
|
steps:
|
15
15
|
- uses: actions/checkout@v3
|
16
16
|
- uses: elastic/apm-pipeline-library/.github/actions/updatecli@current
|
17
|
-
env:
|
18
|
-
BRANCH_NAME: ${{ github.ref_name }}
|
19
17
|
with:
|
20
18
|
vaultUrl: ${{ secrets.VAULT_ADDR }}
|
21
19
|
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
|
22
20
|
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
|
23
|
-
pipeline:
|
21
|
+
pipeline: .ci/updatecli.d
|
24
22
|
- if: failure()
|
25
23
|
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
|
26
24
|
with:
|
data/.pre-commit-config.yaml
CHANGED
data/CHANGELOG.asciidoc
CHANGED
@@ -34,6 +34,38 @@ endif::[]
|
|
34
34
|
[[release-notes-4.x]]
|
35
35
|
=== Ruby Agent version 4.x
|
36
36
|
|
37
|
+
[[release-notes-4.7.2]
|
38
|
+
==== 4.7.2
|
39
|
+
|
40
|
+
[float]
|
41
|
+
===== Fixed
|
42
|
+
- Address machineType not being returned in GCP metadata {pull}1435[#1435]
|
43
|
+
|
44
|
+
[[release-notes-4.7.1]
|
45
|
+
==== 4.7.1
|
46
|
+
|
47
|
+
[float]
|
48
|
+
===== Fixed
|
49
|
+
- Skip capturing cookie header when it's set separately {pull}1405[#1405]
|
50
|
+
- Changes/fixes to metadata.cloud.* fields collected for GCP {pull}1415[#1415]
|
51
|
+
- Pin version of bigdecimal for ruby 2.4 {pull}1417[#1417]
|
52
|
+
- Use response method on Faraday error for older versions of the library {pull}1419[#1419]
|
53
|
+
- Fix ActionDispatchSpy#render_exception for Rails 7.1 {pull}1423[#1423]
|
54
|
+
- Use graphql < 2.1 when Ruby < 2.7 {pull}1425[#1425]
|
55
|
+
- Guard against various Faraday exception response formats {pull}1428[#1428]
|
56
|
+
|
57
|
+
[[release-notes-4.7.0]]
|
58
|
+
==== 4.7.0
|
59
|
+
|
60
|
+
[float]
|
61
|
+
===== Fixed
|
62
|
+
- Handle Faraday response being nil {pull}1382[#1382]
|
63
|
+
- Fix error with invalid %-encoding {pull}1400[#1400]
|
64
|
+
|
65
|
+
[float]
|
66
|
+
===== Added
|
67
|
+
- Add keyword args for span_method helper {pull}1395[#1395]
|
68
|
+
|
37
69
|
[[release-notes-4.6.2]]
|
38
70
|
==== 4.6.2
|
39
71
|
|
data/Gemfile
CHANGED
@@ -41,9 +41,14 @@ gem 'ecs-logging', require: 'ecs_logging/logger'
|
|
41
41
|
gem 'elasticsearch', require: nil
|
42
42
|
gem 'fakeredis', require: nil
|
43
43
|
gem 'faraday', require: nil
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
if RUBY_VERSION < '2.7'
|
45
|
+
gem 'graphql', '< 2.1', require: nil
|
46
|
+
else
|
47
|
+
gem 'graphql', require: nil
|
48
|
+
end
|
49
|
+
if !defined?(JRUBY_VERSION)
|
50
|
+
gem 'google-protobuf', '< 3.12' if RUBY_VERSION < '2.5'
|
51
|
+
gem 'google-protobuf', '< 3.23' if RUBY_VERSION < '2.7' && RUBY_VERSION > '2.5'
|
47
52
|
end
|
48
53
|
gem 'grpc' if !defined?(JRUBY_VERSION) && RUBY_VERSION < '3.0'
|
49
54
|
gem 'json'
|
@@ -62,6 +67,10 @@ gem 'sucker_punch', '~> 2.0', require: nil
|
|
62
67
|
gem 'yard', require: nil
|
63
68
|
gem 'yarjuf'
|
64
69
|
|
70
|
+
if RUBY_VERSION < '2.5'
|
71
|
+
gem 'loofah', '~> 2.20.0', require: nil
|
72
|
+
end
|
73
|
+
|
65
74
|
## Install Framework
|
66
75
|
GITHUB_REPOS = {
|
67
76
|
'grape' => 'ruby-grape/grape',
|
@@ -127,6 +136,10 @@ if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.5.0') && !defined
|
|
127
136
|
gem 'sneakers', github: 'jondot/sneakers', ref: 'd761dfe1493', require: nil
|
128
137
|
end
|
129
138
|
|
139
|
+
if Gem::Version.create(RUBY_VERSION) <= Gem::Version.create('2.5.0')
|
140
|
+
gem 'bigdecimal', '1.3.5'
|
141
|
+
end
|
142
|
+
|
130
143
|
group :bench do
|
131
144
|
gem 'ruby-prof', require: nil, platforms: %i[ruby]
|
132
145
|
gem 'stackprof', require: nil, platforms: %i[ruby]
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Elastic APM agent for Ruby
|
4
4
|
|
5
|
-
[![
|
5
|
+
[![ci](https://github.com/elastic/apm-agent-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/elastic/apm-agent-ruby/actions/workflows/ci.yml) [![Gem](https://img.shields.io/gem/v/elastic-apm.svg)](https://rubygems.org/gems/elastic-apm)
|
6
6
|
|
7
7
|
The official Rubygem for [Elastic][] [APM][].
|
8
8
|
|
data/bench/rubyprof.rb
CHANGED
data/bin/run-tests
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
set -e
|
3
3
|
|
4
|
+
JUNIT_PREFIX=${JUNIT_PREFIX:-""}
|
5
|
+
|
4
6
|
runRspec(){
|
5
7
|
local case=${1:-""}
|
6
8
|
local bn=${case}
|
@@ -8,9 +10,16 @@ runRspec(){
|
|
8
10
|
if [ -n "${case}" ]; then
|
9
11
|
bn="$(basename ${case} _spec.rb)/"
|
10
12
|
fi
|
13
|
+
# If working on an isolated environment then copy the file to
|
14
|
+
# the original location
|
15
|
+
TEST_REPORT_DIR=spec/junit-reports/${JUNIT_PREFIX}${bn}
|
16
|
+
if [ -n "$APP_PATH" ] ; then
|
17
|
+
TEST_REPORT_DIR=$APP_PATH/$TEST_REPORT_DIR
|
18
|
+
mkdir -p $TEST_REPORT_DIR
|
19
|
+
fi
|
11
20
|
bundle exec rspec \
|
12
21
|
-f progress \
|
13
|
-
-r yarjuf -f JUnit -o
|
22
|
+
-r yarjuf -f JUnit -o ${TEST_REPORT_DIR}ruby-agent-junit.xml \
|
14
23
|
${case}
|
15
24
|
}
|
16
25
|
specific_spec=$1
|
data/docker-compose.yml
CHANGED
@@ -35,8 +35,11 @@ services:
|
|
35
35
|
ruby_rspec:
|
36
36
|
image: apm-agent-ruby:${RUBY_VERSION}
|
37
37
|
environment:
|
38
|
+
APP_PATH: /opt/app
|
39
|
+
FRAMEWORK: rails
|
40
|
+
LOCAL_USER_ID: ${LOCAL_USER_ID}
|
41
|
+
LOCAL_GROUP_ID: ${LOCAL_GROUP_ID}
|
38
42
|
MONGODB_URL: 'mongodb:27017'
|
39
|
-
user: ${USER_ID}
|
40
43
|
security_opt:
|
41
44
|
- no-new-privileges
|
42
45
|
|
data/docs/configuration.asciidoc
CHANGED
@@ -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`
|
@@ -170,7 +170,7 @@ 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
|
-
The API key must be created using the {apm-guide-ref}/api-key.html[APM server command-line tool].
|
173
|
+
The API key must be created using the {apm-guide-ref}/api-key.html[APM server command-line tool].
|
174
174
|
|
175
175
|
WARNING: API keys only provide any real security if your APM server uses TLS.
|
176
176
|
|
@@ -199,7 +199,7 @@ The <<config-log-path,logs>> should tell you what went wrong.
|
|
199
199
|
| `ELASTIC_APM_API_REQUEST_SIZE` | `api_request_size` | `"750kb"`
|
200
200
|
|============
|
201
201
|
|
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.
|
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.
|
203
203
|
|
204
204
|
This must be provided in *<<config-format-size, size format>>*.
|
205
205
|
|
@@ -301,7 +301,8 @@ If set to `true`, the client will poll the APM Server regularly for new agent co
|
|
301
301
|
|
302
302
|
Usually APM Server determines how often to poll, but if not, set the default interval is 5 minutes.
|
303
303
|
|
304
|
-
NOTE: This feature requires APM Server v7.3 or later
|
304
|
+
NOTE: This feature requires APM Server v7.3 or later.
|
305
|
+
See {kibana-ref}/agent-configuration.html[APM Agent central configuration] for more information.
|
305
306
|
|
306
307
|
[float]
|
307
308
|
[[config-cloud-provider]]
|
@@ -701,7 +702,7 @@ The name of the given service node. This is optional, and if omitted, the APM
|
|
701
702
|
Server will fall back on `system.container.id` if available, and
|
702
703
|
`host.name` if necessary.
|
703
704
|
|
704
|
-
This option allows you to set the node name manually to ensure it's unique and meaningful.
|
705
|
+
This option allows you to set the node name manually to ensure it's unique and meaningful.
|
705
706
|
|
706
707
|
[float]
|
707
708
|
[[config-service-version]]
|
data/docs/index.asciidoc
CHANGED
@@ -23,12 +23,12 @@ include::./api.asciidoc[]
|
|
23
23
|
|
24
24
|
include::./metrics.asciidoc[]
|
25
25
|
|
26
|
+
include::./logs.asciidoc[]
|
27
|
+
|
26
28
|
include::./opentracing.asciidoc[]
|
27
29
|
|
28
30
|
include::./graphql.asciidoc[]
|
29
31
|
|
30
|
-
include::./log-correlation.asciidoc[]
|
31
|
-
|
32
32
|
include::./performance-tuning.asciidoc[]
|
33
33
|
|
34
34
|
include::./debugging.asciidoc[]
|
@@ -3,8 +3,26 @@ NOTE: For the best reading experience,
|
|
3
3
|
please view this documentation at https://www.elastic.co/guide/en/apm/agent/ruby[elastic.co]
|
4
4
|
endif::[]
|
5
5
|
|
6
|
-
[[
|
7
|
-
==
|
6
|
+
[[logs]]
|
7
|
+
== Logs
|
8
|
+
|
9
|
+
Elastic Ruby APM Agent provides the following log features:
|
10
|
+
|
11
|
+
- <<log-correlation-ids>>: Automatically inject correlation IDs that allow navigation between logs, traces and services.
|
12
|
+
- <<log-reformatting>>: Automatically reformat plaintext logs in {ecs-logging-ref}/intro.html[ECS logging] format.
|
13
|
+
|
14
|
+
Those features are part of {observability-guide}/application-logs.html[Application log ingestion strategies].
|
15
|
+
|
16
|
+
The {ecs-logging-ruby-ref}/intro.html[`ecs-logging-ruby`] library can also be used to format logs in the {ecs-logging-ref}/intro.html[ECS logging] format without an APM agent.
|
17
|
+
When deployed with the Ruby APM agent, the agent will provide <<log-correlation-ids,log correlation>> IDs.
|
18
|
+
|
19
|
+
[float]
|
20
|
+
[[log-correlation-ids]]
|
21
|
+
=== Log correlation
|
22
|
+
|
23
|
+
{apm-guide-ref}/log-correlation.html[Log correlation] allows you to navigate to all logs belonging to a particular trace
|
24
|
+
and vice-versa: for a specific log, see in which context it has been logged and which parameters the user provided.
|
25
|
+
|
8
26
|
|
9
27
|
Trace/log correlation can be set up in three different ways.
|
10
28
|
|
@@ -119,3 +137,12 @@ PUT _ingest/pipeline/extract_trace_id
|
|
119
137
|
----
|
120
138
|
|
121
139
|
Please see {apm-guide-ref}/log-correlation.html[Observability integrations] for more information.
|
140
|
+
|
141
|
+
[float]
|
142
|
+
[[log-reformatting]]
|
143
|
+
=== Log reformatting (experimental)
|
144
|
+
|
145
|
+
Log reformatting is controlled by the <<config-log-ecs-formatting, `log_ecs_reformatting`>> configuration option, and is disabled by default.
|
146
|
+
|
147
|
+
The reformatted logs will include both the <<log-correlation-ids, trace and service correlation>> IDs.
|
148
|
+
|
data/docs/opentracing.asciidoc
CHANGED