Search in sources :

Example 1 with SpectatorRequestMetricCollector

use of com.netflix.spectator.aws.SpectatorRequestMetricCollector in project titus-control-plane by Netflix.

the class AmazonClientProvider method getLoadBalancingClient.

public AmazonElasticLoadBalancingAsync getLoadBalancingClient(String accountId) {
    AmazonElasticLoadBalancingAsync client = loadBalancerClients.get(accountId);
    if (client == null) {
        synchronized (this) {
            client = loadBalancerClients.get(accountId);
            if (client == null) {
                String region = AwsRegionConfigurationUtil.resolveDataPlaneRegion(configuration);
                AWSCredentialsProvider credentialsProvider = getAwsCredentialsProvider(accountId);
                client = AmazonElasticLoadBalancingAsyncClientBuilder.standard().withCredentials(credentialsProvider).withRegion(region).withMetricsCollector(new SpectatorRequestMetricCollector(registry)).build();
                loadBalancerClients.put(accountId, client);
            }
        }
    }
    return client;
}
Also used : SpectatorRequestMetricCollector(com.netflix.spectator.aws.SpectatorRequestMetricCollector) AmazonElasticLoadBalancingAsync(com.amazonaws.services.elasticloadbalancingv2.AmazonElasticLoadBalancingAsync) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider)

Aggregations

AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)1 AmazonElasticLoadBalancingAsync (com.amazonaws.services.elasticloadbalancingv2.AmazonElasticLoadBalancingAsync)1 SpectatorRequestMetricCollector (com.netflix.spectator.aws.SpectatorRequestMetricCollector)1