本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}