com.thinkaurelius.titan.util.stats

## Enum MetricManager

- java.lang.Object
- - java.lang.Enum<MetricManager>
  - - com.thinkaurelius.titan.util.stats.MetricManager

- All Implemented Interfaces:
    Serializable, Comparable<MetricManager>

      public enum MetricManager
      extends Enum<MetricManager>

  Singleton that contains and configures Titan's `MetricRegistry`.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `INSTANCE`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConsoleReporter(Duration reportInterval)` Create a `ConsoleReporter` attached to the Titan Metrics registry.
    `void` | `addCsvReporter(Duration reportInterval, String output)` Create a `CsvReporter` attached to the Titan Metrics registry.
    `void` | `addGangliaReporter(String groupOrHost, int port, info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode addressingMode, int ttl, Boolean protocol31, UUID hostUUID, String spoof, Duration reportInterval)` Create a `GangliaReporter` attached to the Titan Metrics registry.
    `void` | `addGraphiteReporter(String host, int port, String prefix, Duration reportInterval)` Create a `GraphiteReporter` attached to the Titan Metrics registry.
    `void` | `addJmxReporter(String domain, String agentId)` Create a `JmxReporter` attached to the Titan Metrics registry.
    `void` | `addSlf4jReporter(Duration reportInterval, String loggerName)` Create a `Slf4jReporter` attached to the Titan Metrics registry.
    `com.codahale.metrics.Counter` | `getCounter(String name)`
    `com.codahale.metrics.Counter` | `getCounter(String prefix, String... names)`
    `com.codahale.metrics.Histogram` | `getHistogram(String name)`
    `com.codahale.metrics.Histogram` | `getHistogram(String prefix, String... names)`
    `com.codahale.metrics.MetricRegistry` | `getRegistry()` Return the Titan Metrics registry.
    `com.codahale.metrics.Timer` | `getTimer(String name)`
    `com.codahale.metrics.Timer` | `getTimer(String prefix, String... names)`
    `boolean` | `remove(String name)`
    `void` | `removeAllReporters()` Remove all Titan Metrics reporters previously configured through the `add*` methods on this class.
    `void` | `removeConsoleReporter()` Stop a `ConsoleReporter` previously created by a call to `#addConsoleReporter(long)` and release it for GC.
    `void` | `removeCsvReporter()` Stop a `CsvReporter` previously created by a call to `#addCsvReporter(long, String)` and release it for GC.
    `void` | `removeGangliaReporter()` Stop a `GangliaReporter` previously created by a call to `#addGangliaReporter(String, int, UDPAddressingMode, int, Boolean, UUID, long)` and release it for GC.
    `void` | `removeGraphiteReporter()` Stop a `GraphiteReporter` previously created by a call to `#addGraphiteReporter(String, int, String, long)` and release it for GC.
    `void` | `removeJmxReporter()` Stop a `JmxReporter` previously created by a call to `addJmxReporter(String, String)` and release it for GC.
    `void` | `removeSlf4jReporter()` Stop a `Slf4jReporter` previously created by a call to `#addSlf4jReporter(long, String)` and release it for GC.
    `static MetricManager` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static MetricManager[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### INSTANCE

          public static final MetricManager INSTANCE

  - ### Method Detail

    - #### values

          public static MetricManager[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (MetricManager c : MetricManager.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static MetricManager valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### getRegistry

          public com.codahale.metrics.MetricRegistry getRegistry()

      Return the Titan Metrics registry.
      Returns:
        the single `MetricRegistry` used for all of Titan's Metrics monitoring

    - #### addConsoleReporter

          public void addConsoleReporter(Duration reportInterval)

      Create a `ConsoleReporter` attached to the Titan Metrics registry.
      Parameters:
        `reportInterval` - time to wait between dumping metrics to the console

    - #### removeConsoleReporter

          public void removeConsoleReporter()

      Stop a `ConsoleReporter` previously created by a call to `#addConsoleReporter(long)` and release it for GC. Idempotent between calls to the associated add method. Does nothing before the first call to the associated add method.

    - #### addCsvReporter

          public void addCsvReporter(Duration reportInterval,
                            String output)

      Create a `CsvReporter` attached to the Titan Metrics registry.

      The `output` argument must be non-null but need not exist. If it doesn't already exist, this method attempts to create it by calling `File.mkdirs()`.

      Parameters:
        `reportInterval` - time to wait between dumping metrics to CSV files in the configured directory
        `output` - the path to a directory into which Metrics will periodically write CSV data

    - #### removeCsvReporter

          public void removeCsvReporter()

      Stop a `CsvReporter` previously created by a call to `#addCsvReporter(long, String)` and release it for GC. Idempotent between calls to the associated add method. Does nothing before the first call to the associated add method.

    - #### addJmxReporter

          public void addJmxReporter(String domain,
                            String agentId)

      Create a `JmxReporter` attached to the Titan Metrics registry.

      If `domain` or `agentId` is null, then Metrics's uses its own internal default value(s).

      If `agentId` is non-null, then `MBeanServerFactory#findMBeanServer(agentId)` must return exactly one `MBeanServer`. The reporter will register with that server. If the `findMBeanServer(agentId)` call returns no or multiple servers, then this method logs an error and falls back on the Metrics default for `agentId`.

      Parameters:
        `domain` - the JMX domain in which to continuously expose metrics
        `agentId` - the JMX agent ID

    - #### removeJmxReporter

          public void removeJmxReporter()

      Stop a `JmxReporter` previously created by a call to `addJmxReporter(String, String)` and release it for GC. Idempotent between calls to the associated add method. Does nothing before the first call to the associated add method.

    - #### addSlf4jReporter

          public void addSlf4jReporter(Duration reportInterval,
                              String loggerName)

      Create a `Slf4jReporter` attached to the Titan Metrics registry.

      If `loggerName` is null, or if it is non-null but `LoggerFactory#getLogger(loggerName)` returns null, then Metrics's default Slf4j logger name is used instead.

      Parameters:
        `reportInterval` - time to wait between writing metrics to the Slf4j logger
        `loggerName` - the name of the Slf4j logger that receives metrics

    - #### removeSlf4jReporter

          public void removeSlf4jReporter()

      Stop a `Slf4jReporter` previously created by a call to `#addSlf4jReporter(long, String)` and release it for GC. Idempotent between calls to the associated add method. Does nothing before the first call to the associated add method.

    - #### addGangliaReporter

          public void addGangliaReporter(String groupOrHost,
                                int port,
                                info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode addressingMode,
                                int ttl,
                                Boolean protocol31,
                                UUID hostUUID,
                                String spoof,
                                Duration reportInterval)
                                  throws IOException

      Create a `GangliaReporter` attached to the Titan Metrics registry.

      `groupOrHost` and `addressingMode` must be non-null. The remaining non-primitive arguments may be null. If `protocol31` is null, then true is assumed. Null values of `hostUUID` or `spoof` are passed into the `GMetric` constructor, which causes Ganglia to use its internal logic for generating a default UUID and default reporting hostname (respectively).

      Parameters:
        `groupOrHost` - the multicast group or unicast hostname to which Ganglia events are sent
        `port` - the port to which events are sent
        `addressingMode` - whether to send events with multicast or unicast
        `ttl` - multicast ttl (ignored for unicast)
        `protocol31` - true to use Ganglia protocol version 3.1, false to use 3.0
        `hostUUID` - uuid for the host
        `spoof` - override this machine's IP/hostname as it appears on the Ganglia server
        `reportInterval` - titme to wait before sending data to the ganglia unicast host or multicast group
      Throws:
        `IOException` - when a `GMetric` can't be instantiated using the provided arguments

    - #### removeGangliaReporter

          public void removeGangliaReporter()

      Stop a `GangliaReporter` previously created by a call to `#addGangliaReporter(String, int, UDPAddressingMode, int, Boolean, UUID, long)` and release it for GC. Idempotent between calls to the associated add method. Does nothing before the first call to the associated add method.

    - #### addGraphiteReporter

          public void addGraphiteReporter(String host,
                                 int port,
                                 String prefix,
                                 Duration reportInterval)

      Create a `GraphiteReporter` attached to the Titan Metrics registry.

      If `prefix` is null, then Metrics's internal default prefix is used (empty string at the time this comment was written).

      Parameters:
        `host` - the host to which Graphite reports are sent
        `port` - the port to which Graphite reports are sent
        `prefix` - the optional metrics prefix
        `reportInterval` - time to wait between sending metrics to the configured Graphite host and port

    - #### removeGraphiteReporter

          public void removeGraphiteReporter()

      Stop a `GraphiteReporter` previously created by a call to `#addGraphiteReporter(String, int, String, long)` and release it for GC. Idempotent between calls to the associated add method. Does nothing before the first call to the associated add method.

    - #### removeAllReporters

          public void removeAllReporters()

      Remove all Titan Metrics reporters previously configured through the `add*` methods on this class.

    - #### getCounter

          public com.codahale.metrics.Counter getCounter(String name)

    - #### getCounter

          public com.codahale.metrics.Counter getCounter(String prefix,
                                                String... names)

    - #### getTimer

          public com.codahale.metrics.Timer getTimer(String name)

    - #### getTimer

          public com.codahale.metrics.Timer getTimer(String prefix,
                                            String... names)

    - #### getHistogram

          public com.codahale.metrics.Histogram getHistogram(String name)

    - #### getHistogram

          public com.codahale.metrics.Histogram getHistogram(String prefix,
                                                    String... names)

    - #### remove

          public boolean remove(String name)

Copyright © 2012–2014. All rights reserved.