Repository navigation
feat(telemetry): sample rates are code defaults; the CMS block's win - #810
Merged
Merged
Conversation
`telemetry.limits` capped the sample rates in the CMS block's telemetry section, so a site couldn't send more than 10% of error logs, or any trace, from content alone: `errorSampleRate: 1` saved in Studio silently became 0.1. It becomes `telemetry.defaults`: code gives the rates content doesn't save (each falling back to the built-in 0.05 and 0), and a rate content saves wins, from 0 to 1. - `TelemetryConfig.limits` is gone from the types; a config that still passes it throws a TypeError at `createCMS` naming `telemetry.defaults`. - `cms.settings()` fills each rate content didn't save from code's defaults. The built-in `cms-settings` block, which can't see code's config, now returns the telemetry switches filled in and the sample rates only as saved. - `TelemetryPipeline.apply` falls back to the destination's defaults for a rate the section leaves out; nothing is capped. - The per-batch limits (200 logs, 1,000 spans) still bound a burst. Docs: deco-sites/docs-tanstack docs/telemetry-cms-wins-over-code-defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 8.17.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Why
telemetry.limitscapped the CMS block's sample rates atmin(content, code), with code's cap defaulting to 0.1 for errors and 0 for traces. SoerrorSampleRate: 1saved in Studio silently became 10%, and no site could turn on traces from content. We want a merge instead: code sets defaults, and the CMS wins when it sets a rate.Change
createCMS({ telemetry: { defaults: { errorSampleRate?, traceSampleRate? } } })replaceslimits. It gives the rates content doesn't save, each falling back to the built-in 0.05 and 0. A rate content saves wins, from 0 to 1, up or down, with no cap.limitsis gone fromTelemetryConfig. A config that still passes it (JS, or a cast) throws aTypeErroratcreateCMSnamingtelemetry.defaults. Released as a minor (8.17.0) on purpose. No known site passeslimits; osklen and demo-storefront don't.cms.settings()fills each unsaved rate from code's defaults. The built-incms-settingsblock can't see code's config, so it now returns the telemetry switches filled in and the sample rates only as saved.TelemetryPipeline.applyfalls back to the destination's defaults; the pipeline starts on them.MAX_LOGS200,MAX_SPANS1,000 per 10 s flush) are unchanged and still bound a burst.deco-storefront-performance,deco-v7-to-v8-migration) and the observability conformance fixture are updated.The spec change is in https://github.com/deco-sites/docs-tanstack/pull/35. Per CLAUDE.md the docs win, so the conformance tests were rewritten to the new claims (tel-24, tel-17, X31, AR-06, AR-60, dd-15) rather than relaxed.
Verification
bunx vitest run packages/blocks: 2287 pass, 0 fail.bun run check(typecheck, biome, knip): clean, except one biome warning that was already there.skills:checkandskills:readme:check: ok.🤖 Generated with Claude Code
Summary by cubic
Changes telemetry sampling so content's sample rates win instead of being capped: a rate saved in Studio is used as-is, from 0 to 1, so sites can now raise error sampling and turn on traces from content.
telemetry.limits(which silently cappederrorSampleRate: 1at 10% and kept traces off) is replaced bytelemetry.defaults: the rates code gives when content saves none, each falling back to the built-in 0.05 and 0.limitsthrows aTypeErroratcreateCMSnamingtelemetry.defaults; no known site passes it.cms.settings()fills each unsaved rate from code's defaults; the built-incms-settingsblock, which can't see code's config, returns sample rates only as saved.TelemetryPipeline.applystarts on the destination's defaults instead of the built-ins.Written for commit fd62999. Summary will update on new commits.