Statistic
Generic keyed counters/values under a statistics object on either branch. Keys support dot paths (nested) with literal-key fallback, same as GnosisStore path rules.
Policy: Exposed for inbound calls (other services use it for telemetry-style totals).
State
| Location | Keys |
|---|---|
Persistent.statistics | Long-lived totals (e.g. meta progression) |
Ephemeral.statistics | Per-run totals |
How it looks in persistent.json / ephemeral.json
Values are nested objects under statistics; keys may use dot paths when you address them from CallService.
{
"Persistent": {
"statistics": {
"meta": {
"totalRuns": 12
}
}
}
}{
"Ephemeral": {
"statistics": {
"run": {
"enemiesDefeated": 40
}
}
}
}Use a dot-path key when your JSON is nested (e.g. run.enemiesDefeated). persistent: true writes Persistent.statistics only; false updates Ephemeral and also mirrors the same key on Persistent (see Functions).
Events
None.
Functions
| Function | Parameters | Behavior |
|---|---|---|
GetValue | persistent (bool), key or path (string) | Returns { value: <node> } |
SetValue | persistent, key/path, value | Sets node at path |
IncrementCounter | persistent, key/path, delta (optional, default 1) | Adds to numeric stat; if persistent is false, also increments the same key on Persistent (lifetime total + run total) |
Usage example — IncrementCounter
private void BumpRunCounter(string key, int delta = 1)
{
if (Context?.Store == null || Context.CallService == null)
return;
var args = GnosisNode.CreateObject(Context.Store);
args.Set("persistent", false);
args.Set("key", key);
args.Set("delta", delta);
CallService("Statistic", "IncrementCounter", args);
}Statistics
This service is the statistics store; there is no separate metrics layer.
Usage by other services
Currency
Keys currency.<id>.earned, currency.<id>.spent, currency.<id>.interest. See Currency.
{
"Ephemeral": {
"statistics": {
"currency": {
"money": {
"earned": 0,
"spent": 0,
"interest": 0
}
}
}
}
}Consumable
Keys consumables.added.total, consumables.removed.total, consumables.used.total, plus consumables.<action>.tag.<tag> when definitions have tags. See Consumable.
{
"Ephemeral": {
"statistics": {
"consumables": {
"added": { "total": 0 },
"removed": { "total": 0 },
"used": { "total": 0 }
}
}
}
}Upgrade
Keys upgrades.added.total, upgrades.removed.total, plus upgrades.<action>.tag.<tag> when definitions have tags. See Upgrade.
{
"Ephemeral": {
"statistics": {
"upgrades": {
"added": { "total": 0 },
"removed": { "total": 0 }
}
}
}
}