about summary refs log tree commit diff
path: root/README.md
blob: d59de5209dd27a076440428d7944334bf96385c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[![Go Report Card](https://goreportcard.com/badge/git.darknebu.la/emile/metrics-bundler)](https://goreportcard.com/report/git.darknebu.la/emile/metrics-bundler)
# metrics-bundler

> A **super** basic server bundling metrics and exposting them

The metrics bunder is a service receiving metrics from other services bunding them for further user in prometheus and other time series databases.

## Functions (read / write metrics)

First of all, writing metrics works by submitting a POST request to the /metrics endpoint:

```bash
$ url -X POST --data "key=number&value=800" https://metrics-bundler.nbg1.emile.space/metrics
```

After that, a GET request can be submitted to the same endpoint (`/metrics`). It returns all of the
metrics submitted:

```bash
$ curl -X GET https://metrics-bundler.nbg1.emile.space/metrics                                                                       
number 800.000000
```

## Prometheus integration

Prometheus can be instructed to use this by creating a new job in the prometheus configuration file:

```
...

  - job_name: 'metrics-bundler'
    scrape_interval: 5s
    static_configs:
      - targets: ['<hostname>:<port>']

...
```

Using the job a above, prometheus is instructed to scrape the /metrics endpoint of the given host every 5 seconds.