public class MetricContext extends BaseContext
BaseContext.ContextSetNoRemoveIteratorDecorator
Modifier and Type | Field and Description |
---|---|
private Map<String,String> |
counterMap
Map of objects to counter names.
|
private com.google.common.collect.Multimap<String,com.codahale.metrics.Timer.Context> |
timerContextMap
Map of objects to contexts to perform a stop signal.
|
private com.google.common.collect.Multimap<String,net.shibboleth.utilities.java.support.collection.Pair<String,String>> |
timerMap
Map of objects to timer names to start and objects to stop the timer.
|
Constructor and Description |
---|
MetricContext()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MetricContext |
addCounter(String counterName,
String objectId)
Add an object/counter mapping.
|
MetricContext |
addTimer(String timerName,
String startId,
String stopId)
Add an object/timer mapping.
|
void |
dec(String objectId)
Decrement a counter associated with an object, if any.
|
Map<String,String> |
getCounterMappings()
Get a modifiable map of object/counter associations.
|
Collection<net.shibboleth.utilities.java.support.collection.Pair<String,String>> |
getTimerMappings(String objectId)
Get a modifiable collection of timer name / stop object pairs for the supplied
start object ID.
|
void |
inc(String objectId)
Increment a counter associated with an object, if any.
|
void |
start(String objectId)
Conditionally starts one or more timers based on the supplied object identifier.
|
void |
stop(String objectId)
Stops any timers associated with the supplied object identifier and removes them
from the tracking map.
|
addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, isAutoCreateSubcontexts, iterator, removeSubcontext, removeSubcontext, setAutoCreateSubcontexts, setParent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
@Nonnull @NonnullElements private com.google.common.collect.Multimap<String,net.shibboleth.utilities.java.support.collection.Pair<String,String>> timerMap
The first member is the timer name, the second the object to associate with the timer.
@Nonnull @NonnullElements private com.google.common.collect.Multimap<String,com.codahale.metrics.Timer.Context> timerContextMap
@Nonnull public MetricContext addTimer(@Nonnull @NotEmpty String timerName, @Nonnull @NotEmpty String startId, @Nonnull @NotEmpty String stopId)
timerName
- name of timerstartId
- ID of object to start timer withstopId
- ID of object to stop timer@Nonnull @NonnullElements @Live public Collection<net.shibboleth.utilities.java.support.collection.Pair<String,String>> getTimerMappings(@Nonnull @NotEmpty String objectId)
objectId
- the object ID input@Nonnull public MetricContext addCounter(@Nonnull @NotEmpty String counterName, @Nonnull @NotEmpty String objectId)
counterName
- name of counterobjectId
- object ID@Nonnull @NonnullElements @Live public Map<String,String> getCounterMappings()
public void start(@Nonnull @NotEmpty String objectId)
The configured state of the context is used to determine whether, and which, timers to start, further influenced by the runtime state of the system with regard to enabling of metrics.
objectId
- ID of the object being timedpublic void stop(@Nonnull @NotEmpty String objectId)
objectId
- ID of the object being timedpublic void inc(@Nonnull @NotEmpty String objectId)
objectId
- ID of objectCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.