public class Instrumentation extends Object
All instrumentation elements have a group and a name.
Modifier and Type | Class and Description |
---|---|
static class |
Instrumentation.Cron
Cron is a stopwatch that can be started/stopped several times.
|
static interface |
Instrumentation.Element<T>
Gives access to a snapshot of an Instrumentation element (Counter, Timer).
|
static class |
Instrumentation.Timer
Timer Instrumentation element.
|
static interface |
Instrumentation.Variable<T>
Interface for instrumentation variables.
|
Constructor and Description |
---|
Instrumentation()
Instrumentation constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCron(String group,
String name,
Instrumentation.Cron cron)
Add a cron to an instrumentation timer.
|
void |
addSampler(String group,
String name,
int period,
int interval,
Instrumentation.Variable<Long> variable)
Add a sampling variable.
|
void |
addVariable(String group,
String name,
Instrumentation.Variable variable)
Add an instrumentation variable.
|
void |
decr(String group,
String name,
long count)
Decrement an instrumentation counter.
|
Map<String,Map<String,Map<String,Object>>> |
getAll()
Return a map containing all variables, counters and timers.
|
Map<String,String> |
getConfiguration()
Return the current system configuration as a Map<String,String>.
|
Map<String,Map<String,Instrumentation.Element<Long>>> |
getCounters()
Return all the counters.
|
Map<String,String> |
getJavaSystemProperties()
Return the JVM system properties.
|
Map<String,String> |
getOSEnv()
Return the OS environment used to start Oozie.
|
Map<String,Map<String,Instrumentation.Element<Double>>> |
getSamplers()
Return all the samplers.
|
Map<String,Map<String,Instrumentation.Element<Instrumentation.Timer>>> |
getTimers()
Return all the timers.
|
Map<String,Map<String,Instrumentation.Element<Instrumentation.Variable>>> |
getVariables()
Return all the variables.
|
void |
incr(String group,
String name,
long count)
Increment an instrumentation counter.
|
void |
setScheduler(ScheduledExecutorService scheduler)
Set the scheduler instance to handle the samplers.
|
void |
stop() |
String |
toString()
Return the string representation of the instrumentation.
|
public Instrumentation()
public void setScheduler(ScheduledExecutorService scheduler)
scheduler
- scheduler instance.public void addCron(String group, String name, Instrumentation.Cron cron)
This method is thread safe.
group
- timer group.name
- timer name.cron
- cron to add to the timer.public void incr(String group, String name, long count)
This method is thread safe.
group
- counter group.name
- counter name.count
- increment to add to the counter.public void decr(String group, String name, long count)
This method is thread safe.
group
- counter group.name
- counter name.count
- decrement to add to the counter.public void addVariable(String group, String name, Instrumentation.Variable variable)
This method is thread safe.
group
- counter group.name
- counter name.variable
- variable to add.public Map<String,String> getJavaSystemProperties()
public Map<String,String> getOSEnv()
public Map<String,String> getConfiguration()
public Map<String,Map<String,Instrumentation.Element<Long>>> getCounters()
This method is thread safe.
The counters are live. The counter value is a
snapshot at the time the Instrumentation.Element.getValue()
is invoked.
public Map<String,Map<String,Instrumentation.Element<Instrumentation.Timer>>> getTimers()
This method is thread safe.
The timers are live. Once a timer is obtained, all
its values are consistent (they are snapshot at the time the Instrumentation.Element.getValue()
is
invoked.
public Map<String,Map<String,Instrumentation.Element<Instrumentation.Variable>>> getVariables()
This method is thread safe.
The variables are live. The variable value is a
snapshot at the time the Instrumentation.Element.getValue()
is invoked.
public Map<String,Map<String,Map<String,Object>>> getAll()
public void addSampler(String group, String name, int period, int interval, Instrumentation.Variable<Long> variable)
This method is thread safe.
group
- timer group.name
- timer name.period
- sampling period to compute rate.interval
- sampling frequency, how often the variable is probed.variable
- variable to sample.public Map<String,Map<String,Instrumentation.Element<Double>>> getSamplers()
This method is thread safe.
The samplers are live. The sampler value is a
snapshot at the time the Instrumentation.Element.getValue()
is invoked.
public void stop()
Copyright © 2018 Apache Software Foundation. All rights reserved.