Tabnine Logo
AlertStreamEvent.setCategory
Code IndexAdd Tabnine to your IDE (free)

How to use
setCategory
method
in
org.apache.eagle.alert.engine.model.AlertStreamEvent

Best Java code snippets using org.apache.eagle.alert.engine.model.AlertStreamEvent.setCategory (Showing top 2 results out of 315)

origin: apache/eagle

  /**
   * TODO: Refactor wrapAlertPublishEvent into alertTemplateEngine and remove extraData from AlertStreamEvent.
   */
  @Override
  public AlertStreamEvent filter(AlertStreamEvent event) {
    event.ensureAlertId();
    Map<String, Object> extraData = new HashMap<>();
    List<String> appIds = new ArrayList<>();
    if (alertPublisherBolt.policyDefinitionMap == null || alertPublisherBolt.streamDefinitionMap == null) {
      LOG.warn("policyDefinitions or streamDefinitions in publisher bolt have not been initialized");
    } else {
      PolicyDefinition policyDefinition = alertPublisherBolt.policyDefinitionMap.get(event.getPolicyId());
      if (alertPublisherBolt.policyDefinitionMap != null && policyDefinition != null) {
        for (String inputStreamId : policyDefinition.getInputStreams()) {
          StreamDefinition sd = alertPublisherBolt.streamDefinitionMap.get(inputStreamId);
          if (sd != null) {
            extraData.put(AlertPublishEvent.SITE_ID_KEY, sd.getSiteId());
            appIds.add(sd.getStreamSource());
          }
        }
        extraData.put(AlertPublishEvent.APP_IDS_KEY, appIds);
        extraData.put(AlertPublishEvent.POLICY_VALUE_KEY, policyDefinition.getDefinition().getValue());
        event.setSeverity(policyDefinition.getAlertSeverity());
        event.setCategory(policyDefinition.getAlertCategory());
      }
      event.setContext(extraData);
    }
    return event;
  }
}
origin: apache/eagle

public static AlertStreamEvent createEvent(StreamDefinition stream, PolicyDefinition policy, Object[] data) {
  AlertStreamEvent event = new AlertStreamEvent();
  event.setPolicyId(policy.getName());
  event.setSchema(stream);
  event.setStreamId(stream.getStreamId());
  event.setTimestamp(System.currentTimeMillis());
  event.setCreatedTime(System.currentTimeMillis());
  event.setSubject("Namenode Disk Used 98%");
  event.setBody("Disk Usage of Test cluster's name node (<a href=\"#\">namenode.hostname.domain</a>) is <strong style=\"color: red\">98%</strong> at <strong>2016-11-30 12:30:45</strong>, exceeding alert threshold <strong>90</strong>%");
  event.setData(data);
  event.ensureAlertId();
  event.setSeverity(AlertSeverity.CRITICAL);
  event.setCategory("HDFS");
  event.setContext(new HashMap<String,Object>(){{
    put(AlertPublishEvent.SITE_ID_KEY,"TestCluster");
  }});
  Assert.assertNotNull(event.getAlertId());
  return event;
}
org.apache.eagle.alert.engine.modelAlertStreamEventsetCategory

Popular methods of AlertStreamEvent

  • ensureAlertId
  • getAlertId
  • getBody
  • getCreatedTime
  • getPolicyId
  • getSubject
  • setData
  • toString
  • <init>
  • getContext
  • getData
  • getDataMap
  • getData,
  • getDataMap,
  • getStreamId,
  • setContext,
  • setCreatedTime,
  • setPolicyId,
  • setSchema,
  • setStreamId,
  • setTimestamp,
  • getCategory

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now