Skip to content

Commit

Permalink
Move to OTP 27 locally and add run instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Oct 12, 2024
1 parent 71cf2bd commit 6e36132
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# also update ci.yml
erlang 26.2.5.2
erlang 27.1.1
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[
Expand All @@ -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
```
3 changes: 3 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@
{warnings, [no_unknown]}
]}.

{shell, [
{apps, [erldns_metrics]}
]}.

0 comments on commit 6e36132

Please sign in to comment.