frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Trifle – Open-source analytics that stores answers, not events

https://trifle.io/
2•iluzone•53m ago
Trifle is an open-source time-series analytics library that aggregates nested counters instead of storing raw events. All in the database you already have. After rebuilding it twice over 10 years, it now tracks ~1B events a day at my day job.

It started in 2015 as my own Rails APM. I plugged into ActiveSupport::Notifications, got a few small users, and one bigger one whose scraping app broke everything. That sparked the core idea: aggregate counters into pre-defined time buckets, so a single write increments multiple buckets at once. The APM eventually faded away without much traction.

Later in 2021 I needed analytics at my day job. Instead of going for something out there I revised the idea of Trifle as a more generic analytics library, borrowing some data warehouse ideas. First used Redis, then Postgres, eventually MongoDB. Hence why Trifle::Stats comes with multiple drivers that keep the DSL unified while storage layer changes with your needs. In our case (huge write volume, some reads) PG read faster but slowed on large writes.

The nested values are the whole trick here. Single:

  Trifle::Stats.track(
    key: 'requests::aws::s3_uploads',
    values: {
      count: 1,
      status: { request.response_code => 1 },
      size: payload.bytes,
      duration: { sum: request.duration, count: 1 }
    }
  )
  
builds up counts for requests, success rate, result status codes, duration for multiple time buckets at once. Single bucket from 2am then looks like:

  { count: 14, status: { 200: 12, 500: 2 }, size: 5628341, duration: { sum: 43, count: 14 } }
If request.duration is in seconds, then sum stored under duration would be in seconds as well.

Success rate is never stored, but it is calculated by dividing 200s over total number of requests. Same with average duration: sum over count. You ask for a metrics key, granularity and timeframe and you get back aggregated values at each point. Ready for charts or to answer "Average response time over last 30 days".

There's a Series wrapper for aggregating and formatting values for charts in a simple call. And as building dashboards is not as much fun for other devs as I thought, I built Trifle App - a visual layer with dashboards, scheduled digests and alerts. It's written in Elixir, so I ported the library to Elixir too. And later to Go for a CLI. All three are compatible, write in one and read in another.

Today we track activity from over 100M background jobs a day which turns into about 1B events. It runs surprisingly cheap when you're willing to trade some safety away (turn off journaling and write concerns in Mongo). 3-node Hetzner MongoDB cluster where the primary does 20% utilization costs us around $1k/month.

It has its limitations. Payloads can't hold tens of thousands of keys. Documents becomes too large to update efficiently. Some planning ahead is needed. And then there are no dimensions. Sometimes you can nest them (country - there are only so many countries), sometimes it's better to have dedicated metrics key per dimension (customer - growing forever). That multiplies tracked events, hence 1B events from 100M jobs.

The libraries are MIT. The App is source-available under ELv2 - free to self-host and paid cloud if you want it managed. I build this on the side with no investor money to burn on a free service.

Happy to answer anything about architecture, storage models, my failures or why I didn't give up on this yet.

Show HN: HN Hall of Fame – browse 3,100 legendary Hacker News links

https://www.orangecrumbs.com/hall/
1•oyster143•2m ago•0 comments

Astronomers identify a source of PeV cosmic-ray protons in the Milky Way

https://www.hiroshima-u.ac.jp/en/news/98115
1•MarcoDewey•2m ago•0 comments

Zero roadkill as Amazon canopy bridges secure 15,000 crossings

https://news.mongabay.com/2026/07/zero-roadkill-as-amazon-canopy-bridges-secure-15000-crossings/
2•hn_acker•2m ago•0 comments

The Electronic Waste Graveyard: an interactive database of software-killed tech

https://pirg.org/edfund/resources/electronic-waste-graveyard/
1•MarcoDewey•4m ago•0 comments

Using Claude to re-create extinct software – Matlab from the 1980's

https://forum.vcfed.org/index.php?threads/using-claude-to-re-create-extinct-software-matlab-from-...
1•JPLeRouzic•5m ago•0 comments

Garmin $200 no subscription whoop alternative

https://www.garmin.com/en-US/newsroom/press-release/wearables-health/meet-cirqa-smart-band-the-sc...
1•flurly•5m ago•0 comments

Critical Minerals: Reducing U.S. Import Reliance with Substitution and Recycling

https://www.gao.gov/products/gao-26-108687
1•Jimmc414•5m ago•0 comments

A Puerto Rico Government Agency Exposed 1M Social Security Numbers

https://www.propublica.org/article/puerto-rico-crim-data-breach
3•Jimmc414•6m ago•0 comments

C-Flow Matching Inference

https://github.com/ecrasevvv/c-fm
1•ecrasevvv•7m ago•1 comments

You Opened a Credit Card. ICE Now Knows Where You Live

https://www.404media.co/you-opened-a-credit-card-ice-now-knows-where-you-live/
2•Jimmc414•7m ago•0 comments

Tapeworm hijacks worker ants, giving them queen-like metabolism and longer lives

https://phys.org/news/2026-07-tapeworm-hijacks-worker-ants-queen.html
1•wglb•8m ago•1 comments

Why I Am Not Going to Buy a Computer

https://karlvmuller.com/posts/why-i-am-not-going-to-buy-a-computer/
2•KarlVM12•9m ago•0 comments

Is Passwork safe for your business?

https://proton.me/business/blog/is-passwork-safe
1•Erenay09•9m ago•0 comments

What Foreign Architects Get Wrong in the Global South

https://commonedge.org/what-foreign-architects-get-wrong-in-the-global-south/
1•surprisetalk•11m ago•0 comments

AI tool reveals climate shifts may have fueled bursts of bird evolution

https://news.umich.edu/ai-tool-reveals-climate-shifts-may-have-fueled-bursts-of-bird-evolution/
1•gmays•11m ago•0 comments

I Am Buiding BorgIOS

https://github.com/bitmonky/BorgIOS
2•BorgIOS•12m ago•0 comments

Is software enshittified?

https://www.natemeyvis.com/is-software-enshittified/
2•Brajeshwar•13m ago•0 comments

Show HN: Bento - An entire PowerPoint in one HTML file (edit+view+data+collab)

https://bento.page/slides/
2•starfallg•13m ago•0 comments

Show HN: PDF tools that run in the browser, no upload

https://pdfcdf.com
2•sofiurrr•14m ago•0 comments

IMDB now automatically creating user accounts when you are signed into Amazon

3•terminalbraid•15m ago•2 comments

Hilo Raises $19M for Blood Pressure Wearables

https://insider.fitt.co/hilo-raises-19m-for-blood-pressure-wearables/
1•brandonb•15m ago•0 comments

UK Pols Want More Speech Regulation After Ann Widdecombe Murder – She Opposed

https://jonathanturley.org/2026/07/22/uk-politicians-call-for-more-speech-regulation-after-the-mu...
1•anonymousiam•15m ago•1 comments

Show HN: Made a App to Turn Any Podcast into a Website

https://audioenhancer.com/
1•wbemaker•15m ago•0 comments

How to choose a Linux kernel subsystem to work on (as a beginner)

https://cjd8.github.io/kernel/kbeginner/2026/07/22/how-to-start-kernel-work.html
2•cjd8•16m ago•1 comments

A theory of the origins of cognitive inequality

https://davidbessis.substack.com/p/attention-is-all-we-have
1•igonvalue•16m ago•0 comments

AFAWA's support for women entrepreneurs has promoted business expansion in Kenya

https://www.afdb.org/en/success-stories/how-afawas-support-women-entrepreneurs-has-promoted-busin...
1•thunderbong•16m ago•0 comments

Neo Radar: A browser-based orbital mechanics engine with 41k real asteroids

https://neoradar.space
2•daviazpen•17m ago•0 comments

Show HN: BBRv3 for gVisor's netstack, visualized in the browser using WASM

https://ccsim.apoxy.dev
1•dilyevsky•17m ago•0 comments

Forensic Statistics in Python

https://www.johndcook.com/blog/2026/07/21/forensic-accounting-in-python/
1•ibobev•17m ago•0 comments

Building a Live TV Player from Scratch

https://blog.jaysmito.dev/blog/03-live-tv-inside-vulkan/
1•ibobev•18m ago•0 comments