Skip to content

Commit 6516353

Browse files
authored
Update readme (#189)
1 parent 3bcc996 commit 6516353

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

README.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Prometheus.io client for Erlang #
22

3+
[![Erlang/OTP Versions](https://img.shields.io/badge/erlang%2Fotp-26+-blue)](https://www.erlang.org)
34
[![Hex.pm](https://img.shields.io/hexpm/v/prometheus.svg?maxAge=2592000?style=plastic)](https://hex.pm/packages/prometheus)
45
[![Hex.pm](https://img.shields.io/hexpm/dt/prometheus.svg?maxAge=2592000)](https://hex.pm/packages/prometheus)
56
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/prometheus/)
@@ -32,9 +33,8 @@
3233

3334
## Blogs
3435

35-
- [Install, Monitor Erlang Releases in Kubernetes with Helm + Prometheus](https://spacetimeinsight.com/installing-monitoring-erlang-releases-kubernetes-helm-prometheus/)
36-
- [Monitoring Elixir apps in 2016: Prometheus and Grafana](https://aldusleaf.org/monitoring-elixir-apps-in-2016-prometheus-and-grafana/)
3736
- [A Simple Erlang Application, with Prometheus](https://markbucciarelli.com/posts/2016-11-23_a_simple_erlang_application_with_prometheus.html).
37+
- [Monitoring Elixir apps in 2016: Prometheus and Grafana](https://aldusleaf.org/monitoring-elixir-apps-in-2016-prometheus-and-grafana/)
3838

3939
## Erlang VM & OTP Collectors
4040
- [Memory Collector](https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_vm_memory_collector.md)
@@ -44,40 +44,33 @@
4444

4545
## Compatibility
4646

47-
### OTP versions
48-
Version 3.x works on OTP18+. For older version (oldest tested is R16B03) please use
49-
[3.x-pre18 branch](https://github.com/deadtrickster/prometheus.erl/tree/3.x-pre18).
50-
3.x-pre18 will work on all OTP releases starting from R16B03 and its beam will recompile itself to accommodate.
51-
For example, this branch is used by [RabbitMQ Exporter](https://github.com/deadtrickster/prometheus_rabbitmq_exporter) 3.6.x
52-
that should be compatible with all versions starting from R16B03.
53-
5447
### Build tools
55-
Rebar3 is supported.
48+
[Rebar3](https://rebar3.org) is supported.
5649

5750
## Example Console Session
5851

5952
Run shell with compiled and loaded app:
6053

61-
```erlang-repl
62-
$ rebar3 shell
54+
```shell
55+
rebar3 shell
6356
```
6457

65-
Start prometheus app:
58+
Start the Prometheus app:
6659

67-
```erlang-repl
60+
```erlang
6861
prometheus:start().
6962
```
7063

7164
Register metrics:
7265

7366
```erlang
74-
prometheus_gauge:new([{name, pool_size}, {help, "MongoDB Connections pool size"}]),
75-
prometheus_counter:new([{name, http_requests_total}, {help, "Http request count"}]).
76-
prometheus_summary:new([{name, orders}, {help, "Track orders count/total sum"}]).
77-
prometheus_histogram:new([{name, http_request_duration_milliseconds},
78-
{labels, [method]},
79-
{buckets, [100, 300, 500, 750, 1000]},
80-
{help, "Http Request execution time"}]).
67+
prometheus_gauge:new(#{name => pool_size, help => "MongoDB Connections pool size"}),
68+
prometheus_counter:new(#{name => http_requests_total, help => "Http request count"}).
69+
prometheus_summary:new(#{name => orders, help => "Track orders count/total sum"}).
70+
prometheus_histogram:new(#{name => http_request_duration_milliseconds,
71+
labels => [method],
72+
buckets => [100, 300, 500, 750, 1000],
73+
help => "Http Request execution time"]).
8174
```
8275

8376
Use metrics:
@@ -143,6 +136,8 @@ http_request_duration_milliseconds_count{method="get"} 9
143136
http_request_duration_milliseconds_sum{method="get"} 2622
144137
```
145138

139+
To use a ready-made HTTP exporter, check out the [Inets HTTPD Exporter](https://github.com/deadtrickster/prometheus_httpd) or the [Cowboy1/2 Exporters](https://hex.pm/packages/prometheus_cowboy).
140+
146141
## API
147142

148143
API can be grouped like this:
@@ -159,13 +154,13 @@ API can be grouped like this:
159154
All metrics created via `new/1` or `declare/1`. The difference is that `new/1` actually wants metric to be
160155
new and raises `{mf_already_exists, {Registry, Name}, Message}` error if it isn't.
161156
162-
Both `new/1` and `declare/1` accept options as [proplist](http://erlang.org/doc/man/proplists.html).
157+
Both `new/1` and `declare/1` accept options as `t:proplists:proplist/0` or `t:map/0`.
163158
Common options are:
164159
165-
- name - metric name, can be an atom or a string (required);
166-
- help - metric help, string (required);
167-
- labels - metric labels, label can be an atom or a string (default is []);
168-
- registry - Prometheus registry for the metric, can be any term. (default is default)
160+
- `name` - metric name, can be an atom or a string (required);
161+
- `help` - metric help, string (required);
162+
- `labels` - metric labels, label can be an atom or a string (default is []);
163+
- `registry` - Prometheus registry for the metric, can be any term. (default is `default`)
169164
170165
Histogram also accepts `buckets` option. Please refer to respective modules docs for the more information.
171166
@@ -191,8 +186,8 @@ You'll use that if you want to create a custom collector.
191186

192187
## Build
193188

194-
```
195-
$ rebar3 compile
189+
```shell
190+
rebar3 compile
196191
```
197192

198193
## Configuration
@@ -229,5 +224,4 @@ Their configuration should be under `<collector_name>_collector`for erlang or `<
229224
### Naming
230225

231226
For Erlang: `prometheus_<name>_collector`/`prometheus_<name>_exporter`.
232-
233227
For Elixir: `Prometheus.<name>Collector`/`Prometheus.<name>Exporter`.

0 commit comments

Comments
 (0)