Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
danielefongo committed Feb 14, 2020
1 parent 8f588ad commit 3b5933a
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Daikon Prometheus

![Daikon](./logo.svg)

Daikon Prometheus is a library that add to Daikon the ability to expose metrics for Prometheus.

The main goals are:
* Expose useful metrics for Prometheus

## How to add Daikon Prometheus to your project
[![](https://jitpack.io/v/DaikonWeb/daikon-prometheus.svg)](https://jitpack.io/#DaikonWeb/daikon-prometheus)

### Gradle
- Add JitPack in your root build.gradle at the end of repositories:
```
repositories {
...
maven { url 'https://jitpack.io' }
}
```
- Add the dependency
```
implementation('com.github.DaikonWeb:daikon-prometheus:1.1.8')
```

### Maven
- Add the JitPack repository to your build file
```
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
```
- Add the dependency
```
<dependency>
<groupId>com.github.DaikonWeb</groupId>
<artifactId>daikon-prometheus</artifactId>
<version>1.1.8</version>
</dependency>
```

## How to use

### To publish metrics:
```
HttpServer()
.prometheus("/prometheus")
.start().use {
assertThat(get("http://localhost:4545/prometheus").text).contains("jvm")
}
```

### To use a custom metric:
```
HttpServer()
.prometheus("/prometheus")
.get("/counter") { _, _, ctx ->
ctx.meterRegistry().counter("calls").increment()
}
.start().use {
get("http://localhost:4545/counter")
get("http://localhost:4545/counter")
assertThat(get("http://localhost:4545/foo").text).contains("calls_total 2.0")
}
```

## Resources
* Documentation: https://daikonweb.github.io
* Examples: https://github.com/DaikonWeb/daikon-examples
* Micrometer: https://micrometer.io/
* Prometheus: https://github.com/prometheus

## Authors

* **[Daniele Fongo](https://github.com/danielefongo)**

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details

0 comments on commit 3b5933a

Please sign in to comment.