graftorio icon indicating copy to clipboard operation
graftorio copied to clipboard

graftorio assumes 60 UPS

Open phdoerfler opened this issue 7 years ago • 3 comments

My base is big enough that it runs only at 30 to 40 UPS. While in game production stats factor this in, graftorio (or prometheus and grafana) does not. Dumping stats every 600 ticks and have prometheus pick them up every 10s means that with UPS less than 60 oversampling happens. Graphs in grafana will show lower production stats with reduced UPS. This differs from the in game production graphs and you'll end up wondering what made your base output less items than usually even though it was perfectly fine!

I think the correct way to deal with this is to include the in-game time as timestamp in the exposition .prom file: https://prometheus.io/docs/instrumenting/exposition_formats/

The timestamp is an int64 (milliseconds since epoch, i.e. 1970-01-01 00:00:00 UTC, excluding leap seconds), represented as required by Go's ParseInt() function.

If this is not possible one could also just dump the current tick value to the .prom file as its own metric. However this would require more complex queries in grafana and in my understanding the timestamp attribute is exactly what should be used here.

When using the timestamp value you can retrieve the in-game time using the prometheus timestamp() function.

In addition to that I think dumping the current tick value or the current UPS would be an interesting metric for a dashboard, too!

This would also compensate for pauses and delays introduced by saving (and autosaves).

Another option might be to add metrics for "items per minute" instead of just the total amount and then having to calculate the rate yourself just as it is already done for YARM.

phdoerfler avatar Aug 30 '18 08:08 phdoerfler

thanks for the report!

if you make a save file available for me to download which exhibits this behavior (0.17 if you have one), then i could look into this.

afex avatar Feb 28 '19 01:02 afex

There you go! It's a 0.16 save and with 128 MiB it should be sufficiently big to drag down your UPS. On one of my machines it pulls it down to 43 UPS.

https://www.dropbox.com/s/5rztdmh0mm6yd97/MP_0_16.zip?dl=1

Due to the mismatch in UPS of 43 vs 60 you get really odd looking curves in grafana and they are neither pretty nor do they provide any meaningful values really.

phdoerfler avatar Mar 01 '19 19:03 phdoerfler

Oh btw in the screenshot in https://github.com/afex/graftorio/issues/5#issue-355485463 you can see the effect of the mismatch in UPS. I very much suspect these spikes to result from that.

phdoerfler avatar Mar 01 '19 21:03 phdoerfler