fix: code format (#11258)

* fix: code format

* fix: code format

* fix: code format
This commit is contained in:
Xingpeng Li 2023-01-09 20:02:29 +08:00 committed by GitHub
parent 84b152f40c
commit d8e6dfa42a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 14 deletions

View File

@ -140,9 +140,7 @@ public class DefaultMetricsCollector implements MetricsCollector {
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_SUCCEED, k.getTags(), REQUESTS, v::get))));
doExecute(RequestEvent.Type.FAILED, MetricsStatHandler::get).filter(e->!e.isEmpty())
.ifPresent(map->{
map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_FAILED, k.getTags(), REQUESTS, v::get)));
});
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_FAILED, k.getTags(), REQUESTS, v::get))));
doExecute(RequestEvent.Type.PROCESSING, MetricsStatHandler::get).filter(e->!e.isEmpty())
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_PROCESSING, k.getTags(), REQUESTS, v::get))));
@ -150,13 +148,11 @@ public class DefaultMetricsCollector implements MetricsCollector {
doExecute(RequestEvent.Type.BUSINESS_FAILED, MetricsStatHandler::get).filter(e->!e.isEmpty())
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUEST_BUSINESS_FAILED, k.getTags(), REQUESTS, v::get))));
doExecute(RequestEvent.Type.REQUEST_TIMEOUT, MetricsStatHandler::get).filter(e->!e.isEmpty())
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_TIMEOUT_AGG, k.getTags(), REQUESTS, v::get))));
doExecute(RequestEvent.Type.REQUEST_LIMIT, MetricsStatHandler::get).filter(e->!e.isEmpty())
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_LIMIT_AGG, k.getTags(), REQUESTS, v::get))));
}
private void collectRT(List<MetricSample> list) {

View File

@ -53,7 +53,6 @@ public class DefaultMetricsStatHandler implements MetricsStatHandler {
this.doExecute(interfaceName,methodName,group,version,(metric,counts)->{
AtomicLong count = counts.computeIfAbsent(metric, k -> new AtomicLong(0L));
count.incrementAndGet();
});
}
@ -69,6 +68,5 @@ public class DefaultMetricsStatHandler implements MetricsStatHandler {
return counts;
}
public void doNotify(MethodMetric metric){}
public void doNotify(MethodMetric metric){}
}

View File

@ -31,11 +31,11 @@ import org.apache.dubbo.rpc.RpcInvocation;
public class MetricsCollectExecutor {
private final DefaultMetricsCollector collector;
private final Invocation invocation;
private String interfaceName;
private String methodName;
private String group;
private String version;
private final Invocation invocation;
private String interfaceName;
private String methodName;
private String group;
private String version;
public MetricsCollectExecutor(DefaultMetricsCollector collector, Invocation invocation) {

View File

@ -62,7 +62,7 @@ public class MetricsFilter implements Filter, BaseFilter.Listener, ScopeModelAwa
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
collect(invocation,collector-> collector.throwExecute(t));
collect(invocation, collector-> collector.throwExecute(t));
}
private void collect(Invocation invocation, Consumer<MetricsCollectExecutor> execute) {