diff --git a/.tool-versions b/.tool-versions index ba528ec..a288980 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ # also update ci.yml -erlang 26.2.5.2 +erlang 27.1.1 diff --git a/README.md b/README.md index 6fb7dbf..2d19a7b 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,18 @@ This app provides an HTTP API for gathering and querying metrics from an erldns server and presenting those metrics as JSON. -Here's an example script that shows how to get the output with curl and pass through Python to format it in a pretty fashion. +Here's an example script that shows how to get the output with `curl` and pass it through Python to format it in a pretty fashion. It assumes you have this API running on port `8082`. ```bash curl -s http://localhost:8082/ -H "Accept: application/json" | python -mjson.tool ``` -Note that timing stats are givin in microseconds. +> [!IMPORTANT] +> Timing stats are given in microseconds. ## Configuration -To configure the metrics API port, add something like the following to your erlang configuration section: +To configure the metrics API port, add something like the following to your Erlang configuration section: ```erlang [ @@ -37,3 +38,42 @@ To start fresh: ```bash make fresh ``` + +## Running + +You'll need [erldns]() running. Then, you can run erldns_metrics as: + +```bash +rebar3 shell +``` + +If you need to configure erldns (such as to use a different port), you can store configuration such as the one below in a file such as `erldns_metrics.config`: + +```erlang +[ + {erldns, [ + {servers, [ + [ + {name, inet_localhost_1}, + {address, "127.0.0.1"}, + {port, 8053}, + {family, inet}, + {processes, 2} + ], + [{name, inet6_localhost_1}, {address, "::1"}, {port, 8053}, {family, inet6}] + ]} + ]} +]. +``` + +Then, you can run erldns_metrics as: + +```bash +rebar3 shell --config erldns_metrics.config +``` + +## Testing + +```bash +make test +``` diff --git a/rebar.config b/rebar.config index 9d86f78..5939972 100644 --- a/rebar.config +++ b/rebar.config @@ -29,3 +29,6 @@ {warnings, [no_unknown]} ]}. +{shell, [ + {apps, [erldns_metrics]} +]}.