Skip to content

Commit

Permalink
track rocket launches
Browse files Browse the repository at this point in the history
  • Loading branch information
afex committed May 1, 2018
1 parent 85b2750 commit 47aadec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gauge_kill_count_input = prometheus.gauge("factorio_kill_count_input", "kills",
gauge_kill_count_output = prometheus.gauge("factorio_kill_count_output", "losses", {"force", "name"})
gauge_entity_build_count_input = prometheus.gauge("factorio_entity_build_count_input", "entities placed", {"force", "name"})
gauge_entity_build_count_output = prometheus.gauge("factorio_entity_build_count_output", "entities removed", {"force", "name"})
gauge_items_launched = prometheus.gauge("factorio_items_launched_total", "items launched in rockets", {"force", "name"})

script.on_event(defines.events.on_tick, function(event)
if event.tick % 600 == 0 then
Expand All @@ -28,6 +29,10 @@ script.on_event(defines.events.on_tick, function(event)
stat[3]:set(n, {player.force.name, name})
end
end

for name, n in pairs(player.force.items_launched) do
gauge_items_launched:set(n, {player.force.name, name})
end
end

game.write_file("metrics/game.prom", prometheus.collect(), false)
Expand Down

0 comments on commit 47aadec

Please sign in to comment.