Use GKE-specific metrics in the proxy

Associate the custom metrics with the correct monitored resource type. The labels of the monitored resource are either obtained from environment variables for the container, configured in the GKE deployment file, or queried from GCE metadate server. Using the correct monitored resource can help performance and reduced out-of-order metric writes.

Also changed the metrics display name to be more descriptive.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189184411
This commit is contained in:
jianglai 2018-03-15 07:47:33 -07:00
parent 105d62380d
commit 33ec789a44
6 changed files with 330 additions and 16 deletions

View file

@ -62,7 +62,7 @@ public class FrontendMetrics {
.newGauge(
"/proxy/frontend/active_connections",
"Number of active connections from clients to the proxy.",
"Connections",
"Active Connections",
LABELS,
() ->
activeConnections
@ -78,7 +78,7 @@ public class FrontendMetrics {
.newIncrementableMetric(
"/proxy/frontend/total_connections",
"Total number connections ever made from clients to the proxy.",
"Connections",
"Total Connections",
LABELS);
static final IncrementableMetric quotaRejectionsCounter =
@ -86,7 +86,7 @@ public class FrontendMetrics {
.newIncrementableMetric(
"/proxy/frontend/quota_rejections",
"Total number rejected quota request made by proxy for each connection.",
"Rejections",
"Quota Rejections",
LABELS);
@Inject