Skip to content

Commit

Permalink
Update admin.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rg2011 authored Jul 30, 2024
1 parent 679b7d1 commit 0bb40cd
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions doc/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,24 +164,41 @@ support nulls or multi-attribute requests if they are encountered.
It configures the periodic collection of statistics. Use `interval` in milliseconds to set the time between stats
writings.

By default, stats are logged to the standard log at level `INFO`. If the `persistence` flag is defined and set to
`true`, stats are also stored in a collection named `kpis` in the mongo backend.
```javascript
stats: {
interval: 100;
}
```

By default, stats are logged to the standard log at level `INFO`. You can also have your stats written
to a collection named `kpis` in the mongo backend, if you do these two things:

- Set the `stats.persistence` flag to `true`.

```javascript
stats: {
interval: 100;
persistence: false;
persistence: true;
}
```

- Schedule periodic collection of stats to mongo by calling `statsRegistry.addTimerAction`.

```js
statsRegistry.addTimerAction(statsRegistry.mongodbPersistence, function callback() {
// ... called after timer is enabled ...
});
```

Each document in the `kpis` collection will have a `timestamp` attribute with the stat collection time, and an
additional attribute for each of the stats created by calling the `statsRegistry.add` function, e.g.:

```json
{
"timeinstant": new ISODate("2024-07-29T00:00:00.000Z"),
"deviceCreationRequests": 1334,
"deviceRemovalRequests": 454
"deviceRemovalRequests": 454,
"measureRequests": 4432
}
```

Expand Down

0 comments on commit 0bb40cd

Please sign in to comment.