in grpc-gcp/src/main/java/com/google/cloud/grpc/GcpMultiEndpointChannel.java [520:563]
private void createMetrics() {
if (gcpMetricsOptions == null) {
return;
}
MetricRegistry metricRegistry = gcpMetricsOptions.getMetricRegistry();
if (metricRegistry == null) {
return;
}
if (endpointStateMetric != null) {
return;
}
String prefix = gcpMetricsOptions.getNamePrefix();
endpointStateMetric =
metricRegistry.addDerivedLongGauge(
prefix + METRIC_ENDPOINT_STATE,
createMetricOptions(
"Reports 1 when endpoint is in the status.",
COUNT,
LabelKey.create(ENDPOINT_LABEL, ENDPOINT_LABEL_DESC),
LabelKey.create(STATUS_LABEL, STATUS_LABEL_DESC)));
endpointSwitchMetric =
metricRegistry.addDerivedLongCumulative(
prefix + METRIC_ENDPOINT_SWITCH,
createMetricOptions(
"Reports occurrences of changes of current endpoint for a multi-endpoint with "
+ "the name, specifying change type.",
COUNT,
LabelKey.create(ME_NAME_LABEL, ME_NAME_LABEL_DESC),
LabelKey.create(SWITCH_TYPE_LABEL, SWITCH_TYPE_LABEL_DESC)));
currentEndpointMetric =
metricRegistry.addDerivedLongGauge(
prefix + METRIC_CURRENT_ENDPOINT,
createMetricOptions(
"Reports 1 when an endpoint is current for multi-endpoint with the name.",
COUNT,
LabelKey.create(ME_NAME_LABEL, ME_NAME_LABEL_DESC),
LabelKey.create(ENDPOINT_LABEL, ENDPOINT_LABEL_DESC)));
}