Search in sources :

Example 1 with Resource

use of ai.asserts.aws.resource.Resource in project aws-cloudwatch-exporter by asserts.

the class LBToECSRoutingBuilder method getRoutings.

public Set<ResourceRelation> getRoutings(EcsClient ecsClient, Resource cluster, List<Resource> services) {
    Set<ResourceRelation> routing = new HashSet<>();
    log.info("Updating Resource Relation for ECS Cluster {}", cluster);
    try {
        String api = "EcsClient/describeServices";
        DescribeServicesResponse response = rateLimiter.doWithRateLimit(api, ImmutableSortedMap.of(SCRAPE_REGION_LABEL, cluster.getRegion(), SCRAPE_ACCOUNT_ID_LABEL, cluster.getAccount(), SCRAPE_OPERATION_LABEL, api), () -> ecsClient.describeServices(DescribeServicesRequest.builder().cluster(cluster.getArn()).services(services.stream().map(Resource::getArn).collect(Collectors.toList())).build()));
        if (response.hasServices()) {
            response.services().stream().filter(service -> resourceMapper.map(service.serviceArn()).isPresent()).forEach(service -> {
                Optional<Resource> servResOpt = resourceMapper.map(service.serviceArn());
                servResOpt.ifPresent(servRes -> routing.addAll(service.loadBalancers().stream().map(loadBalancer -> resourceMapper.map(loadBalancer.targetGroupArn())).filter(Optional::isPresent).map(Optional::get).map(tg -> targetGroupLBMapProvider.getTgToLB().get(tg)).filter(Objects::nonNull).map(lb -> ResourceRelation.builder().from(lb).to(servRes).name("ROUTES_TO").build()).collect(Collectors.toSet())));
            });
        }
    } catch (Exception e) {
        log.error("Failed to build resource relations", e);
    }
    return routing;
}
Also used : ResourceRelation(ai.asserts.aws.resource.ResourceRelation) SCRAPE_ACCOUNT_ID_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_ACCOUNT_ID_LABEL) Set(java.util.Set) ResourceMapper(ai.asserts.aws.resource.ResourceMapper) Resource(ai.asserts.aws.resource.Resource) Collectors(java.util.stream.Collectors) SCRAPE_REGION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_REGION_LABEL) HashSet(java.util.HashSet) Objects(java.util.Objects) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) List(java.util.List) RateLimiter(ai.asserts.aws.RateLimiter) DescribeServicesRequest(software.amazon.awssdk.services.ecs.model.DescribeServicesRequest) SCRAPE_OPERATION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_OPERATION_LABEL) EcsClient(software.amazon.awssdk.services.ecs.EcsClient) Optional(java.util.Optional) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) DescribeServicesResponse(software.amazon.awssdk.services.ecs.model.DescribeServicesResponse) ResourceRelation(ai.asserts.aws.resource.ResourceRelation) Optional(java.util.Optional) Resource(ai.asserts.aws.resource.Resource) Objects(java.util.Objects) DescribeServicesResponse(software.amazon.awssdk.services.ecs.model.DescribeServicesResponse) HashSet(java.util.HashSet)

Example 2 with Resource

use of ai.asserts.aws.resource.Resource in project aws-cloudwatch-exporter by asserts.

the class LBToLambdaRoutingBuilder method getRoutings.

public Set<ResourceRelation> getRoutings() {
    log.info("LB To Lambda routing relation builder about to build relations");
    Set<ResourceRelation> routing = new HashSet<>();
    scrapeConfigProvider.getScrapeConfig().getRegions().forEach(region -> {
        try (ElasticLoadBalancingV2Client elbV2Client = awsClientProvider.getELBV2Client(region)) {
            Map<Resource, Resource> tgToLB = targetGroupLBMapProvider.getTgToLB();
            tgToLB.keySet().forEach(tg -> {
                try {
                    String api = "ElasticLoadBalancingV2Client/describeTargetHealth";
                    DescribeTargetHealthResponse response = rateLimiter.doWithRateLimit(api, ImmutableSortedMap.of(SCRAPE_REGION_LABEL, region, SCRAPE_ACCOUNT_ID_LABEL, accountIDProvider.getAccountId(), SCRAPE_OPERATION_LABEL, api), () -> elbV2Client.describeTargetHealth(DescribeTargetHealthRequest.builder().targetGroupArn(tg.getArn()).build()));
                    if (!isEmpty(response.targetHealthDescriptions())) {
                        response.targetHealthDescriptions().stream().map(tH -> resourceMapper.map(tH.target().id())).filter(opt -> opt.isPresent() && opt.get().getType().equals(LambdaFunction)).map(Optional::get).forEach(lambda -> routing.add(ResourceRelation.builder().from(tgToLB.get(tg)).to(lambda).name("ROUTES_TO").build()));
                    }
                } catch (Exception e) {
                    log.error("Failed to build resource relations", e);
                }
            });
        }
    });
    return routing;
}
Also used : LambdaFunction(ai.asserts.aws.resource.ResourceType.LambdaFunction) CollectionUtils.isEmpty(org.springframework.util.CollectionUtils.isEmpty) DescribeTargetHealthResponse(software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeTargetHealthResponse) ResourceRelation(ai.asserts.aws.resource.ResourceRelation) SCRAPE_ACCOUNT_ID_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_ACCOUNT_ID_LABEL) AWSClientProvider(ai.asserts.aws.AWSClientProvider) ScrapeConfigProvider(ai.asserts.aws.cloudwatch.config.ScrapeConfigProvider) Set(java.util.Set) ResourceMapper(ai.asserts.aws.resource.ResourceMapper) Resource(ai.asserts.aws.resource.Resource) ElasticLoadBalancingV2Client(software.amazon.awssdk.services.elasticloadbalancingv2.ElasticLoadBalancingV2Client) SCRAPE_REGION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_REGION_LABEL) HashSet(java.util.HashSet) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) RateLimiter(ai.asserts.aws.RateLimiter) Map(java.util.Map) SCRAPE_OPERATION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_OPERATION_LABEL) Optional(java.util.Optional) DescribeTargetHealthRequest(software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeTargetHealthRequest) AllArgsConstructor(lombok.AllArgsConstructor) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) ResourceRelation(ai.asserts.aws.resource.ResourceRelation) Resource(ai.asserts.aws.resource.Resource) ElasticLoadBalancingV2Client(software.amazon.awssdk.services.elasticloadbalancingv2.ElasticLoadBalancingV2Client) DescribeTargetHealthResponse(software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeTargetHealthResponse) HashSet(java.util.HashSet)

Example 3 with Resource

use of ai.asserts.aws.resource.Resource in project aws-cloudwatch-exporter by asserts.

the class LambdaCapacityExporter method getMetrics.

private List<MetricFamilySamples> getMetrics() {
    ScrapeConfig scrapeConfig = scrapeConfigProvider.getScrapeConfig();
    Optional<NamespaceConfig> optional = scrapeConfig.getLambdaConfig();
    String availableMetric = metricNameUtil.getLambdaMetric("available_concurrency");
    String requestedMetric = metricNameUtil.getLambdaMetric("requested_concurrency");
    String allocatedMetric = metricNameUtil.getLambdaMetric("allocated_concurrency");
    String reservedMetric = metricNameUtil.getLambdaMetric("reserved_concurrency");
    String timeoutMetric = metricNameUtil.getLambdaMetric("timeout_seconds");
    String memoryLimit = metricNameUtil.getLambdaMetric("memory_limit_mb");
    String accountLimitMetric = metricNameUtil.getLambdaMetric("account_limit");
    Map<String, List<MetricFamilySamples.Sample>> samples = new TreeMap<>();
    optional.ifPresent(lambdaConfig -> functionScraper.getFunctions().forEach((region, functions) -> {
        log.info(" - Getting Lambda account and provisioned concurrency for region {}", region);
        try (LambdaClient lambdaClient = awsClientProvider.getLambdaClient(region)) {
            GetAccountSettingsResponse accountSettings = rateLimiter.doWithRateLimit("LambdaClient/getAccountSettings", ImmutableSortedMap.of(SCRAPE_REGION_LABEL, region, SCRAPE_OPERATION_LABEL, "getAccountSettings", SCRAPE_NAMESPACE_LABEL, "AWS/Lambda"), lambdaClient::getAccountSettings);
            MetricFamilySamples.Sample sample = sampleBuilder.buildSingleSample(accountLimitMetric, ImmutableMap.of("region", region, "cw_namespace", lambda.getNormalizedNamespace(), "type", "concurrent_executions"), accountSettings.accountLimit().concurrentExecutions() * 1.0D);
            samples.computeIfAbsent(accountLimitMetric, k -> new ArrayList<>()).add(sample);
            sample = sampleBuilder.buildSingleSample(accountLimitMetric, ImmutableMap.of("region", region, "cw_namespace", lambda.getNormalizedNamespace(), "type", "unreserved_concurrent_executions"), accountSettings.accountLimit().unreservedConcurrentExecutions() * 1.0D);
            samples.computeIfAbsent(accountLimitMetric, k -> new ArrayList<>()).add(sample);
            Set<Resource> fnResources = resourceTagHelper.getFilteredResources(region, lambdaConfig);
            functions.forEach((functionArn, lambdaFunction) -> {
                GetFunctionConcurrencyResponse fCResponse = rateLimiter.doWithRateLimit("LambdaClient/getFunctionConcurrency", ImmutableSortedMap.of(SCRAPE_REGION_LABEL, region, SCRAPE_OPERATION_LABEL, "getFunctionConcurrency", SCRAPE_NAMESPACE_LABEL, "AWS/Lambda"), () -> lambdaClient.getFunctionConcurrency(GetFunctionConcurrencyRequest.builder().functionName(lambdaFunction.getArn()).build()));
                if (fCResponse.reservedConcurrentExecutions() != null) {
                    MetricFamilySamples.Sample reserved = sampleBuilder.buildSingleSample(reservedMetric, ImmutableMap.of("region", region, "cw_namespace", lambda.getNormalizedNamespace(), "d_function_name", lambdaFunction.getName(), "job", lambdaFunction.getName(), SCRAPE_ACCOUNT_ID_LABEL, lambdaFunction.getAccount()), fCResponse.reservedConcurrentExecutions().doubleValue());
                    samples.computeIfAbsent(reservedMetric, k -> new ArrayList<>()).add(reserved);
                }
                Optional<Resource> fnResourceOpt = fnResources.stream().filter(resource -> functionArn.equals(resource.getArn())).findFirst();
                Map<String, String> labels = new TreeMap<>();
                fnResourceOpt.ifPresent(fnResource -> fnResource.addEnvLabel(labels, metricNameUtil));
                labels.put("region", region);
                labels.put("cw_namespace", lambda.getNormalizedNamespace());
                labels.put("d_function_name", lambdaFunction.getName());
                labels.put("job", lambdaFunction.getName());
                labels.put(SCRAPE_ACCOUNT_ID_LABEL, lambdaFunction.getAccount());
                // Export timeout
                double timeout = lambdaFunction.getTimeoutSeconds() * 1.0D;
                samples.computeIfAbsent(timeoutMetric, k -> new ArrayList<>()).add(sampleBuilder.buildSingleSample(timeoutMetric, labels, timeout));
                samples.computeIfAbsent(memoryLimit, k -> new ArrayList<>()).add(sampleBuilder.buildSingleSample(memoryLimit, labels, lambdaFunction.getMemoryMB() * 1.0D));
                ListProvisionedConcurrencyConfigsRequest request = ListProvisionedConcurrencyConfigsRequest.builder().functionName(lambdaFunction.getName()).build();
                ListProvisionedConcurrencyConfigsResponse response = rateLimiter.doWithRateLimit("LambdaClient/listProvisionedConcurrencyConfigs", ImmutableSortedMap.of(SCRAPE_REGION_LABEL, region, SCRAPE_OPERATION_LABEL, "listProvisionedConcurrencyConfigs", SCRAPE_NAMESPACE_LABEL, "AWS/Lambda"), () -> lambdaClient.listProvisionedConcurrencyConfigs(request));
                if (response.hasProvisionedConcurrencyConfigs()) {
                    response.provisionedConcurrencyConfigs().forEach(config -> {
                        // Capacity is always provisioned at alias or version level
                        String[] parts = config.functionArn().split(":");
                        String level = Character.isDigit(parts[parts.length - 1].charAt(0)) ? "d_executed_version" : "d_resource";
                        labels.put(level, parts[parts.length - 1]);
                        Integer available = config.availableProvisionedConcurrentExecutions();
                        samples.computeIfAbsent(availableMetric, k -> new ArrayList<>()).add(sampleBuilder.buildSingleSample(availableMetric, labels, available.doubleValue()));
                        Integer requested = config.requestedProvisionedConcurrentExecutions();
                        samples.computeIfAbsent(requestedMetric, k -> new ArrayList<>()).add(sampleBuilder.buildSingleSample(requestedMetric, labels, requested.doubleValue()));
                        Integer allocated = config.allocatedProvisionedConcurrentExecutions();
                        samples.computeIfAbsent(allocatedMetric, k -> new ArrayList<>()).add(sampleBuilder.buildSingleSample(allocatedMetric, labels, allocated.doubleValue()));
                    });
                }
            });
        } catch (Exception e) {
            log.error("Failed to get lambda provisioned capacity for region " + region, e);
        }
    }));
    return samples.values().stream().map(sampleBuilder::buildFamily).collect(Collectors.toList());
}
Also used : NamespaceConfig(ai.asserts.aws.cloudwatch.config.NamespaceConfig) NamespaceConfig(ai.asserts.aws.cloudwatch.config.NamespaceConfig) AWSClientProvider(ai.asserts.aws.AWSClientProvider) ScrapeConfigProvider(ai.asserts.aws.cloudwatch.config.ScrapeConfigProvider) ListProvisionedConcurrencyConfigsResponse(software.amazon.awssdk.services.lambda.model.ListProvisionedConcurrencyConfigsResponse) GetFunctionConcurrencyResponse(software.amazon.awssdk.services.lambda.model.GetFunctionConcurrencyResponse) ArrayList(java.util.ArrayList) SCRAPE_REGION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_REGION_LABEL) ScrapeConfig(ai.asserts.aws.cloudwatch.config.ScrapeConfig) LambdaClient(software.amazon.awssdk.services.lambda.LambdaClient) RateLimiter(ai.asserts.aws.RateLimiter) Map(java.util.Map) CWNamespace.lambda(ai.asserts.aws.cloudwatch.model.CWNamespace.lambda) LambdaFunctionScraper(ai.asserts.aws.lambda.LambdaFunctionScraper) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) SCRAPE_ACCOUNT_ID_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_ACCOUNT_ID_LABEL) SCRAPE_NAMESPACE_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_NAMESPACE_LABEL) ImmutableMap(com.google.common.collect.ImmutableMap) GetAccountSettingsResponse(software.amazon.awssdk.services.lambda.model.GetAccountSettingsResponse) GetFunctionConcurrencyRequest(software.amazon.awssdk.services.lambda.model.GetFunctionConcurrencyRequest) Set(java.util.Set) ResourceTagHelper(ai.asserts.aws.resource.ResourceTagHelper) Resource(ai.asserts.aws.resource.Resource) Collectors(java.util.stream.Collectors) MetricNameUtil(ai.asserts.aws.MetricNameUtil) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) List(java.util.List) Collector(io.prometheus.client.Collector) TreeMap(java.util.TreeMap) SCRAPE_OPERATION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_OPERATION_LABEL) Optional(java.util.Optional) ListProvisionedConcurrencyConfigsRequest(software.amazon.awssdk.services.lambda.model.ListProvisionedConcurrencyConfigsRequest) Set(java.util.Set) Optional(java.util.Optional) TreeMap(java.util.TreeMap) ListProvisionedConcurrencyConfigsResponse(software.amazon.awssdk.services.lambda.model.ListProvisionedConcurrencyConfigsResponse) ListProvisionedConcurrencyConfigsRequest(software.amazon.awssdk.services.lambda.model.ListProvisionedConcurrencyConfigsRequest) GetFunctionConcurrencyResponse(software.amazon.awssdk.services.lambda.model.GetFunctionConcurrencyResponse) GetAccountSettingsResponse(software.amazon.awssdk.services.lambda.model.GetAccountSettingsResponse) LambdaClient(software.amazon.awssdk.services.lambda.LambdaClient) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) ImmutableMap(com.google.common.collect.ImmutableMap) TreeMap(java.util.TreeMap) ScrapeConfig(ai.asserts.aws.cloudwatch.config.ScrapeConfig)

Example 4 with Resource

use of ai.asserts.aws.resource.Resource in project aws-cloudwatch-exporter by asserts.

the class LambdaEventSourceExporter method getMappings.

private List<MetricFamilySamples> getMappings() {
    Map<String, List<Sample>> samples = new TreeMap<>();
    Map<String, List<EventSourceMappingConfiguration>> byRegion = new TreeMap<>();
    ScrapeConfig scrapeConfig = scrapeConfigProvider.getScrapeConfig();
    scrapeConfig.getLambdaConfig().ifPresent(namespaceConfig -> scrapeConfig.getRegions().forEach(region -> {
        try (LambdaClient client = awsClientProvider.getLambdaClient(region)) {
            // Get all event source mappings
            log.info("Discovering Lambda event source mappings for region={}", region);
            String nextToken = null;
            do {
                ListEventSourceMappingsRequest req = ListEventSourceMappingsRequest.builder().marker(nextToken).build();
                ListEventSourceMappingsResponse response = rateLimiter.doWithRateLimit("LambdaClient/listEventSourceMappings", ImmutableSortedMap.of(SCRAPE_REGION_LABEL, region, SCRAPE_OPERATION_LABEL, "listEventSourceMappings", SCRAPE_NAMESPACE_LABEL, "AWS/Lambda"), () -> client.listEventSourceMappings(req));
                if (response.hasEventSourceMappings()) {
                    byRegion.computeIfAbsent(region, k -> new ArrayList<>()).addAll(response.eventSourceMappings().stream().filter(mapping -> resourceMapper.map(mapping.functionArn()).isPresent()).collect(Collectors.toList()));
                }
                nextToken = response.nextMarker();
            } while (StringUtils.hasText(nextToken));
            Set<Resource> fnResources = resourceTagHelper.getFilteredResources(region, namespaceConfig);
            byRegion.computeIfAbsent(region, k -> new ArrayList<>()).forEach(mappingConfiguration -> {
                Optional<Resource> fnResource = Optional.ofNullable(fnResources.stream().filter(r -> r.getArn().equals(mappingConfiguration.functionArn())).findFirst().orElse(resourceMapper.map(mappingConfiguration.functionArn()).orElse(null)));
                Optional<Resource> eventResourceOpt = resourceMapper.map(mappingConfiguration.eventSourceArn());
                eventResourceOpt.ifPresent(eventResource -> fnResource.ifPresent(fn -> buildSample(region, fn, eventResource, samples)));
            });
        } catch (Exception e) {
            log.info("Failed to discover event source mappings", e);
        }
    }));
    return samples.values().stream().map(sampleBuilder::buildFamily).collect(Collectors.toList());
}
Also used : AWSClientProvider(ai.asserts.aws.AWSClientProvider) ScrapeConfigProvider(ai.asserts.aws.cloudwatch.config.ScrapeConfigProvider) ListEventSourceMappingsResponse(software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsResponse) ResourceMapper(ai.asserts.aws.resource.ResourceMapper) Sample(io.prometheus.client.Collector.MetricFamilySamples.Sample) ArrayList(java.util.ArrayList) SCRAPE_REGION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_REGION_LABEL) ScrapeConfig(ai.asserts.aws.cloudwatch.config.ScrapeConfig) LambdaClient(software.amazon.awssdk.services.lambda.LambdaClient) RateLimiter(ai.asserts.aws.RateLimiter) Map(java.util.Map) CWNamespace.lambda(ai.asserts.aws.cloudwatch.model.CWNamespace.lambda) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) SCRAPE_ACCOUNT_ID_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_ACCOUNT_ID_LABEL) SCRAPE_NAMESPACE_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_NAMESPACE_LABEL) Set(java.util.Set) EventSourceMappingConfiguration(software.amazon.awssdk.services.lambda.model.EventSourceMappingConfiguration) ResourceTagHelper(ai.asserts.aws.resource.ResourceTagHelper) Resource(ai.asserts.aws.resource.Resource) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) MetricNameUtil(ai.asserts.aws.MetricNameUtil) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) List(java.util.List) Collector(io.prometheus.client.Collector) TreeMap(java.util.TreeMap) SCRAPE_OPERATION_LABEL(ai.asserts.aws.MetricNameUtil.SCRAPE_OPERATION_LABEL) Optional(java.util.Optional) ListEventSourceMappingsRequest(software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsRequest) StringUtils(org.springframework.util.StringUtils) Set(java.util.Set) Optional(java.util.Optional) TreeMap(java.util.TreeMap) ListEventSourceMappingsResponse(software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsResponse) ListEventSourceMappingsRequest(software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsRequest) LambdaClient(software.amazon.awssdk.services.lambda.LambdaClient) ArrayList(java.util.ArrayList) List(java.util.List) ScrapeConfig(ai.asserts.aws.cloudwatch.config.ScrapeConfig)

Example 5 with Resource

use of ai.asserts.aws.resource.Resource in project aws-cloudwatch-exporter by asserts.

the class ECSServiceDiscoveryExporter method buildTargetsInCluster.

@VisibleForTesting
List<StaticConfig> buildTargetsInCluster(ScrapeConfig scrapeConfig, EcsClient ecsClient, Resource cluster, Set<ResourceRelation> newRouting) {
    List<StaticConfig> targets = new ArrayList<>();
    // List services just returns the service ARN. There is no need to paginate
    ListServicesRequest serviceReq = ListServicesRequest.builder().cluster(cluster.getName()).build();
    ListServicesResponse serviceResp = rateLimiter.doWithRateLimit("EcsClient/listServices", ImmutableSortedMap.of(SCRAPE_REGION_LABEL, cluster.getRegion(), SCRAPE_OPERATION_LABEL, "listServices", SCRAPE_NAMESPACE_LABEL, "AWS/ECS"), () -> ecsClient.listServices(serviceReq));
    if (serviceResp.hasServiceArns()) {
        List<Resource> services = new ArrayList<>();
        serviceResp.serviceArns().stream().map(resourceMapper::map).filter(Optional::isPresent).map(Optional::get).forEach(service -> {
            if (scrapeConfig.isDiscoverECSTasks()) {
                targets.addAll(buildTargetsInService(scrapeConfig, ecsClient, cluster, service));
            }
            services.add(service);
        });
        newRouting.addAll(lbToECSRoutingBuilder.getRoutings(ecsClient, cluster, services));
    }
    return targets;
}
Also used : ListServicesRequest(software.amazon.awssdk.services.ecs.model.ListServicesRequest) Optional(java.util.Optional) ListServicesResponse(software.amazon.awssdk.services.ecs.model.ListServicesResponse) ArrayList(java.util.ArrayList) Resource(ai.asserts.aws.resource.Resource) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

Resource (ai.asserts.aws.resource.Resource)24 RateLimiter (ai.asserts.aws.RateLimiter)13 ScrapeConfig (ai.asserts.aws.cloudwatch.config.ScrapeConfig)12 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)10 AWSClientProvider (ai.asserts.aws.AWSClientProvider)9 ScrapeConfigProvider (ai.asserts.aws.cloudwatch.config.ScrapeConfigProvider)9 Optional (java.util.Optional)9 Set (java.util.Set)9 Test (org.junit.jupiter.api.Test)9 SCRAPE_OPERATION_LABEL (ai.asserts.aws.MetricNameUtil.SCRAPE_OPERATION_LABEL)8 SCRAPE_REGION_LABEL (ai.asserts.aws.MetricNameUtil.SCRAPE_REGION_LABEL)8 Slf4j (lombok.extern.slf4j.Slf4j)8 Component (org.springframework.stereotype.Component)8 ResourceMapper (ai.asserts.aws.resource.ResourceMapper)7 Map (java.util.Map)7 NamespaceConfig (ai.asserts.aws.cloudwatch.config.NamespaceConfig)6 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)6 EcsClient (software.amazon.awssdk.services.ecs.EcsClient)6 MetricNameUtil (ai.asserts.aws.MetricNameUtil)5