Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
1 change: 1 addition & 0 deletions RAW_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ will make it substantially easier for the releaser to "linkify" all of the relea
final version.

## 1.6.0
* Added gRPC healthcheck based on [grpc.health.v1.Health](https://github.com/grpc/grpc/blob/master/src/proto/grpc/health/v1/health.proto) service.
* Added gRPC access logging.
* Added DOWNSTREAM_REMOTE_ADDRESS, DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT, and
DOWNSTREAM_LOCAL_ADDRESS access log formatters. DOWNSTREAM_ADDRESS access log formatter has been
Expand Down
11 changes: 11 additions & 0 deletions source/common/upstream/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_library",
"envoy_package",
"envoy_proto_library",
)

envoy_package()
Expand Down Expand Up @@ -90,9 +91,11 @@ envoy_cc_library(
hdrs = ["health_checker_impl.h"],
external_deps = ["envoy_health_check"],
deps = [
":health_proto",
":host_utility_lib",
"//include/envoy/event:dispatcher_interface",
"//include/envoy/event:timer_interface",
"//include/envoy/grpc:status",
"//include/envoy/http:codec_interface",
"//include/envoy/http:codes_interface",
"//include/envoy/network:connection_interface",
Expand All @@ -101,11 +104,14 @@ envoy_cc_library(
"//include/envoy/stats:stats_interface",
"//include/envoy/upstream:health_checker_interface",
"//source/common/buffer:buffer_lib",
"//source/common/buffer:zero_copy_input_stream_lib",
"//source/common/common:empty_string",
"//source/common/common:enum_to_int",
"//source/common/common:hex_lib",
"//source/common/common:logger_lib",
"//source/common/common:utility_lib",
"//source/common/grpc:codec_lib",
"//source/common/grpc:common_lib",
"//source/common/http:codec_client_lib",
"//source/common/http:header_map_lib",
"//source/common/http:headers_lib",
Expand Down Expand Up @@ -347,3 +353,8 @@ envoy_cc_library(
"//source/common/stats:stats_lib",
],
)

envoy_proto_library(
name = "health_proto",
srcs = ["health.proto"],
)
35 changes: 35 additions & 0 deletions source/common/upstream/health.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package grpc.health.v1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be sourced from the gRPC repo as an external dependency. I'm going to be looking into adding the gRPC repos as an external dep for Envoy today, so stay tuned.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See #2318. When this merges, you should be able to do something like @grpc//src/proto/grpc/health/v1:health.proto to reference the proto there.

@baranov1ch baranov1ch Jan 9, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

trying like this:

--- a/bazel/repositories.bzl
+++ b/bazel/repositories.bzl
@@ -410,3 +410,18 @@ def _com_github_grpc_grpc():
       name = "grpc",
       actual = "@com_github_grpc_grpc//:grpc++"
     )
+    // For grpc proto compilation to work.
+    native.bind(
+        name = "protocol_compiler",
+        actual = "@com_google_protobuf_cc//:protoc",
+    )
+
+    // For grpc proto compilation to work.
+    native.bind(
+        name = "protobuf_clib",
+        actual = "@com_google_protobuf_cc//:protobuf",
+    )
+
+    native.bind(
+      name = "grpc_health_proto",
+      actual = "@com_github_grpc_grpc//src/proto/grpc/health/v1:health_proto",
+    )


--- a/source/common/upstream/BUILD
+++ b/source/common/upstream/BUILD
@@ -89,9 +89,8 @@ envoy_cc_library(
     name = "health_checker_lib",
     srcs = ["health_checker_impl.cc"],
     hdrs = ["health_checker_impl.h"],
-    external_deps = ["envoy_health_check"],
+    external_deps = ["envoy_health_check", "grpc_health_proto"],

does not work with some strange errors:

bazel build -c dbg --verbose_failures //source/common/upstream:health_checker_lib
<...>
INFO: Analysed target //source/common/upstream:health_checker_lib (0 packages loaded).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_baranovich/b62ff95190308ee02bfc031330094506/external/com_github_grpc_grpc/src/proto/grpc/health/v1/BUILD:21:1: output 'external/com_github_grpc_grpc/src/proto/grpc/health/v1/grpc/src/proto/grpc/health/v1/health.pb.h' was not created
ERROR: /private/var/tmp/_bazel_baranovich/b62ff95190308ee02bfc031330094506/external/com_github_grpc_grpc/src/proto/grpc/health/v1/BUILD:21:1: output 'external/com_github_grpc_grpc/src/proto/grpc/health/v1/grpc/src/proto/grpc/health/v1/health.pb.cc' was not created
ERROR: /private/var/tmp/_bazel_baranovich/b62ff95190308ee02bfc031330094506/external/com_github_grpc_grpc/src/proto/grpc/health/v1/BUILD:21:1: not all outputs were created or valid
Target //source/common/upstream:health_checker_lib failed to build
INFO: Elapsed time: 0,506s, Critical Path: 0,30s
FAILED: Build did NOT complete successfully

Seems like grpc proto build rules does smth strange with proto out paths...

I wasn't able to build any of external grpc targets building protobufs with the same kind of errors(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's hard to know what's going on with just that error message. The diff you provide looks correct. Can you do bazel build -s and attach the protoc invocation on health.proto? This might give more of a clue about what is going on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SUBCOMMAND: # @com_github_grpc_grpc//src/proto/grpc/health/v1:_health_proto_codegen [action 'SkylarkAction external/com_github_grpc_grpc/src/proto/grpc/health/v1/grpc/src/proto/grpc/health/v1/health.pb.h']
(cd /private/var/tmp/_bazel_baranovich/b62ff95190308ee02bfc031330094506/execroot/envoy && \
  exec env - \
  bazel-out/host/bin/external/com_google_protobuf_cc/protoc '--cpp_out=:bazel-out/darwin-dbg/genfiles' '-Iexternal/com_github_grpc_grpc/src/proto/grpc/health/v1/health.proto=external/com_github_grpc_grpc/src/proto/grpc/health/v1/health.proto' external/com_github_grpc_grpc/src/proto/grpc/health/v1/health.proto)

option csharp_namespace = "Grpc.Health.V1";

message HealthCheckRequest {
string service = 1;
}

message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
}
ServingStatus status = 1;
}

service Health {
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
}
Loading