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


Java MetricWriteHelper类代码示例

本文整理汇总了Java中com.appdynamics.extensions.util.MetricWriteHelper的典型用法代码示例。如果您正苦于以下问题:Java MetricWriteHelper类的具体用法?Java MetricWriteHelper怎么用?Java MetricWriteHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(Map<String, String> argsMap) {
    if (!initialized) {
        final String configFilePath = argsMap.get(CONFIG_ARG);

        MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);
        conf.setConfigYml(configFilePath);

        conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.METRIC_PREFIX,
                MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER, MonitorConfiguration.ConfItem.EXECUTOR_SERVICE);
        this.configuration = conf;

        initXstream();

        initialized = true;
    }
}
 
开发者ID:Appdynamics,项目名称:azure-servicebus-monitoring-extension,代码行数:18,代码来源:AzureServiceBusMonitor.java

示例2: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(String configFile, String metricFile) {
    if (!initialized) {

        MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);

        conf.setConfigYml(configFile);

        conf.setMetricsXml(metricFile, Stat.Stats.class);

        conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.METRICS_XML, MonitorConfiguration.ConfItem.EXECUTOR_SERVICE,
                MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER);
        this.configuration = conf;
        initialized = true;
    }
}
 
开发者ID:Appdynamics,项目名称:postgresql-monitoring-extension,代码行数:17,代码来源:PostgreSQLMonitor.java

示例3: initAmbariConfig

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
protected MonitorConfiguration initAmbariConfig(Map<String, String> taskArgs) {
    logger.info("Initializing the Ambari Monitor Configuration");
    String configFilename = getConfigFilename(taskArgs.get(CONFIG_ARG));
    MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
    MonitorConfiguration conf = new MonitorConfiguration("Custom Metrics|HadoopMonitor|Ambari",
            new AmbariMonitorExecutor(), metricWriteHelper);
    String xmlPath = getPath(taskArgs, AMBARI_METRICS_XML_ARG, "monitors/HadoopMonitor/metrics-ambari.xml");
    conf.setMetricsXml(xmlPath, MetricConfig.class);
    conf.setConfigYml(configFilename, "ambariMonitor");
    if (conf.isEnabled()) {
        conf.checkIfInitialized(ConfItem.CONFIG_YML, ConfItem.METRIC_PREFIX,
                ConfItem.METRIC_WRITE_HELPER, ConfItem.METRICS_XML);
    } else {
        logger.info("The Ambari Monitor is not enabled");
    }
    return conf;
}
 
开发者ID:Appdynamics,项目名称:hadoop-monitoring-extension,代码行数:18,代码来源:HadoopMonitor.java

示例4: initResourceManagerConfig

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
protected MonitorConfiguration initResourceManagerConfig(Map<String, String> taskArgs) {
    logger.info("Initializing the Resource Manager Monitor Configuration");
    String configFilename = getConfigFilename(taskArgs.get(CONFIG_ARG));
    MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
    MonitorConfiguration conf = new MonitorConfiguration("Custom Metrics|HadoopMonitor|ResourceManager",
            new RMMonitorExecutor(), metricWriteHelper);
    String xmlPath = getPath(taskArgs, RM_METRICS_XML_ARG, "monitors/HadoopMonitor/metrics-resource-manager.xml");
    conf.setMetricsXml(xmlPath, MetricConfig.class);
    conf.setConfigYml(configFilename, new ConfigReloader(), "resourceManagerMonitor");
    if (conf.isEnabled()) {
        conf.checkIfInitialized(ConfItem.CONFIG_YML, ConfItem.METRIC_PREFIX, ConfItem.METRIC_WRITE_HELPER);
    } else{
        logger.info("The Resource Manager Monitor is not enabled");
    }
    return conf;
}
 
开发者ID:Appdynamics,项目名称:hadoop-monitoring-extension,代码行数:17,代码来源:HadoopMonitor.java

示例5: configure

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void configure(Map<String, String> argsMap) {
    logger.info("Initializing the Linux Configuration");
    MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
    MonitorConfiguration conf = new MonitorConfiguration(metricPrefix, new TaskRunnable(), metricWriteHelper);
    configFileName = argsMap.get("config-file");
    if(Strings.isNullOrEmpty(configFileName)){
        configFileName = "monitors/LinuxMonitor/config.yml";
    }
    conf.setConfigYml(configFileName);
    conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.EXECUTOR_SERVICE,
            MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER);
    this.configuration = conf;
    String prefix = (String)this.configuration.getConfigYml().get("metricPrefix");
    if(!Strings.isNullOrEmpty(prefix)){
        metricPrefix = prefix;
    }
    initialized = true;
}
 
开发者ID:Appdynamics,项目名称:linux-monitoring-extension,代码行数:19,代码来源:LinuxMonitor.java

示例6: printMetric

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
/**
 * Returns the metric to the AppDynamics Controller.
 *
 * @param metricPrefix Metric prefix
 * @param metricName   Name of the Metric
 * @param metricValue  Value of the Metric
 */
private void printMetric(String metricPrefix, String metricName, Object metricValue) {

    String aggregation = MetricWriter.METRIC_AGGREGATION_TYPE_OBSERVATION;
    String timeRollup = MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE;
    String cluster = MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_COLLECTIVE;
    String serverName = (String) server.get("name");
    String metricPath = metricPrefix + METRIC_SEPARATOR + serverName + METRIC_SEPARATOR + metricName;
    MetricWriteHelper metricWriter = configuration.getMetricWriter();
    metricWriter.printMetric(metricPath, metricValue.toString(), aggregation, timeRollup, cluster);

    if (logger.isDebugEnabled()) {
        logger.debug("Metric [" + aggregation + "/" + timeRollup + "/" + cluster
                + "] metric = " + metricPath + " = " + metricValue);
    }
}
 
开发者ID:Appdynamics,项目名称:nginx-monitoring-extension,代码行数:23,代码来源:NGinXMonitorTask.java

示例7: setup

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
@Before
public void setup() throws IOException {
    configuration = mock(MonitorConfiguration.class);
    server = new HashMap<String, String>();
    server.put("uri", "http://testuri.com/status");
    nGinXMonitorTask = new NGinXMonitorTask(configuration, server);

    client = mock(CloseableHttpClient.class);
    response = mock(CloseableHttpResponse.class);
    entity = mock(HttpEntity.class);
    header = mock(Header.class);
    metricWriter = mock(MetricWriteHelper.class);

    when(configuration.getHttpClient()).thenReturn(client);
    when(client.execute(Mockito.any(HttpGet.class))).thenReturn(response);
    when(response.getEntity()).thenReturn(entity);
    when(response.getFirstHeader(Mockito.anyString())).thenReturn(header);
    when(configuration.getMetricPrefix()).thenReturn("prefix");
    PowerMockito.mockStatic(EntityUtils.class);
    when(configuration.getMetricWriter()).thenReturn(metricWriter);
}
 
开发者ID:Appdynamics,项目名称:nginx-monitoring-extension,代码行数:22,代码来源:NGinXMonitorTaskTest.java

示例8: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(String configFile) {
    if (!initialized) {

        MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);

        conf.setConfigYml(configFile, new MonitorConfiguration.FileWatchListener() {
            public void onFileChange(File file) {
                connect();
            }
        });

        conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER);
        this.configuration = conf;

        connect();

        initialized = true;
    }
}
 
开发者ID:Appdynamics,项目名称:vmware-vsphere-monitoring-extension,代码行数:21,代码来源:VMWareMonitor.java

示例9: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(Map<String, String> taskArgs) {
    if(!initialized) {
        final String configFilePath = taskArgs.get(CONFIG_ARG);
        MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);
        String metricXMLFilePath = getPath(taskArgs, METRIC_XML_ARG, "monitors/MarkLogicMonitor/metrics.xml");
        conf.setMetricsXml(metricXMLFilePath, MetricConfig.class);
        conf.setConfigYml(configFilePath);
        conf.checkIfInitialized(ConfItem.CONFIG_YML, ConfItem.METRICS_XML, ConfItem.EXECUTOR_SERVICE, ConfItem.HTTP_CLIENT, ConfItem.METRIC_PREFIX, ConfItem.METRIC_WRITE_HELPER);
        this.configuration = conf;
        initialized = true;
    }
}
 
开发者ID:Appdynamics,项目名称:marklogic-monitoring-extension,代码行数:14,代码来源:MarkLogicMonitor.java

示例10: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(Map<String, String> taskArgs) {
    if (!initialized) {
        //read the config.
        final String configFilePath = taskArgs.get(CONFIG_ARG);
        MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);
        conf.setConfigYml(configFilePath);
        conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.EXECUTOR_SERVICE,
                MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER);
        this.configuration = conf;
        initialized = true;
    }
}
 
开发者ID:Appdynamics,项目名称:kafka-monitoring-extension,代码行数:14,代码来源:KafkaMonitor.java

示例11: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
protected void initialize(Map<String, String> argsMap) {
    if (configuration == null) {
        MetricWriteHelper metricWriter = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration("Custom Metrics|Solr|", new TaskRunner(), metricWriter);
        final String configFilePath = argsMap.get("config-file");
        conf.setConfigYml(configFilePath);
        conf.checkIfInitialized(MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.HTTP_CLIENT
                , MonitorConfiguration.ConfItem.EXECUTOR_SERVICE);
        this.configuration = conf;
    }
}
 
开发者ID:Appdynamics,项目名称:solr-monitoring-extension,代码行数:12,代码来源:SolrMonitor.java

示例12: printMetrics

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void printMetrics(Map<String, BigDecimal> solrMetrics) {
    MetricWriteHelper metricWriter = configuration.getMetricWriter();
    String metricPrefix = configuration.getMetricPrefix();
    String aggregation = MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE;
    String cluster = MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL;
    String timeRollup = MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE;

    for (Map.Entry<String, BigDecimal> entry : solrMetrics.entrySet()) {
        String metricPath = metricPrefix + "|" + server.get("name").toString() + entry.getKey();
        String metricValue = String.valueOf(entry.getValue());
        metricWriter.printMetric(metricPath, metricValue, aggregation, timeRollup, cluster);
    }
}
 
开发者ID:Appdynamics,项目名称:solr-monitoring-extension,代码行数:14,代码来源:SolrMonitorTask.java

示例13: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(Map<String, String> taskArgs) {
	if(!initialized) {
           logger.debug("Initializing Elastic Search Monitor configuration");
		final String configFilePath = taskArgs.get(CONFIG_ARG);
		MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
		MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);
		conf.setConfigYml(configFilePath);
		conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.EXECUTOR_SERVICE, MonitorConfiguration.ConfItem.HTTP_CLIENT, MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER);
		this.configuration = conf;
		initialized = true;
	}
}
 
开发者ID:Appdynamics,项目名称:elasticsearch-monitoring-extension,代码行数:13,代码来源:ElasticSearchMonitor.java

示例14: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
private void initialize(Map<String, String> argsMap) {
    if (!initialized) {
        final String configFilePath = argsMap.get(CONFIG_ARG);

        MetricWriteHelper metricWriteHelper = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration(METRIC_PREFIX, new TaskRunnable(), metricWriteHelper);
        conf.setConfigYml(configFilePath);

        conf.checkIfInitialized(MonitorConfiguration.ConfItem.CONFIG_YML, MonitorConfiguration.ConfItem.METRIC_PREFIX,
                MonitorConfiguration.ConfItem.METRIC_WRITE_HELPER, MonitorConfiguration.ConfItem.HTTP_CLIENT, MonitorConfiguration.ConfItem.EXECUTOR_SERVICE);
        this.configuration = conf;
        initialized = true;
    }
}
 
开发者ID:Appdynamics,项目名称:apache-monitoring-extension,代码行数:15,代码来源:ApacheStatusMonitor.java

示例15: initialize

import com.appdynamics.extensions.util.MetricWriteHelper; //导入依赖的package包/类
protected void initialize (Map<String, String> argsMap) {
    if (configuration == null) {
        MetricWriteHelper metricWriter = MetricWriteHelperFactory.create(this);
        MonitorConfiguration conf = new MonitorConfiguration("Custom Metrics|Cassandra|", new TaskRunner(),
                metricWriter);
        final String configFilePath = argsMap.get("config-file");
        conf.setConfigYml(configFilePath);
        conf.checkIfInitialized(MonitorConfiguration.ConfItem.METRIC_PREFIX, MonitorConfiguration.ConfItem
                .CONFIG_YML, MonitorConfiguration.ConfItem.HTTP_CLIENT, MonitorConfiguration.ConfItem
                .EXECUTOR_SERVICE);
        this.configuration = conf;
    }
}
 
开发者ID:Appdynamics,项目名称:cassandra-monitoring-extension,代码行数:14,代码来源:CassandraMonitor.java


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