Giter VIP home page Giter VIP logo

openrct2-prometheus-exporter's Introduction

OpenRCT2 Prometheus Exporter

consolelog on Twitch Ecologi (Trees)

An OpenRCT2 plugin that exports Prometheus metrics for a (limited but growing) set of park metrics.

Installation

This plugin requires the OpenRCT2 networking API, available on the OpenRCT2 master branch, in preparation for OpenRCT2 v0.4.0.

Download index.js from GitHub and save the file into your OpenRCT2 plugin folder. This location can be found according to the OpenRCT2 scripting documentation.

Usage

The plugin runs in the background, listening for scripts at the address "localhost:9751", which is currently hardcoded into the file, but may be configurable soon.

Metrics

The following metrics are available. Metric names and labels are subject to change until version 1.0.0.

metric type stability labels
park_cash gauge unstable park
park_entrance_fee_cash gauge unstable park
park_bank_loan_cash gauge unstable park
park_max_bank_loan_cash gauge unstable park
park_rating gauge unstable park
guests gauge unstable park
staff gauge unstable park
peeps gauge unstable park
ducks gauge unstable park

Yes, these metrics names are bad and don't follow the naming best practices. I consider this to be a bug.

Development

This plugin is maintained in a single file, index.js. While unusal, this allows me to keep the number of dependencies to a minimium and makes it easy for users to install into their copy of OpenRCT2. (This is inspired by the reasoning behind the C single-file libraries list).

This plugin should be written to target EcmaScript 5 only, with no extensions. The plugin environment in OpenRCT2 is not a modern browser nor Node.js installation, and thus only ES5 is reliably available. This policy may change if and when OpenRCT2 upgrades and enables later feature sets of Duktape.

This project uses specific versions and configurations of Prettier and ESLint using Nix. Once installed, you'll be able to use these versions by running nix-shell. You can also use a Docker container, similar to the GitHub Actions configuration.

Twitch Livestreams

You can catch me working on this, or other programming projects, as @consolelog on Twitch. Fill free to come by and ask questions!

Donations

OpenRCT2 trees scenery window

If you enjoy using this plugin, I ask that you plant some trees on Ecologi to help offset and reduce our carbon impact.

openrct2-prometheus-exporter's People

Contributors

terinjokes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lastorder-dc

openrct2-prometheus-exporter's Issues

allow user to define metric port

We should allow the user to define a custom metrics port. At first this should be via the configuration file, but eventually it should be done via an in-game window.

Implement integration testing

I would like to be able to startup OpenRCT2 with a known save game and ensure the plugin runs properly. If it's possible to replay a game session, it would be great to ensure the plugin works over time.

add network metrics

We should export the network metrics: number of connected players, their observed latencies, commands and money spent by each player.

add time metrics

We should add the ticks and month age as exported metrics, otherwise you can't easily identify a paused or fast forwarded game.

stop bitbanging prometheus

The Prometheus text format is being rendered in an adhoc fashion by the TCP server handler. This should be querying the metrics from a registry-like object, which would make it easier to formalize rendering TYPE, HELP, and series lines.

add ride metrics

Should export metrics from each ride. We can start with excitement, nausea, and intensity and work our way up from there.

This will likely require changes to the collector pattern to support multiple series per metric type.

allow other plugins to register metrics

If there's interest from other developers, we could allow for external scripts to expose their own metrics (eg, a Twitch plugin could have metrics for responding to chat commands).

  1. What APIs do these developers need? We'd probably want to expose the fundamental types and the default registry at the very least.
  2. How should we handle OpenRCT2 plugin loading order? Other plugins may load before us. AFAICT, there's no hook for plugins loaded, so not a great way to signal to other plugins that we're now available. Pooling for our global could work, but not great.
  3. Allow users to disable metrics from specific plugins. We might be able to do this as part of a configuration UI (and initially the configuration file)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.