Skip to content

Support loading Python agent through sw-python CLI #156

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

Merged
merged 13 commits into from
Aug 25, 2021

Conversation

Superskyyy
Copy link
Member

@Superskyyy Superskyyy commented Aug 23, 2021

This PR adds functionality of non-intrusive integration CLI for the Python agent.

Though the code is completed, as a dangerous feature that modifies Python bootstrap I will need to test it a bit more before it's ready for review.

closes apache/skywalking#7381

@Superskyyy Superskyyy changed the title Non intrusive bootstrap [WIP] Support loading Python agent through sw-python CLI Aug 23, 2021
@kezhenxu94 kezhenxu94 added core feature New feature labels Aug 23, 2021
@kezhenxu94 kezhenxu94 added this to the 0.7.0 milestone Aug 23, 2021
Signed-off-by: YihaoChen <[email protected]>
@kezhenxu94
Copy link
Member

Looking at the docs just makes me feel exciting about this new feature that I've been planning for so long, and I believe this feature will be the last piece before our 1.0 GA. Look forward to this feature and our 1.0 GA version, soon!

@kezhenxu94
Copy link
Member

Let me review and try this new CLI tomorrow 🤩

@Superskyyy
Copy link
Member Author

Looking at the docs just makes me feel exciting about this new feature that I've been planning for so long, and I believe this feature will be the last piece before our 1.0 GA. Look forward to this feature and our 1.0 GA version, soon!

That's what I thought! This feature will ease a lot of work in deployment.

Let me review and try this new CLI tomorrow 🤩

I also need to run it more in a Linux env tmr, I'm struggling with my WSL and Windows doesn't communicate to each other properly over localhost... So my local test coverage is quite limited for now (not able to deploy gunicorn on windows etc.).

After I verify most cases, I could use some help testing this CLI on different OS and shells and see if it breaks for some corner cases.

@wu-sheng
Copy link
Member

Use GHA to verify running in various env.

Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

Hi @Superskyyy , I just test (on MacOS) and review the codes, and left some comments.

Since you did a lot of test cases, it would be perfect if you can add those cases into our test matrix in GitHub Actions, if you find any trouble in adding that, ping me at anytime, I can offer my help!

The currently supported method is to provide the environment variables listed
in [EnvVars Doc](EnvVars.md) as instructed in the [README](../README.md).

#### Through a sw-config.yaml
Copy link
Member

Choose a reason for hiding this comment

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

One thing we should note when implementing this is that we've been trying to minimize our dependencies as an agent, so we'd better choose a reasonable file format that Python built-in libs can parse, instead of bringing another library, to avoid version conflicts with user applications, yaml is a common case where users may already use and we should not require dependency upgrade or downgrade.

Fix error not raised in runner.

Signed-off-by: YihaoChen <[email protected]>
@Superskyyy
Copy link
Member Author

Hi @Superskyyy , I just test (on MacOS) and review the codes, and left some comments.

Since you did a lot of test cases, it would be perfect if you can add those cases into our test matrix in GitHub Actions, if you find any trouble in adding that, ping me at anytime, I can offer my help!

I'm actually thinking what if I change/ duplicate our existing plugin unit tests to use the sw-python command in docker-compose command, instead of calling agent in those consumer providers, that should work.

Idk if we need to keep the old tests that directly call agent.start(), just that having two versions doing essentially the same thing will double the GHA running time, which seems awfully long.

@kezhenxu94
Copy link
Member

kezhenxu94 commented Aug 24, 2021

I'm actually thinking what if I change/ duplicate our existing plugin unit tests to use the sw-python command in docker-compose command, instead of calling agent in those consumer providers, that should work.

Idk if we need to keep the old tests that directly call agent.start(), just that having two versions doing essentially the same thing will double the GHA running time, which seems awfully long.

What I think is to replace all existing tests with the sw-python as we will recommend users to adopt the later method after it gets merged, we don't need to duplicate the tests.

@kezhenxu94
Copy link
Member

I'm actually thinking what if I change/ duplicate our existing plugin unit tests to use the sw-python command in docker-compose command, instead of calling agent in those consumer providers, that should work.
Idk if we need to keep the old tests that directly call agent.start(), just that having two versions doing essentially the same thing will double the GHA running time, which seems awfully long.

What I think is to replace all existing tests with the sw-python as we will recommend users to adapt the later method after it gets merged, we don't need to duplicate the tests.

That could be done in following pull requests though.

Superskyyy and others added 6 commits August 24, 2021 13:44
Co-authored-by: kezhenxu94 <[email protected]>
Adopt suggested doc changes.

Co-authored-by: kezhenxu94 <[email protected]>
Fix missing punctuation.

Signed-off-by: YihaoChen <[email protected]>
Remove the version number for CLI now.

Signed-off-by: YihaoChen <[email protected]>
@Superskyyy Superskyyy marked this pull request as ready for review August 25, 2021 07:53
@kezhenxu94 kezhenxu94 changed the title [WIP] Support loading Python agent through sw-python CLI Support loading Python agent through sw-python CLI Aug 25, 2021
Signed-off-by: YihaoChen <[email protected]>
Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

Thank you @Superskyyy very much for doing this!! 🎉

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

Successfully merging this pull request may close these issues.

[Python] provide a wrapper script to initiate the Python agent without code changes in user app
3 participants