tracing: update opencensus and googleapis, use SetName for operation name (#7622)

Description:
Un-pin opencensus and googleapis to use master versions
Use SetName span method to set route operation names (aligning with other tracers).

Risk Level: low
Testing: Unit tests
Docs Changes: None
Release Notes: None

Signed-off-by: Kuat Yessenov <kuat@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ ef054f08695b8c883c94674904ad27210aa9ba38
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 53b54e4c53
commit 911658451c
  1. 45
      bazel/api_build_system.bzl
  2. 176
      bazel/repositories.bzl
  3. 6
      bazel/repository_locations.bzl

@ -1,4 +1,4 @@
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
load("@com_google_protobuf//:protobuf.bzl", _py_proto_library = "py_proto_library")
load("@com_envoyproxy_protoc_gen_validate//bazel:pgv_proto_library.bzl", "pgv_cc_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")
@ -24,21 +24,42 @@ def _LibrarySuffix(library_name, suffix):
# https://github.com/bazelbuild/bazel/issues/3935 and/or
# https://github.com/bazelbuild/bazel/issues/2626 are resolved.
def api_py_proto_library(name, srcs = [], deps = [], has_services = 0):
py_proto_library(
_py_proto_library(
name = _Suffix(name, _PY_SUFFIX),
srcs = srcs,
default_runtime = "@com_google_protobuf//:protobuf_python",
protoc = "@com_google_protobuf//:protoc",
deps = [_LibrarySuffix(d, _PY_SUFFIX) for d in deps] + [
"@com_envoyproxy_protoc_gen_validate//validate:validate_py",
"@googleapis//:api_httpbody_protos_py",
"@googleapis//:http_api_protos_py",
"@googleapis//:rpc_status_protos_py",
"@com_google_googleapis//google/rpc:status_py_proto",
"@com_google_googleapis//google/api:annotations_py_proto",
"@com_google_googleapis//google/api:http_py_proto",
"@com_google_googleapis//google/api:httpbody_py_proto",
"@com_github_gogo_protobuf//:gogo_proto_py",
],
visibility = ["//visibility:public"],
)
# This defines googleapis py_proto_library. The repository does not provide its definition and requires
# overriding it in the consuming project (see https://github.com/grpc/grpc/issues/19255 for more details).
def py_proto_library(name, deps = []):
srcs = [dep[:-6] + ".proto" if dep.endswith("_proto") else dep for dep in deps]
proto_deps = []
# py_proto_library in googleapis specifies *_proto rules in dependencies.
# By rewriting *_proto to *.proto above, the dependencies in *_proto rules are not preserved.
# As a workaround, manually specify the proto dependencies for the imported python rules.
if name == "annotations_py_proto":
proto_deps = proto_deps + [":http_py_proto"]
_py_proto_library(
name = name,
srcs = srcs,
default_runtime = "@com_google_protobuf//:protobuf_python",
protoc = "@com_google_protobuf//:protoc",
deps = proto_deps + ["@com_google_protobuf//:protobuf_python"],
visibility = ["//visibility:public"],
)
def api_go_proto_library(name, proto, deps = []):
go_proto_library(
name = _Suffix(name, _GO_PROTO_SUFFIX),
@ -53,7 +74,7 @@ def api_go_proto_library(name, proto, deps = []):
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@io_bazel_rules_go//proto/wkt:wrappers_go_proto",
"@com_envoyproxy_protoc_gen_validate//validate:go_default_library",
"@googleapis//:rpc_status_go_proto",
"@com_google_googleapis//google/rpc:status_go_proto",
],
)
@ -70,7 +91,7 @@ def api_go_grpc_library(name, proto, deps = []):
"@io_bazel_rules_go//proto/wkt:struct_go_proto",
"@io_bazel_rules_go//proto/wkt:wrappers_go_proto",
"@com_envoyproxy_protoc_gen_validate//validate:go_default_library",
"@googleapis//:http_api_go_proto",
"@com_google_googleapis//google/api:annotations_go_proto",
],
)
@ -109,8 +130,9 @@ def api_proto_library(
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
"@googleapis//:http_api_protos_proto",
"@googleapis//:rpc_status_protos_lib",
"@com_google_googleapis//google/api:http_proto",
"@com_google_googleapis//google/api:annotations_proto",
"@com_google_googleapis//google/rpc:status_proto",
"@com_github_gogo_protobuf//:gogo_proto",
"@com_envoyproxy_protoc_gen_validate//validate:validate_proto",
],
@ -121,8 +143,9 @@ def api_proto_library(
linkstatic = linkstatic,
cc_deps = [_LibrarySuffix(d, _CC_SUFFIX) for d in deps] + external_cc_proto_deps + [
"@com_github_gogo_protobuf//:gogo_proto_cc",
"@googleapis//:http_api_protos",
"@googleapis//:rpc_status_protos",
"@com_google_googleapis//google/api:http_cc_proto",
"@com_google_googleapis//google/api:annotations_cc_proto",
"@com_google_googleapis//google/rpc:status_cc_proto",
],
deps = [":" + name],
visibility = ["//visibility:public"],

@ -12,9 +12,8 @@ def api_dependencies():
locations = REPOSITORY_LOCATIONS,
)
envoy_http_archive(
name = "googleapis",
name = "com_google_googleapis",
locations = REPOSITORY_LOCATIONS,
build_file_content = GOOGLEAPIS_BUILD_CONTENT,
)
envoy_http_archive(
name = "com_github_gogo_protobuf",
@ -36,179 +35,6 @@ def api_dependencies():
build_file_content = KAFKASOURCE_BUILD_CONTENT,
)
GOOGLEAPIS_BUILD_CONTENT = """
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",
srcs = [
"google/api/httpbody.proto",
],
visibility = ["//visibility:public"],
)
proto_library(
name = "api_httpbody_protos_proto",
srcs = [":api_httpbody_protos_src"],
deps = ["@com_google_protobuf//:descriptor_proto"],
visibility = ["//visibility:public"],
)
cc_proto_library(
name = "api_httpbody_protos",
deps = [":api_httpbody_protos_proto"],
visibility = ["//visibility:public"],
)
py_proto_library(
name = "api_httpbody_protos_py",
srcs = [
"google/api/httpbody.proto",
],
include = ".",
default_runtime = "@com_google_protobuf//:protobuf_python",
protoc = "@com_google_protobuf//:protoc",
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf_python"],
)
go_proto_library(
name = "api_httpbody_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/httpbody",
proto = ":api_httpbody_protos_proto",
visibility = ["//visibility:public"],
deps = [
":descriptor_go_proto",
],
)
filegroup(
name = "http_api_protos_src",
srcs = [
"google/api/annotations.proto",
"google/api/http.proto",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "descriptor_go_proto",
importpath = "github.com/golang/protobuf/protoc-gen-go/descriptor",
proto = "@com_google_protobuf//:descriptor_proto",
visibility = ["//visibility:public"],
)
proto_library(
name = "http_api_protos_proto",
srcs = [":http_api_protos_src"],
deps = ["@com_google_protobuf//:descriptor_proto"],
visibility = ["//visibility:public"],
)
cc_proto_library(
name = "http_api_protos",
deps = [":http_api_protos_proto"],
visibility = ["//visibility:public"],
)
py_proto_library(
name = "http_api_protos_py",
srcs = [
"google/api/annotations.proto",
"google/api/http.proto",
],
include = ".",
default_runtime = "@com_google_protobuf//:protobuf_python",
protoc = "@com_google_protobuf//:protoc",
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf_python"],
)
go_proto_library(
name = "http_api_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/annotations",
proto = ":http_api_protos_proto",
visibility = ["//visibility:public"],
deps = [
":descriptor_go_proto",
],
)
filegroup(
name = "rpc_status_protos_src",
srcs = [
"google/rpc/status.proto",
],
visibility = ["//visibility:public"],
)
proto_library(
name = "rpc_status_protos_lib",
srcs = [":rpc_status_protos_src"],
deps = ["@com_google_protobuf//:any_proto"],
visibility = ["//visibility:public"],
)
cc_proto_library(
name = "rpc_status_protos",
deps = [":rpc_status_protos_lib"],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "rpc_status_go_proto",
importpath = "google.golang.org/genproto/googleapis/rpc/status",
proto = ":rpc_status_protos_lib",
visibility = ["//visibility:public"],
deps = [
"@io_bazel_rules_go//proto/wkt:any_go_proto",
],
)
py_proto_library(
name = "rpc_status_protos_py",
srcs = [
"google/rpc/status.proto",
],
include = ".",
default_runtime = "@com_google_protobuf//:protobuf_python",
protoc = "@com_google_protobuf//:protoc",
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 = """
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library", "py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

@ -10,8 +10,8 @@ OPENCENSUS_PROTO_SHA256 = "a4e87a1da21d1b3a16674332c3ee6e2689d52f3532e2ff8cb4a62
PGV_GIT_SHA = "dd90514d96e35023ed20201f349542b0bc64461d"
PGV_SHA256 = "f7d67677fbec5b0f561f6ee6788223fb535d3864b53a28b6678e319f5d1f4f25"
GOOGLEAPIS_GIT_SHA = "d642131a6e6582fc226caf9893cb7fe7885b3411" # May 23, 2018
GOOGLEAPIS_SHA = "16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f63"
GOOGLEAPIS_GIT_SHA = "be480e391cc88a75cf2a81960ef79c80d5012068" # Jul 24, 2019
GOOGLEAPIS_SHA = "c1969e5b72eab6d9b6cfcff748e45ba57294aeea1d96fd04cd081995de0605c2"
PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017
PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b"
@ -28,7 +28,7 @@ REPOSITORY_LOCATIONS = dict(
strip_prefix = "protoc-gen-validate-" + PGV_GIT_SHA,
urls = ["https://github.com/envoyproxy/protoc-gen-validate/archive/" + PGV_GIT_SHA + ".tar.gz"],
),
googleapis = dict(
com_google_googleapis = dict(
# TODO(dio): Consider writing a Skylark macro for importing Google API proto.
sha256 = GOOGLEAPIS_SHA,
strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA,

Loading…
Cancel
Save