當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleMetricsReceiverData類代碼示例

本文整理匯總了Java中eu.atos.sla.monitoring.simple.SimpleMetricsTranslator.SimpleMetricsReceiverData的典型用法代碼示例。如果您正苦於以下問題:Java SimpleMetricsReceiverData類的具體用法?Java SimpleMetricsReceiverData怎麽用?Java SimpleMetricsReceiverData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SimpleMetricsReceiverData類屬於eu.atos.sla.monitoring.simple.SimpleMetricsTranslator包,在下文中一共展示了SimpleMetricsReceiverData類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: receiveMetrics

import eu.atos.sla.monitoring.simple.SimpleMetricsTranslator.SimpleMetricsReceiverData; //導入依賴的package包/類
@POST
@Path("{agreementId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public Response receiveMetrics(
		@PathParam("agreementId") String agreementId, 
		final MonitoringMetric metric) {

	if (System.getenv(ENFORCEMENT_TEST) == null) {
		return buildResponse(HttpStatus.NOT_FOUND, 
				"Verify server is running with " + ENFORCEMENT_TEST + " env var");
	}
	logger.debug("receiveMetrics(agreementId={} data={}", agreementId, metric.toString());
	IAgreement agreement = agreementDao.getByAgreementId(agreementId);
	
	if (agreement == null) {
		return buildResponse(HttpStatus.NOT_FOUND, "agreement " + agreementId + " not found");
	}
	SimpleMetricsReceiverData data = new SimpleMetricsReceiverData(
			metric.getMetricKey(), 
			new SimpleMetricsReceiverData.SimpleMetricValue(metric.getMetricValue(), metric.getDate()));
	
	Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap = translator.translate(agreement, data);
	enforcementService.doEnforcement(agreement, metricsMap);
	return buildResponse(HttpStatus.ACCEPTED, "Metrics received");
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:27,代碼來源:MetricsReceiverRest.java

示例2: receiveMetrics

import eu.atos.sla.monitoring.simple.SimpleMetricsTranslator.SimpleMetricsReceiverData; //導入依賴的package包/類
@POST
@Path("{agreementId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public Response receiveMetrics(
        @PathParam("agreementId") String agreementId, 
        final MonitoringMetric metric) {

    if (System.getenv(ENFORCEMENT_TEST) == null) {
        return buildResponse(HttpStatus.NOT_FOUND, 
                "Verify server is running with " + ENFORCEMENT_TEST + " env var");
    }
    logger.debug("receiveMetrics(agreementId={} data={}", agreementId, metric.toString());
    IAgreement agreement = agreementDao.getByAgreementId(agreementId);
    
    if (agreement == null) {
        return buildResponse(HttpStatus.NOT_FOUND, "agreement " + agreementId + " not found");
    }
    SimpleMetricsReceiverData data = new SimpleMetricsReceiverData(
            metric.getMetricKey(), 
            new SimpleMetricsReceiverData.SimpleMetricValue(metric.getMetricValue(), metric.getDate()));
    
    Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap = translator.translate(agreement, data);
    enforcementService.doEnforcement(agreement, metricsMap);
    return buildResponse(HttpStatus.ACCEPTED, "Metrics received");
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:27,代碼來源:MetricsReceiverRest.java


注:本文中的eu.atos.sla.monitoring.simple.SimpleMetricsTranslator.SimpleMetricsReceiverData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。