Skip to content

ref(tsdb): remove the dead Redis cmsketch frequency tables - #122479

Open
strongs wants to merge 1 commit into
masterfrom
strongs/infreng-458-remove-tsdb-cmsketch
Open

ref(tsdb): remove the dead Redis cmsketch frequency tables#122479
strongs wants to merge 1 commit into
masterfrom
strongs/infreng-458-remove-tsdb-cmsketch

Conversation

@strongs

@strongs strongs commented Aug 24, 2026

Copy link
Copy Markdown
Member

Why

RedisTSDB carries a third data type next to counters and set counters: a "frequency table", the thing that answered "which releases show up most often in this issue". It is backed by a Lua count-min sketch, which just so happens to be dead code.

The reads moved to Snuba. SnubaTSDB.get_frequency_series serves them off the events dataset. The Redis implementation is no longer on the path for any read.

The writes go to a no-op backend. There are three live frequency models: frequent_issues_by_project, frequent_releases_by_group, frequent_environments_by_group. Both routing layers agree on where they go, and both send them to dummy on write: redissnuba for every cell except US, and getsentry for the US ServiceDelegator.

No Lua script has ever run on a TSDB Redis. cmsketch.lua is the only script the backend loads and the only file in src/sentry/scripts/tsdb/, so on a dedicated TSDB Redis any EVAL or EVALSHA is a cmsketch call and nothing else. Across the full 15 months of Datadog retention, neither dedicated host reports one, while hincrby on the same hosts, over the same window, is in the billions and still climbing. That hincrby line is the control: it proves the metric, the host tag and the window all work, because the live counter path used them on the same hosts the whole time.

Out of scope

  • This frees no memory. The us1 TSDB Redis holds 5,052,108 keys with no TTL, flat to the key in every one of the 450 daily buckets Datadog retains, which is what a dead write path looks like from the outside. Removing the code does not delete them. That cleanup is a deliberate separate decision. Strictly, that those keys are the cmsketch keys is still inferred: Datadog counts keys, not key patterns, and confirming it needs a keyspace scan for the 404:, 407: and 408: prefixes.
  • The callers stay. event_manager.py still builds a frequencies list on every event and hands it to a no-op backend. That is real waste in a hot path, but it is a separate change with different owners and a different risk profile.

Refs INFRENG-458.

🤖 Generated with Claude Code

RedisTSDB carried a third data type next to counters and set counters, a
frequency table backed by a 649-line Lua count-min sketch. It is dead code.

Both routing layers send all three frequency models to the dummy backend on
write, and SnubaTSDB serves the reads. Neither dedicated TSDB Redis host has
run a single eval or evalsha across the full 15 months of telemetry we retain,
while hincrby ran trillions of times on the same hosts over the same window.

BaseTSDB already declares all four frequency methods as NotImplementedError
stubs, so RedisTSDB drops its overrides and inherits those. No caller changes.

This frees no memory. The keys with no TTL on the us1 tsdb Redis stay until
somebody deletes them, which is a separate decision.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 24, 2026

Copy link
Copy Markdown

INFRENG-458

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 24, 2026
@strongs
strongs marked this pull request as ready for review August 24, 2026 19:33
@strongs
strongs requested a review from a team August 24, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants