MetricsContext (Hadoop 0.20.2+320 API)
Date: 2010-06-28

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.metrics
Interface MetricsContext

All Known Implementing Classes:
  AbstractMetricsContext, CompositeContext, FileContext, GangliaContext, GangliaContext31, NoEmitMetricsContext, NullContext, NullContextWithUpdateThread

    public interface MetricsContext

The main interface to the metrics package.

Field Summary
`static int` | `DEFAULT_PERIOD` Default period in seconds at which data is sent to the metrics system.

Method Summary
`void` | `close()` Stops monitoring and also frees any buffered data, returning this object to its initial state.
`MetricsRecord` | `createRecord(String recordName)` Creates a new MetricsRecord instance with the given `recordName`.
`Map<String,Collection<OutputRecord>>` | `getAllRecords()` Retrieves all the records managed by this MetricsContext.
`String` | `getContextName()` Returns the context name.
`int` | `getPeriod()` Returns the timer period.
`void` | `init(String contextName, ContextFactory factory)` Initialize this context.
`boolean` | `isMonitoring()` Returns true if monitoring is currently in progress.
`void` | `registerUpdater(Updater updater)` Registers a callback to be called at regular time intervals, as determined by the implementation-class specific configuration.
`void` | `startMonitoring()` Starts or restarts monitoring, the emitting of metrics records as they are updated.
`void` | `stopMonitoring()` Stops monitoring.
`void` | `unregisterUpdater(Updater updater)` Removes a callback, if it exists.

Field Detail

### DEFAULT_PERIOD

    static final int DEFAULT_PERIOD

  Default period in seconds at which data is sent to the metrics system.

  See Also:
    Constant Field Values

Method Detail

### init

    void init(String contextName,
              ContextFactory factory)

  Initialize this context.

  Parameters:
    `contextName` - The given name for this context
    `factory` - The creator of this context

### getContextName

    String getContextName()

  Returns the context name.

  Returns:
    the context name

### startMonitoring

    void startMonitoring()
                         throws IOException

  Starts or restarts monitoring, the emitting of metrics records as they are updated.

  Throws:
    `IOException`

### stopMonitoring

    void stopMonitoring()

  Stops monitoring. This does not free any data that the implementation may have buffered for sending at the next timer event. It is OK to call `startMonitoring()` again after calling this.

  See Also:
    `close()`

### isMonitoring

    boolean isMonitoring()

  Returns true if monitoring is currently in progress.

### close

    void close()

  Stops monitoring and also frees any buffered data, returning this object to its initial state.

### createRecord

    MetricsRecord createRecord(String recordName)

  Creates a new MetricsRecord instance with the given `recordName`. Throws an exception if the metrics implementation is configured with a fixed set of record names and `recordName` is not in that set.

  Parameters:
    `recordName` - the name of the record
  Throws:
    `MetricsException` - if recordName conflicts with configuration data

### registerUpdater

    void registerUpdater(Updater updater)

  Registers a callback to be called at regular time intervals, as determined by the implementation-class specific configuration.

  Parameters:
    `updater` - object to be run periodically; it should updated some metrics records and then return

### unregisterUpdater

    void unregisterUpdater(Updater updater)

  Removes a callback, if it exists.

  Parameters:
    `updater` - object to be removed from the callback list

### getPeriod

    int getPeriod()

  Returns the timer period.

### getAllRecords

    Map<String,Collection<OutputRecord>> getAllRecords()

  Retrieves all the records managed by this MetricsContext. Useful for monitoring systems that are polling-based.

  Returns:
    A non-null map from all record names to the records managed.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation