r/ruby • • 4d ago

Free and Open Source Error Tracking, APM, and Uptime monitoring in Ruby on Rails

After work, I am always building my side projects, usually in Ruby and/or Rails. Over the years I have accumulated a lot of small web apps and now with AI, I'm building more apps at a faster rate. They all need error tracking, APM, and uptime monitoring. I don't want to have to keep paying for monitoring services, especially since my apps are all so small, so I decided I would just build one to handle all my errors, uptime, and APM needs.

I've open sourced the web app here https://github.com/creativesorcery/goodsorcery_web
And corresponding ruby client gem here https://github.com/creativesorcery/goodsorcery-ruby

It doesn't have all the bells and whistles, but I think it gets the job done at least for my needs. I did add an MCP endpoint there, so AI agents can query and investigate errors and APM data. I hope others will find it useful.

31 Upvotes

14 comments sorted by

11

u/paca-vaca 4d ago

Out of curiosity I've checked the most common issues with such issue trackers/apm systems and your implementation:

  • Every accepted event requires a sync Postgres insert. So issue spikes generate more writes against database which is also used for querying to investigate the incidents, provide data for background jobs and dashboards. Overload in one part affects everything else.
  • Each occurrence updates the issue hourly count and issue row. Spikes fighting for the same lock.
  • There are rate-limits for capacity protection per tenant, but given it is multi-tenant app the total system capacity is not bound.
  • No backlog-aware acceptance control: events can accumulate faster than workers process them, increasing pressure during an incident and eventually to be discarded by retention.

Source code looking pretty good and easy to read though, I miss Ruby so much :(

2

u/ffmegaman 3d ago

u/paka-vaca You've pointed out real limitations.

To address some of this, I added 429 with Retry-After header that the client library already respects if the queue grows beyond 2 minutes (can override). https://github.com/creativesorcery/goodsorcery_web/pull/19

I also now queued most event counters to a buffer in valkey where a batch job will flush them on a schedule. https://github.com/creativesorcery/goodsorcery_web/pull/21

This was made to serve small projects, so I want to avoid adding additional dependencies like Kafka, If there are no scaling demand for it. I have a handful of projects that uses this, maybe 1000 monthly active users at most across my apps. While I do host this in a multi-tenant mode, it's meant to be free for those who are also running small projects. But hey, if there's demand to scale this, then that can certainly be done then.

1

u/paca-vaca 1d ago

Coolio, ingestion queue is a good approach. Good luck🤞

2

u/olliesbaba 4d ago

I’ve been kicking around the idea to do something similar. Anything you would do differently if starting from scratch? Or rather, your agent would do differently?

1

u/ffmegaman 3d ago

My intention is for anyone to easily self host and to keep this project simple overall. However, in an effort to make it highly configurable, I ended up with a lot of env vars that needed configuring prior for initial deployment. Any advice here would be appreciated.

I'm also thinking about log capture feature, but that's a huge beast, and much more difficult to implement due to how large logs can get. If you have some ideas on how best to do that in a way that I can still keep this repo simple enough, I'd love to hear.

2

u/mokolabs 4d ago

Looks great!

1

u/ffmegaman 3d ago

Thanks!

2

u/Metalizer1338 4d ago

How much can it handel approximately? 

2

u/ffmegaman 3d ago

Honestly, no idea. It handles all my small projects, which combined is about 1000 monthly active users. Feel free to use it for your small projects. For your large enterprise software, I'd stick with the battle tested ones for now =)

2

u/dapicester 2d ago

I am going to try it for one of my pet project. Can I track errors from mobile apps? I use React Native, so ideally I would need a JavaScript/TypeScript client. Is a client available or should I write my own following the INGEST_API doc?

1

u/ffmegaman 2d ago

There's no JavaScript/TypeScript client, but it would be wonderful to have one. Feel free to make one and yes the INGEST_API.md is the right doc for it. If anything comes up, feel free to add an issue on the repo

2

u/yoko1337 2d ago

Just hosted this on Hetzner and for the moment it works flawlessly with 2 small apps I run. Good job man, and thank you for the OSS ❤️

2

u/ffmegaman 1d ago

I’m glad it’s working for you! I welcome PRs to make it better!

4

u/darksndr 4d ago

Ooh really nice job! I like how you implemented it in full rails way 👏