Repository navigation
Conversation
Bootstrap the knowledge base for cloning the tracked-users (MTU) reporting pipeline into MAR (Monthly Active Records) with three deltas (gate, key, query). Documents the reporter, processor hook sites, gateway rETL source/destination params, the flusher/aggregator/client flush path, feature + app-handler wiring, and migration embedding. Records the HLL wire-compat contract and fail-closed gate as traps. 🔒 Scanned for secrets using gitleaks 8.28.0
Clone of the tracked-users pipeline for Monthly Active Records (MAR): - UniqueActivationRecordsReporter builds per-(workspace,source,destination) HLL sketches from the stamped context.activation fingerprint - HLL params (Log2m=16, Regwidth=5, AutoExplicitThreshold, SparseEnabled) and murmur seed 123 reuse the tracked-users wire contract verbatim - fail-closed gate: jobs missing fingerprint or origin are skipped (stat) - config-gated factory returns a noop reporter when ActivationRecords.enabled is false (default) - MigrateDatabase migrates the activation_records dir into activation_records_reports_migrations 🔒 Scanned for secrets using gitleaks 8.28.0
Docker-free table-driven tests for GenerateReportsFromJobs covering the grain (workspace,source,destination), the fail-closed fingerprint/origin gate, duplicate-fingerprint cardinality, multi-destination fan-out, and the wire-compat HLL defaults (Log2m=16, Regwidth=5). 🔒 Scanned for secrets using gitleaks 8.28.0
New migration set auto-embedded via the recursive go:embed glob; the grain columns (source_id, destination_id, origin) are NOT NULL since the fail-closed gate guarantees them. 🔒 Scanned for secrets using gitleaks 8.28.0
…-meter-hll-strip-flush 🔒 Scanned for secrets using gitleaks 8.28.0
…st-keyed HLL aggregation 🔒 Scanned for secrets using gitleaks 8.28.0
… branch, and mediator runner 🔒 Scanned for secrets using gitleaks 8.28.0
…dating dest-keyed aggregation 🔒 Scanned for secrets using gitleaks 8.28.0
…ate-meter-hll-strip-flush 🔒 Scanned for secrets using gitleaks 8.28.0
…e txn Wire the activation-records (MAR) reporter alongside the existing tracked-users (MTU) reporter: a processor-local activationRecordsReporter interface, Handle field + Setup wiring, manager New/Start pass-through, generate at the pre-transform stage with no source filter, and report inside the same WithUpdateSafeTx store transaction. Immediately after generate, strip batch[0].context.activation from each job payload via go-kit jsonparser.DeleteKey so the internal metering fields never reach the destination (no-op when absent). The MTU calls are left unchanged. 🔒 Scanned for secrets using gitleaks 8.28.0
Add the ActivationRecords feature interface and factory registration in the app, and Setup+MigrateDatabase(activation_records)+inject the reporter into proc.New in BOTH processorAppHandler and embeddedAppHandler, mirroring TrackedUsers. Wiring both handlers ensures MAR meters in both deployment topologies. 🔒 Scanned for secrets using gitleaks 8.28.0
…on strip Pass activationrecords.NewNoopActivationRecordsReporter() at every Handle.Setup and manager New call site so the suite compiles with the new dependency, inject it at the trackedUsers mock-injection sites, and assert that a record job's payload no longer carries batch[0].context.activation after the pre-transform stage — proving the strip runs before transformation. 🔒 Scanned for secrets using gitleaks 8.28.0
…e-meter-hll-strip-flush 🔒 Scanned for secrets using gitleaks 8.28.0
Prove the READ/CONSUMER side of the MAR wire contract. The gate is fail-closed, so a write->read mismatch undercounts silently at runtime and must be locked by tests: - jsonparser read-path over the exact gateway SingularEventBatch shape - connection-grain derivation (source/destination/origin) - HLL byte round-trip under Log2m=16/Regwidth=5 via hll.FromBytes - fail-closed proofs: missing fingerprint/origin/destination_id => 0 🔒 Scanned for secrets using gitleaks 8.28.0
…ver-gate-meter-hll-strip-flush 🔒 Scanned for secrets using gitleaks 8.28.0
The CreateRunner guard still reported 'Only tracked_users_reports is supported now' after activation_records_reports was added to supportedTables; align it with the trailing guard's message. 🔒 Scanned for secrets using gitleaks 8.28.0
…ment 🔒 Scanned for secrets using gitleaks 8.28.0
unparam (golangci-lint, new:false in CI) flagged test helpers whose sourceID/origin args always received the same literal. Inline the constants so the helpers expose only the axes the tests vary. 🔒 Scanned for secrets using gitleaks 8.28.0
…-gate-meter-hll-strip-flush 🔒 Scanned for secrets using gitleaks 8.28.0
Synthesises all stage memories (reporter-core, flusher-pipeline, processor-hook, wire-compat-and-tests, integration-verify) into the loom knowledge base: - architecture.md: MAR as implemented sibling of MTU — per-file breakdown, diff table (gate/key/route/columns), wiring confirmation in both handlers. - entry-points.md: all new MAR files with key symbols and line anchors. - patterns.md: end-to-end 11-step clone recipe (MAR as worked example); origin-is-carried-not-keyed rationale. - mistakes.md: 6 new prevention rules — unparam one-at-a-time scan, sandbox golangci-lint, processor dockertest timeout, jsonparser bracket notation, three-struct carrier chain, signature ripple to test call sites, package-level name conflicts. - concerns.md: mark supportedTables concern resolved; add loom acceptance timeout vs dockertest integration suites. 🔒 Scanned for secrets using gitleaks 8.28.0
…gate-meter-hll-strip-flush 🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7119 +/- ##
==========================================
- Coverage 79.66% 79.60% -0.07%
==========================================
Files 584 592 +8
Lines 65483 65912 +429
==========================================
+ Hits 52167 52469 +302
- Misses 10253 10341 +88
- Partials 3063 3102 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ter-hll-strip-flush
… best-effort Strip context.activation unconditionally from each parsed batch event in preprocessStage so it never reaches a destination, removing the redundant raw-bytes strip in pretransformStage. Wrap the MAR (activation records) write in a Postgres SAVEPOINT so a failed COPY rolls back only the MAR insert instead of poisoning the gateway-status transaction and dropping event delivery; failures log and increment activation_records_store_error. 🔒 Scanned for secrets using gitleaks 8.28.0
Inspect the destination-bound transformer input via WithDynamicDestinationTransform and assert context.activation is absent on every event, including a multi-event batch (batch[0] and batch[1]). 🔒 Scanned for secrets using gitleaks 8.28.0
Iterate the whole batch array when aggregating activation records so every event is metered exactly once (previously only batch[0]), preserving the fail-closed skip for events missing fingerprint/origin. Defensively cap origin to 256 runes with a rune-safe truncation. 🔒 Scanned for secrets using gitleaks 8.28.0
Assert the grain HLL cardinality reflects all unique fingerprints across a multi-event batch, and that a valid element is still metered when a sibling element is skipped. 🔒 Scanned for secrets using gitleaks 8.28.0
origin can exceed 64 chars; widen the brand-new column from VARCHAR(64) to TEXT. COPY column order is unchanged. 🔒 Scanned for secrets using gitleaks 8.28.0
itsmihir
reviewed
Jun 30, 2026
…ter-hll-strip-flush
preprocessStage runs for every source type, not just rETL, and context is a customer-extensible object. Unconditionally deleting context.activation could clobber a customer-set field. Strip only the fingerprint we stamp for MAR metering, and drop the activation namespace only when it is left empty. 🔒 Scanned for secrets using gitleaks 8.28.0
message-3 carries only our fingerprint (whole namespace removed); message-4 carries a customer field alongside it (fingerprint stripped, field preserved). 🔒 Scanned for secrets using gitleaks 8.28.0
Classify MAR-eligible jobs by source_category (gateway-stamped from SourceDefinition.Category) and skip anything that is not the reverse-ETL "warehouse" category. This stops a client from being metered by stamping context.activation.fingerprint on a non-rETL (e.g. event-stream) source, rather than relying on the fingerprint gate alone. Non-rETL is the expected majority of traffic, so it is skipped silently with no per-job skip stat. 🔒 Scanned for secrets using gitleaks 8.28.0
Assert a non-rETL source carrying a client-injected fingerprint is skipped, and stamp source_category=warehouse into the reporter, wire-compat, and end-to-end fixtures so rETL records are metered. 🔒 Scanned for secrets using gitleaks 8.28.0
The router only delivers warehouse-source (reverse-ETL) jobs when a top-level connection exists for the source/destination pair (router/worker.go). The MAR e2e now sets the source category to warehouse, so it must also register the connection, mirroring a real rETL setup. Adds ConfigBuilder.WithConnection and wires it into the test so all events reach the destination again. 🔒 Scanned for secrets using gitleaks 8.28.0
Restore origin as a carried (non-keyed) column end-to-end: the reporter reads context.activation.origin, defensively 256-rune-truncates it (emitting activation_records_origin_truncated), and fails closed on missing origin; it is written in the COPY and read back in the aggregator SELECT/Scan and shipped on the ActivationRecordsReport wire payload. Reverses the earlier origin removal while keeping the source_category=warehouse metering gate intact. 🔒 Scanned for secrets using gitleaks 8.28.0
Re-add origin TEXT NOT NULL to the activation_records_reports init schema (edited 000001 in place; it has not shipped to any environment). 🔒 Scanned for secrets using gitleaks 8.28.0
Re-add origin to the reporter unit/wire-compat helpers and assertions, the flusher integration report + payload expectations, and the e2e grain/rETL structs (including the AND origin filter in countActivationRecords). Restore the "missing origin - skip" case. 🔒 Scanned for secrets using gitleaks 8.28.0
Only reverse-ETL (warehouse) sources stamp context.activation for MAR metering, so the destination-bound strip is now gated on the source's SourceDefinition.Category: a customer-set context.activation on any other source type is left untouched. On rETL sources the strip now also removes context.activation.origin (previously only fingerprint was removed), so the internal metering origin no longer leaks to destinations; any other keys under context.activation are preserved as customer data. The per-event strip is extracted into stripActivationMetadata. The existing end-to-end trackedUsers spec uses a webhook (non-rETL) source, so its assertions now verify context.activation is preserved untouched. 🔒 Scanned for secrets using gitleaks 8.28.0
Table-driven coverage for stripActivationMetadata: reverse-ETL events have fingerprint and origin removed (the activation namespace dropped when left empty, customer fields kept), while non-reverse-ETL events are left fully intact by the source-category gate. 🔒 Scanned for secrets using gitleaks 8.28.0
itsmihir
reviewed
Jul 2, 2026
itsmihir
reviewed
Jul 2, 2026
itsmihir
left a comment
Contributor
There was a problem hiding this comment.
lets rename flusher/aggregator/types.go -> flusher/aggregator/tracked_users_types.go
…rce_id Event-stream jobs are the expected majority and are skipped by the reverse-ETL source_category gate anyway, so check the category first to avoid the source_id parse on every non-rETL job. 🔒 Scanned for secrets using gitleaks 8.28.0
…adata Move the isReverseETLSource check to the call site so the helper takes a single argument and does one job. Test mirrors the caller's gate so the non-rETL cases still verify customer context.activation is preserved. 🔒 Scanned for secrets using gitleaks 8.28.0
HLL settings are validated once at startup, so NewHll cannot fail on the hot path with the same settings. A failure would be deterministic across the whole batch, so the previous skip+stat would silently under-count MAR billing data while reporting success. Panic to fail loud and let the batch retry, consistent with the panic in trackedusers' users_reporter. 🔒 Scanned for secrets using gitleaks 8.28.0
Names the file after the TrackedUsersReport type it holds, matching the sibling activation_records_types.go in the same package. 🔒 Scanned for secrets using gitleaks 8.28.0
itsmihir
approved these changes
Jul 2, 2026
mihir20
approved these changes
Jul 3, 2026
🔒 Scanned for secrets using gitleaks 8.28.0
…ition worker pipeline 🔒 Scanned for secrets using gitleaks 8.28.0
am6010
deleted the
feature/pro-5774-mar-rudder-server-gate-meter-hll-strip-flush
branch
July 3, 2026 08:37
This was referenced Jul 6, 2026
Merged
itsmihir
pushed a commit
that referenced
this pull request
Jul 6, 2026
🤖 I have created a release *beep* *boop* --- ## [1.80.0-rc.1](v1.79.0...v1.80.0-rc.1) (2026-07-06) ### Features * add control-plane connection management for processor ([#7126](#7126)) ([ea6ca00](ea6ca00)) * carry integration version on DestinationT to the transformer ([#7125](#7125)) ([421c613](421c613)) * implement Forward RPC for control-plane requests to workspace pyt transformers ([#7143](#7143)) ([8a704cf](8a704cf)) * implement Kubernetes deployment scaler for workspace replica management ([#7123](#7123)) ([84fc747](84fc747)) * monthly active records (MAR) metering pipeline ([#7119](#7119)) ([d1df486](d1df486)) ### Bug Fixes * **router:** transformer returning response with empty metadata array causes server to panic ([#7144](#7144)) ([d6a4dbc](d6a4dbc)) ### Miscellaneous * enable compression for google pubsub ([#7137](#7137)) ([11c9ab8](11c9ab8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir
pushed a commit
that referenced
this pull request
Jul 7, 2026
🤖 I have created a release *beep* *boop* --- ## [1.80.0](v1.79.0...v1.80.0) (2026-07-06) ### Features * add control-plane connection management for processor ([#7126](#7126)) ([ea6ca00](ea6ca00)) * carry integration version on DestinationT to the transformer ([#7125](#7125)) ([421c613](421c613)) * implement Forward RPC for control-plane requests to workspace pyt transformers ([#7143](#7143)) ([8a704cf](8a704cf)) * implement Kubernetes deployment scaler for workspace replica management ([#7123](#7123)) ([84fc747](84fc747)) * monthly active records (MAR) metering pipeline ([#7119](#7119)) ([d1df486](d1df486)) ### Bug Fixes * **router:** transformer returning response with empty metadata array causes server to panic ([#7144](#7144)) ([d6a4dbc](d6a4dbc)) ### Miscellaneous * enable compression for google pubsub ([#7137](#7137)) ([11c9ab8](11c9ab8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the Monthly Active Records (MAR) metering pipeline to rudder-server, modeled on the existing MTU / tracked-users flow. The feature meters activation records per destination, aggregates them in-app using HyperLogLog, and flushes them through the reporting pipeline.
Key changes:
enterprise/activationrecords/): MAR reporter, factory, and noop implementation with gating and HLL settings.enterprise/reporting/flusher/):ActivationRecordsInAppAggregatorwith destination-keyed HLL aggregation, wired into the flusher factory and mediator runner.processor/): meters MAR activation records during pre-transform and stripscontext.activationbefore storing in the txn store.app/): registers the MAR feature and wires both the embedded and processor app handlers.activation_records_reportstable.Review fixes (B1/B2/B3)
Two independent code reviews flagged three blocking issues, now fixed:
context.activationleaked to destinations. The strip mutated the rawjob.EventPayloadbytes, but destination-bound events are separately-parsedsingularEventmaps. Fixed by strippingcontext.activationper-event inpreprocessStage(covers the transformer input,eventsByMessageID, and the archivalpayloadFunc), unconditionally. The redundant raw-bytes strip is removed. A new processor test captures the destination-bound transformer input and assertscontext.activationis absent on every event of a multi-event batch.batch[0]was metered/stripped. A job batch can hold multiple events; the meter now iterates the fullbatcharray (every event metered exactly once), and the per-event strip naturally covers all events.origincould abort the store transaction. Theorigincolumn is widened fromVARCHAR(64)toTEXT, length-capped defensively, and the MAR write is now best-effort: wrapped in a PostgresSAVEPOINTso a failed COPY rolls back only the MAR insert (logging +activation_records_store_errorstat) instead of failing event delivery.Linear Ticket
https://linear.app/rudderstack/issue/PRO-5774
Security
context.activation) could reach destination payloads.