Skip to content
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

tracer: Add SkyWalking tracer #13060

Merged
merged 73 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
74e0892
initial code from @dio
Sep 2, 2020
f384820
Tracer: support SkyWalking tracing report
Sep 11, 2020
b8ce5a3
add simple stats to skywalking tracer
Sep 12, 2020
f95f9dd
add more test for skywalking
Sep 14, 2020
f44d946
Merge branch 'master' of github.com:envoyproxy/envoy into skywalking
Sep 14, 2020
bf033d8
fix http tracer impl test
Sep 14, 2020
348387e
fix clang tidy check
Sep 16, 2020
d689a88
use authentication as token key
Sep 16, 2020
3dcb800
peer address looks like downstream adddress
Sep 17, 2020
5583faf
use request host as peer address for exit span
Sep 18, 2020
bd16737
add more test to cover more code
Sep 22, 2020
44a954f
minor change
Sep 25, 2020
6bef0f4
add backoff strategy
Sep 25, 2020
7c05904
fix format
Sep 25, 2020
7c80783
Merge branch 'master' of github.com:envoyproxy/envoy into skywalking
Oct 4, 2020
e57eca8
fix api
Oct 4, 2020
86da0e7
remove unused header file
Oct 4, 2020
a88e92d
some minor update
Oct 4, 2020
7b1cee9
update component id and add comment
Oct 4, 2020
0156a82
update comments for component
Oct 6, 2020
0a8d5e7
add update info
Oct 6, 2020
40150ee
Merge branch 'master' of github.com:envoyproxy/envoy into skywalking
Oct 6, 2020
8a15758
add sandbox test example for skywalking tracer
Oct 9, 2020
1ae2902
add skywalking sandbox docs.
Oct 10, 2020
fe02559
fix docs format
Oct 10, 2020
c7c148e
Merge branch 'master' of github.com:envoyproxy/envoy into skywalking
Oct 10, 2020
a8ca0fc
fix version history and docs format
Oct 10, 2020
4184636
fix for random api change
Oct 12, 2020
647679e
if start child span is set then inject tracing context by child span
Oct 12, 2020
e10a47b
create two span for skywalking tracer
Oct 15, 2020
c914203
add start child span config in sandbox yaml
Oct 16, 2020
75f5ed7
add tracing log for skywalking reporter
Oct 16, 2020
0952632
Merge branch 'master' of github.com:envoyproxy/envoy into skywalking
Oct 16, 2020
b518d3e
fix conflict
Oct 16, 2020
73a7f2d
fix format
Oct 16, 2020
3373ab8
fix header map get error
Oct 16, 2020
c58cf8f
fix tracer reporter test
Oct 17, 2020
f76ea47
fix config test
Oct 17, 2020
33d9e61
Revert "if start child span is set then inject tracing context by chi…
Oct 17, 2020
46a82ab
some minor update
Oct 17, 2020
c63db99
add some debug log
Oct 17, 2020
57348a3
make 'authentication' oneof
Oct 20, 2020
1adcbb2
add docs and fix format
Oct 20, 2020
9804a03
add annotations for authentation
Oct 21, 2020
73cd767
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Oct 21, 2020
b622945
fix new error after merge master
Oct 21, 2020
641d546
remove skywalking python proto library
Oct 21, 2020
ada59bc
capture value of skywalking proto config
Oct 21, 2020
0a659b3
update some comment and use 'EnvoyProxy' as default service/instance …
Oct 23, 2020
c3fa2d9
rename authentication to backend token
Oct 24, 2020
c705f4e
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Oct 24, 2020
69d7dd1
update sandbox
Oct 25, 2020
998c8a1
update comment
Oct 25, 2020
fbc6b93
add skywalking traceing to sandoxes docs tree
Oct 25, 2020
056c459
fix format error
Oct 26, 2020
82ef1fe
remove depends_on.condition and add 60s delay in verify.sh
Oct 26, 2020
f80844a
some updates
Oct 27, 2020
7488a66
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Oct 27, 2020
e4a815a
add some new log and comment
Oct 27, 2020
d9a1278
remove unnecessary config in sandbox and add new test
Oct 27, 2020
c3b30c8
fix shell format
Oct 27, 2020
b2e8661
fix typo error
Oct 28, 2020
753f79f
simplify unnecessary logic
Oct 30, 2020
32ba207
register authentication header for skywalking
Oct 30, 2020
749f69a
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Oct 30, 2020
ec03cb7
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Oct 31, 2020
8fa92a2
remove global static std::string and some minor update
Nov 1, 2020
fdc58a0
remove using namespace & wrap test by anonymous namespace
Nov 2, 2020
b93d3ff
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Nov 2, 2020
675f634
Merge branch 'master' of https://github.com/envoyproxy/envoy into sky…
Nov 3, 2020
f95b77d
fix docs after merge master
Nov 3, 2020
6aab97c
Kick CI
Nov 3, 2020
fe43441
anonymous namespace in header
Nov 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ extensions/filters/common/original_src @snowp @klarose
/*/extensions/tracers/datadog @cgilmour @palazzem @mattklein123
# tracers.xray extension
/*/extensions/tracers/xray @marcomagdy @lavignes @mattklein123
# tracers.skywalking extension
/*/extensions/tracers/skywalking @wbpcode @dio @lizan
# mysql_proxy extension
/*/extensions/filters/network/mysql_proxy @rshriram @venilnoronha @mattklein123
# postgres_proxy extension
Expand Down
31 changes: 31 additions & 0 deletions api/bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def api_dependencies():
name = "com_github_openzipkin_zipkinapi",
build_file_content = ZIPKINAPI_BUILD_CONTENT,
)
external_http_archive(
name = "com_github_apache_skywalking_data_collect_protocol",
build_file_content = SKYWALKING_DATA_COLLECT_PROTOCOL_BUILD_CONTENT,
)

PROMETHEUSMETRICS_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
Expand Down Expand Up @@ -101,3 +105,30 @@ go_proto_library(
visibility = ["//visibility:public"],
)
"""

SKYWALKING_DATA_COLLECT_PROTOCOL_BUILD_CONTENT = """
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "protocol",
srcs = [
"common/Common.proto",
"language-agent/Tracing.proto",
],
visibility = ["//visibility:public"],
)

cc_proto_library(
name = "protocol_cc_proto",
deps = [":protocol"],
visibility = ["//visibility:public"],
)

go_proto_library(
name = "protocol_go_proto",
proto = ":protocol",
visibility = ["//visibility:public"],
)
"""
11 changes: 11 additions & 0 deletions api/bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,15 @@ REPOSITORY_LOCATIONS_SPEC = dict(
release_date = "2020-08-17",
use_category = ["api"],
),
com_github_apache_skywalking_data_collect_protocol = dict(
project_name = "SkyWalking API",
project_desc = "SkyWalking's language independent model and gRPC API Definitions",
project_url = "https://github.com/apache/skywalking-data-collect-protocol",
version = "8.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

8.2.0 is out at https://github.com/apache/skywalking-data-collect-protocol/releases/tag/v8.2.0. Do you want to bump here or do as a follow up?

Copy link

Choose a reason for hiding this comment

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

8.1.0 and 8.2.0 are the same for the tracing format of the language agent. I think it is fine.
SkyWalking wouldn't break the tracing format for a long time to keep all language agents compatible and LTS.

Copy link

Choose a reason for hiding this comment

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

If this is an envoy project requirement, @wbpcode the 8.1.0->8.2.0 should not break anything you wrote :)

sha256 = "ebea8a6968722524d1bcc4426fb6a29907ddc2902aac7de1559012d3eee90cf9",
strip_prefix = "skywalking-data-collect-protocol-{version}",
urls = ["https://github.com/apache/skywalking-data-collect-protocol/archive/v{version}.tar.gz"],
release_date = "2020-07-29",
wbpcode marked this conversation as resolved.
Show resolved Hide resolved
use_category = ["api"],
lizan marked this conversation as resolved.
Show resolved Hide resolved
),
)
66 changes: 66 additions & 0 deletions api/envoy/config/trace/v3/skywalking.proto
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;
}
13 changes: 13 additions & 0 deletions api/envoy/extensions/tracers/skywalking/v4alpha/BUILD

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions 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.

1 change: 1 addition & 0 deletions docs/root/start/sandboxes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ features. The following sandboxes are available:
redis
wasm-cc
zipkin_tracing
skywalking_tracing
89 changes: 89 additions & 0 deletions docs/root/start/sandboxes/skywalking_tracing.rst
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>`
Copy link
Member

Choose a reason for hiding this comment

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

@phlax for sandbox review.

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.
wbpcode marked this conversation as resolved.
Show resolved Hide resolved
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.
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ New Features
* ratelimit: added support for use of various :ref:`metadata <envoy_v3_api_field_config.route.v3.RateLimit.Action.metadata>` as a ratelimit action.
* ratelimit: added :ref:`disable_x_envoy_ratelimited_header <envoy_v3_api_msg_extensions.filters.http.ratelimit.v3.RateLimit>` option to disable `X-Envoy-RateLimited` header.
* tcp: added a new :ref:`envoy.overload_actions.reject_incoming_connections <config_overload_manager_overload_actions>` action to reject incoming TCP connections.
* tracing: added SkyWalking tracer.
* xds: added support for resource TTLs. A TTL is specified on the :ref:`Resource <envoy_api_msg_Resource>`. For SotW, a :ref:`Resource <envoy_api_msg_Resource>` can be embedded
in the list of resources to specify the TTL.

Expand Down
5 changes: 4 additions & 1 deletion examples/front-proxy/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
'X-B3-Flags',

# Jaeger header (for native client)
"uber-trace-id"
"uber-trace-id",

# SkyWalking headers.
"sw8"
]


Expand Down
7 changes: 7 additions & 0 deletions examples/skywalking-tracing/Dockerfile-frontenvoy
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
2 changes: 2 additions & 0 deletions examples/skywalking-tracing/README.md
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)
Loading