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


Java Resolution類代碼示例

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


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

示例1: alertAboutStatusResolve

import com.squareup.pagerduty.incidents.Resolution; //導入依賴的package包/類
private void alertAboutStatusResolve(RunningUnit runningUnit, StatusSnapshot.Measurement measurement) {
    try {
        Resolution resolution = new Resolution
                .Builder(createIncidentKey(runningUnit, measurement))
                .withDescription(String.format("%s - the measurement '%s' is in status %s.", createHumanReadableName(runningUnit), measurement.getKey(), measurement.getStatus()))
                .addDetails("measurement-numeric", String.valueOf(measurement.getNumericValue()))
                .addDetails("measurement-value", measurement.getDisplayValue())
                .addDetails("measurement-status", measurement.getStatus())
                .addDetails("measurement-key", measurement.getKey())
                .addDetails("server", runningUnit.getServer())
                .addDetails("component", runningUnit.getComponent())
                .addDetails("system", runningUnit.getSystem())
                .addDetails("environment", runningUnit.getEnvironment())
                .build();
        pagerduty.notify(resolution);
    } catch (IOException e) {
        LOG.warn("Error when calling pagerduty to resolve measurement", e);
    }
}
 
開發者ID:Espenhh,項目名稱:panopticon,代碼行數:20,代碼來源:PagerdutyClient.java

示例2: indicateMoreRunningUnits

import com.squareup.pagerduty.incidents.Resolution; //導入依賴的package包/類
public void indicateMoreRunningUnits(MissingRunningUnitsAlerter.Component c, int serversLastTime, int serversNow) {
    if (!shouldAlert(c.getEnvironment())) {
        return;
    }
    try {
        Resolution resolution = new Resolution
                .Builder(createIncidentKey(c))
                .withDescription(String.format("%s - number of servers running the app has increased from %s to %s.", createHumanReadableName(c), serversLastTime, serversNow))
                .addDetails("component", c.getComponent())
                .addDetails("system", c.getSystem())
                .addDetails("environment", c.getEnvironment())
                .build();
        pagerduty.notify(resolution);
    } catch (IOException e) {
        LOG.warn("Error when calling pagerduty for resolution to missing running unit", e);
    }
}
 
開發者ID:Espenhh,項目名稱:panopticon,代碼行數:18,代碼來源:PagerdutyClient.java

示例3: handle

import com.squareup.pagerduty.incidents.Resolution; //導入依賴的package包/類
public void handle(GoNotificationMessage message) throws Exception {

        String pipelineStage = message.getPipelineName() + "-" + message.getStageName();
        PagerDuty pd;

        // Create an incident when matching pipelines fail
        if (pipelineApiKeys.containsKey(message.getPipelineName()) && statusesToAlertOn.contains(message.getStageState())) {
            // TODO: Should we create a new incident for each failure or assume that if we've already created one that we're good?
            //       If we create multiple incidents it will be more challenging to resolve them after a pass, obviously.

            // If we don't already have an open incident for this pipeline/stage
            if (!currentIncidentKeys.containsKey(pipelineStage)){
                pd = newPagerDuty(pipelineApiKeys.get(message.getPipelineName()));

                String goUrl = getGoCDURL(message);

                Trigger trigger = new Trigger.Builder(String.format("Failed Build: %s build %s on %s", message.fullyQualifiedJobName(), message.getStageState(), hostname))
                        .client("GoCD")
                        .clientUrl(goUrl)
                        .build();
                NotifyResult result = pd.notify(trigger);
                currentIncidentKeys.put(pipelineStage, result.incidentKey());
            }
        } else if (currentIncidentKeys.containsKey(pipelineStage) && "Passed".equals(message.getStageResult())) {
            // If that pipeline + stage passes, clear the incident
            pd = newPagerDuty(pipelineApiKeys.get(message.getPipelineName()));

            Resolution resolution = new Resolution.Builder(currentIncidentKeys.get(pipelineStage))
                    .withDescription(String.format("%s build %s on %s", message.fullyQualifiedJobName(), message.getStageState(), hostname))
                    .build();
            pd.notify(resolution);
            currentIncidentKeys.remove(pipelineStage);
        }
    }
 
開發者ID:PagerDuty,項目名稱:gocd-pagerduty-plugin,代碼行數:35,代碼來源:PagerDutyHandler.java

示例4: resolve

import com.squareup.pagerduty.incidents.Resolution; //導入依賴的package包/類
public void resolve(@Nonnull String alert) {
	checkNotNull(alert);

	notify(new Resolution.Builder(alert).build());
}
 
開發者ID:lithiumtech,項目名稱:flow,代碼行數:6,代碼來源:PagerDutyAlerter.java


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