website logo
⌘K
What is Gameye?
Getting started
Getting ready to start
1. Set up your Docker Hub account
2: Set up your organization on Gameye
3. Sort and push your Docker file
4. Configure your ports
5. Start the API call
API
API endpoints
Regions and locations
Error handling
Guides
Integrations
Using Gameye
Working with Docker
Support
Getting support
Giving feedback
Troubleshooting
Troubleshooting problems
FAQs
How do I start using Gameye?
Do you require authorisation to use the API?
How does Gameye scale?
What is the difference between a location and a region?
Is Gameye free to use?
FAQs
Glossary
Docker
Container
Region
Image Registry
Bare metal
Flex metal
Cloud
Matchmaker
Changelogs
Docs powered by
Archbee
Guides
Using Gameye

Switch on Smarthost (BETA)

4min

If you want to use Smarthost, you need to expose an endpoint that our platform can use to get the information we need. For this example, we’ll call this metrics.

We need to speak with you first. There are a few values we need from you so we can set up our platform to work with your game. Speak with our support team to get everything ready.

Configuring the metrics endpoint

Typically, people set this to /metrics on port 80. This is an http endpoint (not https).

You must use port 80.

The endpoint exposes a Prometheus gauge metric named occupancy with just one label slot. This label uniquely identifies the "seat" that a player can fill.

When this value is 1 (or 1.0), that means a player is present in that chair. When this value is 0 (or 0.0), there’s no player.

Here’s an example of a response to GET /metrics:

JSON
|
occupancy{slot="1"} 1  // There's a player in slot number 1
occupancy{slot="2"} 0  // There isn't a player in slot number 2
occupancy{slot="3"} 1 
occupancy{slot="4"} 1 
occupancy{slot="5"} 0 
occupancy{slot="6"} 0


Here’s a simple Python script to do this:

Python
|
from prometheus_client import start_http_server, Gauge

g = Gauge("occupancy", "Occupied slots", ["slot"])

if __name__ == '__main__':
    start_http_server(80) #exposes the metrics to /, /metrics/, and /metric path
    while True:
        g.labels("1").set(1) # player exists in slot 1
        g.labels("2").set(1)
        g.labels("3").set(0) # player does not exist in slot 3
        g.labels("4").set(1)


With that done, Smarthost can now use that information to predict how many sessions you'll need and load them up ready for new players.

Updated 04 Jul 2023
Did this page help you?
PREVIOUS
Generating logs
NEXT
How does Smarthost work?
Docs powered by
Archbee
TABLE OF CONTENTS
Configuring the metrics endpoint
Docs powered by
Archbee