Skip to content

Basic support for remote EJB invocations on a WildFly application server #1815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from

Conversation

tobiasstadler
Copy link
Contributor

@tobiasstadler tobiasstadler commented May 16, 2021

What does this PR do?

Fixes #1814 for WildFly

Checklist

  • This is an enhancement of existing features, or a new feature in existing plugins
    • I have updated CHANGELOG.asciidoc
    • I have added tests that prove my fix is effective or that my feature works
    • Added an API method or config option? Document in which version this will be introduced
    • I have made corresponding changes to the documentation
  • This is a bugfix
  • This is a new plugin
    • I have updated CHANGELOG.asciidoc
    • My code follows the style guidelines of this project
    • I have made corresponding changes to the documentation
    • 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
    • I have updated supported-technologies.asciidoc
    • Added an API method or config option? Document in which version this will be introduced
    • Added an instrumentation plugin? Describe how you made sure that old, non-supported versions are not instrumented by accident.
  • This is something else

@apmmachine
Copy link
Contributor

apmmachine commented May 16, 2021

❕ Build Aborted

The PR is not allowed to run in the CI yet

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

Expand to view the summary

Build stats

  • Reason: The PR is not allowed to run in the CI yet

  • Start Time: 2021-07-08T07:30:20.005+0000

  • Duration: 3 min 59 sec

  • Commit: 1dcde39

Trends 🧪

Image of Build Times

Steps errors 2

Expand to view the steps failures

Load a resource file from a shared library
  • Took 0 min 0 sec . View more details on here
  • Description: approval-list/elastic/apm-agent-java.yml
Error signal
  • Took 0 min 0 sec . View more details on here
  • Description: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permissions can do so.)

Log output

Expand to view the last 100 lines of log output

[2021-07-08T07:32:52.097Z] Cloning repository https://github.com/elastic/apm-agent-java.git
[2021-07-08T07:32:52.149Z]  > git init /var/lib/jenkins/workspace/_java_apm-agent-java-mbp_PR-1815 # timeout=10
[2021-07-08T07:32:52.215Z] Using reference repository: /var/lib/jenkins/.git-references/apm-agent-java.git
[2021-07-08T07:32:52.220Z] Fetching upstream changes from https://github.com/elastic/apm-agent-java.git
[2021-07-08T07:32:52.221Z]  > git --version # timeout=10
[2021-07-08T07:32:52.229Z]  > git --version # 'git version 2.17.1'
[2021-07-08T07:32:52.229Z] using GIT_ASKPASS to set credentials GitHub user @apmmachine User + Personal Access Token
[2021-07-08T07:32:52.232Z]  > git fetch --no-tags --progress -- https://github.com/elastic/apm-agent-java.git +refs/heads/*:refs/remotes/origin/* # timeout=100
[2021-07-08T07:32:53.050Z] Pruning obsolete local branches
[2021-07-08T07:32:53.507Z] Merging remotes/origin/master commit d85c09d6a9fdf0859cc5eb1ec84165264d1f40ae into PR head commit 1dcde39e03cdf3ad6c68e491130745a776836c4e
[2021-07-08T07:32:53.801Z] Merge succeeded, producing 1dcde39e03cdf3ad6c68e491130745a776836c4e
[2021-07-08T07:32:53.801Z] Checking out Revision 1dcde39e03cdf3ad6c68e491130745a776836c4e (PR-1815)
[2021-07-08T07:32:53.022Z]  > git config remote.origin.url https://github.com/elastic/apm-agent-java.git # timeout=10
[2021-07-08T07:32:53.028Z]  > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
[2021-07-08T07:32:53.043Z]  > git config remote.origin.url https://github.com/elastic/apm-agent-java.git # timeout=10
[2021-07-08T07:32:53.054Z] Fetching upstream changes from https://github.com/elastic/apm-agent-java.git
[2021-07-08T07:32:53.054Z] using GIT_ASKPASS to set credentials GitHub user @apmmachine User + Personal Access Token
[2021-07-08T07:32:53.055Z]  > git fetch --no-tags --progress --prune -- https://github.com/elastic/apm-agent-java.git +refs/pull/1815/head:refs/remotes/origin/PR-1815 +refs/heads/master:refs/remotes/origin/master # timeout=100
[2021-07-08T07:32:53.514Z]  > git config core.sparsecheckout # timeout=10
[2021-07-08T07:32:53.520Z]  > git checkout -f 1dcde39e03cdf3ad6c68e491130745a776836c4e # timeout=100
[2021-07-08T07:32:53.730Z]  > git remote # timeout=10
[2021-07-08T07:32:53.755Z]  > git config --get remote.origin.url # timeout=10
[2021-07-08T07:32:53.761Z] using GIT_ASKPASS to set credentials GitHub user @apmmachine User + Personal Access Token
[2021-07-08T07:32:53.763Z]  > git merge d85c09d6a9fdf0859cc5eb1ec84165264d1f40ae # timeout=10
[2021-07-08T07:32:53.780Z]  > git rev-parse HEAD^{commit} # timeout=10
[2021-07-08T07:32:53.804Z]  > git config core.sparsecheckout # timeout=10
[2021-07-08T07:32:53.827Z]  > git checkout -f 1dcde39e03cdf3ad6c68e491130745a776836c4e # timeout=100
[2021-07-08T07:32:57.909Z] Commit message: "Merge branch 'master' into fix-1814"
[2021-07-08T07:32:57.912Z]  > git rev-list --no-walk 63bb918c83efe957dfb99283b9fa8aaaec7b5a33 # timeout=10
[2021-07-08T07:32:58.613Z] Masking supported pattern matches of $JOB_GCS_BUCKET or $NOTIFY_TO
[2021-07-08T07:32:58.658Z] Timeout set to expire in 1 hr 0 min
[2021-07-08T07:32:58.674Z] The timestamps step is unnecessary when timestamps are enabled for all Pipeline builds.
[2021-07-08T07:32:58.911Z] [INFO] Number of builds to be searched 10
[2021-07-08T07:32:59.219Z] [INFO] 'shallow' is forced to be disabled when running on PullRequests
[2021-07-08T07:32:59.235Z] Running in /var/lib/jenkins/workspace/_java_apm-agent-java-mbp_PR-1815/src/github.com/elastic/apm-agent-java
[2021-07-08T07:32:59.254Z] [INFO] gitCheckout: Checkout SCM PR-1815 with some customisation.
[2021-07-08T07:32:59.282Z] [INFO] Override default checkout
[2021-07-08T07:32:59.318Z] Sleeping for 10 sec
[2021-07-08T07:33:09.328Z] The recommended git tool is: git
[2021-07-08T07:33:09.453Z] using credential 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken
[2021-07-08T07:33:09.464Z] Cloning the remote Git repository
[2021-07-08T07:33:09.478Z] Cloning repository https://github.com/elastic/apm-agent-java.git
[2021-07-08T07:33:09.505Z]  > git init /var/lib/jenkins/workspace/_java_apm-agent-java-mbp_PR-1815/src/github.com/elastic/apm-agent-java # timeout=10
[2021-07-08T07:33:09.512Z] Using reference repository: /var/lib/jenkins/.git-references/apm-agent-java.git
[2021-07-08T07:33:09.512Z] Fetching upstream changes from https://github.com/elastic/apm-agent-java.git
[2021-07-08T07:33:09.513Z]  > git --version # timeout=10
[2021-07-08T07:33:09.519Z]  > git --version # 'git version 2.17.1'
[2021-07-08T07:33:09.519Z] using GIT_ASKPASS to set credentials GitHub user @apmmachine User + Personal Access Token
[2021-07-08T07:33:09.520Z]  > git fetch --tags --progress -- https://github.com/elastic/apm-agent-java.git +refs/heads/*:refs/remotes/origin/* # timeout=10
[2021-07-08T07:33:10.129Z]  > git config remote.origin.url https://github.com/elastic/apm-agent-java.git # timeout=10
[2021-07-08T07:33:10.132Z]  > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
[2021-07-08T07:33:10.143Z]  > git config remote.origin.url https://github.com/elastic/apm-agent-java.git # timeout=10
[2021-07-08T07:33:10.149Z] Fetching upstream changes from https://github.com/elastic/apm-agent-java.git
[2021-07-08T07:33:10.149Z] using GIT_ASKPASS to set credentials GitHub user @apmmachine User + Personal Access Token
[2021-07-08T07:33:10.150Z]  > git fetch --tags --progress -- https://github.com/elastic/apm-agent-java.git +refs/pull/1815/head:refs/remotes/origin/PR-1815 +refs/heads/master:refs/remotes/origin/master # timeout=10
[2021-07-08T07:33:10.622Z] Checking out Revision 1dcde39e03cdf3ad6c68e491130745a776836c4e (origin/PR-1815)
[2021-07-08T07:33:10.816Z] Commit message: "Merge branch 'master' into fix-1814"
[2021-07-08T07:33:10.616Z]  > git rev-parse origin/PR-1815^{commit} # timeout=10
[2021-07-08T07:33:10.623Z]  > git config core.sparsecheckout # timeout=10
[2021-07-08T07:33:10.629Z]  > git checkout -f 1dcde39e03cdf3ad6c68e491130745a776836c4e # timeout=10
[2021-07-08T07:33:11.509Z] Masking supported pattern matches of $GIT_USERNAME or $GIT_PASSWORD
[2021-07-08T07:33:11.963Z] + git fetch https://****:****@github.com/elastic/apm-agent-java.git +refs/pull/*/head:refs/remotes/origin/pr/*
[2021-07-08T07:33:12.958Z] Running in /var/lib/jenkins/workspace/_java_apm-agent-java-mbp_PR-1815/src/github.com/elastic/apm-agent-java/.git
[2021-07-08T07:33:13.022Z] Archiving artifacts
[2021-07-08T07:33:13.674Z] + git rev-parse HEAD
[2021-07-08T07:33:14.007Z] + git rev-parse HEAD
[2021-07-08T07:33:14.325Z] + git rev-parse origin/pr/1815
[2021-07-08T07:33:14.380Z] [INFO] githubEnv: Found Git Build Cause: pr
[2021-07-08T07:33:14.637Z] Masking supported pattern matches of $GITHUB_TOKEN
[2021-07-08T07:33:15.615Z] [WARN] githubApiCall: The REST API call https://api.github.com/repos/elastic/apm-agent-java/pulls/1815/reviews return 0 elements
[2021-07-08T07:33:15.653Z] [INFO] githubPrCheckApproved: Title: Basic support for remote EJB invocations on a WildFly application server - User: tobiasstadler - Author Association: CONTRIBUTOR
[2021-07-08T07:33:15.923Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet
[2021-07-08T07:33:15.923Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permissions can do so.)
[2021-07-08T07:33:15.960Z] [INFO] Let's stop build #54. The PR is not allowed to run in the CI yet
[2021-07-08T07:33:15.977Z] Sleeping for 5 sec
[2021-07-08T07:33:17.086Z] Stage "Build" skipped due to earlier failure(s)
[2021-07-08T07:33:17.188Z] Stage "Tests" skipped due to earlier failure(s)
[2021-07-08T07:33:17.246Z] Stage "Unit Tests" skipped due to earlier failure(s)
[2021-07-08T07:33:17.248Z] Stage "Smoke Tests 01" skipped due to earlier failure(s)
[2021-07-08T07:33:17.249Z] Stage "Smoke Tests 02" skipped due to earlier failure(s)
[2021-07-08T07:33:17.249Z] Stage "Benchmarks" skipped due to earlier failure(s)
[2021-07-08T07:33:17.250Z] Stage "Javadoc" skipped due to earlier failure(s)
[2021-07-08T07:33:17.321Z] Failed in branch Unit Tests
[2021-07-08T07:33:17.322Z] Failed in branch Smoke Tests 01
[2021-07-08T07:33:17.323Z] Failed in branch Smoke Tests 02
[2021-07-08T07:33:17.323Z] Failed in branch Benchmarks
[2021-07-08T07:33:17.324Z] Failed in branch Javadoc
[2021-07-08T07:33:17.388Z] Stage "Integration Tests" skipped due to earlier failure(s)
[2021-07-08T07:33:17.429Z] Stage "Stable" skipped due to earlier failure(s)
[2021-07-08T07:33:17.473Z] Stage "AfterRelease" skipped due to earlier failure(s)
[2021-07-08T07:33:17.495Z] Stage "AfterRelease" skipped due to earlier failure(s)
[2021-07-08T07:33:17.821Z] Running on Jenkins in /var/lib/jenkins/workspace/_java_apm-agent-java-mbp_PR-1815
[2021-07-08T07:33:18.079Z] [INFO] getVaultSecret: Getting secrets
[2021-07-08T07:33:18.125Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-07-08T07:33:18.887Z] + chmod 755 generate-build-data.sh
[2021-07-08T07:33:18.888Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/apm-agent-java-mbp/PR-1815/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/apm-agent-java-mbp/PR-1815/runs/54 ABORTED 178618
[2021-07-08T07:33:18.888Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/apm-agent-java-mbp/PR-1815/runs/54/steps/?limit=10000 -o steps-info.json
[2021-07-08T07:33:18.888Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-java/apm-agent-java-mbp/PR-1815/runs/54/tests/?status=FAILED -o tests-errors.json
[2021-07-08T07:33:19.138Z] Retry 1/3 exited 22, retrying in 1 seconds...
[2021-07-08T07:33:20.049Z] Retry 2/3 exited 22, retrying in 2 seconds...

@tobiasstadler
Copy link
Contributor Author

Can somebody please do a review?

@tobiasstadler
Copy link
Contributor Author

@SylvainJuge May you could have a look please?

@tobiasstadler
Copy link
Contributor Author

@felixbarny Maybe you could have a look please?

@SylvainJuge
Copy link
Member

Hi @tobiasstadler ,

Supporting EJBs is not in our short-term roadmap for now, thus we don´t think that it would be beneficial to just add partial support for a single server implementation. From experience instrumenting EJBs is full of caveats and corner cases, thus it's definitely a huge development effort to commit to this task.

Few things on top of my mind:

  • EJB2 and EJB3 support
  • EJBs over RMI : context propagation is definitely tricky and might depend on the wire protocol
  • plenty of application servers implementations to test : Jboss, Wildfly, Websphere, Weblogic, ...

However, since it already works for your use-case, it would be probably a very good candidate for an external plugin, which means it won't be part of the agent main codebase, but could be loaded at runtime to enable it on your setup.
There are a few things to consider here:

  • modifications required into the core part of the agent would still be required (there are a few of them)
  • building an external plugin is not yet well documented, but we have an example in integration-tests/external-plugin-test

What do you think about this ?

@tobiasstadler
Copy link
Contributor Author

I am totally fine with building an external plugin (actually I already did this for something else). The only problem is that I need to instrument org.jboss.as.ejb3.remote.AssociationImpl. This is currently not possible because org.jboss.as is excluded in classes_excluded_from_instrumentation_default (Of course I could change the setting, but this negatively affects maintainability and performance). I implemented CustomElementMatchers# anyMatchExcept as workaround. Should I create another PR with this change only?

@tobiasstadler
Copy link
Contributor Author

@SylvainJuge I converted my code to an external plugin locally and it seems to work except that I can not set the framework name using the public api (not so important). Also I am unsure if span.setDestinationService/setDestinationAddress is equivalent to span.getContext().getDestination(). withAddress/withPort/withResource/withName

@SylvainJuge
Copy link
Member

Thanks !

FYI I'll be off for a couple of weeks, thus I'll likely handle that when I get back, or @eyalkoren might also take a look at it (but no guarantee).

@tobiasstadler
Copy link
Contributor Author

I will create an external Plugin.

Thank you for your support!

@tobiasstadler
Copy link
Contributor Author

FYI, you can find the plugin here: https://github.com/tobiasstadler/apm-wildfly-ejb-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for remote EJB invocation on WildFly
3 participants