# get\_memory\_history

Read what komrad and its agents cost in memory at each sample over the last ten minutes, and what one owner cost alongside it.

read-only · idempotent · CLI only · [System](https://komrad.dev/latest/api/system.md)

## Calling it

```bash
curl -X POST http://127.0.0.1:8787/komrad.system.v1.SystemService/GetMemoryHistory \
  -H 'Content-Type: application/json' \
  -d '{}'
```

```bash
komrad rpc get-memory-history
```

## Request

### GetMemoryHistoryRequest

| Field | Type | Description |
| --- | --- | --- |
| [one of](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-GetMemoryHistoryRequest-owner) |  | The owner whose own samples to read alongside the total. Unset reads the total alone. |
| [`part`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-GetMemoryHistoryRequest-part) | [KomradPart](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart) | The part of komrad's own share. |
| [`agent_id`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-GetMemoryHistoryRequest-agent_id) | uuid | The agent's id. |

## Response

### GetMemoryHistoryResponse

| Field | Type | Description |
| --- | --- | --- |
| [`total`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-GetMemoryHistoryResponse-total) | [MemorySample\[\]](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-MemorySample) | What komrad and its agents cost at each sample over the last ten minutes, oldest first. |
| [`owner`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-GetMemoryHistoryResponse-owner) | [MemorySample\[\]](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-MemorySample) | What the named owner cost at each sample over the last ten minutes, oldest first. Empty when the request names no owner, or one that held no memory in that time. |

## Types

### MemorySample

MemorySample is what something cost in memory at one sample.

| Field | Type | Description |
| --- | --- | --- |
| [`sampled_at`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-MemorySample-sampled_at) | timestamp | When komrad took the sample. |
| [`bytes`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-MemorySample-bytes) | int64 | What it cost at that sample. |

### KomradPart

KomradPart is one part of komrad's own share of memory.

| Value | Description |
| --- | --- |
| [`server`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-server) | The server process. |
| [`postgres`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-postgres) | The embedded Postgres and its backends. |
| [`tmux`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-tmux) | The tmux server on komrad's socket. |
| [`language_servers`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-language_servers) | The language servers komrad runs over checkouts. |
| [`hooks`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-hooks) | The hooks and scripts komrad runs. |
| [`panel`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-panel) | The panel. |
| [`leftover_agent_processes`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-leftover_agent_processes) | The processes left running by archived agents. |
| [`unattributed`](https://komrad.dev/latest/api/system/get-memory-history.md#komrad-system-v1-KomradPart-unattributed) | What komrad's cgroup holds outside the cgroups of its parts and its agents, such as what the server held before komrad split its cgroup. |
