@Override public final void initialize(final ReportingInitializationContext config) throws InitializationException { identifier = config.getIdentifier(); logger = config.getLogger(); name = config.getName(); schedulingNanos = config.getSchedulingPeriod(TimeUnit.NANOSECONDS); serviceLookup = config.getControllerServiceLookup(); nodeTypeProvider = config.getNodeTypeProvider(); init(config); }
@Override public Bulletin createBulletin(final String category, final Severity severity, final String message) { return BulletinFactory.createBulletin(category, severity.name(), message); }
private String getBulletinStoreKey(final Bulletin bulletin) { switch (bulletin.getSourceType()) { case FLOW_CONTROLLER: return CONTROLLER_BULLETIN_STORE_KEY; case CONTROLLER_SERVICE: return SERVICE_BULLETIN_STORE_KEY; case REPORTING_TASK: return REPORTING_TASK_BULLETIN_STORE_KEY; default: return bulletin.getGroupId(); } }
public static Bulletin createBulletin(final String groupId, final String groupName, final String sourceId, final String sourceName, final String category, final String severity, final String message) { final Bulletin bulletin = new MockBulletin(currentId.getAndIncrement()); bulletin.setGroupId(groupId); bulletin.setGroupName(groupName); bulletin.setSourceId(sourceId); bulletin.setSourceName(sourceName); bulletin.setCategory(category); bulletin.setLevel(severity); bulletin.setMessage(message); return bulletin; }
@Override public void reportEvent(final Severity severity, final String category, final String message) { final Bulletin bulletin = BulletinFactory.createBulletin(category, severity.name(), message); bulletinRepo.addBulletin(bulletin); } }
public static Bulletin createBulletin(final String category, final String severity, final String message) { final Bulletin bulletin = new MockBulletin(currentId.getAndIncrement()); bulletin.setCategory(category); bulletin.setLevel(severity); bulletin.setMessage(message); return bulletin; } }
@Override public boolean select(final Bulletin bulletin) { return bulletin.getTimestamp().getTime() >= fiveMinutesAgo; } }, maxPerComponent));
private boolean isControllerBulletin(final Bulletin bulletin) { switch (bulletin.getSourceType()) { case FLOW_CONTROLLER: case CONTROLLER_SERVICE: case REPORTING_TASK: return true; default: return false; } }
/** * Returns the status of all components in the specified group. This request * is not in the context of a user so the results will be unfiltered. * * @param groupId group id * @return the component status */ @Override public ProcessGroupStatus getGroupStatus(final String groupId) { final RepositoryStatusReport repoStatusReport = generateRepositoryStatusReport(); return getGroupStatus(groupId, repoStatusReport); }
@Override public void initialize(ReportingInitializationContext config) throws InitializationException { this.logger = config.getLogger(); }
public BulletinQuery build() { return new BulletinQuery(this); } }
@Override public PropertyDescriptor getPropertyDescriptor(final String name) { return buildDescriptor(name); }
public static Bulletin createBulletin(final String groupId, final String sourceId, final String sourceName, final String category, final String severity, final String message) { final Bulletin bulletin = new MockBulletin(currentId.getAndIncrement()); bulletin.setGroupId(groupId); bulletin.setSourceId(sourceId); bulletin.setSourceName(sourceName); bulletin.setCategory(category); bulletin.setLevel(severity); bulletin.setMessage(message); return bulletin; }
@Override public void reportEvent(final Severity severity, final String category, final String message) { final Bulletin bulletin = BulletinFactory.createBulletin(category, severity.name(), message); bulletinRepository.addBulletin(bulletin); } };
/** * Returns the status for components in the specified group. This request is * made by the specified user so the results will be filtered accordingly. * * @param groupId group id * @param user user making request * @return the component status */ public ProcessGroupStatus getGroupStatus(final String groupId, final NiFiUser user, final int recursiveStatusDepth) { final RepositoryStatusReport repoStatusReport = generateRepositoryStatusReport(); return getGroupStatus(groupId, repoStatusReport, user, recursiveStatusDepth); }
@Override public synchronized void onLeaderRelinquish() { LOG.info("This node is no longer the elected Active Cluster Coordinator"); bulletinRepository.addBulletin(BulletinFactory.createBulletin("Cluster Coordinator", Severity.INFO.name(), participantId + " is no longer the Cluster Coordinator")); // We do not want to stop the heartbeat monitor. This is because even though ZooKeeper offers guarantees // that watchers will see changes on a ZNode in the order they happened, there does not seem to be any // guarantee that Curator will notify us that our leadership was gained or loss in the order that it happened. // As a result, if nodes connect/disconnect from cluster quickly, we could invoke stop() then start() or // start() then stop() in the wrong order, which can cause the cluster to behavior improperly. As a result, we simply // call start() when we become the leader, and this will ensure that initialization is handled. The heartbeat monitor // then will check the zookeeper znode to check if it is the cluster coordinator before kicking any nodes out of the // cluster. }
/** * Returns the status for components in the specified group. This request is * made by the specified user so the results will be filtered accordingly. * * @param groupId group id * @param user user making request * @return the component status */ public ProcessGroupStatus getGroupStatus(final String groupId, final NiFiUser user) { final RepositoryStatusReport repoStatusReport = generateRepositoryStatusReport(); return getGroupStatus(groupId, repoStatusReport, user); }
@Override public void onLogMessage(final LogMessage message) { // Map LogLevel.WARN to Severity.WARNING so that we are consistent with the Severity enumeration. Else, just use whatever // the LogLevel is (INFO and ERROR map directly and all others we will just accept as they are). final String bulletinLevel = (message.getLevel() == LogLevel.WARN) ? Severity.WARNING.name() : message.getLevel().toString(); bulletinRepository.addBulletin(BulletinFactory.createBulletin(processorNode, CATEGORY, bulletinLevel, message.getMessage())); }
@Override public void reportEvent(final Severity severity, final String category, final String message) { final String groupId = StandardRemoteProcessGroup.this.getProcessGroup().getIdentifier(); final String groupName = StandardRemoteProcessGroup.this.getProcessGroup().getName(); final String sourceId = StandardRemoteProcessGroup.this.getIdentifier(); final String sourceName = StandardRemoteProcessGroup.this.getName(); bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, groupName, sourceId, ComponentType.REMOTE_PROCESS_GROUP, sourceName, category, severity.name(), message)); } };