# Basics¶

## Gauges¶

Gauges measure discrete values at the time they are sampled. These are useful for measuring queue depths and pool sizes.

```// scala
import java.util.ArrayBlockingQueue

val aQueue = new ArrayBlockingQueue[Job]()

aQueue.size
}
```
```// java
import java.util.ArrayBlockingQueue;

ArrayBlockingQueue<Job> aQueue =
new ArrayBlockingQueue<Job>();

new Callable<Float>() {
@Override public Float call() { return aQueue.size(); }
},
"queue_size"
);
```

## Counters¶

Counters are used to, well, count how often something happens. Common examples include the number of requests dispatched and failure counts.

```// scala

numRequests.incr()
```
```// java

Counter numRequests =

numRequests.incr();
```

## Stats¶

Stats provide a distribution of values that are seen, including percentiles, averages and maximums. Stats are quite useful for measuring the n-th percentiles for latency of requests or capturing the distribution of work batches.

```// scala
import java.util.concurrent.TimeUnit

Stat.time(latency, TimeUnit.MILLISECONDS) {
twiddleBits();
}
```
```// java
import java.util.concurrent.TimeUnit;

JStat.time(
latency,
new Callable<Void>() {
@Override public void call() { twiddleBits(); }
},
TimeUnit.MILLISECONDS
);
```

## Verbosity Levels¶

Each metric created via a StatsReceiver has a verbosity level (i.e., “debug” or “default”) attached to it. Distinguishing verbosity levels for metrics is optional and is up to a concrete implementation. Doing this, however, helps to separate debug metrics (only helpful in troubleshooting) from their operationally-required counterparts (provide visibility into a healthy process) thus potentially reducing the observability cost.

Note

Unless an explicit `Verbosity` is passed, `Verbosity.Default` is used.

```// scala
```// java