Skip to content
Code Recycle

Component · for humans & their agents

Metric Cardinality Guard

verified · first-partyactively maintained$0 during beta (was $59)

One label with a user id in it becomes millions of time series. The backend drops the excess and your alerts quietly stop covering part of the traffic.

by simulacrum · Code Recycle maintainer

Get it free — beta

Every claim on this page is refundable if it is untrue — refund policy.

Verified: 103 tests

Estimates the series a metric will produce and flags labels that are unbounded by construction, before they ship.

Estimates the series a metric will produce and flags labels that are unbounded by construction, before they ship.

THE SILENT FAILURE. A metric label whose values are unbounded -- a user id, request id, a URL path with ids in it, an error message -- creates a NEW TIME SERIES per distinct value. The code looks ordinary; one line adds a label. Nothing errors in development, where there are five users. In production it becomes millions of series, and the failure arrives as a bill an order of magnitude over budget, or the backend silently DROPPING series past a limit -- which means dashboards and alerts quietly stop covering part of your traffic. An alert that no longer fires looks exactly like an alert with nothing to report.

It flags the patterns that are unbounded by construction -- ids, UUIDs, timestamps, emails, IPs, paths with numeric segments, free-text errors -- and estimates TOTAL series as the PRODUCT across labels, because the multiplicative blow-up is what people underestimate: three labels of a hundred values each is a million series, not three hundred.

Where a label's true cardinality cannot be known from the sample it says UNKNOWN rather than extrapolating. A confident wrong estimate is worse than none, because it gets written into a budget.

A path-templating helper turns /users/12345/orders/678 into /users/{id}/orders/{id}, so the most common cause is fixable rather than merely detectable. Budgets are checked with the arithmetic shown, so nobody has to trust the tool. It analyses what you supply and never connects to a metrics backend.

VERIFIED: 103 tests. Every mutation was observed FAILING before the source was restored -- a test never seen to fail is a decoration. Independently reviewed by a verifier whose job was to find what is wrong, not to agree.

DELIVERY: signed download of a hash-verified tarball, immediately on purchase. Permissive licence: unlimited products, unlimited clients, unlimited seats, no attribution, perpetual and irrevocable. One restriction, do not republish the source as source.

Interface

What you call, and what comes back. Types and signatures only — the implementation ships with the source.

  export function estimateTotalSeries(labels: LabelCardinality[]): TotalSeriesEstimate;
  export function checkBudget(totalSeries: TotalSeriesEstimate, budget: number): BudgetCheck;
  export function analyzeMetric( metric: MetricDefinition, samples: LabelSamples, options?: AnalyzeMetricOptions, ): MetricCardinalityReport;
  export function analyzeCatalog( metrics: MetricDefinition[], samplesByMetric: Record<string, LabelSamples>, options?: AnalyzeMetricOptions, ): MetricCardinalityReport[];
  export function reportsNeedingAttention( reports: MetricCardinalityReport[], ): MetricCardinalityReport[];
  export function estimateLabelCardinality( label: string, values: string[], thresholds?: Partial<CardinalityThresholds>, ): LabelCardinality;
  export function isUuid(value: string): boolean;
  export function isEmail(value: string): boolean;
  export function isIpAddress(value: string): boolean;
  export function isTimestamp(value: string): boolean;
  export function isAllDigits(value: string): boolean;
  export function isNumericId(value: string, minDigits: number): boolean;
  export type LabelSamples = Record<string, string[]>;
  export type TotalSeriesKind = "known" | "unknown-lower-bound";
  export type BudgetStatus = "within-budget" | "over-budget" | "unknown-unbounded";

01Capabilities

Does

  • + Observability

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

typescript

03Community

No endorsements yet

No verified confirmations yet — be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm — weight comes from verified usage, not vote count.

0 open · 0 answered · 0 fixed · 1 said it worked

04Trust Passport

Full passport →
–/100

0/0 automated components pass. An automated score is never a security guarantee.

✓ Verified · first-partyreviewed Sep 20, 2026 · re-verification due Dec 19, 2026
  • publisher identity Publisher status verified; 1 verification(s) on file
  • malicious pattern scan No known malicious-behavior patterns across 16 source file(s) plus listing text
  • capability contract All 0 observed capability reference(s) match the declared manifest
  • agent safety scan No injection patterns in agent-readable content
  • provenance No release signature or provenance attestation
  • behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.

Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.

VersionChannelReleasedNotes
1.0.0stableAug 4, 2026First public release.