Merge remote-tracking branch 'apache/3.2' into apache-3.2
This commit is contained in:
commit
03fde083b7
|
|
@ -134,39 +134,39 @@ public class DefaultMetricsCollector implements MetricsCollector {
|
|||
|
||||
private void collectRequests(List<MetricSample> list) {
|
||||
doExecute(RequestEvent.Type.TOTAL, MetricsStatHandler::get).filter(e->!e.isEmpty())
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_TOTAL, k.getTags(), REQUESTS, v::get))));
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_TOTAL, k.getTags(), REQUESTS, v::get))));
|
||||
|
||||
doExecute(RequestEvent.Type.SUCCEED, MetricsStatHandler::get).filter(e->!e.isEmpty())
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_SUCCEED, k.getTags(), REQUESTS, v::get))));
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_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.PROVIDER_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))));
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_PROCESSING, k.getTags(), REQUESTS, v::get))));
|
||||
|
||||
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))));
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_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))));
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_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))));
|
||||
.ifPresent(map-> map.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_LIMIT_AGG, k.getTags(), REQUESTS, v::get))));
|
||||
}
|
||||
|
||||
private void collectRT(List<MetricSample> list) {
|
||||
this.stats.getLastRT().forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_LAST, k.getTags(), RT, v::get)));
|
||||
this.stats.getMinRT().forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_MIN, k.getTags(), RT, v::get)));
|
||||
this.stats.getMaxRT().forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_MAX, k.getTags(), RT, v::get)));
|
||||
this.stats.getLastRT().forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_LAST, k.getTags(), RT, v::get)));
|
||||
this.stats.getMinRT().forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_MIN, k.getTags(), RT, v::get)));
|
||||
this.stats.getMaxRT().forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_MAX, k.getTags(), RT, v::get)));
|
||||
|
||||
this.stats.getTotalRT().forEach((k, v) -> {
|
||||
list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_TOTAL, k.getTags(), RT, v::get));
|
||||
list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_TOTAL, k.getTags(), RT, v::get));
|
||||
|
||||
AtomicLong avg = this.stats.getAvgRT().get(k);
|
||||
AtomicLong count = this.stats.getRtCount().get(k);
|
||||
avg.set(v.get() / count.get());
|
||||
list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_AVG, k.getTags(), RT, avg::get));
|
||||
list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_AVG, k.getTags(), RT, avg::get));
|
||||
});
|
||||
}
|
||||
private <T> Optional<T> doExecute(RequestEvent.Type requestType, Function<MetricsStatHandler,T> statExecutor) {
|
||||
|
|
|
|||
|
|
@ -19,27 +19,30 @@ package org.apache.dubbo.common.metrics.model;
|
|||
|
||||
public enum MetricsKey {
|
||||
|
||||
METRIC_REQUESTS_TOTAL("requests.total", "Total Requests"),
|
||||
METRIC_REQUESTS_SUCCEED("requests.succeed", "Succeed Requests"),
|
||||
METRIC_REQUESTS_FAILED("requests.failed", "Failed Requests"),
|
||||
METRIC_REQUEST_BUSINESS_FAILED("requests.business.failed","Failed Business Requests"),
|
||||
METRIC_REQUESTS_PROCESSING("requests.processing", "Processing Requests"),
|
||||
// provider metrics key
|
||||
PROVIDER_METRIC_REQUESTS_TOTAL("dubbo.provider.requests.total", "Total Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_SUCCEED("dubbo.provider.requests.succeed", "Succeed Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_FAILED("dubbo.provider.requests.failed", "Failed Requests"),
|
||||
PROVIDER_METRIC_REQUEST_BUSINESS_FAILED("dubbo.provider.requests.business.failed","Failed Business Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_PROCESSING("dubbo.provider.requests.processing", "Processing Requests"),
|
||||
|
||||
METRIC_REQUESTS_TOTAL_AGG("requests.total.aggregate", "Aggregated Total Requests"),
|
||||
METRIC_REQUESTS_SUCCEED_AGG("requests.succeed.aggregate", "Aggregated Succeed Requests"),
|
||||
METRIC_REQUESTS_FAILED_AGG("requests.failed.aggregate", "Aggregated Failed Requests"),
|
||||
METRIC_REQUESTS_BUSINESS_FAILED_AGG("requests.business.failed.aggregate", "Aggregated Business Failed Requests"),
|
||||
METRIC_REQUESTS_TIMEOUT_AGG("requests.timeout.failed.aggregate", "Aggregated timeout Failed Requests"),
|
||||
METRIC_REQUESTS_LIMIT_AGG("requests.limit.aggregate", "Aggregated limit Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_TOTAL_AGG("dubbo.provider.requests.total.aggregate", "Aggregated Total Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_SUCCEED_AGG("dubbo.provider.requests.succeed.aggregate", "Aggregated Succeed Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_FAILED_AGG("dubbo.provider.requests.failed.aggregate", "Aggregated Failed Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_BUSINESS_FAILED_AGG("dubbo.provider.requests.business.failed.aggregate", "Aggregated Business Failed Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_TIMEOUT_AGG("dubbo.provider.requests.timeout.failed.aggregate", "Aggregated timeout Failed Requests"),
|
||||
PROVIDER_METRIC_REQUESTS_LIMIT_AGG("dubbo.provider.requests.limit.aggregate", "Aggregated limit Requests"),
|
||||
|
||||
METRIC_QPS("qps", "Query Per Seconds"),
|
||||
METRIC_RT_LAST("rt.last", "Last Response Time"),
|
||||
METRIC_RT_MIN("rt.min", "Min Response Time"),
|
||||
METRIC_RT_MAX("rt.max", "Max Response Time"),
|
||||
METRIC_RT_TOTAL("rt.total", "Total Response Time"),
|
||||
METRIC_RT_AVG("rt.avg", "Average Response Time"),
|
||||
METRIC_RT_P99("rt.p99", "Response Time P99"),
|
||||
METRIC_RT_P95("rt.p95", "Response Time P95"),
|
||||
PROVIDER_METRIC_QPS("dubbo.provider.qps", "Query Per Seconds"),
|
||||
PROVIDER_METRIC_RT_LAST("dubbo.provider.rt.last", "Last Response Time"),
|
||||
PROVIDER_METRIC_RT_MIN("dubbo.provider.rt.min", "Min Response Time"),
|
||||
PROVIDER_METRIC_RT_MAX("dubbo.provider.rt.max", "Max Response Time"),
|
||||
PROVIDER_METRIC_RT_TOTAL("dubbo.provider.rt.total", "Total Response Time"),
|
||||
PROVIDER_METRIC_RT_AVG("dubbo.provider.rt.avg", "Average Response Time"),
|
||||
PROVIDER_METRIC_RT_P99("dubbo.provider.rt.p99", "Response Time P99"),
|
||||
PROVIDER_METRIC_RT_P95("dubbo.provider.rt.p95", "Response Time P95"),
|
||||
|
||||
// consumer metrics key
|
||||
;
|
||||
|
||||
private final String name;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.apache.dubbo.common.metrics.event.MetricsEvent;
|
|||
import org.apache.dubbo.common.metrics.event.RTEvent;
|
||||
import org.apache.dubbo.common.metrics.event.RequestEvent;
|
||||
import org.apache.dubbo.common.metrics.listener.MetricsListener;
|
||||
import org.apache.dubbo.common.metrics.model.MetricsKey;
|
||||
import org.apache.dubbo.common.metrics.model.sample.GaugeMetricSample;
|
||||
import org.apache.dubbo.common.metrics.model.sample.MetricSample;
|
||||
import org.apache.dubbo.config.ApplicationConfig;
|
||||
|
|
@ -99,7 +100,7 @@ class DefaultMetricsCollectorTest {
|
|||
return number.longValue();
|
||||
}));
|
||||
|
||||
Assertions.assertEquals(sampleMap.get("requests.processing"), 0L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_PROCESSING.getName()), 0L);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -124,11 +125,11 @@ class DefaultMetricsCollectorTest {
|
|||
return number.longValue();
|
||||
}));
|
||||
|
||||
Assertions.assertEquals(sampleMap.get("rt.last"), 0L);
|
||||
Assertions.assertEquals(sampleMap.get("rt.min"), 0L);
|
||||
Assertions.assertEquals(sampleMap.get("rt.max"), 10L);
|
||||
Assertions.assertEquals(sampleMap.get("rt.avg"), 5L);
|
||||
Assertions.assertEquals(sampleMap.get("rt.total"), 10L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_RT_LAST.getName()), 0L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_RT_MIN.getName()), 0L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_RT_MAX.getName()), 10L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_RT_AVG.getName()), 5L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_RT_TOTAL.getName()), 10L);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -162,4 +163,4 @@ class DefaultMetricsCollectorTest {
|
|||
return curEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,22 +148,22 @@ public class AggregateMetricsCollector implements MetricsCollector, MetricsListe
|
|||
}
|
||||
|
||||
private void collectRequests(List<MetricSample> list) {
|
||||
totalRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_TOTAL_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
succeedRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_SUCCEED_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
failedRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_FAILED_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
businessFailedRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_BUSINESS_FAILED_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
timeoutRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_TIMEOUT_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
limitRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_REQUESTS_LIMIT_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
totalRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_TOTAL_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
succeedRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
failedRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_FAILED_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
businessFailedRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_BUSINESS_FAILED_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
timeoutRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_TIMEOUT_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
limitRequests.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_REQUESTS_LIMIT_AGG, k.getTags(), REQUESTS, v::get)));
|
||||
}
|
||||
|
||||
private void collectQPS(List<MetricSample> list) {
|
||||
qps.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.METRIC_QPS, k.getTags(), QPS, () -> v.get() / v.bucketLivedSeconds())));
|
||||
qps.forEach((k, v) -> list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_QPS, k.getTags(), QPS, () -> v.get() / v.bucketLivedSeconds())));
|
||||
}
|
||||
|
||||
private void collectRT(List<MetricSample> list) {
|
||||
rt.forEach((k, v) -> {
|
||||
list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_P99, k.getTags(), RT, () -> v.quantile(0.99)));
|
||||
list.add(new GaugeMetricSample(MetricsKey.METRIC_RT_P95, k.getTags(), RT, () -> v.quantile(0.95)));
|
||||
list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_P99, k.getTags(), RT, () -> v.quantile(0.99)));
|
||||
list.add(new GaugeMetricSample(MetricsKey.PROVIDER_METRIC_RT_P95, k.getTags(), RT, () -> v.quantile(0.95)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,12 +104,12 @@ class AggregateMetricsCollectorTest {
|
|||
return number.longValue();
|
||||
}));
|
||||
|
||||
Assertions.assertEquals(sampleMap.get("requests.total.aggregate"), 1L);
|
||||
Assertions.assertEquals(sampleMap.get("requests.succeed.aggregate"), 1L);
|
||||
Assertions.assertEquals(sampleMap.get("requests.failed.aggregate"), 1L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.METRIC_REQUESTS_BUSINESS_FAILED_AGG.getName()), 1L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_TOTAL_AGG.getName()), 1L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED_AGG.getName()), 1L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_FAILED_AGG.getName()), 1L);
|
||||
Assertions.assertEquals(sampleMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_BUSINESS_FAILED_AGG.getName()), 1L);
|
||||
|
||||
Assertions.assertTrue(sampleMap.containsKey("qps"));
|
||||
Assertions.assertTrue(sampleMap.containsKey(MetricsKey.PROVIDER_METRIC_QPS.getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -132,7 +132,7 @@ class AggregateMetricsCollectorTest {
|
|||
return number.longValue();
|
||||
}));
|
||||
|
||||
Assertions.assertTrue(sampleMap.containsKey("rt.p99"));
|
||||
Assertions.assertTrue(sampleMap.containsKey("rt.p95"));
|
||||
Assertions.assertTrue(sampleMap.containsKey(MetricsKey.PROVIDER_METRIC_RT_P99.getName()));
|
||||
Assertions.assertTrue(sampleMap.containsKey(MetricsKey.PROVIDER_METRIC_RT_P95.getName()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ class MetricsFilterTest {
|
|||
}
|
||||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
Assertions.assertTrue(metricsMap.containsKey("requests.failed"));
|
||||
Assertions.assertFalse(metricsMap.containsKey("requests.succeed"));
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUESTS_FAILED.getName()));
|
||||
Assertions.assertFalse(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName()));
|
||||
|
||||
MetricSample sample = metricsMap.get("requests.failed");
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_FAILED.getName());
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
Assertions.assertEquals(tags.get(TAG_INTERFACE_KEY), INTERFACE_NAME);
|
||||
|
|
@ -131,10 +131,10 @@ class MetricsFilterTest {
|
|||
}
|
||||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.METRIC_REQUEST_BUSINESS_FAILED.getName()));
|
||||
Assertions.assertFalse(metricsMap.containsKey("requests.succeed"));
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUEST_BUSINESS_FAILED.getName()));
|
||||
Assertions.assertFalse(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName()));
|
||||
|
||||
MetricSample sample = metricsMap.get(MetricsKey.METRIC_REQUEST_BUSINESS_FAILED.getName());
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUEST_BUSINESS_FAILED.getName());
|
||||
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
|
|
@ -163,9 +163,9 @@ class MetricsFilterTest {
|
|||
}
|
||||
}
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.METRIC_REQUESTS_TIMEOUT_AGG.getName()));
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUESTS_TIMEOUT_AGG.getName()));
|
||||
|
||||
MetricSample sample = metricsMap.get(MetricsKey.METRIC_REQUESTS_TIMEOUT_AGG.getName());
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_TIMEOUT_AGG.getName());
|
||||
|
||||
Assertions.assertSame(((GaugeMetricSample) sample).getSupplier().get().longValue(), count);
|
||||
}
|
||||
|
|
@ -188,9 +188,9 @@ class MetricsFilterTest {
|
|||
}
|
||||
}
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.METRIC_REQUESTS_LIMIT_AGG.getName()));
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUESTS_LIMIT_AGG.getName()));
|
||||
|
||||
MetricSample sample = metricsMap.get(MetricsKey.METRIC_REQUESTS_LIMIT_AGG.getName());
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_LIMIT_AGG.getName());
|
||||
|
||||
Assertions.assertSame(((GaugeMetricSample) sample).getSupplier().get().longValue(), count);
|
||||
}
|
||||
|
|
@ -206,10 +206,10 @@ class MetricsFilterTest {
|
|||
filter.onResponse(result, invoker, invocation);
|
||||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
Assertions.assertFalse(metricsMap.containsKey("requests.failed"));
|
||||
Assertions.assertTrue(metricsMap.containsKey("requests.succeed"));
|
||||
Assertions.assertFalse(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUEST_BUSINESS_FAILED.getName()));
|
||||
Assertions.assertTrue(metricsMap.containsKey(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName()));
|
||||
|
||||
MetricSample sample = metricsMap.get("requests.succeed");
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName());
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
Assertions.assertEquals(tags.get(TAG_INTERFACE_KEY), INTERFACE_NAME);
|
||||
|
|
@ -232,7 +232,7 @@ class MetricsFilterTest {
|
|||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
|
||||
MetricSample sample = metricsMap.get("requests.succeed");
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName());
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
Assertions.assertEquals(tags.get(TAG_INTERFACE_KEY), INTERFACE_NAME);
|
||||
|
|
@ -255,7 +255,7 @@ class MetricsFilterTest {
|
|||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
|
||||
MetricSample sample = metricsMap.get("requests.succeed");
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName());
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
Assertions.assertEquals(tags.get(TAG_INTERFACE_KEY), INTERFACE_NAME);
|
||||
|
|
@ -278,7 +278,7 @@ class MetricsFilterTest {
|
|||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
|
||||
MetricSample sample = metricsMap.get("requests.succeed");
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_SUCCEED.getName());
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
Assertions.assertEquals(tags.get(TAG_INTERFACE_KEY), INTERFACE_NAME);
|
||||
|
|
@ -305,7 +305,7 @@ class MetricsFilterTest {
|
|||
|
||||
Map<String, MetricSample> metricsMap = getMetricsMap();
|
||||
|
||||
MetricSample sample = metricsMap.get("requests.processing");
|
||||
MetricSample sample = metricsMap.get(MetricsKey.PROVIDER_METRIC_REQUESTS_PROCESSING.getName());
|
||||
Map<String, String> tags = sample.getTags();
|
||||
|
||||
Assertions.assertEquals(tags.get(TAG_INTERFACE_KEY), INTERFACE_NAME);
|
||||
|
|
|
|||
Loading…
Reference in New Issue