Karma-Lens for Node.js
Production runtime metrics. Inside your editor. On every function.
Karma-Lens overlays live production telemetry onto your JavaScript and TypeScript source — request rates, latency, error rates, dead code, and traffic-weighted call graphs — so you can refactor, debug, and review code with the same data your services emit at runtime.
Stop tab-switching between APM dashboards and your IDE. The numbers come to the code.
Why Karma-Lens
- Refactor with confidence — see how often each method actually runs before you touch it.
- Delete dead code safely — methods that never execute in production are marked automatically.
- Find real hotspots — call hierarchies ranked by traffic, not file order.
- Catch regressions early — error % and latency overlays surface anomalies as you read code.
- Review faster — open a PR, hover a method, get the production story in one place.
Features
- Inline CodeLens overlays on every function showing live request rate and error %, plus latency on API endpoints.
- Dead-code detection with strikethrough decoration on functions that never execute in production.
- JavaScript and TypeScript — plain
.js, ES modules, CommonJS, and TypeScript projects (the plugin reads your tsconfig.json to work out the compiled file each source file becomes).
- Hover cards with detailed metrics for the function under the cursor.
- Call Hierarchy with Metrics — see who calls a function, weighted by real traffic.
- Method Dashboard, Timeseries, and Metrics Graph panels for deep-dive analysis.
- Pinned Metrics side-bar — keep an eye on the functions that matter.
- Project Insights view counting the total, active and dead functions across your codebase.
- Secure sign-in via OAuth (PKCE) with tokens stored in VS Code SecretStorage; automatic refresh on expiry.
- Configurable background polling so overlays stay current without manual refresh.
A route handler written inline, such as app.get("/health", (req, res) => ...), is shown when it has metrics and is never marked as dead.
Getting Started
- Install Karma-Lens for Node.js.
- Open the folder of a Node.js service whose running instances have the CodeKarma Node.js agent attached. Click the Karma-Lens icon in the Activity Bar.
- Sign in via the panel — uses your CodeKarma account.
- Pick a domain and service. Metrics begin streaming onto your code.
The open folder and the selected service must be the same project: metrics are matched by file path.
Requirements
|
|
| VS Code |
1.84.0+ |
| Service |
A Node.js service running with the CodeKarma Node.js agent |
| Backend |
Reachable Karma (Nexus) instance |
No other extension is needed. The TypeScript compiler used to read TypeScript projects is bundled.
Opening Karma-Lens
Open the Karma-Lens sidebar from the Activity Bar icon, or run View: Show Karma-Lens from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
The sidebar hosts three views:
- Settings — backend endpoint, sign in/out, domain, service, time window, dead-code toggle.
- Insights — project-wide method counts, dead-code list, hotspots.
- Pinned — methods you've pinned for quick monitoring.
Actions
All actions live in the editor — there is no command palette surface for individual features.
| Where |
Action |
| Right-click in a JavaScript or TypeScript file |
Open Call Hierarchy with Metrics · Show Method Metrics Graph · Copy Method Signature · Pin Metric · Open Insights |
| CodeLens above a function with metrics |
Call Hierarchy opens the callers of that function |
| CodeLens above a function |
Click to open the Method Dashboard with detailed metrics, timeseries, graph |
| Settings view → Time Window |
Calendar + aggregation picker. Apply to refresh all overlays |
| Pinned view item → context |
Unpin |
| Insights tree item → context |
Show Method Metrics Graph |
Settings
Configure under Settings → Extensions → Karma-Lens, or edit settings.json directly.
| Key |
Type |
Default |
Description |
karmaLens.enabled |
boolean |
true |
Show overlays (CodeLens, dead-code, hover) in this project. |
karmaLens.classNamePrefix |
string |
"" |
Folder the backend puts in front of this project's file paths, for example codetrails when the agent reports codetrails/src/app.js for src/app.js. Leave empty to let Karma-Lens work it out. |
karmaLens.aggregationMinutes |
5 | 10 | 15 |
15 |
Inlay metrics aggregation window (minutes). |
karmaLens.metricsEndTimeEpochMs |
number |
0 |
Window end time (epoch ms). 0 = live. |
karmaLens.deadMethod.strikethrough |
boolean |
true |
Strikethrough decoration on dead methods. |
karmaLens.throughputUnit |
QPM | QPS |
QPM |
Show request rates per minute (rpm) or per second (rps) in inlays and popups. |
karmaLens.errorType |
All | 4xx | 5xx |
All |
Which errors API endpoint inlays show. |
karmaLens.pollingIntervals.apiMetricsMs |
number |
120000 |
API metrics poll interval (ms). |
karmaLens.pollingIntervals.classMethodMs |
number |
120000 |
Class/method metrics poll interval (ms). |
karmaLens.pollingIntervals.classStatusMs |
number |
1800000 |
Class status poll interval (ms). |
karmaLens.extraCaCerts |
string[] |
[] |
Absolute paths to PEM files with additional trusted CA certificates. See Sign-in on networks with private certificate authorities below. |
Sign-in on networks with private certificate authorities
If you are on a corporate network that runs TLS inspection (Zscaler, Palo Alto, Netskope, Fortinet, etc.), behind a self-hosted CodeKarma deployment with an internal CA, or pointing at a self-signed development backend, sign-in will fail with one of:
unable to verify the first certificate
self signed certificate in certificate chain
UNABLE_TO_VERIFY_LEAF_SIGNATURE
Karma-Lens validates the TLS chain against Node's default root store, which does not contain private corporate or self-signed CAs. To extend the trust store, configure karmaLens.extraCaCerts with the path(s) to the required root CA certificate(s) in PEM format.
Option 1 — per-user setting
Obtain the root CA certificate in PEM format from your IT team, or export it from your OS keychain. The file usually looks like:
-----BEGIN CERTIFICATE-----
MIIE...
-----END CERTIFICATE-----
Save it locally, for example ~/karma-lens/corp-root.pem.
Add the path under Settings → Extensions → Karma-Lens → Extra Ca Certs, or edit settings.json directly:
{
"karmaLens.extraCaCerts": [
"/Users/<you>/karma-lens/corp-root.pem"
]
}
Retry sign-in. No VS Code reload is required — the change is picked up immediately.
Option 2 — fleet rollout via environment variable
For IT-managed deployments, set the NODE_EXTRA_CA_CERTS environment variable to the corporate root CA PEM before launching VS Code:
export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/corp-root.pem
Node extends its default trust store automatically; no plugin configuration is needed.
Security notes
- The configured certificates are merged with Node's default roots, never replacing them. Default-chain validation runs first.
- Hostname verification stays strict — there is no
rejectUnauthorized: false, no custom hostname check, and no code-level trust bypass.
- Trust extension requires an explicit user action (editing the setting or the environment variable) and is auditable via
settings.json.
Privacy
Karma-Lens talks only to the backend URL you configure (karmaLens.apiBaseUrl). Auth tokens are stored in VS Code SecretStorage. No source code leaves your machine.
Support
License
License: See LICENSE file - Proprietary License
(c) 2026 CodeKarma Technologies. All Rights Reserved.