Name: screeps-stats
Owner: screepers
Description: Access Screeps Console, Performance, and Statistics Data via Kibana and ElasticSearch
Created: 2016-06-01 03:41:15.0
Updated: 2018-02-02 02:18:33.0
Pushed: 2017-08-02 06:16:28.0
Size: 96
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Screeps Stats Collection is a service that ingests statistics and console data from the Screeps game and saves them in ElasticSearch. This service can be setup on an existing server or can be provisioned using the supplied vagrant file.
You can run this immediately on your own computer using vagrant.
cp .screeps_settings.dist.yaml .screeps_settings.yaml
) and fill it out.vagrant up
and wait.Running the Screps Stats Collector service on a linux server is a little more complicated but far more robust. This is the recommended setup for long term installations.
ElasticSearch can be installed however you wish, but a provisioning script for ElasticSearch and Kibana is provided.
wget $(curl -L -s https://api.github.com/repos/screepers/screeps-stats/releases/latest | grep tarball_url | head -n 1 | cut -d '"' -f 4) -O screepsstats.tgz
mkdir screepsstats; tar zxvf screepsstats.tgz -C ./screepsstats --strip 1
.sudo mv screepsstats /opt/screepsstats
.cd /opt/screepsstats
sudo ./provisioning/provision.sh
.cp .screeps_settings.dist.yaml ~screepsstats/.screeps_settings.yaml
and then edit.make
sudo make install
If you are using an operating system with SystemD this service will be installed when you run make install
.
From there it can be managed with the systemctl tool (systemctl start screepsstats.service
).
For servers without systemd the screepsstatsctl
service manager has been provided. It takes the commands
start
, stop
, and reset
. For security reasons this should be run as root (it will downgrade itself
to it's own user).
By default this service will ingest the console and performance data (cpu and memory size).
With the addition of a client side (in game, javascript) module additional statistics, including custom stats, can be added.
ScreepsStats = require('screepsstats')
al.Stats = new ScreepsStats()
le.exports.loop = function () {
Do code stuff!
Run Stats Last.
ats.runBuiltinStats()
Optional: Move stats from this tick out of memory
and into one of the passed segments.
ats.manageSegments([50,51,52,53,54])
When the stats collection service picks stats up from the server it will erase them, so as long as the service is running only a few ticks worth of data will be stored. If the stats service fails. Stats will be collected for up to 20 ticks, at which point the oldest data will be removed.
It's important for the ScreepsStats
class to get assigned to global.Stats
, as the stats collection server will
use this class to delete ticks that it has finished processing.
This module uses the console attribute system defined in the Screeps Console
project. By adding additional tags like severity
, group
, and tick
, developers can sort and filter their console data
to drill down into issue.
You can start with the ExampleLogger in
that project as a replacement for console.log
to immediately take advantage of this.