Skip to content

Commit a6d351e

Browse files
authored
Refactor current Python agent docs to serve on SkyWalking official website (#162)
1 parent 91c315b commit a6d351e

20 files changed

+376
-113
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Be sure to include a **title and clear description**, as much relevant informati
2222

2323
## Compiling and building
2424

25-
Check [here](docs/FAQ.md#q-how-to-build-from-sources).
25+
Check [here](docs/en/setup/faq/How-to-build-from-sources.md).
2626

2727
## Add a new feature or enhance an existing one
2828

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ pip install apache-skywalking==0.1.0 # For example, install version 0.1.0 no ma
3939
SkyWalking Python agent provides convenient dockerfile and images for easy integration utilizing its auto-bootstrap
4040
capability. You can build your Python application image based on our agent-enabled Python images and start
4141
your applications with SkyWalking agent enabled for you. Please refer to our
42-
[dockerfile guide](docker/README.md) for further instructions on building and configurations.
42+
[dockerfile guide](docs/en/setup/Container.md) for further instructions on building and configurations.
4343

4444
### From Source Codes
4545

46-
Refer to the [FAQ](docs/FAQ.md#q-how-to-build-from-sources).
46+
Refer to the [FAQ](docs/en/setup/faq/How-to-build-from-sources.md).
4747

4848
## Set up Python Agent
4949

5050
SkyWalking Python SDK requires SkyWalking 8.0+ and Python 3.5+.
5151

52-
> If you want to try out the latest features that are not released yet, please refer to [the guide](docs/FAQ.md#q-how-to-build-from-sources) to build from sources.
52+
> If you want to try out the latest features that are not released yet, please refer to [the guide](docs/en/setup/faq/How-to-build-from-sources.md) to build from sources.
5353
5454
By default, SkyWalking Python agent uses gRPC protocol to report data to SkyWalking backend,
5555
in SkyWalking backend, the port of gRPC protocol is `11800`, and the port of HTTP protocol is `12800`,
@@ -62,7 +62,7 @@ SkyWalking Python agent supports running and attaching to your awesome applicati
6262
project. The package installation comes with a new command-line script named `sw-python`, which you can use to run your Python-based
6363
applications and programs in the following manner `sw-python run python abc.py` or `sw-python run program arg0 arg1`
6464

65-
Please do read the [CLI Guide](docs/CLI.md) for a detailed introduction to this new feature before using in production.
65+
Please do read the [CLI Guide](docs/en/setup/CLI.md) for a detailed introduction to this new feature before using in production.
6666

6767
You can always fall back to our traditional way of integration as introduced below,
6868
which is by importing SkyWalking into your project and starting the agent.
@@ -112,17 +112,17 @@ agent.start()
112112

113113
Alternatively, you can also pass the configurations via environment variables (such as `SW_AGENT_NAME`, `SW_AGENT_COLLECTOR_BACKEND_SERVICES`, etc.) so that you don't need to call `config.init`.
114114

115-
All supported environment variables can be found [here](docs/EnvVars.md)
115+
All supported environment variables can be found in the [Environment Variables List](docs/en/setup/EnvVars.md)
116116

117117
## Report logs with Python Agent
118118

119119
The Python agent is capable of reporting collected logs to the backend(SkyWalking OAP), enabling Log & Trace Correlation.
120120

121-
Please refer to the [Log Reporter Doc](docs/LogReporter.md) for a detailed guide.
121+
Please refer to the [Log Reporter Doc](docs/en/setup/advanced/LogReporter.md) for a detailed guide.
122122

123123
## Supported Libraries
124124

125-
There are some built-in plugins (such as `http.server`, `Flask`, `Django` etc.) that support automatic instrumentation of Python libraries, the complete lists can be found [here](docs/Plugins.md)
125+
There are some built-in plugins (such as `http.server`, `Flask`, `Django` etc.) that support automatic instrumentation of Python libraries, the complete lists can be found [here](docs/en/setup/Plugins.md)
126126

127127
## API
128128

@@ -206,11 +206,11 @@ with context.new_entry_span(op=str('https://github.com/apache/skywalking')) as s
206206

207207
## Contributing
208208

209-
Before submitting a pull request or push a commit, please read our [contributing](CONTRIBUTING.md) and [developer guide](docs/Developer.md).
209+
Before submitting a pull request or push a commit, please read our [contributing](CONTRIBUTING.md) and [developer guide](docs/en/contribution/Developer.md).
210210

211211
## FAQs
212212

213-
Check [the FAQ page](docs/FAQ.md) or add the FAQs there.
213+
Check the FAQ page in our official documentation site or contribute FAQs to the doc folder.
214214

215215
## License
216216
Apache 2.0

docs/FAQ.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/PluginTest.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

docs/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SkyWalking Python Agent
2+
3+
**This is the official documentation of SkyWalking Python agent. Welcome to the SkyWalking community!**
4+
5+
The Python Agent for Apache SkyWalking provides the native tracing/logging abilities for Python projects.
6+
7+
This documentation covers a number of ways to set up the Python agent for various use cases.
8+
9+
[![GitHub stars](https://img.shields.io/github/stars/apache/skywalking-python.svg?style=for-the-badge&label=Stars&logo=github)](https://github.com/apache/skywalking-python)
10+
[![Twitter Follow](https://img.shields.io/twitter/follow/asfskywalking.svg?style=for-the-badge&label=Follow&logo=twitter)](https://twitter.com/AsfSkyWalking)
11+
12+
[![Build](https://github.com/apache/skywalking-python/workflows/Build/badge.svg?branch=master)](https://github.com/apache/skywalking-python/actions?query=branch%3Amaster+event%3Apush+workflow%3A%22Build%22)
13+
14+
## Contact Us
15+
16+
* Submit an [issue](https://github.com/apache/skywalking/issues/new) following the GitHub Issues template.
17+
* Mail list: **dev@skywalking.apache.org**.
18+
Mail to **dev-subscribe@skywalking.apache.org**, follow the reply to subscribe the mail list.
19+
* Join `skywalking` channel by sending a request to the mail list - dev@skywalking.apache.org, we will invite you in.
20+
* Twitter - [ASFSkyWalking](https://twitter.com/ASFSkyWalking)
21+
22+
## Contributing
23+
24+
Before submitting a pull request or push a commit, please read our [contributing](https://github.com/apache/skywalking-python/blob/master/CONTRIBUTING.md) and [developer guide](en/contribution/Developer.md).
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
## Developing a new plugin
1111

12-
You can always take [the existing plugins](../skywalking/plugins) as examples, while there are some general ideas for all plugins.
13-
1. A plugin is a module under directory [`skywalking/plugins/`](../skywalking/plugins) with an `install` method;
12+
You can always take [the existing plugins](../setup/Plugins.md) as examples, while there are some general ideas for all plugins.
13+
1. A plugin is a module under the directory `skywalking/plugins` with an `install` method;
1414
1. Inside the `install` method, you find out the relevant method(s) of the libraries that you plan to instrument, and create/close spans before/after those method(s).
1515
1. You should also provide version rules in the plugin module, which means the version of package your plugin support. You should init a dict with keys `name` and `rules`. the `name` is your plugin's corresponding package's name, the `rules` is the version rules this package should follow.
1616

@@ -27,12 +27,12 @@ You can always take [the existing plugins](../skywalking/plugins) as examples, w
2727
"rules": [">=2.0 <=2.3 !=2.2.1", ">3.0"]
2828
}
2929
```
30-
1. Every plugin requires a corresponding test under [`tests/plugin`](../tests/plugin) before it can be merged, refer to [the plugin test guide](PluginTest.md) when writing a plugin test.
31-
1. Update [the supported list](Plugins.md).
32-
1. Add the environment variables to [the list](EnvVars.md) if any.
30+
1. Every plugin requires a corresponding test under `tests/plugin` before it can be merged, refer to [the plugin test guide](PluginTest.md) when writing a plugin test.
31+
1. Update the [Supported Plugin List](../setup/Plugins.md).
32+
1. Add the environment variables to [Environment Variable list](../setup/EnvVars.md) if any.
3333

3434
## Steps after coding
3535

3636
If your PR introduces the need for a new non-standard library which needs to be pulled via pip or if it removes the need for a previously-used library:
37-
1. Execute the [`build_requirements` script](../tools/env/build_requirements_linux.sh) relevant to your OS.
37+
1. Execute the `build_requirements` script relevant to your OS.
3838
1. Double check the `requirements.txt` file in the project root to ensure that the changes have been reflected.

docs/How-to-release-docker.md renamed to docs/en/contribution/How-to-release-docker.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ This documentation shows the way to build and push the SkyWalking Python images
66

77
Before building the latest release of images, make sure an official release is pushed to PyPI where the dockerfile will depend on.
88

9-
# Images
9+
## Images
1010

1111
This process wil generate a list of images covering most used Python versions and variations(grpc/http/kafka) of the Python agent.
1212

1313
The convenience images are published to Docker Hub and available from the `skywalking.docker.scarf.sh` endpoint.
1414
- `skywalking.docker.scarf.sh/apache/skywalking-python` ([Docker Hub](https://hub.docker.com/r/apache/skywalking-python))
1515

16-
# How to build
16+
## How to build
1717

1818
Issue the following commands to build relevant docker images for the Python agent.
1919
The `make` command will generate three images(grpc, http, kafka) for each Python version supported.
@@ -34,7 +34,7 @@ export AGENT_VERSION=<version>
3434
make
3535
```
3636

37-
# How to publish images
37+
## How to publish images
3838

3939
1. After a SkyWalking Apache release for the Python agent,
4040
please compose a new script named `<version>.sh` to `docker/v` folder.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This documentation guides the release manager to release the SkyWalking Python i
55
## Prerequisites
66

77
1. Close (if finished, or move to next milestone otherwise) all issues in the current milestone from [skywalking-python](https://github.com/apache/skywalking-python/milestones) and [skywalking](https://github.com/apache/skywalking/milestones), create a new milestone if needed.
8-
2. Update [CHANGELOG.md](../CHANGELOG.md) and `version` in [setup.py](../setup.py).
8+
2. Update CHANGELOG.md and `version` in setup.py.
99

1010

1111
## Add your GPG public key to Apache svn

docs/en/contribution/PluginTest.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Plugin Test
2+
3+
Plugin tests are required and should pass before a new plugin is able to merge into the master branch.
4+
5+
## Mock Collector
6+
7+
Mock Collector respects the same protocol as the SkyWalking backend, and thus receives the report data from the agent side,
8+
besides, it also exposes some HTTP endpoints for verification.
9+
10+
## Tested Service
11+
12+
A tested service is a service involving the plugin that is to be tested, and exposes some endpoints to trigger the instrumentation
13+
and report data to the mock collector.
14+
15+
## Docker Compose
16+
17+
`docker-compose` is used to orchestrate the mock collector and the tested service(s), the `docker-compose.yml` should be
18+
able to run with `docker-compose -f docker-compose.yml up` in standalone mode, which can be used in debugging too.
19+
20+
## Expected Data
21+
22+
The `expected.data.yml` file contains the expected segment data after we have triggered the instrumentation and report to mock collector,
23+
since the mock collector received the segment data then, we can post the expected data to the mock collector and verify whether
24+
they match. This can be done through the `/dataValidate` of the mock collector, say `http://collector:12800/dataValidate`, for example.
25+
26+
## Example
27+
28+
If we want to test the plugin for the built-in library `http`, we will:
29+
30+
1. Build a tested service, which sets up an HTTP server by `http` library, and exposes an HTTP endpoint to be triggered in the test codes, say `/trigger`,
31+
take this [provider service](https://github.com/apache/skywalking-python/blob/master/tests/plugin/sw_http/services/provider.py) as example.
32+
2. Compose a `docker-compose.yml` file, orchestrating the service built in step 1 and the mock collector,
33+
take this [docker-compose.yml](https://github.com/apache/skywalking-python/blob/master/tests/plugin/sw_http/docker-compose.yml) as an example.
34+
3. Write test codes to trigger the endpoint int step 1, and send the expected data file to the mock collector to verify,
35+
take this [test](https://github.com/apache/skywalking-python/blob/master/tests/plugin/sw_http/test_http.py) as example.
36+
37+
## Notes
38+
39+
Remember to add the library/module into the `setup.py` - `extras_require/test`
40+
so that other developers can have it installed after pulling your commits, and run tests locally.

docs/CLI.md renamed to docs/en/setup/CLI.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SkyWalking Python Agent Command-Line Interface(CLI)
22

3-
In earlier releases than 0.7.0, you would at least need to add the following lines to your applications to get the agent attached and running.
3+
In releases before 0.7.0, you would at least need to add the following lines to your applications to get the agent attached and running.
44

55
```python
66
from skywalking import agent
@@ -10,11 +10,11 @@ agent.start()
1010

1111
Now the SkyWalking Python agent implements a command-line interface that can be utilized to attach the agent to your
1212
awesome applications during deployment **without changing any application code**,
13-
just like the [SkyWalking Java Agent](https://github.com/apache/skywalking).
13+
just like the [SkyWalking Java Agent](https://github.com/apache/skywalking-java).
1414

1515
## Usage
1616

17-
Upon successful [installation of the SkyWalking Python agent via pip](../README.md#install),
17+
Upon successful [installation of the SkyWalking Python agent via pip](Installation.md#from-pypi),
1818
a command-line script `sw-python` is installed in your environment(virtual env preferred).
1919

2020
### The `run` option
@@ -62,7 +62,7 @@ You would normally want to provide additional configurations other than the defa
6262
#### Through environment variables
6363

6464
The currently supported method is to provide the environment variables listed
65-
in [EnvVars Doc](EnvVars.md) as instructed in the [README](../README.md).
65+
and explained in the [Environment Variables List](EnvVars.md).
6666

6767
#### Through a sw-config.yaml
6868

0 commit comments

Comments
 (0)