♻️ Simplify debugger template evaluation#4730
Merged
Merged
Conversation
Stop clearing compiled template and condition caches when probes are removed or cleared. Removed probes can be garbage-collected with their caches, so the explicit cache-clearing API is unnecessary.
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
5 tasks
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 284e2b3 | Docs | Datadog PR Page | Give us feedback! |
0edbca8 to
90a1c84
Compare
Hide dynamic template function creation behind an `evaluateTemplate` probe method so message rendering no longer reaches through the compiled template cache.
90a1c84 to
284e2b3
Compare
P403n1x87
approved these changes
Jun 5, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Motivation
Simplify debugger template evaluation and remove unnecessary cache cleanup paths. The previous implementation stored compiled template cache objects on probes and explicitly cleared those caches when probes were removed, but the caches were already only reachable through the probe instance and could be garbage-collected with it. Moving evaluation behind an initialized-probe function keeps this behavior local to probe initialization and makes the runtime code easier to maintain.
Changes
probe.templatewith anevaluateTemplate(context)function on initialized probes.probe.templateas the original template string after initialization.Test instructions
yarn test:unit --spec packages/browser-debugger/src/domain/template.spec.ts --spec packages/browser-debugger/src/domain/probes.spec.tsyarn typecheckChecklist