z_stats (zotonic_core v1.0.0-rc.17)

Module for handling request statistics.

Summary

Functions

Setup stats for each site.

Initialize the statistics collection machinery.

Collect log data from cowmachine and update cowmachine metrics

Count some amount, like data transfers

Start the log buffer consumer.

Functions

filezcache_stats()

handle_call(Cmd, From, State)

handle_cast(Cmd, State)

handle_info(_, State)

init(Buffers)

init_site(Site)

Setup stats for each site.

init_system()

Initialize the statistics collection machinery.

log_access(MetricsData)

Collect log data from cowmachine and update cowmachine metrics

The log entry from zotonic_listen_http_metrics is:

  Log = #{
      site => Site,
      reason => Reason,
      req_start => ReqStart,
      duration_total_usec => DurationTotalUsec,
      duration_process_usec => DurationProcessUsec,
      resp_status => RespStatus,
      resp_status_category => StatusCategory,
      req_bytes => ReqBodyLength,
      resp_bytes => RespBodyLength,
      http_version => cowboy_req:version(Req),
      method => cowboy_req:method(Req),
      path => cowboy_req:path(Req),
      user_agent => cowboy_req:header(<<"user-agent">>, Req),
      referer => cowboy_req:header(<<"referer">>, Req),
      metrics => UserData#{ peer_ip => PeerIP }
  }

record_count(System, What, Count, Context)

Count some amount, like data transfers

record_duration(System, What, Duration, Context)

Record a duration

record_event(System, What, Context)

Count a event

start_link(Buffers)

Start the log buffer consumer.

system_usage(_)