SkyWalking Tracing

The SkyWalking tracing sandbox demonstrates Envoy’s request tracing capabilities using SkyWalking as the tracing provider. This sandbox is very similar to the Zipkin sandbox. All containers will be deployed inside a virtual network called envoymesh.

All incoming requests are routed via the front Envoy, which is acting as a reverse proxy sitting on the edge of the envoymesh network. Port 8000 is exposed by docker compose (see /examples/skywalking-tracing/docker-compose.yaml). Notice that all Envoys are configured to collect request traces (e.g., http_connection_manager/config/tracing setup in /examples/skywalking-tracing/front-envoy-skywalking.yaml) and setup to propagate the spans generated by the SkyWalking tracer to a SkyWalking cluster (trace driver setup in /examples/skywalking-tracing/front-envoy-skywalking.yaml).

When service1 accepts the request forwarded from front envoy, it will make an API call to service2 before returning a response.

The following documentation runs through the setup of Envoy described above.

Step 1: Install Docker

Ensure that you have a recent versions of docker and docker-compose installed.

A simple way to achieve this is via the Docker Desktop.

Step 2: Clone the Envoy repo

If you have not cloned the Envoy repo, clone it with:

git clone git@github.com:envoyproxy/envoy
git clone https://github.com/envoyproxy/envoy.git

Step 3: Build the sandbox

To build this sandbox example, and start the example apps run the following commands:

$ pwd
envoy/examples/skywalking-tracing
$ docker-compose pull
$ docker-compose up --build -d
$ docker-compose ps

            Name                              Command                State                                  Ports
--------------------------------------------------------------------------------------------------------------------------------------------------
skywalking-tracing_elasticsearch_1    /tini -- /usr/local/bin/do ... Up (healthy)   0.0.0.0:9200->9200/tcp, 9300/tcp
skywalking-tracing_front-envoy_1      /docker-entrypoint.sh /bin ... Up             10000/tcp, 0.0.0.0:8000->8000/tcp, 0.0.0.0:8001->8001/tcp
skywalking-tracing_service1_1         /bin/sh /usr/local/bin/sta ... Up             10000/tcp
skywalking-tracing_service2_1         /bin/sh /usr/local/bin/sta ... Up             10000/tcp
skywalking-tracing_skywalking-oap_1   bash docker-entrypoint.sh      Up (healthy)   0.0.0.0:11800->11800/tcp, 1234/tcp, 0.0.0.0:12800->12800/tcp
skywalking-tracing_skywalking-ui_1    bash docker-entrypoint.sh      Up             0.0.0.0:8080->8080/tcp

Step 4: Generate some load

You can now send a request to service1 via the front-envoy as follows:

$ curl -v localhost:8000/trace/1
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> GET /trace/1 HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/html; charset=utf-8
< content-length: 89
< server: envoy
< date: Sat, 10 Oct 2020 01:56:08 GMT
< x-envoy-upstream-service-time: 27
<
Hello from behind Envoy (service 1)! hostname: 1a2ba43d6d84 resolvedhostname: 172.19.0.6
* Connection #0 to host localhost left intact

You can get SkyWalking stats of front-envoy after some requests as follows:

$ curl -s localhost:8001/stats | grep tracing.skywalking
tracing.skywalking.cache_flushed: 0
tracing.skywalking.segments_dropped: 0
tracing.skywalking.segments_flushed: 0
tracing.skywalking.segments_sent: 13

Step 5: View the traces in SkyWalking UI

Point your browser to http://localhost:8080 . You should see the SkyWalking dashboard. Set the service to “front-envoy” and set the start time to a few minutes before the start of the test (step 2) and hit enter. You should see traces from the front-proxy. Click on a trace to explore the path taken by the request from front-proxy to service1 to service2, as well as the latency incurred at each hop.