Mobius.to_csv

You're seeing just the function to_csv, go back to Mobius module for more information.
Link to this function

to_csv(metric_name, tags \\ %{}, opts \\ [])

View Source

Specs

to_csv(String.t(), map(), [csv_opt()]) :: :ok

Produces a CSV of currently collected metrics, optionally writing the CSV to file. The CSV looks like: timestamp, name, type, value, tag1, tag2, tag3..., tagN If tags are provided, only the metrics matching the tags are output to the CSV. If a writable file is given via the :file option, the CSV is written to it. Otherwise it is written to the terminal. If the optional :naming option contains :csv_ext, the .csv extension is added to the file name if not already present. If the optional :naming option list :timestamp, the file name is prefixed by a timestamp.

Just as with plotting, metrics to be outputted to CSV can be restricted to a relative time period:

  • :last - metrics captured over the last x amount of time. Where x is either an integer or a tuple of {integer(), time_unit()}. If you only pass an integer the time unit of :seconds is assumed. By default the last 3 minutes of data will be outputted.
  • :from - the unix timestamp, in seconds, to start querying from
  • :to - the unix timestamp, in seconds, to stop querying at

Examples:

iex> Mobius.to_csv("vm.memory.total", %{})

-- writes CSV values to the terminal

iex> Mobius.to_csv("vm.memory.total", %{}, file: "/data/csv/vm.memory.total")

-- writes CSV values to file vm.memory.total

iex> Mobius.to_csv("vm.memory.total", %{}, file: "/data/csv/vm.memory.total", naming: [:csv_ext, :timestamp])

-- writes CSV values to a file like 20210830T174954_vm.memory.total.csv

iex> Mobius.to_csv("vm.memory.total", %{})

-- writes CSV values to the terminal