Search documentation of macula

# macula_metrics_http (macula v4.4.1)

View Source

Prometheus text-format pull endpoint for `macula_metrics`.

Phase 4.1 — see PLAN_MACULA_NET_PHASE4_1_OBSERVABILITY.md.

Embeds an `inets` httpd listener that serves a single resource: `GET /metrics` returns the current snapshot in Prometheus text-exposition format (v0.0.4 / OpenMetrics-compatible).

Defaults bind 127.0.0.1; remote scraping requires an explicit bind address via `start_link/1`.

# Summary

## Functions

do(Mod)
handle_call(_, From, State)
handle_cast(_, S)
handle_info(_, S)
init(Opts)
port()

Returns the actual port the server is listening on (useful when port=0 is passed for tests).

render()

Render the current metric snapshot as Prometheus text format.

start_link()
start_link(Opts)
stop()
terminate(_, State)

# Functions

# do(Mod)

    -spec do(#mod{init_data :: term(),
                  data :: term(),
                  socket_type :: term(),
                  socket :: term(),
                  config_db :: term(),
                  method :: term(),
                  absolute_uri :: term(),
                  request_uri :: term(),
                  http_version :: term(),
                  request_line :: term(),
                  parsed_header :: term(),
                  entity_body :: term(),
                  connection :: term()}) ->
                {proceed, list()}.

# handle_call(_, From, State)

# handle_cast(_, S)

# handle_info(_, S)

# init(Opts)

# port()

    -spec port() -> inet:port_number().

Returns the actual port the server is listening on (useful when port=0 is passed for tests).

# render()

    -spec render() -> iolist().

Render the current metric snapshot as Prometheus text format.

# start_link()

    -spec start_link() -> {ok, pid()} | {error, term()}.

# start_link(Opts)

    -spec start_link(map()) -> {ok, pid()} | {error, term()}.

# stop()

    -spec stop() -> ok.

# terminate(_, State)