[READ ONLY MIRROR] Envoy REST/proto API definitions and documentation. (grpc依赖)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
5.3 KiB

load(":envoy_http_archive.bzl", "envoy_http_archive")
load(":external_deps.bzl", "load_repository_locations")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS_SPEC")
REPOSITORY_LOCATIONS = load_repository_locations(REPOSITORY_LOCATIONS_SPEC)
# Use this macro to reference any HTTP archive from bazel/repository_locations.bzl.
def external_http_archive(name, **kwargs):
envoy_http_archive(
name,
locations = REPOSITORY_LOCATIONS,
**kwargs
)
def api_dependencies():
external_http_archive(
name = "bazel_skylib",
)
external_http_archive(
name = "com_envoyproxy_protoc_gen_validate",
)
external_http_archive(
name = "com_google_googleapis",
)
external_http_archive(
name = "com_github_cncf_udpa",
)
external_http_archive(
name = "prometheus_metrics_model",
build_file_content = PROMETHEUSMETRICS_BUILD_CONTENT,
)
external_http_archive(
name = "opencensus_proto",
)
external_http_archive(
name = "rules_proto",
)
external_http_archive(
name = "com_github_openzipkin_zipkinapi",
build_file_content = ZIPKINAPI_BUILD_CONTENT,
)
external_http_archive(
name = "opentelemetry_proto",
build_file_content = OPENTELEMETRY_BUILD_CONTENT,
)
tooling: Add buf bazel dependency and tests to evaluate it (#17515) Follow-up to #17375 where it was agreed that protolock is not actively maintained enough to depend on. This PR "migrates" the tests from that PR to use buf instead, and also cleans some of the code per a few of the review comments. Still a few outstanding points: - buf build on the envoy/api folder requires several protobuf dependencies such as udpa to be available to buf to consume. Suggested solution by buf is to point buf's config to necessary BSR modules that the buf team is hosting. - These lines are commented out in this PR as I had some trouble automating it for the tests, and it is not necessary for the tests to pass - May introduce issues if buf is not pointing to the same version of modules that bazel builds for envoy. May need to introduce some way to couple them, or (ideally) find a way to run the breaking change detector without building the dependencies - Currently bazel is using a binary release of buf (for linux). Goal is to move to building it from source in the near future - It may be in our interest to expand the list of API-breaking-change rules (buf provides an extensive list of rules we could adopt) Risk Level: Low Testing: Tests that evaluate buf against "allowed" and "breaking" protobuf API changes. Currently 4 tests are skipped - 3 of them are PGV-related (we need to communicate our desired PGV rules to the buf team so they may add them in the near future). The 4th is a test I had originally written to evaluate protolock but may not apply to buf ("forcing" a breaking change) - refer to comments Docs Changes: Release Notes: Platform Specific Features: buf binary imported by bazel is linux-only. Hopefully the ["manual"] tags attribute prevents any issues for non-linux users Signed-off-by: Yaseen Alkhafaji <yaseena@google.com> Mirrored from https://github.com/envoyproxy/envoy @ c74cebb3cc7dfb26488f7cac8eb9258cf9a7588e
3 years ago
external_http_archive(
name = "com_github_bufbuild_buf",
build_file_content = BUF_BUILD_CONTENT,
tags = ["manual"],
)
PROMETHEUSMETRICS_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
api_cc_py_proto_library(
name = "client_model",
srcs = [
"io/prometheus/client/metrics.proto",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "client_model_go_proto",
importpath = "github.com/prometheus/client_model/go",
proto = ":client_model",
visibility = ["//visibility:public"],
)
"""
OPENCENSUSTRACE_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
api_cc_py_proto_library(
name = "trace_model",
srcs = [
"trace.proto",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "trace_model_go_proto",
importpath = "trace_model",
proto = ":trace_model",
visibility = ["//visibility:public"],
)
"""
ZIPKINAPI_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
api_cc_py_proto_library(
name = "zipkin",
srcs = [
"zipkin-jsonv2.proto",
"zipkin.proto",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "zipkin_go_proto",
proto = ":zipkin",
visibility = ["//visibility:public"],
)
"""
OPENTELEMETRY_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
api_cc_py_proto_library(
name = "common",
srcs = [
"opentelemetry/proto/common/v1/common.proto",
],
visibility = ["//visibility:public"],
)
api_cc_py_proto_library(
name = "resource",
srcs = [
"opentelemetry/proto/resource/v1/resource.proto",
],
deps = [
"//:common",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "common_go_proto",
importpath = "go.opentelemetry.io/proto/otlp/common/v1",
proto = ":common",
visibility = ["//visibility:public"],
)
# TODO(snowp): Generating one Go package from all of these protos could cause problems in the future,
# but nothing references symbols from collector or resource so we're fine for now.
api_cc_py_proto_library(
name = "logs",
srcs = [
"opentelemetry/proto/collector/logs/v1/logs_service.proto",
"opentelemetry/proto/logs/v1/logs.proto",
],
deps = [
"//:common",
"//:resource",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "logs_go_proto",
importpath = "go.opentelemetry.io/proto/otlp/logs/v1",
proto = ":logs",
visibility = ["//visibility:public"],
)
api_cc_py_proto_library(
name = "metrics",
srcs = [
"opentelemetry/proto/collector/metrics/v1/metrics_service.proto",
"opentelemetry/proto/metrics/v1/metrics.proto",
],
deps = [
"//:common",
"//:resource",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "metrics_go_proto",
importpath = "go.opentelemetry.io/proto/otlp/metrics/v1",
proto = ":metrics",
visibility = ["//visibility:public"],
)
api_cc_py_proto_library(
name = "trace",
srcs = [
"opentelemetry/proto/collector/trace/v1/trace_service.proto",
"opentelemetry/proto/trace/v1/trace.proto",
],
deps = [
"//:common",
"//:resource",
],
visibility = ["//visibility:public"],
)
"""
tooling: Add buf bazel dependency and tests to evaluate it (#17515) Follow-up to #17375 where it was agreed that protolock is not actively maintained enough to depend on. This PR "migrates" the tests from that PR to use buf instead, and also cleans some of the code per a few of the review comments. Still a few outstanding points: - buf build on the envoy/api folder requires several protobuf dependencies such as udpa to be available to buf to consume. Suggested solution by buf is to point buf's config to necessary BSR modules that the buf team is hosting. - These lines are commented out in this PR as I had some trouble automating it for the tests, and it is not necessary for the tests to pass - May introduce issues if buf is not pointing to the same version of modules that bazel builds for envoy. May need to introduce some way to couple them, or (ideally) find a way to run the breaking change detector without building the dependencies - Currently bazel is using a binary release of buf (for linux). Goal is to move to building it from source in the near future - It may be in our interest to expand the list of API-breaking-change rules (buf provides an extensive list of rules we could adopt) Risk Level: Low Testing: Tests that evaluate buf against "allowed" and "breaking" protobuf API changes. Currently 4 tests are skipped - 3 of them are PGV-related (we need to communicate our desired PGV rules to the buf team so they may add them in the near future). The 4th is a test I had originally written to evaluate protolock but may not apply to buf ("forcing" a breaking change) - refer to comments Docs Changes: Release Notes: Platform Specific Features: buf binary imported by bazel is linux-only. Hopefully the ["manual"] tags attribute prevents any issues for non-linux users Signed-off-by: Yaseen Alkhafaji <yaseena@google.com> Mirrored from https://github.com/envoyproxy/envoy @ c74cebb3cc7dfb26488f7cac8eb9258cf9a7588e
3 years ago
BUF_BUILD_CONTENT = """
package(
default_visibility = ["//visibility:public"],
)
filegroup(
name = "buf",
srcs = [
"@com_github_bufbuild_buf//:bin/buf",
],
tags = ["manual"], # buf is downloaded as a linux binary; tagged manual to prevent build for non-linux users
)
"""