GetStatsByServer
Description:
Returns historical host metrics, the current host state and the latest internal
platform runtime snapshot. Platform metrics describe the whole st-server
process and are not divided by brand.
Access Control
🛡️ Access Level Required: SESSION_MANAGER, SESSION_ADMIN, SESSION_DEALER
Access Scope
The server resolves the manager from the current staff cache and requires admin scope or access_backoffice. Token payload is used only to resolve the manager id and session type.
Parameters
| Name |
Type |
Required |
Description |
| from |
int |
âś… |
Start timestamp (UNIX) |
| to |
int |
âś… |
End timestamp (UNIX) |
Response
A response contains:
structure: ordered list of metric field names
rows: ordered metric snapshots for the requested interval plus one live snapshot row appended at the end
info: current server state summary
platform: latest internal platform snapshot collected by MetricsManager
The platform object is a live snapshot rather than a historical row. It is
normally refreshed every 30 seconds. Consumers should inspect sampled_at and
age_sec before treating its values as current.
rows / structure fields
| Field |
Type |
Description |
| connections |
int |
Number of active connections counted during the sampling window |
| requests |
int |
Number of handled requests counted during the sampling window |
| cpu_load_pct |
float |
Total CPU usage in percent |
| disk_load_pct |
float |
Filesystem usage in percent for / |
| net_pck_in |
float |
Incoming packets per second on the monitored network interface |
| net_pck_out |
float |
Outgoing packets per second on the monitored network interface |
| ram_load_pct |
float |
RAM usage in percent |
| time |
int |
UNIX timestamp of the metric snapshot |
| cpu_irq_pct |
float |
CPU time spent in IRQ handlers in percent |
| cpu_softirq_pct |
float |
CPU time spent in soft IRQ handlers in percent |
| net_bytes_in |
float |
Incoming bytes per second on the monitored network interface |
| net_bytes_out |
float |
Outgoing bytes per second on the monitored network interface |
| disk_read_mbps |
float |
Disk read throughput in MB/s for the first detected block device |
| disk_write_mbps |
float |
Disk write throughput in MB/s for the first detected block device |
| sockets_total |
int |
Total observed TCP sockets |
| sockets_waiting |
int |
TCP sockets currently waiting in SYN states |
info fields
| Field |
Type |
Description |
| os |
string |
Operating system pretty name |
| cpu_name |
string |
CPU model name |
| cpu_cores |
int |
Number of CPU cores |
| cpu_load_pct |
float |
Current CPU usage in percent |
| ram_free_mb |
int |
Currently available RAM in MB |
| ram_total_mb |
int |
Total RAM in MB |
| ram_largest_mb |
int |
Largest free contiguous RAM block in MB |
| disk_free_mb |
int |
Free disk space in MB for / |
| disk_total_mb |
int |
Total disk space in MB for / |
| disk_read_mbps |
float |
Current disk read throughput in MB/s |
| disk_write_mbps |
float |
Current disk write throughput in MB/s |
| net_iface |
string |
Monitored network interface name |
| net_bytes_in |
float |
Current incoming bytes per second |
| net_bytes_out |
float |
Current outgoing bytes per second |
| net_pck_in |
float |
Current incoming packets per second |
| net_pck_out |
float |
Current outgoing packets per second |
| sockets_total |
int |
Current total TCP sockets |
| sockets_waiting |
int |
Current TCP sockets in waiting/SYN states |
| Field |
Type |
Description |
| sampled_at |
int |
UNIX timestamp when the snapshot was collected |
| sequence |
uint64 |
Monotonically increasing snapshot sequence within the current server process |
| age_sec |
int |
Snapshot age in seconds; -1 means that the first snapshot is not available yet |
| runtime |
object |
Process memory, file descriptor and thread counters |
| quotes |
object |
Quote storage queue and sampled processing latency |
| event_bus |
object |
Local EventBus state |
| thread_pools |
object |
Tracked task state for the general and quote executors |
| trade_pipeline |
object |
Internal trade calculation and persistence queues |
| feeders |
array |
Runtime state of configured quote feeders |
| Field |
Type |
Description |
| rss_kb |
uint64 |
Resident memory in KiB |
| rss_anon_kb |
uint64 |
Anonymous resident memory in KiB |
| vmdata_kb |
uint64 |
Process data virtual memory in KiB |
| heap_arena_bytes |
uint64 |
Bytes currently allocated to heap arenas |
| heap_used_bytes |
uint64 |
Used heap bytes reported by the allocator |
| heap_free_bytes |
uint64 |
Free bytes retained inside heap arenas |
| heap_mmap_bytes |
uint64 |
Heap bytes backed by separate mmap allocations |
| heap_mmap_blocks |
uint64 |
Number of mmap-backed heap allocations |
| fd_total |
uint64 |
Total open file descriptors |
| fd_sockets |
uint64 |
File descriptors referring to sockets |
| fd_files |
uint64 |
File descriptors referring to regular files |
| threads |
uint64 |
Number of process threads |
| Field |
Type |
Description |
| ticks_enqueued |
uint64 |
Quote storage jobs accepted since process start |
| ticks_dequeued |
uint64 |
Quote storage jobs processed since process start |
| ticks_dropped |
uint64 |
Quote storage jobs rejected since process start |
| backlog |
uint64 |
Current quote storage queue backlog |
| max_worker_backlog |
uint64 |
Highest observed worker backlog |
| latency_samples |
uint64 |
Number of quote callbacks sampled during the latest snapshot interval |
| latency_p50_us |
uint64 |
Approximate p50 processing latency for the latest interval, in microseconds |
| latency_p95_us |
uint64 |
Approximate p95 processing latency for the latest interval, in microseconds |
| latency_p99_us |
uint64 |
Approximate p99 processing latency for the latest interval, in microseconds |
| latency_max_us |
uint64 |
Maximum sampled processing latency for the latest interval |
Quote latency uses deterministic per-thread sampling: one callback out of 128
is measured. Unsampled callbacks do not call the clock and therefore avoid
adding timing overhead to every quote. Percentiles are histogram
approximations for the latest collection interval, not values split by symbol
or brand.
| Field |
Type |
Description |
| backlog |
uint64 |
Approximate number of events awaiting dispatch |
| event_names |
uint64 |
Number of registered event names |
| handlers |
uint64 |
Number of registered handlers |
| running |
bool |
Whether the local EventBus worker is running |
| Field |
Type |
Description |
| state |
int |
Pool lifecycle: 0 stopped, 1 running, 2 draining, 3 stopping |
| threads |
uint64 |
Configured worker count |
| queued |
uint64 |
Tracked tasks accepted but not started |
| running |
uint64 |
Tracked tasks currently executing |
| completed |
uint64 |
Tracked tasks completed since process start |
| rejected |
uint64 |
Tasks rejected because the pool was unavailable or shutting down |
| failed |
uint64 |
Tasks that raised an exception inside the tracked wrapper |
| slow |
uint64 |
Tasks whose execution took at least five seconds |
| max_duration_ms |
uint64 |
Maximum completed tracked-task duration |
| active_tasks |
array |
Currently executing tracked tasks with id, name, thread_id, enqueue/start timestamps, and running_ms |
Task metadata never contains request bodies, credentials, or business payloads.
It identifies only the internal operation, for example workflow.trade.closed,
eventbus.account.online, plugin.event.1, or core.quote.publish.
| Field |
Type |
Description |
| batches_enqueued |
uint64 |
Calculation batches queued since process start |
| batches_completed |
uint64 |
Calculation batches completed since process start |
| batches_in_flight |
uint64 |
Calculation batches currently running |
| trades_in_flight |
uint64 |
Trade records currently being calculated |
| trades_high_watermark |
uint64 |
Highest observed number of trades in flight |
| runtime_tasks_in_flight |
uint64 |
Trade runtime tasks currently running |
| db_ops_queued |
uint64 |
Trade persistence operations waiting in the database queue |
| db_tasks_in_flight |
uint64 |
Trade persistence tasks currently running |
| Field |
Type |
Description |
| index |
int |
Feeder index |
| name |
string |
Configured feeder name |
| state |
int |
Current feeder runtime state |
| ticks_total |
uint64 |
Ticks received from the feeder since process start |
| tick_errors |
uint64 |
Feeder callback errors since process start |
| callbacks_in_flight |
uint64 |
Callbacks currently running |
| callbacks_high_watermark |
uint64 |
Highest observed callbacks-in-flight value |
Example Response
{
"structure": [
"connections",
"requests",
"cpu_load_pct",
"disk_load_pct",
"net_pck_in",
"net_pck_out",
"ram_load_pct",
"time",
"cpu_irq_pct",
"cpu_softirq_pct",
"net_bytes_in",
"net_bytes_out",
"disk_read_mbps",
"disk_write_mbps",
"sockets_total",
"sockets_waiting"
],
"rows": [
[123, 4567, 23.5, 14.8, 120.0, 115.0, 67.1, 1712345678, 0.3, 0.8, 1048576.0, 943718.0, 12.4, 3.1, 842, 4]
],
"info": {
"os": "Ubuntu 24.04 LTS",
"cpu_name": "Intel(R) Xeon(R) CPU",
"cpu_cores": 8,
"cpu_load_pct": 21.2,
"ram_free_mb": 6144,
"ram_total_mb": 16384,
"ram_largest_mb": 512,
"disk_free_mb": 102400,
"disk_total_mb": 204800,
"disk_read_mbps": 12.4,
"disk_write_mbps": 3.1,
"net_iface": "eth0",
"net_bytes_in": 1048576.0,
"net_bytes_out": 943718.0,
"net_pck_in": 120.0,
"net_pck_out": 115.0,
"sockets_total": 842,
"sockets_waiting": 4
},
"platform": {
"sampled_at": 1789545722,
"sequence": 125,
"age_sec": 7,
"runtime": {
"rss_kb": 7355392,
"rss_anon_kb": 7323648,
"vmdata_kb": 23532544,
"heap_arena_bytes": 21103640576,
"heap_used_bytes": 20796407808,
"heap_free_bytes": 307232768,
"heap_mmap_bytes": 2232418304,
"heap_mmap_blocks": 229,
"fd_total": 466,
"fd_sockets": 19,
"fd_files": 429,
"threads": 87
},
"quotes": {
"ticks_enqueued": 169238,
"ticks_dequeued": 169238,
"ticks_dropped": 0,
"backlog": 0,
"max_worker_backlog": 0,
"latency_samples": 55,
"latency_p50_us": 500,
"latency_p95_us": 2000,
"latency_p99_us": 5000,
"latency_max_us": 4312
},
"event_bus": {
"backlog": 0,
"event_names": 22,
"handlers": 31,
"running": true
},
"thread_pools": {
"general": {
"state": 1,
"threads": 4,
"queued": 0,
"running": 1,
"completed": 18432,
"rejected": 0,
"failed": 0,
"slow": 1,
"max_duration_ms": 6120,
"active_tasks": [
{
"id": 18433,
"name": "workflow.trade.closed",
"thread_id": "140172902938368",
"queued_at_ms": 1789545722000,
"started_at_ms": 1789545722001,
"running_ms": 37
}
]
},
"quote": {
"state": 1,
"threads": 2,
"queued": 0,
"running": 0,
"completed": 95431,
"rejected": 0,
"failed": 0,
"slow": 0,
"max_duration_ms": 14,
"active_tasks": []
}
},
"trade_pipeline": {
"batches_enqueued": 40006,
"batches_completed": 40006,
"batches_in_flight": 0,
"trades_in_flight": 0,
"trades_high_watermark": 547946,
"runtime_tasks_in_flight": 0,
"db_ops_queued": 0,
"db_tasks_in_flight": 0
},
"feeders": [
{
"index": 7,
"name": "SCT-Feeder",
"state": 1,
"ticks_total": 159293,
"tick_errors": 0,
"callbacks_in_flight": 0,
"callbacks_high_watermark": 1
}
]
}
}
Collection and provider monitoring
The platform snapshot has three consumers:
MetricsManager exposes the current snapshot through this BO method.
- With server debug logging enabled, the same runtime values are printed as
[MONITORING][...] debug messages.
- The server exposes Prometheus text through the local Unix socket
/run/sttrader/metrics.sock. stmonit reads this socket, adds instance-level
labels and sends the metrics to the provider's centralized registry.
The Unix socket does not open an inbound TCP port. Failure or absence of
stmonit does not block quote processing, trade calculation or BO access.
Errors
| Code |
Description |
| 400 |
Invalid request data |
| 500 |
Internal server error |