当前位置: 首页>>代码示例>>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;未经允许,请勿转载。