Skip to content

Conversation

@matthiasemde
Copy link
Contributor

@matthiasemde matthiasemde commented Nov 16, 2025

This PR adds collectors for the four inventory endpoints:

Open tasks:

  • Write tests
  • Adapt README.md
  • Consider using the /getResearchTrees endpoint to figure out the storage capacity of the dimensional depot and expose it as an additional metric
  • Consider player inventories (Ficsit does not guarantee player privacy)

Fixes #30

@matthiasemde
Copy link
Contributor Author

matthiasemde commented Nov 17, 2025

@AP-Hunt, I just realized that the metrics for containers which are deleted still show up in Grafana. That's what the 'metric dropper' is for, right?

@AP-Hunt
Copy link
Owner

AP-Hunt commented Nov 18, 2025

I believe that's right, yes. @featheredtoast added that, but reading after reading it I've got the same conclusion. The metric dropper is, if I understand it right, there to stop reporting values things that no longer exist.

It's probable though that Grafana is showing old labels because Prometheus is giving it metrics with that label because they exist within the time frame being queried. The metric dropper doesn't purge anything in Prometheus.

@featheredtoast
Copy link
Collaborator

Yeah - that's it exactly.

For a concrete example, at 10am, report iron plate: 100 from some buffer at 0,0. Take some plates out at 10:30, now reporting iron plate: 80 All good...

If the buffer is deleted or moved... we probably want to stop reporting that there is iron plate: 80 at 0,0. That's what metrics dropper is for.

Prometheus itself doesn't drop any data, so if you check in at 11:30 and go "hey what are my buffers in the last two hours?" prometheus can still report "oh yes, there was 80 iron plates at some buffer at 0,0 then".

Label queries are asking the above to give what's where. That's probably why Grafana still shows old labels. Hope that makes sense.

@matthiasemde
Copy link
Contributor Author

Makes sense - and a good thing to know (and keep in mind) when working with Prometheus. Tried it out and it worked flawlessly. ATM I'm still messing around with machine and player inventories but I'll update the PRs soon™.

@matthiasemde matthiasemde marked this pull request as ready for review November 23, 2025 17:39
@matthiasemde
Copy link
Contributor Author

Hi @AP-Hunt,
the PR is now ready for review / ready to merge :)

@matthiasemde
Copy link
Contributor Author

I added one more change. Now storage containers and factory buildings use the "ID" field for the metric dropper, since I had problems with metrics not being dropped for buildings with near identical coordinates.

Btw. before you merge this I would like to do a clean up of the commit history - I just dont want to rewrite the history during a review.

@AP-Hunt
Copy link
Owner

AP-Hunt commented Nov 29, 2025

Happy for you to rewrite history before merging 👍 Seems the tests aren't happy. I wonder if that's related to code that got merged in the intervening time?

@matthiasemde matthiasemde force-pushed the add-inventory-collectors branch from 08979ad to 3299fff Compare December 3, 2025 20:58
@matthiasemde
Copy link
Contributor Author

Ok, I cleaned up the history and fixed the tests. Ready to merge if you are :)

@matthiasemde
Copy link
Contributor Author

@AP-Hunt after merging you could also run the docker build pipeline to create the first image on ghcr.io (and check whether the pipeline actually works 😆 )

@AP-Hunt
Copy link
Owner

AP-Hunt commented Dec 3, 2025

I shall merge now, test, and cut a release

@AP-Hunt AP-Hunt merged commit 93736fa into AP-Hunt:main Dec 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storage Metrics

3 participants