---
feature_story: FS_87_02_77_34
feature_title: usage stats
feature_status: TODO
---

# Purpose

Accumulate usage stats persistent across server restarts.

The data is collected on the server-side.

# Implementation

TODO: Implement: Client can set `send_usage_stats` to `true` in `ClientConfig`.

TODO: Implement: Server can set `store_usage_stats` to `true`.

Stats are collected in `@/var/usage_stats` on the server side.

# Collected metadata

The metadata can be collected from both server-side and client-side input.

## Input attributes equivalent on both sides

*   `${proc_side}_ts_ns`

    Time stamp in nanoseconds since epoch.

    *   Client: request preparation time.
    *   Server: request arrival time.

*   `${proc_side}_conf_target`

    Path where `@/conf` symlink points to.

*   `${proc_side}_version`

    Version of `argrelay` package.

    After TODO_78_94_31_68: splitting `argrelay` into multiple packages,
    server-side and client-side may need to specify different packages. 

## Server-side input attributes

*   `server_ts_ns`

    See `${proc_side}_ts_ns`.

*   `server_conf_target`

    See `${proc_side}_conf_target`.

    TODO: Implement. Or do we need it if it is constant for a given server?
          But, at least, it makes sense to keep it in schema for cases when
          usage stats from multiple servers are combined.

*   `func_id`

    TODO: Implement: This should report selected `func_id` (which may not be available until it is done).

## Client-side input attributes

*   `client_ts_ns`

    See `${proc_side}_ts_ns`.

*   `client_version`

    See `${proc_side}_version`.

*   `client_conf_target`

    See `${proc_side}_conf_target`.

*   `client_user_id`

    See `client_user_id` from `CallContext`.

*   `server_action`

    See `server_action` from `CallContext`.

*   `command_line`

    See `command_line` from `CallContext`.

*   `cursor_cpos`

    See `cursor_cpos` from `CallContext`.

*   `comp_scope`

    See `comp_scope` from `CallContext`.
