in flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/metrics/KubernetesClientMetrics.java [91:146]
public KubernetesClientMetrics(
MetricGroup parentGroup,
FlinkOperatorConfiguration flinkOperatorConfiguration,
LongSupplier nanoTimeSource) {
this.nanoTimeSource = nanoTimeSource;
MetricGroup metricGroup = parentGroup.addGroup(KUBE_CLIENT_GROUP);
this.requestMetricGroup = metricGroup.addGroup(HTTP_REQUEST_GROUP);
this.failedRequestMetricGroup = requestMetricGroup.addGroup(HTTP_REQUEST_FAILED_GROUP);
this.slowRequestMetricGroup = requestMetricGroup.addGroup(HTTP_REQUEST_SLOW_GROUP);
this.responseMetricGroup = metricGroup.addGroup(HTTP_RESPONSE_GROUP);
this.requestCounter =
OperatorMetricUtils.synchronizedCounter(requestMetricGroup.counter(COUNTER));
this.failedRequestCounter =
OperatorMetricUtils.synchronizedCounter(failedRequestMetricGroup.counter(COUNTER));
this.slowRequestThreshold = flinkOperatorConfiguration.getSlowRequestThreshold();
this.slowRequestCounter =
OperatorMetricUtils.synchronizedCounter(slowRequestMetricGroup.counter(COUNTER));
this.responseCounter =
OperatorMetricUtils.synchronizedCounter(responseMetricGroup.counter(COUNTER));
this.requestRateMeter =
OperatorMetricUtils.synchronizedMeterView(
requestMetricGroup.meter(METER, new MeterView(requestCounter)));
this.requestFailedRateMeter =
OperatorMetricUtils.synchronizedMeterView(
failedRequestMetricGroup.meter(METER, new MeterView(failedRequestCounter)));
this.responseRateMeter =
OperatorMetricUtils.synchronizedMeterView(
responseMetricGroup.meter(METER, new MeterView(responseCounter)));
this.responseLatency =
responseMetricGroup.histogram(
HISTO, OperatorMetricUtils.createHistogram(flinkOperatorConfiguration));
this.httpResponseCodeGroupsEnabled =
flinkOperatorConfiguration.isKubernetesClientMetricsHttpResponseCodeGroupsEnabled();
if (this.httpResponseCodeGroupsEnabled) {
this.responseCodeGroupMeters.add(
createMeterViewForMetricsGroup(
responseMetricGroup.addGroup(HTTP_RESPONSE_1XX)));
this.responseCodeGroupMeters.add(
createMeterViewForMetricsGroup(
responseMetricGroup.addGroup(HTTP_RESPONSE_2XX)));
this.responseCodeGroupMeters.add(
createMeterViewForMetricsGroup(
responseMetricGroup.addGroup(HTTP_RESPONSE_3XX)));
this.responseCodeGroupMeters.add(
createMeterViewForMetricsGroup(
responseMetricGroup.addGroup(HTTP_RESPONSE_4XX)));
this.responseCodeGroupMeters.add(
createMeterViewForMetricsGroup(
responseMetricGroup.addGroup(HTTP_RESPONSE_5XX)));
}
}