Search in sources :

Example 71 with MetricCollector

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;
}
Also used : MetricCollector(software.amazon.awssdk.metrics.MetricCollector)

Example 72 with MetricCollector

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);
}
Also used : MetricCollection(software.amazon.awssdk.metrics.MetricCollection) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Test(org.junit.Test)

Example 73 with MetricCollector

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);
}
Also used : MetricCollection(software.amazon.awssdk.metrics.MetricCollection) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Test(org.junit.Test)

Example 74 with MetricCollector

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");
}
Also used : MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Test(org.junit.Test)

Example 75 with MetricCollector

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();
}
Also used : MetricCollection(software.amazon.awssdk.metrics.MetricCollection) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Test(org.junit.Test)

Aggregations

MetricCollector (software.amazon.awssdk.metrics.MetricCollector)115 NoOpMetricCollector (software.amazon.awssdk.metrics.NoOpMetricCollector)65 MetricPublisher (software.amazon.awssdk.metrics.MetricPublisher)64 AwsServiceException (software.amazon.awssdk.awscore.exception.AwsServiceException)59 ClientExecutionParams (software.amazon.awssdk.core.client.handler.ClientExecutionParams)47 CompletableFuture (java.util.concurrent.CompletableFuture)37 JsonOperationMetadata (software.amazon.awssdk.protocols.json.JsonOperationMetadata)35 Collections (java.util.Collections)34 List (java.util.List)34 Logger (org.slf4j.Logger)34 LoggerFactory (org.slf4j.LoggerFactory)34 Generated (software.amazon.awssdk.annotations.Generated)34 SdkInternalApi (software.amazon.awssdk.annotations.SdkInternalApi)34 AwsAsyncClientHandler (software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler)34 RequestOverrideConfiguration (software.amazon.awssdk.core.RequestOverrideConfiguration)34 SdkClientConfiguration (software.amazon.awssdk.core.client.config.SdkClientConfiguration)34 SdkClientOption (software.amazon.awssdk.core.client.config.SdkClientOption)34 AsyncClientHandler (software.amazon.awssdk.core.client.handler.AsyncClientHandler)34 HttpResponseHandler (software.amazon.awssdk.core.http.HttpResponseHandler)34 CoreMetric (software.amazon.awssdk.core.metrics.CoreMetric)34