Article
· May 6 13m read

IRIS iRacing

 Hello IRIS Fans and Welcome to IRIS iRacing!

Here were going to take 3 laps of your time and demonstrate how I wired up my Racing SIM to IRIS for "As Real Time as It Gets" Metrics reporting.  I missed the window for the contest, which happens quite often, but I still ended up 3rd I think in the demo race in the video below.


Technical Salad

Below are the technical ingredients for this demonstration for a salad you can post on Instragram.

 
User.iRacing.cls


Dont forget to do a:

set tSC = ##class(SYS.Monitor.SAM.Config).AddApplicationClass("User.iRacing", "USER")

Then you should see your new metrics on the /api/monitor/metrics endpoint.


Notable here is my python setup on Windows:

iris_site.py

[config]
LibPath=
MaxServerConn=1
MaxServers=2
Path=
PythonPath=c:\Python\Python313\python.exe
PythonRuntimeLibrary=C:\Python\Python313\python313.dll
PythonRuntimeLibraryVersion=3.13
UUIDv1RandomMac=0
bbsiz=-1
console=,


cpf
 

def set_site_path(platform_name):
    sys.path = sys.path + __sitegetsitepackages(['C:\\Python\Python313'])    
    sys.path = sys.path + ["C:\\Python\Python313\\Lib"]

Racing SIM

Below is the SIM specifications, complete with Driver.

Gluing it all together, we have a rolling SIM emitting, scraping and serving up iRacing metrics suitable for real time display.

As Real Time as It Gets

The excuse I made for myself to derive some real value of sorts out of this was I have always wanted to be as agressive as possible with data reporting from the source to the exporter, clear through the Prometheus Scrape and the eventual dashboard.  The python sdk is wicked fast, as it reads from a memory mapped file while in session, and the other components can be configured to be agressive, but just are not by default and took some edits and daemon reloads.

In order to make this work, I found the following tweaks for necessary:

grafani.ini

min_refresh_interval = 1s

prometheus.yml
1s scrape
 

  - job_name: 'iracing'     # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 1s
    scrape_timeout: 1s     # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: ['192.168.1.193:52773']
    metrics_path: '/api/monitor/metrics'

Dashboard

Newly added refresh rate can be added, and "Refresh Live Dashboards"  should be enabled.


At rest it doesnt look like much, as its designed to be real time, but a screenshot is in order to see the 5 panels.

 
Grafana Dash



Demo

The video shows us putting the Dashboard and scraping to work in a quick 3 lap shootout at Darlington Motor Speedway.

https://www.youtube.com/embed/rTE-Mk05yAQ
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

🏆 This is considered an InterSystems Best Practice

Discussion (0)1
Log in or sign up to continue