instrument_metrics_exporter_console (instrument v1.0.0)

View Source

Console exporter for metrics.

Exports metrics to stdout for debugging and development.

Example Usage

  %% Register with default options
  instrument_metrics_exporter:register(instrument_metrics_exporter_console:new()),
 
  %% Register with options
  instrument_metrics_exporter:register(instrument_metrics_exporter_console:new(#{
      format => json,      %% json | text (default: text)
      output => standard_io %% standard_io | standard_error | {file, Path}
  })),

Summary

Functions

Exports metrics to the console.

Initializes the exporter.

Shuts down the exporter.

Creates a new console exporter configuration with defaults.

Creates a new console exporter configuration.

Functions

exporter_export(Metrics, State)

-spec exporter_export([map()],
                      #state{format :: text | json,
                             output :: standard_io | standard_error | {file, file:io_device()}}) ->
                         {ok,
                          #state{format :: text | json,
                                 output :: standard_io | standard_error | {file, file:io_device()}}} |
                         {error,
                          term(),
                          #state{format :: text | json,
                                 output :: standard_io | standard_error | {file, file:io_device()}}}.

Exports metrics to the console.

exporter_init(Config)

-spec exporter_init(map()) ->
                       {ok,
                        #state{format :: text | json,
                               output :: standard_io | standard_error | {file, file:io_device()}}} |
                       {error, term()}.

Initializes the exporter.

exporter_shutdown(State)

-spec exporter_shutdown(#state{format :: text | json,
                               output :: standard_io | standard_error | {file, file:io_device()}}) ->
                           ok.

Shuts down the exporter.

new()

-spec new() -> #{module := module(), config := map()}.

Creates a new console exporter configuration with defaults.

new(Config)

-spec new(map()) -> #{module := module(), config := map()}.

Creates a new console exporter configuration.