Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Unless otherwise stated, the APIs with the same names as v1 APIs have a similar
endpoints. The health check subset may not be a subset of the Envoy instance's
EDS endpoints.
* [Listener Discovery Service (LDS)](api/lds.proto). This new API supports dynamic discovery of the listener configuration (which ports to bind to, TLS details, filter chains, etc.).
* [Metric Service (MS)](api/metrics_service.proto). This new API allows Envoy to push (stream) metrics forever for servers to consume.
* [Rate Limit Service (RLS)](api/rls.proto)
* [Route Discovery Service (RDS)](api/rds.proto).
* [Secret Discovery Service (SDS)](api/sds.proto).
Expand Down
11 changes: 11 additions & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ api_proto_library(
],
)

api_proto_library(
name = "metrics",
srcs = ["metrics_service.proto"],
has_services = 1,
deps = [
":base",
"@promotheus_metrics_model//:client_model_protos_lib",
],
require_py = 0,
)

api_proto_library(
name = "protocol",
srcs = ["protocol.proto"],
Expand Down
40 changes: 40 additions & 0 deletions api/metrics_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";

package envoy.api.v2;
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.

Nit: blank line after package.


import "api/base.proto";

import "google/api/annotations.proto";
import "metrics.proto";

// Service for streaming metrics to server that consumes the metrics data. It uses Prometheus metric
// data model as a standard to represent metrics information.
service MetricsService {
// Envoy will connect and send StreamMetricsMessage messages forever. It does not expect any
// response to be sent as nothing would be done in the case of failure.
rpc StreamMetrics(stream StreamMetricsMessage) returns (StreamMetricsResponse) {
}
}

message StreamMetricsResponse {}

message StreamMetricsMessage {
message Identifier {
// The node sending the access log messages over the stream.
Node node = 1;
}

// Identifier data effectively is a structured metadata.
// As a performance optimization this will only be sent in the first message on the stream.
Identifier identifier = 1;

// A list of metric entries
repeated io.prometheus.client.MetricFamily envoy_metrics = 2;
}

// Configuration structure.
message MetricsServiceConfig {
// The name of the upstream cluster that hosts the metrics service. The cluster must be
// configured in the cluster manager.
string cluster_name = 1;
}
5 changes: 3 additions & 2 deletions bazel/api_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def api_py_proto_library(name, srcs = [], deps = [], has_services = 0):

# TODO(htuch): has_services is currently ignored but will in future support
# gRPC stub generation.
def api_proto_library(name, srcs = [], deps = [], has_services = 0):
def api_proto_library(name, srcs = [], deps = [], has_services = 0, require_py = 1):
native.proto_library(
name = name,
srcs = srcs,
Expand All @@ -43,7 +43,8 @@ def api_proto_library(name, srcs = [], deps = [], has_services = 0):
deps = [name],
visibility = ["//visibility:public"],
)
api_py_proto_library(name, srcs, deps, has_services)
if (require_py == 1):
api_py_proto_library(name, srcs, deps, has_services)

def api_cc_test(name, srcs, proto_deps):
native.cc_test(
Expand Down
29 changes: 29 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GOOGLEAPIS_SHA = "5c6df0cd18c6a429eab739fb711c27f6e1393366" # May 14, 2017
PROMETHEUS_SHA = "6f3806018612930941127f2a7c6c453ba2c527d2" # Nov 02, 2017

def api_dependencies():
native.new_http_archive(
Expand Down Expand Up @@ -44,3 +45,31 @@ py_proto_library(
)
""",
)

native.new_http_archive(
name = "promotheus_metrics_model",
strip_prefix = "client_model-" + PROMETHEUS_SHA,
url = "https://github.com/prometheus/client_model/archive/" + PROMETHEUS_SHA + ".tar.gz",
build_file_content = """

filegroup(
name = "client_model_protos_src",
srcs = [
"metrics.proto",
],
visibility = ["//visibility:public"],
)

proto_library(
name = "client_model_protos_lib",
srcs = [":client_model_protos_src"],
visibility = ["//visibility:public"],
)

cc_proto_library(
name = "client_model_protos",
deps = [":client_model_protos_lib"],
visibility = ["//visibility:public"],
)
""",
)
1 change: 1 addition & 0 deletions test/build/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ api_cc_test(
"//api:eds",
"//api:hds",
"//api:lds",
"//api:metrics",
"//api:rds",
"//api:rls",
],
Expand Down
1 change: 1 addition & 0 deletions test/build/build_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int main(int argc, char *argv[]) {
"envoy.api.v2.HealthDiscoveryService.StreamHealthCheck",
"envoy.api.v2.ListenerDiscoveryService.FetchListeners",
"envoy.api.v2.ListenerDiscoveryService.StreamListeners",
"envoy.api.v2.MetricsService.StreamMetrics",
"envoy.api.v2.RouteDiscoveryService.FetchRoutes",
"envoy.api.v2.RouteDiscoveryService.StreamRoutes",
"envoy.api.v2.RateLimitService.ShouldRateLimit",
Expand Down