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


Java IMetricsRetrieverV2類代碼示例

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


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

示例1: enforce

import eu.atos.sla.monitoring.IMetricsRetrieverV2; //導入依賴的package包/類
/**
 * Enforce an agreement that was last enforced at <code>since</code>. The enforcement process must retrieve
 * the metrics since that date and validate them, raising violations if applicable.
 * 
 * This method is intended to be used when the metric data has to be pulled from the Monitoring.
 * 
 * @param agreement Agreement to enforce.
 * @param since Last time the agreement was enforced.
 * @param isLastExecution the enforcement job has been stopped and it will be the last execution
 */
public void enforce(IAgreement agreement, Date since, boolean isLastExecution) {
	logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since);
	
	final Date now = new Date();
	
	checkInitialized(true);

	Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution);

	Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap;
	if (retriever instanceof IMetricsRetrieverV2) {
		metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems);
	}
	else {
		metricsMap = getMetrics(retriever, agreement, retrievalItems);
	}
	enforce(agreement, metricsMap);
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:29,代碼來源:AgreementEnforcement.java

示例2: getMetrics

import eu.atos.sla.monitoring.IMetricsRetrieverV2; //導入依賴的package包/類
private Map<IGuaranteeTerm, List<IMonitoringMetric>> getMetrics(
		IMetricsRetriever retriever, 
		IAgreement agreement, 
		Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems) {
	logger.debug("getMetrics");
	
	Map<IGuaranteeTerm, List<IMonitoringMetric>> result = new HashMap<IGuaranteeTerm, List<IMonitoringMetric>>();
	for (IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
		IMetricsRetrieverV2.RetrievalItem item = retrievalItems.get(term);
		if (item!=null){
			List<IMonitoringMetric> metrics = retriever.getMetrics(
					agreement.getAgreementId(), 
					term.getServiceScope(), 
					item.getVariable(),
					item.getBegin(), 
					item.getEnd(),
					maxRetrievedResults);
			
			result.put(term, metrics);
		}
	}
	return result;
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:24,代碼來源:AgreementEnforcement.java

示例3: enforce

import eu.atos.sla.monitoring.IMetricsRetrieverV2; //導入依賴的package包/類
/**
 * Enforce an agreement that was last enforced at <code>since</code>. The enforcement process must retrieve
 * the metrics since that date and validate them, raising violations if applicable.
 * 
 * This method is intended to be used when the metric data has to be pulled from the Monitoring.
 * 
 * @param agreement Agreement to enforce.
 * @param since Last time the agreement was enforced.
 * @param isLastExecution the enforcement job has been stopped and it will be the last execution
 */
public void enforce(IAgreement agreement, Date since, boolean isLastExecution) {
    logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since);
    
    final Date now = new Date();
    
    checkInitialized(true);

    Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution);

    Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap;
    if (retriever instanceof IMetricsRetrieverV2) {
        metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems);
    }
    else {
        metricsMap = getMetrics(retriever, agreement, retrievalItems);
    }
    enforce(agreement, metricsMap);
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:29,代碼來源:AgreementEnforcement.java

示例4: getMetrics

import eu.atos.sla.monitoring.IMetricsRetrieverV2; //導入依賴的package包/類
private Map<IGuaranteeTerm, List<IMonitoringMetric>> getMetrics(
        IMetricsRetriever retriever, 
        IAgreement agreement, 
        Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems) {
    logger.debug("getMetrics");
    
    Map<IGuaranteeTerm, List<IMonitoringMetric>> result = new HashMap<IGuaranteeTerm, List<IMonitoringMetric>>();
    for (IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
        IMetricsRetrieverV2.RetrievalItem item = retrievalItems.get(term);
        if (item!=null){
            List<IMonitoringMetric> metrics = retriever.getMetrics(
                    agreement.getAgreementId(), 
                    term.getServiceScope(), 
                    item.getVariable(),
                    item.getBegin(), 
                    item.getEnd(),
                    maxRetrievedResults);
            
            result.put(term, metrics);
        }
    }
    return result;
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:24,代碼來源:AgreementEnforcement.java

示例5: buildRetrievalItems

import eu.atos.sla.monitoring.IMetricsRetrieverV2; //導入依賴的package包/類
private Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> buildRetrievalItems(
		IAgreement agreement,
		final Date since,
		final Date now, boolean isLastExecution) {
	try {
		pollInterval = Long.parseLong(pollIntervalString);
	}catch(NumberFormatException npe){
		String str = String.format("AgreementEnforcement Can not parse ENF{%s} value{%s}. Is it a number?",	POLL_INTERVAL, pollIntervalString); 
		throw new IllegalArgumentException(str);
	}

	logger.debug("buildRetrievalItems(agreement:"+agreement.getAgreementId()+" - since:"+iso8601(since)+"+ now "+iso8601(now)+")");
	
	Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = 
				new HashMap<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem>();
	
	for (final IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
		if (guaranteeTermHasToBeEvaluated(term, isLastExecution)){
			service.saveCheckedGuaranteeTerm(term);

			retrievalItems.put(term, new IMetricsRetrieverV2.RetrievalItem() {
				
				@Override
				public IGuaranteeTerm getGuaranteeTerm() {
					return term;
				}
				
				@Override
				public String getVariable() {
					return constraintEval.getConstraintVariable(term.getServiceLevel());
				}
				
				@Override
				public Date getEnd() {
					return now;
				}
				
				@Override
				public Date getBegin() {
					return since;
				}

			});
		}

	}
	return retrievalItems;
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:49,代碼來源:AgreementEnforcement.java

示例6: buildRetrievalItems

import eu.atos.sla.monitoring.IMetricsRetrieverV2; //導入依賴的package包/類
private Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> buildRetrievalItems(
        IAgreement agreement,
        final Date since,
        final Date now, boolean isLastExecution) {
    try {
        pollInterval = Long.parseLong(pollIntervalString);
    }catch(NumberFormatException npe){
        String str = String.format("AgreementEnforcement Can not parse ENF{%s} value{%s}. Is it a number?",    POLL_INTERVAL, pollIntervalString); 
        throw new IllegalArgumentException(str);
    }

    logger.debug("buildRetrievalItems(agreement:"+agreement.getAgreementId()+" - since:"+iso8601(since)+"+ now "+iso8601(now)+")");
    
    Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = 
                new HashMap<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem>();
    
    for (final IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
        if (guaranteeTermHasToBeEvaluated(term, isLastExecution)){
            service.saveCheckedGuaranteeTerm(term);

            retrievalItems.put(term, new IMetricsRetrieverV2.RetrievalItem() {
                
                @Override
                public IGuaranteeTerm getGuaranteeTerm() {
                    return term;
                }
                
                @Override
                public String getVariable() {
                    return constraintEval.getConstraintVariable(term.getServiceLevel());
                }
                
                @Override
                public Date getEnd() {
                    return now;
                }
                
                @Override
                public Date getBegin() {
                    return since;
                }

            });
        }

    }
    return retrievalItems;
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:49,代碼來源:AgreementEnforcement.java


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