Skip to content

Update elastic search spy to check for new gem name#1257

Merged
jaggederest merged 5 commits intoelastic:mainfrom
jaggederest:elastic_transport_spy
May 12, 2022
Merged

Update elastic search spy to check for new gem name#1257
jaggederest merged 5 commits intoelastic:mainfrom
jaggederest:elastic_transport_spy

Conversation

@jaggederest
Copy link
Contributor

@jaggederest jaggederest commented May 5, 2022

What does this pull request do?

There is an error in the tests, and likely no data being captured, with the new elasticsearch-ruby gem. This fixes that issue.

Why is it important?

elasticsearch-ruby relies on a separate gem to provide transport functionality, and that gem is what we instrument. Last year, in preparation for the 8.0 release, that gem was renamed and separated from the core elasticsearch-ruby repo into a new repo, and renamed elastic-transport. Our spy still works, but it was no longer checking the right dependency name to install itself, and therefore was not capturing data correctly.

Checklist

  • I have signed the Contributor License Agreement.
  • My code follows the style guidelines of this project (See .rubocop.yml)
  • I have rebased my changes on top of the latest main branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related issues

@jaggederest jaggederest requested a review from estolfo May 5, 2022 22:59
@jaggederest jaggederest self-assigned this May 5, 2022
@ghost
Copy link

ghost commented May 5, 2022

💔 Tests Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-05-12T09:05:59.836+0000

  • Duration: 34 min 46 sec

Test stats 🧪

Test Results
Failed 6
Passed 39072
Skipped 71
Total 39149

Test errors 6

Expand to view the tests failures

Tests / Tests / Ruby:ruby:3.0#sinatra-2.0 / [empty] – ruby-agent-junit.xml
  • no error details
  • Expand to view the stacktrace

     Test report file /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1257/src/github.com/elastic/apm-agent-ruby/spec/junit-reports/ruby-agent-junit.xml was length 0 
    

Tests / Main Tests frameworks / Ruby:ruby:3.0#rails-main / [empty] – ruby-agent-junit.xml
  • no error details
  • Expand to view the stacktrace

     Test report file /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1257/src/github.com/elastic/apm-agent-ruby/spec/junit-reports/ruby-agent-junit.xml was length 0 
    

Tests / Main Tests frameworks / Ruby:ruby:3.0#sinatra-master / [empty] – ruby-agent-junit.xml
  • no error details
  • Expand to view the stacktrace

     Test report file /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1257/src/github.com/elastic/apm-agent-ruby/spec/junit-reports/ruby-agent-junit.xml was length 0 
    

Tests / Tests / Ruby:ruby:3.0#rails-6.1 / [empty] – ruby-agent-junit.xml
  • no error details
  • Expand to view the stacktrace

     Test report file /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1257/src/github.com/elastic/apm-agent-ruby/spec/junit-reports/ruby-agent-junit.xml was length 0 
    

Tests / Tests / Ruby:ruby:3.0#rails-6.0 / [empty] – ruby-agent-junit.xml
  • no error details
  • Expand to view the stacktrace

     Test report file /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1257/src/github.com/elastic/apm-agent-ruby/spec/junit-reports/ruby-agent-junit.xml was length 0 
    

Tests / Main Tests frameworks / Ruby:ruby:3.0#grape-master / [empty] – ruby-agent-junit.xml
  • no error details
  • Expand to view the stacktrace

     Test report file /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1257/src/github.com/elastic/apm-agent-ruby/spec/junit-reports/ruby-agent-junit.xml was length 0 
    

Steps errors 21

Expand to view the steps failures

Show only the first 10 steps failures

Shell Script
  • Took 1 min 5 sec . View more details here
  • Description: ./spec/scripts/spec.sh ruby:3.0 rails-main
Shell Script
  • Took 1 min 5 sec . View more details here
  • Description: ./spec/scripts/spec.sh ruby:3.0 rails-main
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-05-12T09:23:19.885Z] Archiving artifacts [2022-05-12T09:23:20.183Z] ‘coverage/matrix_result
Shell Script
  • Took 1 min 31 sec . View more details here
  • Description: ./spec/scripts/spec.sh ruby:3.0 sinatra-master
Shell Script
  • Took 1 min 31 sec . View more details here
  • Description: ./spec/scripts/spec.sh ruby:3.0 sinatra-master
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-05-12T09:23:24.166Z] Archiving artifacts [2022-05-12T09:23:24.413Z] ‘coverage/matrix_result
Shell Script
  • Took 1 min 35 sec . View more details here
  • Description: ./spec/scripts/spec.sh ruby:3.0 grape-master
Shell Script
  • Took 1 min 36 sec . View more details here
  • Description: ./spec/scripts/spec.sh ruby:3.0 grape-master
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-05-12T09:23:56.420Z] Archiving artifacts [2022-05-12T09:23:56.675Z] ‘coverage/matrix_result
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Ruby:ruby:3.0#rails-6.1 tests failed : hudson.AbortException: script returned exit code 134

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark test.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@ghost
Copy link

ghost commented May 10, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 99.2% (124/125)
Classes 99.2% (124/125)
Lines 59.47% (2493/4192)
Conditionals 100.0% (0/0) 💚
Copy link
Contributor

@estolfo estolfo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this PR to fixing the elastisearch client instrumentation. Then, let's open a separate PR to resolve the other test failures (sneakers version and json seg fault)


def install
::Elasticsearch::Transport::Client.prepend(Ext)
if defined?(::ElasticSearch::Transport::Client)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this condition and clause?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 3 different constants in use through the versions of elastic transport ruby - Elastic::Transport is the current one, the older one is ElasticSearch::Transport, and the oldest one is Elasticsearch::Transport. So this if statement makes sure we instrument the correct one of those three, based on which one is defined. I should probably make it Elastic::Transport first, now that I think about it 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you find that it was ElasticSearch previously?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, maybe it wasn't. That was just the constant I used when I fixed the test errors. I will remove it and if it doesn't cause any additional test errors, no harm no foul I guess.


def install
::Elasticsearch::Transport::Client.prepend(Ext)
if defined?(::ElasticSearch::Transport::Client)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 3 different constants in use through the versions of elastic transport ruby - Elastic::Transport is the current one, the older one is ElasticSearch::Transport, and the oldest one is Elasticsearch::Transport. So this if statement makes sure we instrument the correct one of those three, based on which one is defined. I should probably make it Elastic::Transport first, now that I think about it 👍

@jaggederest
Copy link
Contributor Author

@estolfo This PR should be ready for re-review, thanks for reviewing it!

@jaggederest jaggederest requested a review from estolfo May 12, 2022 08:22
@jaggederest jaggederest merged commit 1d6f89f into elastic:main May 12, 2022
@jaggederest jaggederest deleted the elastic_transport_spy branch May 12, 2022 10:33
estolfo pushed a commit that referenced this pull request Mar 2, 2023
* Update elastic search spy to check for new gem name

* Update changelog for pr #1257

* Fix case where we are using older version of elasticsearch-transport (pre 2.5)

* Omit extra bundler install in scripts/spec

* Remove erroneous ElasticSearch constant check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants