-
Notifications
You must be signed in to change notification settings - Fork 31
Jetstream Application Monitoring
Jetstream Framework provides a monitoring and management subsystem. Monitoring and Management is exposed through a REST interface. Every Channel and Processor must implement Monitorable & XSerializable Interfaces. These are marker interfaces and require no implementation. Each Channel and Processor exposes a consistent set of counters viz. TotalEventsReceived, TotalEventsSent(), TotalEventsDropped(), EventsReceivedPerSec(), EventsSentPerSec, TotalPauseCount(), TotalResumeCount. When Channel and Processor instances start up they register themselves with the Monitoring and Management subsystem. The counters are organized in a hierarchical folder structure similar to a file system.
The Channel and Processor implementations must declare themselves to the Management subsystem to be monitored as follows
import com.ebay.jetstream.management.Management;
@ManagedResource(objectName = "Event/Channel", description = "Sample Channel Implementation")
public class SampleChannel extends AbstractOutboundChannel {
public void open() throws EventException {
// handle open signal
// now register with Management subsystem
Management.removeBeanOrFolder(getBeanName(), this);
Management.addBean(getBeanName(), this);
}
public void close() throws EventException {
// handle close signal
// now unregister with Management subsystem
Management.removeBeanOrFolder(getBeanName(), this);
}
Once a Channel or Processor instance is registered all members of the implementation class will be shown along with the counters listed above provided there is a getter method implementation for the member. This way the monitoring page can not only be used by seeing how many events are flowing through a processor or channel instance but also view the state of the instance which is useful in debugging a running application. Even events flowing through can be viewed.
A particular member can be hidden by annotating the getter method as follows
@Hidden
public long getSomeCounter() {
return someCounter;
}
In order to control some functionality in the Channel or Processor, one needs to use the @ManagedOperation as shown below.
@ManagedOperation public void resetStats() { }
Default Management port for a Jetstream application is 9999. This can be overridden by using a "-p" command line option.