Skip to content

Commit b581514

Browse files
committed
Update README.md
1 parent deba898 commit b581514

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
You can write custom collector/exporter for any library/app you'd like. For example here is [RabbitMQ Exporter](https://github.com/deadtrickster/prometheus_rabbitmq_exporter)
1919

20-
Elixir Plugs
21-
-----
20+
### Elixir Plugs
21+
2222
[Here](https://github.com/deadtrickster/prometheus-plugs) you can find Elixir Plugs.
2323

24-
Example Console Session
25-
-----
24+
### Example Console Session
25+
2626
Run shell with compiled and loaded app:
2727

2828
$ rebar3 shell
@@ -101,37 +101,43 @@ http_request_duration_milliseconds_sum{method="get"} 2622
101101
102102
```
103103

104-
Implementation Note
105-
-----
104+
### Bucket generators
105+
106+
```erlang
107+
prometheus_buckets:generate_linear(-15, 5, 6) produces [-15, -10, -5, 0, 5, 10]
108+
109+
prometheus_buckets:generate_exponential(100, 1.2, 3) produces [100, 120, 144]
110+
```
111+
112+
### Implementation Note
113+
106114
Prometheus.erl exports two API sets.
107115
- For Integers: `prometheus_coutner:inc`, `prometheus_summary:observe` and `prometheus_histogram:observe`. Implementation is based on `ets:update_counter`. While this is expected to be much faster than using processes for synchronization it restricts us to integers-only while Prometheus expects series values to be double.
108116
ETS-based metrics are optimistic - for basic metrics such as counters/gauges it first tries to increment and iff series doesn't exist it queries ETS to check if metric actually registered and if so it inserts series. For histograms at least one lookup is required - we need buckets to compute bucket counter position.
109117
- For Floats: `prometheus_coutner:dinc`, `prometheus_summary:dobserve` and `prometheus_histogram:dobserve`. Implementation is based on `gen_server` which is used for synchronizations (ets doesn't support float atomic increments).
110118

111119
***NOTE***: you can use float APIs after integer but not vice-versa.
112120

113-
Configuration
114-
-----
121+
### Configuration
122+
115123
Prometheus.erl supports standard Erlang app configuration.
116124
- `default_collectors` - List of custom collectors modules to be registered automatically. If undefined list of all modules implementing `prometheus_collector` behaviour will be used.
117125
- `default_metrics` - List of metrics to be registered during app startup. Metric format: `{Registry, Metric, Spec}` where `Registry` is registry name, `Metric` is metric type (prometheus_counter, prometheus_gauge ... etc), `Spec` is a list to be passed to `Metric:register/2`.
118126

119127

120-
TODO
121-
-----
128+
### TODO
129+
122130
- [x] Floats support
123131
- [x] Tests
124-
- [ ] Bucket generators
132+
- [x] Bucket generators
125133
- [ ] Protobuf format
126134
- [ ] Extend custom collectors collection?
127135

128136

129-
Build
130-
-----
137+
### Build
131138

132139
$ rebar3 compile
133140

134-
License
135-
-----
141+
### License
136142

137143
MIT

0 commit comments

Comments
 (0)