elastic-apm 4.9.0 → 4.10.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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.pre-commit-config.yaml +1 -1
  3. data/CONTRIBUTING.md +13 -9
  4. data/Gemfile +43 -6
  5. data/docs/reference/getting-started-rails.md +14 -0
  6. data/docs/reference/graphql.md +1 -1
  7. data/docs/reference/supported-technologies.md +3 -3
  8. data/docs/release-notes/index.md +36 -4
  9. data/elastic-apm.gemspec +6 -3
  10. data/lib/elastic_apm/config.rb +1 -0
  11. data/lib/elastic_apm/error_builder.rb +1 -0
  12. data/lib/elastic_apm/graphql.rb +8 -0
  13. data/lib/elastic_apm/spies/sidekiq.rb +36 -1
  14. data/lib/elastic_apm/spies/sneakers.rb +4 -1
  15. data/lib/elastic_apm/spies/solid_queue.rb +80 -0
  16. data/lib/elastic_apm/stacktrace_builder.rb +1 -1
  17. data/lib/elastic_apm/transport/connection/proxy_pipe.rb +11 -1
  18. data/lib/elastic_apm/transport/connection.rb +1 -1
  19. data/lib/elastic_apm/transport/worker.rb +1 -1
  20. data/lib/elastic_apm/version.rb +1 -1
  21. data/updatecli-compose.yaml +4 -4
  22. metadata +6 -56
  23. data/.ci/.codecov.yml +0 -5
  24. data/.ci/.exclude.yml +0 -138
  25. data/.ci/.framework.yml +0 -10
  26. data/.ci/.main_framework.yml +0 -4
  27. data/.ci/.ruby.yml +0 -10
  28. data/.ci/docker/jruby/11-jdk/Dockerfile +0 -46
  29. data/.ci/docker/jruby/12-jdk/Dockerfile +0 -44
  30. data/.ci/docker/jruby/13-jdk/Dockerfile +0 -44
  31. data/.ci/docker/jruby/7-jdk/Dockerfile +0 -44
  32. data/.ci/docker/jruby/8-jdk/Dockerfile +0 -46
  33. data/.ci/docker/jruby/README.md +0 -31
  34. data/.ci/docker/jruby/run.sh +0 -97
  35. data/.ci/docker/jruby/test.sh +0 -28
  36. data/.ci/scripts/bench.sh +0 -52
  37. data/.ci/scripts/install-build-system.sh +0 -5
  38. data/.ci/updatecli/values.d/apm-data-spec.yml +0 -1
  39. data/.ci/updatecli/values.d/apm-gherkin.yml +0 -1
  40. data/.ci/updatecli/values.d/apm-json-specs.yml +0 -1
  41. data/.ci/updatecli/values.d/scm.yml +0 -10
  42. data/.ci/updatecli/values.d/update-compose.yml +0 -3
  43. data/.github/CODEOWNERS +0 -1
  44. data/.github/ISSUE_TEMPLATE/Bug_report.md +0 -40
  45. data/.github/ISSUE_TEMPLATE/Feature_request.md +0 -17
  46. data/.github/PULL_REQUEST_TEMPLATE.md +0 -60
  47. data/.github/dependabot.yml +0 -35
  48. data/.github/labeler-config.yml +0 -3
  49. data/.github/workflows/README.md +0 -57
  50. data/.github/workflows/addToProject.yml +0 -63
  51. data/.github/workflows/ci-docs.yml +0 -20
  52. data/.github/workflows/ci.yml +0 -70
  53. data/.github/workflows/docs-build.yml +0 -16
  54. data/.github/workflows/docs-deploy.yml +0 -16
  55. data/.github/workflows/docs-preview-cleanup.yml +0 -12
  56. data/.github/workflows/github-commands-comment.yml +0 -18
  57. data/.github/workflows/labeler.yml +0 -21
  58. data/.github/workflows/microbenchmark.yml +0 -31
  59. data/.github/workflows/release.yml +0 -87
  60. data/.github/workflows/run-matrix.yml +0 -68
  61. data/.github/workflows/test-reporter.yml +0 -25
  62. data/.github/workflows/updatecli.yml +0 -61
  63. data/bench/.gitignore +0 -2
  64. data/bench/app.rb +0 -53
  65. data/bench/benchmark.rb +0 -36
  66. data/bench/report.rb +0 -55
  67. data/bench/rubyprof.rb +0 -40
  68. data/bench/sql.rb +0 -49
  69. data/bench/stackprof.rb +0 -23
  70. data/bench/tmp/.gitkeep +0 -0
@@ -1,68 +0,0 @@
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
- permissions:
19
- contents: read
20
-
21
- jobs:
22
- create-test-matrix:
23
- runs-on: ubuntu-latest
24
- outputs:
25
- matrix: ${{ steps.generate.outputs.matrix }}
26
- steps:
27
- - uses: actions/checkout@v4
28
- - id: generate
29
- uses: elastic/oblt-actions/version-framework@v1
30
- with:
31
- versions-file: ${{ inputs.versionsFile }}
32
- frameworks-file: ${{ inputs.frameworksFile }}
33
- excluded-file: ${{ inputs.excludedFile }}
34
- test:
35
- needs:
36
- - create-test-matrix
37
- runs-on: ubuntu-latest
38
- strategy:
39
- fail-fast: false
40
- max-parallel: 20
41
- matrix: ${{ fromJSON(needs.create-test-matrix.outputs.matrix) }}
42
- steps:
43
- - uses: actions/checkout@v4
44
- - name: Run BDD tests
45
- run: ./spec/scripts/features.sh ${{ matrix.version }}
46
- - name: Run test
47
- run: ./spec/scripts/spec.sh ${{ matrix.version }} ${{ matrix.framework }}
48
- env:
49
- JUNIT_PREFIX: ${{ matrix.version }}-${{ matrix.framework }}
50
-
51
- - if: success() || failure()
52
- id: normalize-junit
53
- uses: actions/github-script@v7
54
- with:
55
- result-encoding: string
56
- script: |
57
- function normalizeName(name) {
58
- return name.replace(/["/:<>|*?\\]/g, '-')
59
- }
60
- const framework = normalizeName('${{ matrix.framework }}')
61
- const version = normalizeName('${{ matrix.version }}')
62
- return `${version}-${framework}`
63
- - if: success() || failure()
64
- name: Upload JUnit Test Results
65
- uses: actions/upload-artifact@v4
66
- with:
67
- name: test-results-${{ steps.normalize-junit.outputs.result }}
68
- path: "**/spec/junit-reports/**/*ruby-agent-junit.xml"
@@ -1,25 +0,0 @@
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
- actions: read
14
- checks: write
15
-
16
- jobs:
17
- report:
18
- runs-on: ubuntu-latest
19
- steps:
20
- - uses: elastic/oblt-actions/test-report@v1
21
- with:
22
- artifact: /test-results(.*)/
23
- name: 'Test Report $1'
24
- path: "**/*ruby-agent-junit.xml"
25
- reporter: java-junit
@@ -1,61 +0,0 @@
1
- name: updatecli
2
-
3
- on:
4
- workflow_dispatch: ~
5
- schedule:
6
- - cron: '0 6 * * *'
7
-
8
- permissions:
9
- contents: read
10
-
11
- jobs:
12
- compose:
13
- runs-on: ubuntu-latest
14
- permissions:
15
- contents: read
16
- packages: read
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Get token
21
- id: get_token
22
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
23
- with:
24
- app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
25
- private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
26
- permissions: >-
27
- {
28
- "contents": "write",
29
- "pull_requests": "write"
30
- }
31
-
32
- - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
33
- with:
34
- registry: ghcr.io
35
- username: ${{ github.actor }}
36
- password: ${{ secrets.GITHUB_TOKEN }}
37
-
38
- - uses: elastic/oblt-actions/updatecli/run@v1
39
- with:
40
- command: --experimental compose diff
41
- # TODO: update to the latest version so the policies can work as expected.
42
- # latest changes in the policies require to use the dependson feature.
43
- version: "v0.88.0"
44
- env:
45
- GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
46
-
47
- - uses: elastic/oblt-actions/updatecli/run@v1
48
- with:
49
- command: --experimental compose apply
50
- # TODO: update to the latest version so the policies can work as expected.
51
- # latest changes in the policies require to use the dependson feature.
52
- version: "v0.88.0"
53
- env:
54
- GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
55
-
56
- - if: failure()
57
- uses: elastic/oblt-actions/slack/send@v1
58
- with:
59
- bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
60
- channel-id: "#apm-agent-ruby"
61
- message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
data/bench/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- tmp/*
2
- db/*
data/bench/app.rb DELETED
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
- require 'active_record'
6
- require 'action_controller/railtie'
7
- require 'elastic-apm'
8
- require 'elastic_apm/railtie'
9
-
10
- $log = Logger.new('/tmp/bench.log')
11
-
12
- ActiveRecord::Base.logger = $log
13
-
14
- ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: '/tmp/bench.sqlite3')
15
-
16
- ActiveRecord::Schema.define do
17
- create_table :posts, force: true do |t|
18
- t.string :title
19
- t.timestamps
20
- end
21
- end
22
-
23
- class Post < ActiveRecord::Base
24
- end
25
-
26
- 10.times { |i| Post.create! title: "Post #{i}" }
27
-
28
- class ApplicationController < ActionController::Base
29
- def index
30
- render inline: '<%= Post.pluck(:title).join(", ") %>'
31
- end
32
-
33
- def favicon
34
- render nothing: true
35
- end
36
- end
37
-
38
- class App < Rails::Application
39
- config.secret_key_base = '__secret'
40
- config.logger = $log
41
- config.eager_load = false
42
-
43
- config.elastic_apm.disable_send = true
44
- config.elastic_apm.logger = $log
45
- config.elastic_apm.log_level = Logger::DEBUG
46
- end
47
-
48
- App.initialize!
49
-
50
- App.routes.draw do
51
- get '/favicon.ico', to: 'application#favicon'
52
- root to: 'application#index'
53
- end
data/bench/benchmark.rb DELETED
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- ENV['RAILS_ENV'] = 'production'
5
-
6
- require 'bundler'
7
- require 'bundler/setup'
8
-
9
- require 'benchmark'
10
- include Benchmark
11
- require 'rack/test'
12
-
13
- require './bench/app'
14
-
15
- def app
16
- App
17
- end
18
-
19
- include Rack::Test::Methods
20
-
21
- def perform
22
- 10_000.times do
23
- get '/'
24
- end
25
- end
26
-
27
- bench = Benchmark.benchmark(CAPTION, 15, FORMAT) do |b|
28
- perform # warm up
29
-
30
- b.report('with agent:') { perform }
31
-
32
- ElasticAPM.stop
33
- perform # warm up
34
-
35
- b.report('without agent:') { perform }
36
- end
data/bench/report.rb DELETED
@@ -1,55 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'time'
5
- require 'json'
6
-
7
- input = STDIN.read.split("\n")
8
-
9
- git_sha, git_msg = `git log -n 1 --pretty="format:%H|||%s"`.split('|||')
10
- git_date = `git log -n 1 --pretty="format:%ai"`
11
- platform = Gem::Platform.local
12
-
13
- def doc(payload)
14
- puts({ index: { _index: "benchmark-ruby" } }.to_json)
15
- puts(payload.to_json)
16
- end
17
-
18
- meta = {
19
- executed_at: Time.new.iso8601,
20
- 'git.commit' => git_sha,
21
- 'git.date' => (String(git_date).strip != '' && Time.parse(git_date).iso8601) || Time.now.iso8601,
22
- 'git.subject' => git_msg,
23
- hostname: `hostname`.chomp,
24
- engine: RUBY_ENGINE,
25
- arch: platform.cpu,
26
- os: platform.os,
27
- ruby_version: "#{RUBY_ENGINE == 'jruby' ? 'j' : ''}#{RUBY_VERSION}"
28
- }
29
-
30
- results =
31
- input
32
- .grep(/^with/)
33
- .map do |line|
34
- title = line.match(/^(.*):/) { |m| m[1] }
35
- user, system, total, real = line.scan(/[0-9\.]+/).map(&:to_f)
36
- meta.merge(
37
- title: title,
38
- user: user,
39
- system: system,
40
- total: total,
41
- real: real,
42
- )
43
- end
44
-
45
- results.each { |result| doc result }
46
-
47
- overhead =
48
- (results[0][:total] - results[1][:total]) *
49
- 1000 / # milliseconds
50
- 10_000 # transactions
51
-
52
- doc meta.merge(
53
- title: 'overhead',
54
- overhead: overhead
55
- )
data/bench/rubyprof.rb DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'ruby-prof'
5
- require 'rack/test'
6
-
7
- $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
8
- require 'elastic-apm'
9
-
10
- require './bench/app'
11
- include App::Helpers
12
-
13
- def perform(app, count: 1000)
14
- app.start
15
-
16
- transactions = count.times.map do |i|
17
- ElasticAPM.transaction "Transaction##{i}",
18
- context: ElasticAPM.build_context(app.mock_env) do
19
- ElasticAPM.span('Number one') { 'ok 1' }
20
- ElasticAPM.span('Number two') { 'ok 2' }
21
- ElasticAPM.span('Number three') { 'ok 3' }
22
- end
23
- end
24
-
25
- app.stop
26
- end
27
-
28
- def do_bench(transaction_count: 1000, **config)
29
- with_app(config) do |app|
30
- profile = RubyProf::Profile.new
31
- profile.exclude_common_methods!
32
- profile.start
33
- perform(app, count: transaction_count)
34
- profile.stop
35
- printer = RubyProf::GraphHtmlPrinter.new(profile)
36
- printer.print(File.open('bench/tmp/out.html', 'w'))
37
- end
38
- end
39
-
40
- do_bench(transaction_count: 10_000)
data/bench/sql.rb DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
-
6
- require 'json'
7
- require 'benchmark'
8
- include Benchmark # rubocop:disable Style/MixinUsage
9
-
10
- require 'elastic_apm/sql_summarizer'
11
- require 'elastic_apm/sql/signature'
12
-
13
- examples =
14
- JSON
15
- .parse(File.read('../apm/tests/random_sql_query_set.json'))
16
- .map { |ex| ex['input'] }
17
-
18
- puts "#{'=' * 14} Parsing #{examples.length} examples #{'=' * 14}"
19
-
20
- summarizer = ElasticAPM::SqlSummarizer.new
21
-
22
- result_old = nil
23
- result_new = nil
24
-
25
- benchmark(CAPTION, 7, FORMAT, 'avg/ex:') do |bm|
26
- old = bm.report('old:') do
27
- result_old = examples.map { |i| summarizer.summarize(i) }
28
- end
29
- new = bm.report('new:') do
30
- result_new = examples.map { |i| ElasticAPM::Sql::Signature.parse(i) }
31
- end
32
-
33
- [(new - old) / examples.length]
34
- end
35
-
36
- pp(result_old.count { |res| res == 'SQL' })
37
- pp(result_new.count { |res| res =~ /(--|\/\*\*)/ })
38
-
39
- ## Stackprof
40
-
41
- require 'stackprof'
42
-
43
- puts 'Running stackprof'
44
- profile = StackProf.run(mode: :wall, interval: 1) do
45
- examples.each { |i| ElasticAPM::Sql::Signature.parse(i) }
46
- end
47
- puts ''
48
-
49
- StackProf::Report.new(profile).print_text
data/bench/stackprof.rb DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'stackprof'
5
- require 'rack/test'
6
-
7
- require './bench/app'
8
-
9
- def app
10
- App
11
- end
12
-
13
- include Rack::Test::Methods
14
-
15
- puts 'Running '
16
- profile = StackProf.run(mode: :cpu) do
17
- 10_000.times do
18
- get '/'
19
- end
20
- end
21
- puts ''
22
-
23
- StackProf::Report.new(profile).print_text
data/bench/tmp/.gitkeep DELETED
File without changes