Class Event

java.lang.Object
com.yahoo.log.event.Event
All Implemented Interfaces:
Serializable

public abstract class Event extends Object implements Serializable
The Event class is the base class for all VESPA defined events. All specific Event classes extend this abstract class. An event is more or less a type and a set of properties. For convenience we use the logging system to transport Event instances, so the typical use is to serialize events into the payload of log messages.

Note that the static methods started(), stopped() etc are for use with this class so using them in the subclasses isn't really sanctioned. These methods are what the user wants to use for logging events, rather than making events him/herself and stuffing them through the logging API.

Author:
Bjorn Borud Only for internal Vespa usage
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final void
    count(String name, long value)
    Static method for logging the count event.
    static final void
    crash(String name, int pid, int signal)
    Static method for logging the crash event.
    Get the name of the event instance.
    long
    Get the timestamp of this event
    Get a property value.
    Convenience method which returns a property.
    int
    Get the event version.
    static Event
    Parse string representation of Event and emit correct Event subtype.
    static final void
    progress(String name, long value, long total)
    Static method for logging the progress event.
    void
    setTime(long time)
    Set the timestamp of this event.
    setValue(String name, String value)
    Set a property.
    setVersion(int version)
    Set event version
    static final void
    Static method for logging the started event.
    static final void
    Static method for logging the starting event.
    static final void
    state(String name, String value)
    Static method for logging the state event.
    static final void
    stopped(String name, int pid, int exitcode)
    Static method for logging the stopped event.
    static final void
    stopping(String name, String why)
    Static method for logging the stopping event.
    This method returns the string representation of the event and must return something that can be parsed by the parse method.
    static final void
    value(String name, double value)
    Static method for logging the value event.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Event

      protected Event()
  • Method Details

    • setValue

      public Event setValue(String name, String value)
      Set a property.
      Parameters:
      name - The name of the property
      value - The value of the property
    • getValue

      public String getValue(String name)
      Get a property value.
    • setTime

      public void setTime(long time)
      Set the timestamp of this event.
    • getTime

      public long getTime()
      Get the timestamp of this event
      Returns:
      returns the timestamp of this event
    • setVersion

      public Event setVersion(int version)
      Set event version
      Parameters:
      version - The version of the event.
    • getVersion

      public int getVersion()
      Get the event version.
      Returns:
      event version
    • getValuePossiblyQuote

      public String getValuePossiblyQuote(String name)
      Convenience method which returns a property. If the property contains whitespace the property will be enclosed in quotes. FIXME: quotes inside the value are not quoted
    • getName

      public String getName()
      Get the name of the event instance.
      Returns:
      the name of the event instance.
    • toString

      public String toString()
      This method returns the string representation of the event and must return something that can be parsed by the parse method.
      Overrides:
      toString in class Object
    • parse

      public static Event parse(String s) throws MalformedEventException
      Parse string representation of Event and emit correct Event subtype.
      Parameters:
      s - A string containing an event
      Returns:
      Event represented by s.
      Throws:
      MalformedEventException - if unable to deciper Event from string.
    • starting

      public static final void starting(String name)
      Static method for logging the starting event.
    • started

      public static final void started(String name)
      Static method for logging the started event.
    • stopping

      public static final void stopping(String name, String why)
      Static method for logging the stopping event.
    • stopped

      public static final void stopped(String name, int pid, int exitcode)
      Static method for logging the stopped event.
    • count

      public static final void count(String name, long value)
      Static method for logging the count event.
    • value

      public static final void value(String name, double value)
      Static method for logging the value event.
    • progress

      public static final void progress(String name, long value, long total)
      Static method for logging the progress event.
    • state

      public static final void state(String name, String value)
      Static method for logging the state event.
    • crash

      public static final void crash(String name, int pid, int signal)
      Static method for logging the crash event.