|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Monitor
A Monitor is an abstraction of some application resource that
is instrumented with a set of indicators (Gauges or Counters).
A Monitor is identified by its Key, that MUST be unique in the application. To ensure this, the Key class defines the monitor identifier as a combination of name, subsystem and category.
The name is the human-readable representation of the "resource" beeing monitored. A typical use is the fully qualified class name + method signature, or the HTTP request path.
The category is a grouping attribute to reflect the application layering. Typically for JEE application, you will set category to the N-tier layer beeing monitored ("servlet", "service", "persistence").
The subsystem is a logical grouping, by use-cases. "account", and "user" can be used as subsystem for the application account and user management dedicated components.
You are free to use more complex Key types, by simple subclassing the Key class and providing the adequate equals()/hasCode() methods.
The Counters / Gauges used to store monitored application state are retrieved based on a "role" String. The monitor can handle as many values as needed, until any of them has a dedicated role. This allows to easily extend the monitor by registering custom values.
| Nested Class Summary | |
|---|---|
static class |
Monitor.Key
Identifier class for Monitors |
static interface |
Monitor.Listener
Listener interface to get notified on montor events |
static interface |
Monitor.Observable
Monitor that accepts Listeners and notify them on monitor events |
| Field Summary | |
|---|---|
static Role<Gauge> |
CONCURRENCY
default role for multi-thread concurrency |
static Role<Counter> |
FAILURES
default Role for the invocation failure counter |
static Role<Counter> |
PERFORMANCES
default role key for code performances |
| Method Summary | ||
|---|---|---|
Counter |
getCounter(Role<Counter> role)
Retrieve or create a Counter in the monitor |
|
Counter |
getCounter(java.lang.String role)
Retrieve a Counter |
|
Gauge |
getGauge(Role<Gauge> role)
Retrieve or create a Gauge in the monitor |
|
Gauge |
getGauge(java.lang.String role)
Retrieve a Gauge in the monitor |
|
Monitor.Key |
getKey()
|
|
java.util.Collection<Role> |
getRoles()
|
|
|
getValue(Role<T> role)
Retrieve a StatValue in the monitor |
|
StatValue |
getValue(java.lang.String role)
Retrieve a StatValue. |
|
java.util.Collection<StatValue> |
getValues()
|
|
void |
reset()
Reset all StatValues (don't remove them) |
|
| Field Detail |
|---|
static final Role<Counter> PERFORMANCES
static final Role<Gauge> CONCURRENCY
static final Role<Counter> FAILURES
| Method Detail |
|---|
Monitor.Key getKey()
Counter getCounter(java.lang.String role)
role - a unique identifier for a Counter in the monitorunit - the data unit to count
Counter getCounter(Role<Counter> role)
role - the Counter role in the monitor
Gauge getGauge(java.lang.String role)
role - a unique identifier for a Gauge in the monitor
Gauge getGauge(Role<Gauge> role)
role - the gauge role in the monitor
StatValue getValue(java.lang.String role)
role - a unique identifier for a StatValue in the monitor
<T extends StatValue> T getValue(Role<T> role)
role - the StatValue role in the monitor
java.util.Collection<Role> getRoles()
java.util.Collection<StatValue> getValues()
void reset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||