当前位置: 首页>>代码示例>>Java>>正文


Java UrlBuilder.build方法代码示例

本文整理汇总了Java中com.appdynamics.extensions.http.UrlBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java UrlBuilder.build方法的具体用法?Java UrlBuilder.build怎么用?Java UrlBuilder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.appdynamics.extensions.http.UrlBuilder的用法示例。


在下文中一共展示了UrlBuilder.build方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchMetrics

import com.appdynamics.extensions.http.UrlBuilder; //导入方法依赖的package包/类
private void fetchMetrics(String displayName) {
    if (catEndPoints != null && !catEndPoints.isEmpty()) {
        CatMetricsClient catMetricsClient = new CatMetricsClient();
        Map<String,String> metrics = Maps.newHashMap();
        for (Map catApiConfig : catEndPoints) {
            String endPoint = (String) catApiConfig.get("endPoint");
            String metricPrefix = (String) catApiConfig.get("metricPrefix");
            List<String> metricKeys = (List<String>) catApiConfig.get("metricKeys");
            try {
                UrlBuilder urlBuilder = UrlBuilder.fromYmlServerConfig(server).path(endPoint);
                String url = urlBuilder.build();
                String response = HttpClientUtils.getResponseAsStr(configuration.getHttpClient(), url);
                metrics.putAll(catMetricsClient.extractMetrics(response, metricKeys, metricPrefix));

            } catch (Exception e) {
                logger.error("Unable to execute the request " + endPoint + " Failed with Error :" + e);
            }

        }
        printMetrics(displayName, metrics);
    } else {
        logger.warn("catEndPoints in config.yml is not configured for Elastic Search server " + displayName);
    }
}
 
开发者ID:Appdynamics,项目名称:elasticsearch-monitoring-extension,代码行数:25,代码来源:ElasticSearchMonitorTask.java

示例2: fetchMetrics

import com.appdynamics.extensions.http.UrlBuilder; //导入方法依赖的package包/类
private void fetchMetrics(String serverPrefix) {
    Stat [] stats = getStats();
    if (stats != null && stats.length != 0) {
        for (Stat stat : getStats()) {
            if(!Strings.isNullOrEmpty(stat.getUrl())) {
                logger.debug("Started fetching metrics for endpoint " + stat.getUrl());
                UrlBuilder urlBuilder = UrlBuilder.fromYmlServerConfig(server).path(stat.getUrl() + "&format=json");
                String url = urlBuilder.build();
                JsonNode node = HttpClientUtils.getResponseAsJson(configuration.getHttpClient(), url, JsonNode.class);

                MetricGroup [] metricGroups = stat.getMetricGroups();
                for (MetricGroup metricGroup : metricGroups) {
                    String xpath = metricGroup.getXpath();
                    String metricGroupPrefix = metricGroup.getPrefix();
                    JsonNode jsonNode = JsonUtils.getNestedObject(node.path(stat.getEntryNode()), xpath.split("\\|"));
                    Metric [] metrics = metricGroup.getMetrics();
                    for (Metric metric : metrics) {
                        String metricName = getMetricPath(metricGroupPrefix, metric, jsonNode);
                        printMetric(serverPrefix + metricName, extractMetricValueFromNode(jsonNode, metric.getXpath()), stat);
                    }
                }
            } else {
                logger.debug("uri for stat in metrics.xml is not configured");
            }
        }
    } else {
        logger.debug("Stat in metrics.xml is empty");
    }
}
 
开发者ID:Appdynamics,项目名称:marklogic-monitoring-extension,代码行数:30,代码来源:MarkLogicMonitorTask.java


注:本文中的com.appdynamics.extensions.http.UrlBuilder.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。