-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracer: Add SkyWalking tracer (#13060)
This patch adds a new tracer to support the SkyWalking tracing mechanism and format. Risk Level: Low, a new extension. Testing: Unit Docs Changes: Added Release Notes: Added Signed-off-by: wbpcode <[email protected]>
- Loading branch information
Showing
47 changed files
with
3,582 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.config.trace.v3; | ||
|
||
import "envoy/config/core/v3/grpc_service.proto"; | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
|
||
import "udpa/annotations/migrate.proto"; | ||
import "udpa/annotations/sensitive.proto"; | ||
import "udpa/annotations/status.proto"; | ||
import "udpa/annotations/versioning.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.config.trace.v3"; | ||
option java_outer_classname = "SkywalkingProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_migrate).move_to_package = | ||
"envoy.extensions.tracers.skywalking.v4alpha"; | ||
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
||
// [#protodoc-title: SkyWalking tracer] | ||
|
||
// Configuration for the SkyWalking tracer. Please note that if SkyWalking tracer is used as the | ||
// provider of http tracer, then | ||
// :ref:`start_child_span <envoy_v3_api_field_extensions.filters.http.router.v3.Router.start_child_span>` | ||
// in the router must be set to true to get the correct topology and tracing data. Moreover, SkyWalking | ||
// Tracer does not support SkyWalking extension header (``sw8-x``) temporarily. | ||
// [#extension: envoy.tracers.skywalking] | ||
message SkyWalkingConfig { | ||
// SkyWalking collector service. | ||
core.v3.GrpcService grpc_service = 1 [(validate.rules).message = {required: true}]; | ||
|
||
ClientConfig client_config = 2; | ||
} | ||
|
||
// Client config for SkyWalking tracer. | ||
message ClientConfig { | ||
// Service name for SkyWalking tracer. If this field is empty, then local service cluster name | ||
// that configured by :ref:`Bootstrap node <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.node>` | ||
// message's :ref:`cluster <envoy_v3_api_field_config.core.v3.Node.cluster>` field or command line | ||
// option :option:`--service-cluster` will be used. If both this field and local service cluster | ||
// name are empty, ``EnvoyProxy`` is used as the service name by default. | ||
string service_name = 1; | ||
|
||
// Service instance name for SkyWalking tracer. If this field is empty, then local service node | ||
// that configured by :ref:`Bootstrap node <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.node>` | ||
// message's :ref:`id <envoy_v3_api_field_config.core.v3.Node.id>` field or command line option | ||
// :option:`--service-node` will be used. If both this field and local service node are empty, | ||
// ``EnvoyProxy`` is used as the instance name by default. | ||
string instance_name = 2; | ||
|
||
// Authentication token config for SkyWalking. SkyWalking can use token authentication to secure | ||
// that monitoring application data can be trusted. In current version, Token is considered as a | ||
// simple string. | ||
// [#comment:TODO(wbpcode): Get backend token through the SDS API.] | ||
oneof backend_token_specifier { | ||
// Inline authentication token string. | ||
string backend_token = 3 [(udpa.annotations.sensitive) = true]; | ||
} | ||
|
||
// Envoy caches the segment in memory when the SkyWalking backend service is temporarily unavailable. | ||
// This field specifies the maximum number of segments that can be cached. If not specified, the | ||
// default is 1024. | ||
google.protobuf.UInt32Value max_cache_size = 4; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
api/envoy/extensions/tracers/skywalking/v4alpha/skywalking.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ features. The following sandboxes are available: | |
redis | ||
wasm-cc | ||
zipkin_tracing | ||
skywalking_tracing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
.. _install_sandboxes_skywalking_tracing: | ||
|
||
SkyWalking Tracing | ||
================== | ||
|
||
The SkyWalking tracing sandbox demonstrates Envoy's :ref:`request tracing <arch_overview_tracing>` | ||
capabilities using `SkyWalking <http://skywalking.apache.org>`_ 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 :repo:`/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 | ||
:repo:`/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 :repo:`/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. | ||
|
||
.. include:: _include/docker-env-setup.rst | ||
|
||
Step 3: Build the sandbox | ||
************************* | ||
|
||
To build this sandbox example, and start the example apps run the following commands: | ||
|
||
.. code-block:: console | ||
$ 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: | ||
|
||
.. code-block:: console | ||
$ 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: | ||
|
||
.. code-block:: console | ||
$ 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM envoyproxy/envoy-dev:latest | ||
|
||
RUN apt-get update && apt-get -q install -y \ | ||
curl | ||
COPY ./front-envoy-skywalking.yaml /etc/front-envoy.yaml | ||
RUN chmod go+r /etc/front-envoy.yaml | ||
CMD /usr/local/bin/envoy -c /etc/front-envoy.yaml --service-cluster front-proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
To learn about this sandbox and for instructions on how to run it please head over | ||
to the [envoy docs](https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/skywalking_tracing) |
Oops, something went wrong.