Search in sources :

Example 1 with MetricsFetcherMetrics

use of org.cloudfoundry.promregator.fetcher.MetricsFetcherMetrics in project promregator by promregator.

the class AbstractMetricsEndpoint method createMetricsFetchers.

protected List<MetricsFetcher> createMetricsFetchers(List<Instance> instanceList) {
    List<MetricsFetcher> callablesList = new LinkedList<>();
    for (Instance instance : instanceList) {
        log.info(String.format("Instance %s", instance.getInstanceId()));
        Target target = instance.getTarget();
        String orgName = target.getOrgName();
        String spaceName = target.getSpaceName();
        String appName = target.getApplicationName();
        String accessURL = instance.getAccessUrl();
        if (accessURL == null) {
            log.warn(String.format("Unable to retrieve hostname for %s/%s/%s; skipping", orgName, spaceName, appName));
            continue;
        }
        AbstractMetricFamilySamplesEnricher mfse = new CFMetricFamilySamplesEnricher(orgName, spaceName, appName, instance.getInstanceId());
        MetricsFetcherMetrics mfm = new MetricsFetcherMetrics(mfse, up);
        MetricsFetcher mf = null;
        if (this.proxyHost != null && this.proxyPort != 0) {
            mf = new CFMetricsFetcher(accessURL, instance.getInstanceId(), this.ae, mfse, this.proxyHost, this.proxyPort, mfm);
        } else {
            mf = new CFMetricsFetcher(accessURL, instance.getInstanceId(), this.ae, mfse, mfm);
        }
        callablesList.add(mf);
    }
    return callablesList;
}
Also used : MetricsFetcherMetrics(org.cloudfoundry.promregator.fetcher.MetricsFetcherMetrics) CFMetricFamilySamplesEnricher(org.cloudfoundry.promregator.rewrite.CFMetricFamilySamplesEnricher) CFMetricsFetcher(org.cloudfoundry.promregator.fetcher.CFMetricsFetcher) Target(org.cloudfoundry.promregator.config.Target) Instance(org.cloudfoundry.promregator.scanner.Instance) AbstractMetricFamilySamplesEnricher(org.cloudfoundry.promregator.rewrite.AbstractMetricFamilySamplesEnricher) MetricsFetcher(org.cloudfoundry.promregator.fetcher.MetricsFetcher) CFMetricsFetcher(org.cloudfoundry.promregator.fetcher.CFMetricsFetcher) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 Target (org.cloudfoundry.promregator.config.Target)1 CFMetricsFetcher (org.cloudfoundry.promregator.fetcher.CFMetricsFetcher)1 MetricsFetcher (org.cloudfoundry.promregator.fetcher.MetricsFetcher)1 MetricsFetcherMetrics (org.cloudfoundry.promregator.fetcher.MetricsFetcherMetrics)1 AbstractMetricFamilySamplesEnricher (org.cloudfoundry.promregator.rewrite.AbstractMetricFamilySamplesEnricher)1 CFMetricFamilySamplesEnricher (org.cloudfoundry.promregator.rewrite.CFMetricFamilySamplesEnricher)1 Instance (org.cloudfoundry.promregator.scanner.Instance)1