Add initial OpenCensus tracing support. (#5387)

Addresses #2456

Risk level: Low

Signed-off-by: Emil Mikulic <g-easy@users.noreply.github.com>

Mirrored from https://github.com/envoyproxy/envoy @ 350a35f2ac685c4958934466a90b40f876968f99
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent ed9db8d1c8
commit 7e98d27926
  1. 58
      bazel/repositories.bzl
  2. 12
      bazel/repository_locations.bzl
  3. 2
      envoy/config/trace/v2/BUILD
  4. 49
      envoy/config/trace/v2/trace.proto
  5. 4
      envoy/service/trace/v2/BUILD
  6. 2
      envoy/service/trace/v2/trace_service.proto

@ -27,9 +27,8 @@ def api_dependencies():
build_file_content = PROMETHEUSMETRICS_BUILD_CONTENT,
)
envoy_http_archive(
name = "io_opencensus_trace",
name = "opencensus_proto",
locations = REPOSITORY_LOCATIONS,
build_file_content = OPENCENSUSTRACE_BUILD_CONTENT,
)
envoy_http_archive(
name = "kafka_source",
@ -38,8 +37,9 @@ def api_dependencies():
)
GOOGLEAPIS_BUILD_CONTENT = """
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library", "py_proto_library")
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
filegroup(
name = "api_httpbody_protos_src",
@ -58,12 +58,7 @@ proto_library(
cc_proto_library(
name = "api_httpbody_protos",
srcs = [
"google/api/httpbody.proto",
],
default_runtime = "@com_google_protobuf//:protobuf",
protoc = "@com_google_protobuf//:protoc",
deps = ["@com_google_protobuf//:cc_wkt_protos"],
deps = [":api_httpbody_protos_proto"],
visibility = ["//visibility:public"],
)
@ -114,14 +109,7 @@ proto_library(
cc_proto_library(
name = "http_api_protos",
srcs = [
"google/api/annotations.proto",
"google/api/http.proto",
],
default_runtime = "@com_google_protobuf//:protobuf",
protoc = "@com_google_protobuf//:protoc",
linkstatic = 1,
deps = ["@com_google_protobuf//:cc_wkt_protos"],
deps = [":http_api_protos_proto"],
visibility = ["//visibility:public"],
)
@ -165,12 +153,7 @@ proto_library(
cc_proto_library(
name = "rpc_status_protos",
srcs = ["google/rpc/status.proto"],
default_runtime = "@com_google_protobuf//:protobuf",
protoc = "@com_google_protobuf//:protoc",
deps = [
"@com_google_protobuf//:cc_wkt_protos"
],
deps = [":rpc_status_protos_lib"],
visibility = ["//visibility:public"],
)
@ -195,6 +178,35 @@ py_proto_library(
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf_python"],
)
proto_library(
name = "tracing_proto_proto",
srcs = [
"google/devtools/cloudtrace/v2/trace.proto",
"google/devtools/cloudtrace/v2/tracing.proto",
],
deps = [
":http_api_protos_proto",
":rpc_status_protos_lib",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_google_protobuf//:empty_proto",
],
)
cc_proto_library(
name = "tracing_proto_cc",
deps = [":tracing_proto_proto"],
)
cc_grpc_library(
name = "tracing_proto",
srcs = [":tracing_proto_proto"],
deps = [":tracing_proto_cc"],
grpc_only = True,
visibility = ["@io_opencensus_cpp//opencensus:__subpackages__"],
)
"""
GOGOPROTO_BUILD_CONTENT = """

@ -4,8 +4,8 @@ BAZEL_SKYLIB_SHA256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc70
GOGOPROTO_RELEASE = "1.2.1"
GOGOPROTO_SHA256 = "99e423905ba8921e86817607a5294ffeedb66fdd4a85efce5eb2848f715fdb3a"
OPENCENSUS_RELEASE = "0.1.0"
OPENCENSUS_SHA256 = "4fd21cc6de63d7cb979fd749d8101ff425905aa0826fed26019d1c311fcf19a7"
OPENCENSUS_PROTO_GIT_SHA = "d5d80953a8c2ff4633087af6933cd152678434bb" # Mar 18, 2019
OPENCENSUS_PROTO_SHA256 = "a4e87a1da21d1b3a16674332c3ee6e2689d52f3532e2ff8cb4a626c8bcdabcfc"
PGV_GIT_SHA = "26db5cb7c01a67c6a2e21a832106406185530b2f"
PGV_SHA256 = "6510cbcf69d99059c652ae2376f6240bc761d0b019cd962225f4f609be361e26"
@ -44,10 +44,10 @@ REPOSITORY_LOCATIONS = dict(
strip_prefix = "client_model-" + PROMETHEUS_GIT_SHA,
urls = ["https://github.com/prometheus/client_model/archive/" + PROMETHEUS_GIT_SHA + ".tar.gz"],
),
io_opencensus_trace = dict(
sha256 = OPENCENSUS_SHA256,
strip_prefix = "opencensus-proto-" + OPENCENSUS_RELEASE + "/src/opencensus/proto/trace/v1",
urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/v" + OPENCENSUS_RELEASE + ".tar.gz"],
opencensus_proto = dict(
sha256 = OPENCENSUS_PROTO_SHA256,
strip_prefix = "opencensus-proto-" + OPENCENSUS_PROTO_GIT_SHA + "/src",
urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/" + OPENCENSUS_PROTO_GIT_SHA + ".tar.gz"],
),
kafka_source = dict(
sha256 = KAFKA_SOURCE_SHA,

@ -10,6 +10,7 @@ api_proto_library_internal(
],
deps = [
"//envoy/api/v2/core:grpc_service",
"@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto",
],
)
@ -18,5 +19,6 @@ api_go_proto_library(
proto = ":trace",
deps = [
"//envoy/api/v2/core:grpc_service_go_proto",
"@opencensus_proto//opencensus/proto/trace/v1:trace_and_config_proto_go",
],
)

@ -11,6 +11,7 @@ option java_package = "io.envoyproxy.envoy.config.trace.v2";
option go_package = "v2";
import "envoy/api/v2/core/grpc_service.proto";
import "opencensus/proto/trace/v1/trace_config.proto";
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
@ -33,6 +34,7 @@ message Tracing {
// - *envoy.zipkin*
// - *envoy.dynamic.ot*
// - *envoy.tracers.datadog*
// - *envoy.tracers.opencensus*
string name = 1 [(validate.rules).string.min_bytes = 1];
// Trace driver specific configuration which depends on the driver being instantiated.
@ -42,6 +44,7 @@ message Tracing {
// - :ref:`ZipkinConfig <envoy_api_msg_config.trace.v2.ZipkinConfig>`
// - :ref:`DynamicOtConfig <envoy_api_msg_config.trace.v2.DynamicOtConfig>`
// - :ref:`DatadogConfig <envoy_api_msg_config.trace.v2.DatadogConfig>`
// - :ref:`OpenCensusConfig <envoy_api_msg_config.trace.v2.OpenCensusConfig>`
oneof config_type {
google.protobuf.Struct config = 2;
@ -103,6 +106,52 @@ message DatadogConfig {
string service_name = 2 [(validate.rules).string.min_bytes = 1];
}
// Configuration for the OpenCensus tracer.
// [#proto-status: experimental]
message OpenCensusConfig {
// Configures tracing, e.g. the sampler, max number of annotations, etc.
opencensus.proto.trace.v1.TraceConfig trace_config = 1;
// Enables the stdout exporter if set to true. This is intended for debugging
// purposes.
bool stdout_exporter_enabled = 2;
// Enables the Stackdriver exporter if set to true. The project_id must also
// be set.
bool stackdriver_exporter_enabled = 3;
// The Cloud project_id to use for Stackdriver tracing.
string stackdriver_project_id = 4;
// Enables the Zipkin exporter if set to true. The url and service name must
// also be set.
bool zipkin_exporter_enabled = 5;
// The URL to Zipkin, e.g. "http://127.0.0.1:9411/api/v2/spans"
string zipkin_url = 6;
// The Zipkin service name.
string zipkin_service_name = 7;
enum TraceContext {
// W3C Trace-Context format "traceparent:" header.
trace_context = 0;
// Binary "grpc-trace-bin:" header.
grpc_trace_bin = 1;
// "X-Cloud-Trace-Context:" header.
cloud_trace_context = 2;
}
// List of incoming trace context headers we will accept. First one found
// wins.
repeated TraceContext incoming_trace_context = 8;
// List of outgoing trace context headers we will produce.
repeated TraceContext outgoing_trace_context = 9;
}
// Configuration structure.
message TraceServiceConfig {
// The upstream gRPC cluster that hosts the metrics service.

@ -9,7 +9,7 @@ api_proto_library_internal(
require_py = 0,
deps = [
"//envoy/api/v2/core:base",
"@io_opencensus_trace//:trace_model",
"@opencensus_proto//opencensus/proto/trace/v1:trace_proto",
],
)
@ -18,6 +18,6 @@ api_go_grpc_library(
proto = ":trace_service",
deps = [
"//envoy/api/v2/core:base_go_proto",
"@io_opencensus_trace//:trace_model_go_proto",
"@opencensus_proto//opencensus/proto/trace/v1:trace_proto_go",
],
)

@ -11,7 +11,7 @@ option go_package = "v2";
option java_generic_services = true;
import "envoy/api/v2/core/base.proto";
import "trace.proto";
import "opencensus/proto/trace/v1/trace.proto";
import "google/api/annotations.proto";

Loading…
Cancel
Save