pinterest / elixometer

A light Elixir wrapper around exometer.
https://hexdocs.pm/elixometer
Apache License 2.0
827 stars 67 forks source link

Accessing predefined exometer Reports, e.g. erlang memory #71

Open cblock opened 7 years ago

cblock commented 7 years ago

Hi!

I'm just wondering how I might access predefined exomter reports. I tried to add a predefined section to the config but that didn't work:

# Configure Elixometer Instrumentation
config(:exometer_core,
report: [
  reporters: [
    {:exometer_report_tty, []}
  ]
],
predefined: [
  {
    ~w(erlang memory)a,
    {:function, :erlang, :memory, [], :proplist, ~w(atom binary ets processes total)a},
    []
  },
  {
    ~w(erlang statistics)a,
    {:function, :erlang, :statistics, [:'$dp'], :value, [:run_queue]},
    []
  }
])
config(:elixometer, reporter: :exometer_report_tty,
    env: Mix.env,
    metric_prefix: "bms")
smoak commented 7 years ago

I think you need to subscribe to it:

config(:exometer_core,
report: [
  reporters: [
    {:exometer_report_tty, []}
  ],
  subscribers: [
    {
      :exometer_report_tty,
      [:erlang, :memory], ~w(atom binary ets processes total)a, 1_000, true
    }
  ]
],
# rest of config here...