public class CacheCollector extends Object implements CacheInstrument, RequestListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
CacheCollector.Sizer
In order to find out how large a cache is, this callback interface is invoked to give a "guesstimate" about how
large the cache is at present.
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
static CacheCollector.Sizer |
NOOP_SIZER
A sizer that always returns -1
|
protected CacheCollector.Sizer |
sizer |
| Constructor and Description |
|---|
CacheCollector(String name) |
CacheCollector(String name,
CacheCollector.Sizer sizer) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Instrument that) |
long |
getCacheSize() |
com.atlassian.instrumentation.caches.CacheCollector.Counters |
getCounter()
Returns the counter that is on the ThreadLocal.
|
double |
getHitMissRatio() |
long |
getHits() |
String |
getLoggingKey()
This value will be used in the JSON object when logged to identify this collection of statistics.
|
long |
getMisses() |
long |
getMissTime() |
String |
getName()
Get the name of the instrument that we are collecting
|
long |
getPuts() |
long |
getRemoves() |
List<SimpleTimer> |
getSplits() |
List<String> |
getTags()
Get the tags that are associated with this instrument.
|
long |
getValue() |
long |
hit()
Call this to record a hits on the instrumented cache
|
boolean |
isEnabled()
Returns true if the instrument is enabled.
|
long |
miss()
Call this to record a misses on the instrumented cache
|
long |
miss(long nanosecondsTaken)
Record a misses on the instrumented cache and how long it took to create the object that was missed.
|
Map<String,Object> |
onRequestEnd()
Process data collected at the end of the request.
|
void |
onRequestStart()
Request preamble - run before the application's request processing starts.
|
long |
put()
Call this to record a new put into the cache.
|
long |
remove()
Count removes from the cache.
|
void |
setEnabled(boolean enabled)
Set the instrument to have collection enabled if passed true.
|
public static final CacheCollector.Sizer NOOP_SIZER
protected final String name
protected final CacheCollector.Sizer sizer
public CacheCollector(String name)
public CacheCollector(String name, CacheCollector.Sizer sizer)
public com.atlassian.instrumentation.caches.CacheCollector.Counters getCounter()
public String getLoggingKey()
RequestListenergetLoggingKey in interface RequestListenerpublic long hit()
public long miss()
public long miss(long nanosecondsTaken)
nanosecondsTaken - the time in nanoseconds it took to create the missed cache objectpublic long put()
public long remove()
public List<SimpleTimer> getSplits()
public String getName()
RequestListenergetName in interface RequestListenergetName in interface Instrumentpublic void onRequestStart()
RequestListeneronRequestStart in interface RequestListenerpublic Map<String,Object> onRequestEnd()
onRequestEnd in interface RequestListenerpublic List<String> getTags()
RequestListenergetTags in interface RequestListenerpublic long getValue()
getValue in interface Instrumentpublic int compareTo(Instrument that)
compareTo in interface Comparable<Instrument>public long getHits()
getHits in interface CacheInstrumentpublic long getMisses()
getMisses in interface CacheInstrumentpublic long getPuts()
public long getRemoves()
public long getMissTime()
getMissTime in interface CacheInstrumentpublic double getHitMissRatio()
getHitMissRatio in interface CacheInstrumentpublic long getCacheSize()
getCacheSize in interface CacheInstrumentpublic boolean isEnabled()
RequestListenerisEnabled in interface RequestListenerpublic void setEnabled(boolean enabled)
RequestListenersetEnabled in interface RequestListenerenabled - True to enable collection. False otherwise.Copyright © 2016 Atlassian. All rights reserved.