Rollup duplicate high-volume event logs into a single row instead of deleting duplicates

Open
#855 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
44/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rails, ruby
Domain
backend

Research direction

Start at app/workers/prune_event_logs_worker.rb around line 73, where duplicate high-volume event logs are currently pruned, and read the EventLog model and its schema to see what a rolled-up row could store. Expect a migration to add a count (and possibly a timestamps array) plus updated worker logic, with existing worker tests under test/ to extend. The issue leaves the shape of the rollup open (count vs. timestamp array), so agree on that before starting; done means duplicates collapse into one row carrying how many times the event fired that day.

Written by the indexing model from the issue text.

Description

Currently, we prune duplicate event logs for certain high-volume events. Instead, we should rollup the duplicates into a single row so that we don't lose history. It may be valuable information to some to see that a license was validated n times on a certain day, or that a machine sent n heartbeat pings on a certain day. But right now, we lose that information because duplicates are pruned rather than rolled up, so only 1 event log is saved per-day.

Keeping a simple count should be sufficient. But we should also consider keeping an array of timestamps as well.

Dominant language
Gherkin
Stars
1.6k
Forks
131
Avg merge
13h 52m
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from keygen-sh/keygen-api

All issues in keygen-sh/keygen-api

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.