本文整理匯總了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;
}