use of software.amazon.awssdk.metrics.MetricCollector in project aws-sdk-java-v2 by aws.
the class DefaultMetricCollector method createChild.
@Override
public synchronized MetricCollector createChild(String name) {
MetricCollector child = new DefaultMetricCollector(name);
children.add(child);
return child;
}
use of software.amazon.awssdk.metrics.MetricCollector in project aws-sdk-java-v2 by aws.
the class DefaultMetricCollectorTest method testCollect_returnedCollectionContainsAllChildren.
@Test
public void testCollect_returnedCollectionContainsAllChildren() {
MetricCollector parent = MetricCollector.create("parent");
String[] childNames = { "c1", "c2", "c3" };
Stream.of(childNames).forEach(parent::createChild);
MetricCollection collected = parent.collect();
assertThat(collected.children().stream().map(MetricCollection::name)).containsExactly(childNames);
}
use of software.amazon.awssdk.metrics.MetricCollector in project aws-sdk-java-v2 by aws.
the class DefaultMetricCollectorTest method testCollect_allReportedMetricsInCollection.
@Test
public void testCollect_allReportedMetricsInCollection() {
MetricCollector collector = MetricCollector.create("collector");
Integer[] values = { 1, 2, 3 };
Stream.of(values).forEach(v -> collector.reportMetric(M1, v));
MetricCollection collect = collector.collect();
assertThat(collect.metricValues(M1)).containsExactly(values);
}
use of software.amazon.awssdk.metrics.MetricCollector in project aws-sdk-java-v2 by aws.
the class DefaultMetricCollectorTest method testName_returnsName.
@Test
public void testName_returnsName() {
MetricCollector collector = MetricCollector.create("collector");
assertThat(collector.name()).isEqualTo("collector");
}
use of software.amazon.awssdk.metrics.MetricCollector in project aws-sdk-java-v2 by aws.
the class ApacheMetricsTest method concurrencyAcquireDurationIsRecorded.
@Test
public void concurrencyAcquireDurationIsRecorded() throws IOException {
client = ApacheHttpClient.create();
MetricCollector collector = MetricCollector.create("test");
makeRequestWithMetrics(client, collector);
MetricCollection collection = collector.collect();
assertThat(collection.metricValues(CONCURRENCY_ACQUIRE_DURATION)).isNotEmpty();
}
Aggregations