Skip to content

Commit

Permalink
move docs files and modify build script (#4258)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristaZero committed Feb 12, 2020
1 parent 3dd9c35 commit b2fc668
Show file tree
Hide file tree
Showing 483 changed files with 282 additions and 289 deletions.
10 changes: 7 additions & 3 deletions docs/README.md
@@ -1,7 +1,11 @@
# ShardingSphere Documents

For generate ShardingSphere document and website only.
To build ShardingSphere website by means of [hugo](http://gohugo.io/overview/introduction/) and [hugo theme learn](https://github.com/matcornic/hugo-theme-learn).

Use [hugo](http://gohugo.io/overview/introduction/) to process markdown files and use [hugo theme learn](https://github.com/matcornic/hugo-theme-learn) as theme.
Follow the steps below to deploy ShardingSphere website,

Execute build.sh to generate website.
1. Execute `docs/build.sh` to generate `html` files at the directory of `docs/target/`.
2. Clone [incubator-shardingsphere-doc](https://github.com/apache/incubator-shardingsphere-doc.git).
3. Checkout to `asf-site` branch.
3. Overwrite `document/current` with `docs/target/document/current` and `community` with `docs/target/community`.
4. Commit changes and raise a PR for [incubator-shardingsphere-doc](https://github.com/apache/incubator-shardingsphere-doc.git).
19 changes: 4 additions & 15 deletions docs/build.sh
Expand Up @@ -2,20 +2,11 @@
cd `dirname $0`

rm -rf target
mkdir target
mkdir -p target/document

cp -rf homepage/. target

mkdir -p target/document/legacy/1.x
mkdir -p target/document/legacy/2.x
mkdir -p target/document/legacy/3.x

cp -rf document/legacy/1.x/cn target/document/legacy/1.x/cn
cp -rf document/legacy/2.x/cn target/document/legacy/2.x/cn
cp -rf document/legacy/2.x/en target/document/legacy/2.x/en
cp -rf document/legacy/3.x/* target/document/legacy/3.x/

cd document/current
cd document
hugo

find ./ -name '*.html' -exec sed -i -e 's|[[:space:]]*<option id="\([a-zA-Z]\+\)" value="|<option id="\1" value="/document/current|g' {} \;
Expand All @@ -24,14 +15,12 @@ cd public/en
sed -i -e 's/cn/en/g' index.html
cd ../..


cd ..
cd ..
mv document/current/public target/document/current
mv document/public target/document/current

mkdir target/community

cd community/
cd community
hugo

find ./ -name '*.html' -exec sed -i -e 's|[[:space:]]*<option id="\([a-zA-Z]\+\)" value="|<option id="\1" value="/community|g' {} \;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,93 +1,93 @@
+++
pre = "<b>3.3.4. </b>"
toc = true
title = "APM"
weight = 4
+++

## Background

`APM` is the abbreviation for application performance monitoring. Currently, main `APM` functions lie in the performance diagnosis of distributed systems, including chain demonstration, application topology analysis and so on.

ShardingSphere is not responsible for gathering, storing and demonstrating APM data, but sends the core information of SQL parsing and enforcement to APM to process. In other words, ShardingSphere is only responsible for generating valuable data and submitting it to relevant systems through standard protocol.
It can connect to APM systems in two ways.

The first way is to send performance tracing data by OpenTracing API. APM products facing OpenTracing protocol can all automatically connect to ShardingSphere, like SkyWalking, Zipkin and Jaeger. In this way, users only need to configure the implementation of OpenTracing protocol at the start. Its advantage is the compatibility of all the products compatible of OpenTracing protocol, such as the APM demonstration system. If companies intend to implement their own APM systems, they only need to implement the OpenTracing protocol, and they can automatically show the chain tracing information of ShardingSphere. Its disadvantage is that OpenTracing protocol is not stable in its development, has only a few new versions, and is too neutral to support customized products as native ones do.

The second way is to use SkyWalking's automatic monitor agent. Cooperating with [SkyWalking](https://skywalking.apache.org/) team, ShardingSphere team has realized `ShardingSphere` automatic monitor agent to automatically send application performance data to `SkyWalking`.

## Usage

### Use OpenTracing

* Method 1: inject Tracer provided by APM system through reading system parameters

Add startup arguments

```
-Dorg.apache.shardingsphere.opentracing.tracer.class=org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer
```

Call initialization method

```java
ShardingTracer.init();
```

```
ShardingTracer.init();
```

* Method 2: inject Tracer provided by APM through parameter

```java
ShardingTracer.init(new SkywalkingTracer());
```

*Notice: when using SkyWalking OpenTracing agent, you should disable the former ShardingSphere agent plug-in to avoid the conflict between them.*

### Use SkyWalking's Automatic Agent

Please refer to [SkyWalking Manual](https://github.com/apache/skywalking/blob/5.x/docs/en/Quick-start.md).

## Result Demonstration

No matter in which way, it is convenient to demonstrate APM information in the connected system. Take SkyWalking for example:

### Application Architecture

Use `Sharding-Proxy` to visit two databases, `192.168.0.1:3306` and `192.168.0.2:3306`, and there are two tables in each one of them.

### Topology

![The topology diagram](https://shardingsphere.apache.org/document/current/img/apm/5x_topology.png)

It can be seen from the picture that the user has accessed Sharding-Proxy 18 times, with each database twice each time. It is because two tables in each database are accessed each time, so there are totally four tables accessed each time.

### Tracking Data

![The tracking diagram](https://shardingsphere.apache.org/document/current/img/apm/5x_trace.png)

SQL parsing and implementation can be seen from the tracing diagram.

`/Sharding-Sphere/parseSQL/` indicates the SQL parsing performance this time.

![The parsing node](https://shardingsphere.apache.org/document/current/img/apm/5x_parse.png)

`/Sharding-Sphere/executeSQL/` indicates the SQL parsing performance in actual execution.

![The actual access node](https://shardingsphere.apache.org/document/current/img/apm/5x_executeSQL.png)

### Exception

![Exception tracking diagram](https://shardingsphere.apache.org/document/current/img/apm/5x_trace_err.png)

Exception nodes can be seen from the tracing diagram.

`/Sharding-Sphere/executeSQL/` indicates the exception results of SQL.

![Exception node](https://shardingsphere.apache.org/document/current/img/apm/5x_executeSQL_Tags_err.png)

`/Sharding-Sphere/executeSQL/` indicates the exception log of SQL execution.

![Exception log](https://shardingsphere.apache.org/document/current/img/apm/5x_executeSQL_Logs_err.png)
+++
pre = "<b>3.3.4. </b>"
toc = true
title = "APM"
weight = 4
+++

## Background

`APM` is the abbreviation for application performance monitoring. Currently, main `APM` functions lie in the performance diagnosis of distributed systems, including chain demonstration, application topology analysis and so on.

ShardingSphere is not responsible for gathering, storing and demonstrating APM data, but sends the core information of SQL parsing and enforcement to APM to process. In other words, ShardingSphere is only responsible for generating valuable data and submitting it to relevant systems through standard protocol.
It can connect to APM systems in two ways.

The first way is to send performance tracing data by OpenTracing API. APM products facing OpenTracing protocol can all automatically connect to ShardingSphere, like SkyWalking, Zipkin and Jaeger. In this way, users only need to configure the implementation of OpenTracing protocol at the start. Its advantage is the compatibility of all the products compatible of OpenTracing protocol, such as the APM demonstration system. If companies intend to implement their own APM systems, they only need to implement the OpenTracing protocol, and they can automatically show the chain tracing information of ShardingSphere. Its disadvantage is that OpenTracing protocol is not stable in its development, has only a few new versions, and is too neutral to support customized products as native ones do.

The second way is to use SkyWalking's automatic monitor agent. Cooperating with [SkyWalking](https://skywalking.apache.org/) team, ShardingSphere team has realized `ShardingSphere` automatic monitor agent to automatically send application performance data to `SkyWalking`.

## Usage

### Use OpenTracing

* Method 1: inject Tracer provided by APM system through reading system parameters

Add startup arguments

```
-Dorg.apache.shardingsphere.opentracing.tracer.class=org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer
```

Call initialization method

```java
ShardingTracer.init();
```

```
ShardingTracer.init();
```

* Method 2: inject Tracer provided by APM through parameter

```java
ShardingTracer.init(new SkywalkingTracer());
```

*Notice: when using SkyWalking OpenTracing agent, you should disable the former ShardingSphere agent plug-in to avoid the conflict between them.*

### Use SkyWalking's Automatic Agent

Please refer to [SkyWalking Manual](https://github.com/apache/skywalking/blob/5.x/docs/en/Quick-start.md).

## Result Demonstration

No matter in which way, it is convenient to demonstrate APM information in the connected system. Take SkyWalking for example:

### Application Architecture

Use `Sharding-Proxy` to visit two databases, `192.168.0.1:3306` and `192.168.0.2:3306`, and there are two tables in each one of them.

### Topology

![The topology diagram](https://shardingsphere.apache.org/document/current/img/apm/5x_topology.png)

It can be seen from the picture that the user has accessed Sharding-Proxy 18 times, with each database twice each time. It is because two tables in each database are accessed each time, so there are totally four tables accessed each time.

### Tracking Data

![The tracking diagram](https://shardingsphere.apache.org/document/current/img/apm/5x_trace.png)

SQL parsing and implementation can be seen from the tracing diagram.

`/Sharding-Sphere/parseSQL/` indicates the SQL parsing performance this time.

![The parsing node](https://shardingsphere.apache.org/document/current/img/apm/5x_parse.png)

`/Sharding-Sphere/executeSQL/` indicates the SQL parsing performance in actual execution.

![The actual access node](https://shardingsphere.apache.org/document/current/img/apm/5x_executeSQL.png)

### Exception

![Exception tracking diagram](https://shardingsphere.apache.org/document/current/img/apm/5x_trace_err.png)

Exception nodes can be seen from the tracing diagram.

`/Sharding-Sphere/executeSQL/` indicates the exception results of SQL.

![Exception node](https://shardingsphere.apache.org/document/current/img/apm/5x_executeSQL_Tags_err.png)

`/Sharding-Sphere/executeSQL/` indicates the exception log of SQL execution.

![Exception log](https://shardingsphere.apache.org/document/current/img/apm/5x_executeSQL_Logs_err.png)

0 comments on commit b2fc668

Please sign in to comment.