<commit_before>[![Build Status](https://travis-ci.org/mxro/lightweight-java-metrics.svg?branch=master)](https://travis-ci.org/mxro/lightweight-java-metrics) <span class="octicon octicon-mark-github"></span> [lightweight-java-metrics](https://github.com/mxro/lightweight-java-metrics)

# Lightweight Java Metrics

A very lightweight way to report metrics for Java applications based on the [Dropwizard Metrics Project](https://dropwizard.github.io/metrics/3.1.0/).

**Why** Other metric frameworks are often complex and feature-rich. 
This framework is composed of a small set of core classes; thus, it is easy to understand and plug into various environments.

## Usage

### Keeping a count

For instance: How many users are logged into the system concurrently?

```java
MetricsNode m = Metrics.create();

m.record(Metrics.increment("users"));
m.record(Metrics.increment("users"));
m.record(Metrics.decrement("users"));

m.print();

m.stop().get();
```

Should result in the output:

```
{
    'users': '1'<commit_msg>Simplifiying documentation Autocommit Tue Jan 13 08:48:25 EST 2015<commit_after>[![Build Status](https://travis-ci.org/mxro/lightweight-java-metrics.svg?branch=master)](https://travis-ci.org/mxro/lightweight-java-metrics) 

# Lightweight Java Metrics

The [Lightweight Java Metrics](https://github.com/mxro/lightweight-java-metrics) library provides a simple way to report metrics for Java applications based on the [Dropwizard Metrics Project](https://dropwizard.github.io/metrics/3.1.0/).

**Why** Other metric frameworks are often complex and feature-rich. 
This framework is composed of a small set of core classes; thus, it is easy to understand and plug into various environments.

## Usage

### Keeping a count

For instance: How many users are logged into the system concurrently?

```java
MetricsNode m = Metrics.create();

m.record(Metrics.increment("users"));
m.record(Metrics.increment("users"));
m.record(Metrics.decrement("users"));

m.print();

m.stop().get();
```

Should result in the output:

```
{
    'users': '1'
{'fraction_non_alphanumeric': 0.1394441735738664, 'fraction_numerical': 0.009751340809361287, 'mean_word_length': 5.218181818181818, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '272187', 'n_tokens_mistral': 640, 'n_tokens_neox': 609, 'n_words': 182}