Skip to content

Commit

Permalink
Use exometer_core in readme and test
Browse files Browse the repository at this point in the history
  • Loading branch information
lixen authored and surik committed Oct 24, 2017
1 parent d8731d9 commit b5f4158
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
51 changes: 29 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ This reporter pushes data to [InfluxDB](https://influxdb.com/index.html).
3. Configure it:

```erlang
{exometer,
{reporters, [
{exometer_report_influxdb, [{protocol, http},
{host, <<"localhost">>},
{port, 8086},
{db, <<"exometer">>},
{tags, [{region, ru}]}]}
{exometer_core, [
{report, [
{reporters, [
{exometer_report_influxdb, [{protocol, http},
{host, <<"localhost">>},
{port, 8086},
{db, <<"exometer">>},
{tags, [{region, ru}]}]}
]}
]}
}.
]}.
```

Available options:
Expand All @@ -55,11 +57,14 @@ The following options can be set globally in the reporter config or locally in a
### Subscription examples:

```erlang
{exometer,
{subscriptions, [
{exometer_report_influxdb, [erlang, memory], total, 5000, [{tags, {tag, value}}]},

{exometer_core, [
{report, [
{subscribers, [
{exometer_report_influxdb, [erlang, memory], total, 5000, [{tags, {tag, value}}]}
]}
]}
}.
]}.
```

By default the in InfluxDB visible name of the metric is derived from the exometer id: Here `[erlang, memory]` is translated to `erlang_memory`.
Expand All @@ -86,17 +91,19 @@ Further it might be handy to remove e.g. `undefined` tag keys or values. This ca
There is capability for making a subscription automatically for each new entry. By default it is off. If you need to enable it in the reporter options and also provide a callback module which handles newly created entries.

```erlang
{exometer,
{reporters, [
{exometer_report_influxdb, [{autosubscribe, true},
{subscriptions_module, exometer_influxdb_subscribe_mod},
{protocol, http},
{host, <<"localhost">>},
{port, 8086},
{db, <<"exometer">>},
{tags, [{region, ru}]}]}
{exometer_core, [
{report, [
{reporters, [
{exometer_report_influxdb, [{autosubscribe, true},
{subscriptions_module, exometer_influxdb_subscribe_mod},
{protocol, http},
{host, <<"localhost">>},
{port, 8086},
{db, <<"exometer">>},
{tags, [{region, ru}]}]}
]}
]}
}.
]}.
```

The callback module may look like:
Expand Down
2 changes: 1 addition & 1 deletion test/exometer_influxdb_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ subscribtions_module_test() ->
]}],
error_logger:tty(false),
application:set_env(lager, handlers, [{lager_console_backend, none}]),
application:set_env(exometer, report, Subscribers),
application:set_env(exometer_core, report, Subscribers),
{ok, Apps} = application:ensure_all_started(exometer_influxdb),

exometer:update_or_create([metric, test], 1, histogram, []),
Expand Down

0 comments on commit b5f4158

Please sign in to comment.