Enum MetricManager
- java.lang.Object
- 
- java.lang.Enum<MetricManager>
- 
- org.apache.tinkerpop.gremlin.server.util.MetricManager
 
 
- 
- All Implemented Interfaces:
- Serializable,- Comparable<MetricManager>
 
 public enum MetricManager extends Enum<MetricManager> Singleton that contains and configures Gremlin Server'sMetricRegistry. Borrowed from Titan's approach to managing Metrics.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
 
- 
- 
Enum Constant SummaryEnum Constants Enum Constant Description INSTANCE
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConsoleReporter(long reportIntervalInMS)Create aConsoleReporterattached to theMetricsRegistry.voidaddCsvReporter(long reportIntervalInMS, String output)Create aCsvReporterattached to theMetricsRegistry.voidaddGangliaReporter(String groupOrHost, int port, String addressingMode, int ttl, Boolean protocol31, UUID hostUUID, String spoof, long reportIntervalInMS)Create aGangliaReporterattached to theMetricsRegistry.voidaddGraphiteReporter(String host, int port, String prefix, long reportIntervalInMS)Create aGraphiteReporterattached to theMetricsRegistry.voidaddJmxReporter(String domain, String agentId)Create aJmxReporterattached to theMetricsRegistry.voidaddSlf4jReporter(long reportIntervalInMS, String loggerName)Create aSlf4jReporterattached to theMetricsRegistry.booleancontains(String name)com.codahale.metrics.CountergetCounter(String name)com.codahale.metrics.CountergetCounter(String prefix, String... names)intgetCounterSize()<T> com.codahale.metrics.Gauge<T>getGuage(com.codahale.metrics.Gauge<T> gauge, String name)<T> com.codahale.metrics.Gauge<T>getGuage(com.codahale.metrics.Gauge<T> gauge, String prefix, String... names)com.codahale.metrics.HistogramgetHistogram(String name)com.codahale.metrics.HistogramgetHistogram(String prefix, String... names)com.codahale.metrics.MetergetMeter(String name)com.codahale.metrics.MetergetMeter(String prefix, String... names)com.codahale.metrics.MetricRegistrygetRegistry()Return theMetricsRegistry.com.codahale.metrics.TimergetTimer(String name)com.codahale.metrics.TimergetTimer(String prefix, String... names)voidregisterGremlinScriptEngineMetrics(GremlinScriptEngine engine, String... prefix)Registers metrics from aGremlinScriptEngine.voidremoveAllMetrics()voidremoveAllReporters()Remove all reporters previously configured through theadd*methods on this class.voidremoveConsoleReporter()Stop aConsoleReporterpreviously created by a call toaddConsoleReporter(long)and release it for GC.voidremoveCsvReporter()Stop aCsvReporterpreviously created by a call toaddCsvReporter(long, String)and release it for GC.voidremoveGangliaReporter()Stop aGangliaReporterpreviously created by a call to addGangliaReporter(String, int, GMetric.UDPAddressingMode, int, Boolean, UUID, long) and release it for GC.voidremoveGraphiteReporter()Stop aGraphiteReporterpreviously created by a call toaddGraphiteReporter(String, int, String, long)and release it for GC.voidremoveJmxReporter()Stop aJmxReporterpreviously created by a call toaddJmxReporter(String, String)and release it for GC.voidremoveSlf4jReporter()Stop aSlf4jReporterpreviously created by a call toaddSlf4jReporter(long, String)and release it for GC.static MetricManagervalueOf(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.
 
- 
- 
- 
Enum Constant Detail- 
INSTANCEpublic static final MetricManager INSTANCE 
 
- 
 - 
Method Detail- 
valuespublic 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
 
 - 
valueOfpublic 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
 
 - 
getRegistrypublic com.codahale.metrics.MetricRegistry getRegistry() Return theMetricsRegistry.- Returns:
- the single MetricRegistryused for all of monitoring
 
 - 
addConsoleReporterpublic void addConsoleReporter(long reportIntervalInMS) Create aConsoleReporterattached to theMetricsRegistry.- Parameters:
- reportIntervalInMS- milliseconds to wait between dumping metrics to the console
 
 - 
removeConsoleReporterpublic void removeConsoleReporter() Stop aConsoleReporterpreviously created by a call toaddConsoleReporter(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.
 - 
addCsvReporterpublic void addCsvReporter(long reportIntervalInMS, String output)Create aCsvReporterattached to theMetricsRegistry. Theoutputargument must be non-null but need not exist. If it doesn't already exist, this method attempts to create it by callingFile.mkdirs().- Parameters:
- reportIntervalInMS- milliseconds 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
 
 - 
removeCsvReporterpublic void removeCsvReporter() Stop aCsvReporterpreviously created by a call toaddCsvReporter(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.
 - 
addJmxReporterpublic void addJmxReporter(String domain, String agentId) Create aJmxReporterattached to theMetricsRegistry. IfdomainoragentIdis null, then Metrics's uses its own internal default value(s). IfagentIdis non-null, then MBeanServerFactory#findMBeanServer(agentId) must return exactly oneMBeanServer. The reporter will register with that server. If thefindMBeanServer(agentId)call returns no or multiple servers, then this method logs an error and falls back on the Metrics default foragentId.- Parameters:
- domain- the JMX domain in which to continuously expose metrics
- agentId- the JMX agent ID
 
 - 
removeJmxReporterpublic void removeJmxReporter() Stop aJmxReporterpreviously created by a call toaddJmxReporter(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.
 - 
addSlf4jReporterpublic void addSlf4jReporter(long reportIntervalInMS, String loggerName)Create aSlf4jReporterattached to theMetricsRegistry. IfloggerNameis null, or if it is non-null but LoggerFactory.getLogger(loggerName) returns null, then Metrics's default Slf4j logger name is used instead.- Parameters:
- reportIntervalInMS- milliseconds to wait between writing metrics to the Slf4j logger
- loggerName- the name of the Slf4j logger that receives metrics
 
 - 
removeSlf4jReporterpublic void removeSlf4jReporter() Stop aSlf4jReporterpreviously created by a call toaddSlf4jReporter(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.
 - 
addGangliaReporterpublic void addGangliaReporter(String groupOrHost, int port, String addressingMode, int ttl, Boolean protocol31, UUID hostUUID, String spoof, long reportIntervalInMS) throws IOException Create aGangliaReporterattached to theMetricsRegistry.groupOrHostandaddressingModemust be non-null. The remaining non-primitive arguments may be null. Ifprotocol31is null, then true is assumed. Null values ofhostUUIDorspoofare passed into theGMetricconstructor, 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
- reportIntervalInMS- milliseconds to wait before sending data to the ganglia unicast host or multicast group
- Throws:
- IOException- when a- GMetriccan't be instantiated using the provided arguments
 
 - 
removeGangliaReporterpublic void removeGangliaReporter() Stop aGangliaReporterpreviously created by a call to addGangliaReporter(String, int, GMetric.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.
 - 
addGraphiteReporterpublic void addGraphiteReporter(String host, int port, String prefix, long reportIntervalInMS) Create aGraphiteReporterattached to theMetricsRegistry. Ifprefixis 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
- reportIntervalInMS- milliseconds to wait between sending metrics to the configured Graphite host and port
 
 - 
removeGraphiteReporterpublic void removeGraphiteReporter() Stop aGraphiteReporterpreviously created by a call toaddGraphiteReporter(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.
 - 
removeAllReporterspublic void removeAllReporters() Remove all reporters previously configured through theadd*methods on this class.
 - 
removeAllMetricspublic void removeAllMetrics() 
 - 
getCounterSizepublic int getCounterSize() 
 - 
containspublic boolean contains(String name) 
 - 
getCounterpublic com.codahale.metrics.Counter getCounter(String name) 
 - 
getGuagepublic <T> com.codahale.metrics.Gauge<T> getGuage(com.codahale.metrics.Gauge<T> gauge, String name)
 - 
getGuagepublic <T> com.codahale.metrics.Gauge<T> getGuage(com.codahale.metrics.Gauge<T> gauge, String prefix, String... names)
 - 
getMeterpublic com.codahale.metrics.Meter getMeter(String name) 
 - 
getTimerpublic com.codahale.metrics.Timer getTimer(String name) 
 - 
getHistogrampublic com.codahale.metrics.Histogram getHistogram(String name) 
 - 
registerGremlinScriptEngineMetricspublic void registerGremlinScriptEngineMetrics(GremlinScriptEngine engine, String... prefix) Registers metrics from aGremlinScriptEngine. At this point, this only works for theGremlinGroovyScriptEngineas it is the only one that collects metrics at this point. As theGremlinScriptEngineimplementations achieve greater parity these metrics will get expanded.
 
- 
 
-