Skip to content

WIP: feat: add sanic support for elastic-apm python agent #522

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

Conversation

harshanarayana
Copy link
Contributor

@harshanarayana harshanarayana commented Jul 8, 2019

Description

This PR is a quick prototype of what it would look like when it comes to enabling the elastic APM client support for sanic.

Closes #521

To Do

  • Update Tests
  • Update Documentation
  • Add example usage

@dadoeyad
Copy link

dadoeyad commented Feb 4, 2020

Any updates on this PR? :D

@basepi
Copy link
Contributor

basepi commented Feb 4, 2020

As referenced in #521, there were some issues with blocking code potentially causing issues in sanic. As far as I can tell, most of those have been fixed. Source code collection is now in a background thread as of #607.

I think we can probably move forward on this, if @harshanarayana is willing and able. We added support for a couple of async frameworks recently as well, for reference: tornado, starlette, and aiohttp

@harshanarayana
Copy link
Contributor Author

@dadoeyad Time for me to resurrect this PR and get this one sorted. I will take some time and get this one done over the weekend.

@basepi I will take a look at the way the support has been added to the other frameworks and see how much of it can be leveraged into sanic. I will push the changes to this PR shortly

Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
@harshanarayana harshanarayana force-pushed the feat/Enable_Sanic_Support branch from 2a6a461 to 5ee5ed4 Compare February 10, 2020 09:12
@apmmachine
Copy link
Contributor

apmmachine commented Apr 28, 2020

❕ 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

Expand to view the summary

Build stats

  • Build Cause: Branch indexing

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

  • Start Time: 2021-02-26T16:27:47.729+0000

  • Duration: 3 min 52 sec

  • Commit: 5ee5ed4

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-python.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-02-26T16:30:13.827Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2021-02-26T16:30:13.832Z]  > git merge 97603d1ceb3c2219c47479167ad82634acffadc9 # timeout=10
[2021-02-26T16:30:13.987Z]  > git rev-parse HEAD^{commit} # timeout=10
[2021-02-26T16:30:13.999Z]  > git config core.sparsecheckout # timeout=10
[2021-02-26T16:30:14.008Z]  > git checkout -f fd6b4046ceb64bd9c99cf4dbc109deea6178c967 # timeout=15
[2021-02-26T16:30:17.667Z] Commit message: "Merge commit '97603d1ceb3c2219c47479167ad82634acffadc9' into HEAD"
[2021-02-26T16:30:17.686Z] First time build. Skipping changelog.
[2021-02-26T16:30:17.686Z] Cleaning workspace
[2021-02-26T16:30:17.672Z]  > git rev-list --no-walk 7e36616bd8e37dfd7866b931ee1c8d3b7026437e # timeout=10
[2021-02-26T16:30:17.690Z]  > git rev-parse --verify HEAD # timeout=10
[2021-02-26T16:30:17.696Z] Resetting working tree
[2021-02-26T16:30:17.696Z]  > git reset --hard # timeout=10
[2021-02-26T16:30:17.708Z]  > git clean -fdx # timeout=10
[2021-02-26T16:30:18.754Z] Masking supported pattern matches of $JOB_GCS_BUCKET or $NOTIFY_TO
[2021-02-26T16:30:18.801Z] The timestamps step is unnecessary when timestamps are enabled for all Pipeline builds.
[2021-02-26T16:30:18.866Z] Timeout set to expire in 1 hr 0 min
[2021-02-26T16:30:19.009Z] [INFO] Number of builds to be searched 10
[2021-02-26T16:30:19.175Z] [INFO] 'shallow' is forced to be disabled when running on PullRequests
[2021-02-26T16:30:19.194Z] Running in /var/lib/jenkins/workspace/thon_apm-agent-python-mbp_PR-522/src/github.com/elastic/apm-agent-python
[2021-02-26T16:30:19.216Z] [INFO] gitCheckout: Checkout SCM PR-522 with default customisation from the Item.
[2021-02-26T16:30:19.244Z] [INFO] Override default checkout
[2021-02-26T16:30:19.289Z] Sleeping for 10 sec
[2021-02-26T16:30:29.309Z] The recommended git tool is: git
[2021-02-26T16:30:29.441Z] using credential f6c7695a-671e-4f4f-a331-acdce44ff9ba
[2021-02-26T16:30:29.456Z] Wiping out workspace first.
[2021-02-26T16:30:29.468Z] Cloning the remote Git repository
[2021-02-26T16:30:29.468Z] Using shallow clone with depth 3
[2021-02-26T16:30:29.468Z] Avoid fetching tags
[2021-02-26T16:30:29.488Z] Cloning repository git@github.com:elastic/apm-agent-python.git
[2021-02-26T16:30:29.523Z]  > git init /var/lib/jenkins/workspace/thon_apm-agent-python-mbp_PR-522/src/github.com/elastic/apm-agent-python # timeout=10
[2021-02-26T16:30:29.539Z] Fetching upstream changes from git@github.com:elastic/apm-agent-python.git
[2021-02-26T16:30:29.540Z]  > git --version # timeout=10
[2021-02-26T16:30:29.549Z]  > git --version # 'git version 2.17.1'
[2021-02-26T16:30:29.549Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2021-02-26T16:30:29.555Z]  > git fetch --no-tags --progress -- git@github.com:elastic/apm-agent-python.git +refs/heads/*:refs/remotes/origin/* # timeout=15
[2021-02-26T16:30:30.837Z] Cleaning workspace
[2021-02-26T16:30:30.899Z] Using shallow fetch with depth 3
[2021-02-26T16:30:30.899Z] Pruning obsolete local branches
[2021-02-26T16:30:30.802Z]  > git config remote.origin.url git@github.com:elastic/apm-agent-python.git # timeout=10
[2021-02-26T16:30:30.808Z]  > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
[2021-02-26T16:30:30.819Z]  > git config remote.origin.url git@github.com:elastic/apm-agent-python.git # timeout=10
[2021-02-26T16:30:30.841Z]  > git rev-parse --verify HEAD # timeout=10
[2021-02-26T16:30:30.861Z] No valid HEAD. Skipping the resetting
[2021-02-26T16:30:30.862Z]  > git clean -fdx # timeout=10
[2021-02-26T16:30:30.903Z] Fetching upstream changes from git@github.com:elastic/apm-agent-python.git
[2021-02-26T16:30:30.903Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2021-02-26T16:30:30.918Z]  > git fetch --no-tags --progress --prune -- git@github.com:elastic/apm-agent-python.git +refs/pull/522/head:refs/remotes/origin/PR-522 +refs/heads/master:refs/remotes/origin/master # timeout=15
[2021-02-26T16:30:31.552Z] Merging remotes/origin/master commit 97603d1ceb3c2219c47479167ad82634acffadc9 into PR head commit 5ee5ed418b93af88c1d2da5d088ef3c52f027bba
[2021-02-26T16:30:31.768Z] Merge succeeded, producing 3c36e8378abc0bf49600e3dd388930f31e3910c2
[2021-02-26T16:30:31.768Z] Checking out Revision 3c36e8378abc0bf49600e3dd388930f31e3910c2 (PR-522)
[2021-02-26T16:30:31.822Z] Commit message: "Merge commit '97603d1ceb3c2219c47479167ad82634acffadc9' into HEAD"
[2021-02-26T16:30:31.833Z] First time build. Skipping changelog.
[2021-02-26T16:30:31.833Z] Cleaning workspace
[2021-02-26T16:30:31.556Z]  > git config core.sparsecheckout # timeout=10
[2021-02-26T16:30:31.561Z]  > git checkout -f 5ee5ed418b93af88c1d2da5d088ef3c52f027bba # timeout=15
[2021-02-26T16:30:31.619Z]  > git remote # timeout=10
[2021-02-26T16:30:31.624Z]  > git config --get remote.origin.url # timeout=10
[2021-02-26T16:30:31.628Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2021-02-26T16:30:31.635Z]  > git merge 97603d1ceb3c2219c47479167ad82634acffadc9 # timeout=10
[2021-02-26T16:30:31.759Z]  > git rev-parse HEAD^{commit} # timeout=10
[2021-02-26T16:30:31.772Z]  > git config core.sparsecheckout # timeout=10
[2021-02-26T16:30:31.777Z]  > git checkout -f 3c36e8378abc0bf49600e3dd388930f31e3910c2 # timeout=15
[2021-02-26T16:30:31.827Z]  > git rev-list --no-walk 7e36616bd8e37dfd7866b931ee1c8d3b7026437e # timeout=10
[2021-02-26T16:30:31.836Z]  > git rev-parse --verify HEAD # timeout=10
[2021-02-26T16:30:31.844Z] Resetting working tree
[2021-02-26T16:30:31.844Z]  > git reset --hard # timeout=10
[2021-02-26T16:30:31.877Z]  > git clean -fdx # timeout=10
[2021-02-26T16:30:33.049Z] Masking supported pattern matches of $GIT_USERNAME or $GIT_PASSWORD
[2021-02-26T16:30:33.637Z] + git fetch https://****:****@github.com/elastic/apm-agent-python.git +refs/pull/*/head:refs/remotes/origin/pr/*
[2021-02-26T16:30:35.080Z] Running in /var/lib/jenkins/workspace/thon_apm-agent-python-mbp_PR-522/src/github.com/elastic/apm-agent-python/.git
[2021-02-26T16:30:35.135Z] Archiving artifacts
[2021-02-26T16:30:35.792Z] + git rev-parse HEAD
[2021-02-26T16:30:36.121Z] + git rev-parse HEAD
[2021-02-26T16:30:36.434Z] + git rev-parse origin/pr/522
[2021-02-26T16:30:36.478Z] [INFO] githubEnv: Found Git Build Cause: pr
[2021-02-26T16:30:36.777Z] Masking supported pattern matches of $GITHUB_TOKEN
[2021-02-26T16:30:37.379Z] [WARN] githubApiCall: The REST API call https://api.github.com/repos/elastic/apm-agent-python/pulls/522/reviews return 0 elements
[2021-02-26T16:30:37.412Z] [INFO] githubPrCheckApproved: Title: WIP: feat: add sanic support for elastic-apm python agent - User: harshanarayana - Author Association: FIRST_TIME_CONTRIBUTOR
[2021-02-26T16:30:37.625Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet
[2021-02-26T16:30:37.625Z] ERROR: githubPrCheckApproved: The PR is not allowed to run in the CI yet. (Only users with write permissions can do so.)
[2021-02-26T16:30:37.655Z] [INFO] Let's stop build #201. The PR is not allowed to run in the CI yet
[2021-02-26T16:30:37.669Z] Sleeping for 5 sec
[2021-02-26T16:30:38.656Z] Stage "Sanity checks" skipped due to earlier failure(s)
[2021-02-26T16:30:38.690Z] Stage "Test" skipped due to earlier failure(s)
[2021-02-26T16:30:38.722Z] Stage "Building packages" skipped due to earlier failure(s)
[2021-02-26T16:30:38.754Z] Stage "Integration Tests" skipped due to earlier failure(s)
[2021-02-26T16:30:38.787Z] Stage "Benchmarks" skipped due to earlier failure(s)
[2021-02-26T16:30:38.859Z] Stage "Prepare Release" skipped due to earlier failure(s)
[2021-02-26T16:30:38.875Z] Stage "Prepare Release" skipped due to earlier failure(s)
[2021-02-26T16:30:38.909Z] Stage "Prepare Release" skipped due to earlier failure(s)
[2021-02-26T16:30:38.943Z] Stage "Prepare Release" skipped due to earlier failure(s)
[2021-02-26T16:30:39.185Z] Running on Jenkins in /var/lib/jenkins/workspace/thon_apm-agent-python-mbp_PR-522
[2021-02-26T16:30:39.273Z] [INFO] getVaultSecret: Getting secrets
[2021-02-26T16:30:39.560Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-02-26T16:30:40.249Z] + chmod 755 generate-build-data.sh
[2021-02-26T16:30:40.249Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-python/apm-agent-python-mbp/PR-522/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-python/apm-agent-python-mbp/PR-522/runs/201 ABORTED 172260
[2021-02-26T16:30:40.500Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-python/apm-agent-python-mbp/PR-522/runs/201/steps/?limit=10000 -o steps-info.json
[2021-02-26T16:30:41.050Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-python/apm-agent-python-mbp/PR-522/runs/201/tests/?status=FAILED -o tests-errors.json
[2021-02-26T16:30:41.050Z] Retry 1/3 exited 22, retrying in 1 seconds...
[2021-02-26T16:30:41.961Z] Retry 2/3 exited 22, retrying in 2 seconds...

@ajay1mg
Copy link

ajay1mg commented Nov 5, 2020

Is there any development on this? Any plans on adding native support for Sanic. This framework also is getting some serious attention

@alexcc4
Copy link

alexcc4 commented Jul 9, 2021

Is there any development on this?

@basepi
Copy link
Contributor

basepi commented Jul 12, 2021

@alexcc4 The latest version is in #1056 -- I think it's close to being finished.

@alexcc4
Copy link

alexcc4 commented Jul 13, 2021

awesome!

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

Successfully merging this pull request may close these issues.

Proposal: Enable support for Sanic
7 participants