@saptools/cf-live-trace
Injects a bounded HTTP trace hook into a running Node.jsNode.jsA cross-platform JavaScript runtime that servers, command line tools and scripts written in JavaScript are run with. For the things here, the prerequisite a repository names when its build is a set of npm scripts. app on SAP BTP Cloud Foundry and streams each request and response to the terminal as JSON.
Shows which HTTP requests a deployed Node.jsNode.jsA cross-platform JavaScript runtime that servers, command line tools and scripts written in JavaScript are run with. For the things here, the prerequisite a repository names when its build is a set of npm scripts. app receives and what it answers, with no change to the app's code. cf-live-trace attaches to the app's Node inspector through @saptools/cf-inspector@saptools/cf-inspectorSets breakpoints, captures variable snapshots and evaluates expressions on a remote Node.js process over the Chrome DevTools Protocol from the shell, with no IDE attached.independent, btp, evaluates a hook that patches the http and https server prototypes, and streams one event per request with method, URL, status and duration; full events stay on disk as private JSON files for two hours, and session replay re-sends a captured request to another target such as a local server. It follows the route of the Live Trace feature in the SAP Tools extension for VS Code, under its own global name so the two do not collide. If SSH is disabled on the Cloud FoundrySAP BTP, Cloud Foundry RuntimeThe Cloud Foundry runtime of SAP BTP: memory for applications in a Cloud Foundry org, run from SAP's Java, Node.js and Python buildpacks or community buildpacks and managed with the standard Cloud Foundry tools.sap official, btp app, it enables SSH and restarts the app before opening the tunnel. Captured headers and bodies can hold credentials and personal data: stdout redacts common credential query values and cuts bodies at 128 characters, and if cleanup fails the hook can stay in the process until it restarts.
Facts
Where it sits
Who is behind it
In the atlas: maintains 18, contributes to 18@dongitranmaintainer
What it declares
Every artifact
- Type
- CLI
- Origin
- Independently maintained
- Runs on
- Cloud Foundry
As a CLI
- Distributed through
- npm
Connections
Seeing what running code did between input and result
Shell debugger for remote Node.js over the Chrome DevTools Protocol
A cross-platform JavaScript runtime that servers, command line tools and scripts written in JavaScript are run with. For the things here, the prerequisite a repository names when its build is a set of npm scripts.
Cloud Foundry runtime of SAP BTP for polyglot applications
Download
Install
npm add @saptools/cf-live-traceDerived from the package name. No recipe recorded; the README has the configuration.
Architecture
Download
README
quoted from dongitran/saptools under MIT, read@saptools/cf-live-trace
Inject a bounded HTTP trace hook into a running SAP BTP Cloud Foundry Node.js app and stream request/response events from the CLI.
Install - Quick Start - CLI - Security
Features
- Runtime HTTP tracing for Node.js apps already running on Cloud Foundry.
- Automatic CF session setup, SSH enablement check, Node inspector startup, and SSH port forwarding.
- CDP-based JavaScript injection derived from the SAP Tools VS Code Live Trace flow.
- Request and response header capture, bounded body capture, status, duration, byte counts, correlation id, and bounded queue drops.
- Compact stdout for scripts and agents: headers and app id stay out of live output, common credential query values are redacted, body previews are capped at 128 characters, and full captured events are saved locally.
- Per-request backup JSON files under
~/.saptools/cf-live-trace/sessions/with two-hour retention and session inspection commands for large JSON bodies. - Strict TypeScript, ESLint, unit coverage, and fake-backed E2E tests without live SAP access.
Install
npm install -g @saptools/cf-live-trace
# or as a library
npm install @saptools/cf-live-trace
Requires Node.js >= 20 and the official cf CLI on PATH.
The target Cloud Foundry app must be a Node.js process where cf ssh can reach 127.0.0.1:9229 after Node inspector startup. If SSH is disabled, the CLI enables SSH and restarts the app before opening the tunnel.
Updates
Every command first checks npm for a newer @saptools/cf-live-trace (at most once an hour, one small request
with a 2-second timeout) and, when one exists, installs that exact version with the package manager
that owns the running binary and re-runs the command you typed on the new version. Both steps are
announced on stderr; nothing is printed when the install is already current:
cf-live-trace: updating 0.3.0 -> 0.4.0 ...
cf-live-trace: updated to 0.4.0; re-running the command
If the install cannot complete, one stderr line gives the manual command and the command runs on the
installed version; that version is not retried for a day. cf-live-trace self-update forces the check and
install now; cf-live-trace self-update --check only reports.
| Control | Effect |
|---|---|
SAPTOOLS_AUTO_UPDATE=on|notify|off | on (default) installs and re-runs; notify prints the manual command once per version; off never checks. Applies to every @saptools CLI. |
CF_LIVE_TRACE_AUTO_UPDATE | same values, this CLI only; wins over the global variable |
SAPTOOLS_UPDATE_INTERVAL_MINUTES | minutes between checks (default 60; 0 checks on every run) |
SAPTOOLS_NPM_REGISTRY | registry to check and install from (default: npm's configured registry, then npmjs) |
SAPTOOLS_UPDATE_DEBUG=1 | explain on stderr why nothing happened |
The updater switches itself off in CI (CI set), under NODE_ENV=test or NO_UPDATE_NOTIFIER, when
the binary runs from a source checkout, an npm link or an npx cache, and inside the re-run itself.
It never writes to stdout, never asks for input, never uses sudo, and never moves onto a prerelease.
Its state lives in ~/.saptools/updates/.
Quick Start
export SAP_EMAIL="sample@example.com"
export SAP_PASSWORD="<password>"
cf-live-trace \
--region ap10 \
--org sample-org \
--space dev \
--app orders-api \
--instance 0 \
--format ndjson
If you already know the CF API endpoint, replace --region ap10 with --api-endpoint https://api.cf.ap10.hana.ondemand.com.
By default the command streams one JSON object per captured HTTP request and runs until Ctrl+C.
{"id":"1","sessionId":"s1a2b3c4d5e6f7a8b","requestId":"r1a2b3c4d5e6f7a8","method":"POST","normalizedUrl":"/orders","status":201,"durationMs":24,"requestBodyFormat":"json","responseBodyFormat":"json"}
CLI
cf-live-trace --help
Targeting flags:
| Flag | Description |
|---|---|
--region <key> | CF region key (defaults via cf target when omitted; errors if no current target when only app given) |
--api-endpoint <url> | Explicit CF API endpoint instead of a region key |
--org <name> | CF org name |
--space <name> | CF space name |
--app <name> | CF app name |
--instance <index> | CF app instance index, default 0 |
--email <value> | Override SAP_EMAIL |
--password <value> | Override SAP_PASSWORD |
--cf-home <dir> | Reuse an existing CF home instead of a temporary one |
--cf-command <path> | CF CLI executable or test shim |
Trace flags:
| Flag | Description |
|---|---|
--duration <seconds> | Stop after N seconds |
--max-events <count> | Stop after N captured trace events |
--max-body-bytes <bytes> | Maximum request/response capture bytes, default 4096; must be greater than 0 |
--no-capture-headers | Do not capture request/response headers |
--no-capture-request-body | Do not capture request body previews |
--no-capture-response-body | Do not capture response body previews |
--no-uninstall-on-exit | Disable the injected hook instead of uninstalling it |
--format <format> | ndjson, summary, or json |
--quiet | Suppress progress lines on stderr |
Prefer SAP_EMAIL and SAP_PASSWORD over inline credential flags. Process arguments can be visible to other users on the same machine.
Each captured request is also saved as a private JSON file under:
~/.saptools/cf-live-trace/sessions/<sessionId>/events/
Files expire after two hours. Expired files are pruned while tracing and when session commands run. The path is based on Node's user home directory, so Windows uses the current user's profile directory.
Examples
Stop after the first five requests and print a compact text stream:
cf-live-trace \
--api-endpoint https://api.cf.ap10.hana.ondemand.com \
--org sample-org \
--space dev \
--app orders-api \
--max-events 5 \
--format summary
Capture headers only, without body previews:
cf-live-trace \
--region ap10 \
--org sample-org \
--space dev \
--app orders-api \
--no-capture-request-body \
--no-capture-response-body
Emit one final JSON document for downstream processing:
cf-live-trace \
--region ap10 \
--org sample-org \
--space dev \
--app orders-api \
--duration 30 \
--format json
Inspect, export, or replay a saved session after or during a trace run:
cf-live-trace session events s1a2b3c4d5e6f7a8b --method POST --limit 20
cf-live-trace session search s1a2b3c4d5e6f7a8b orderId --body response --length 256
cf-live-trace session body s1a2b3c4d5e6f7a8b r1a2b3c4d5e6f7a8 --body response --path /data/items/0 --limit 4000 --rows 100
cf-live-trace session curl s1a2b3c4d5e6f7a8b r1a2b3c4d5e6f7a8 --target http://localhost:4004 --out replay.sh
cf-live-trace session replay s1a2b3c4d5e6f7a8b r1a2b3c4d5e6f7a8 --target http://localhost:4004
cf-live-trace session prune
session curl reconstructs an absolute URL from x-forwarded-proto, x-forwarded-host, or host when --target is omitted. Without --copy or --out, it truncates displayed header values and request bodies to keep terminals responsive; use --copy or --out for the full command. Both session curl and session replay refuse to run when the captured request body was already truncated by --max-body-bytes, because replaying an incomplete payload is usually misleading. Hop-by-hop headers such as host and content-length are omitted from generated and replayed requests so the target HTTP client can recalculate them safely.
How It Works
cf-live-trace follows the same high-level route as the SAP Tools VS Code Live Trace feature:
- Prepare an isolated CF session with
cf api,cf auth, andcf target. - Ensure SSH is enabled for the app.
- Run a robust
/procscan inside the app container and sendSIGUSR1to the best Node.js process candidate. - Open
cf ssh -L <local>:127.0.0.1:9229for the selected app instance. - Attach to the Node inspector over CDP using
@saptools/cf-inspector. - Evaluate a runtime hook that patches Node's
httpandhttpsserver prototypes. - Poll a bounded in-process queue with acknowledgement-based retries, save each drained trace event locally, and stream compact trace events back to stdout.
- Disable or uninstall the hook and close the tunnel on exit.
The injected global is named __SAPTOOLS_CF_LIVE_TRACE__ so CLI sessions do not collide with the VS Code extension's Live Trace runtime global.
Security Notes
- This tool injects JavaScript into a running Node.js process through the Node inspector. Use it only for apps and spaces you are authorized to inspect.
- Captured headers and bodies can contain credentials, tokens, cookies, or personal data. Backup files are private by default, but keep the user profile and CI artifacts protected.
- Live stdout intentionally omits request/response headers and app id, redacts common credential query values, and only prints 128 characters of each captured body. Backup JSON files retain the fuller captured event for two hours.
--max-body-bytesbounds captured body data transported back from the app and must be greater than zero. Set it lower for sensitive or high-throughput services.- The CLI avoids putting credentials in
cf autharguments; credentials are passed to the CF CLI throughCF_USERNAMEandCF_PASSWORD. - If cleanup fails, the runtime hook can remain disabled or installed until the app process restarts. Progress events report this state.
Development
pnpm install
pnpm --filter @saptools/cf-live-trace build
pnpm --filter @saptools/cf-live-trace lint
pnpm --filter @saptools/cf-live-trace typecheck
pnpm --filter @saptools/cf-live-trace test:unit
pnpm --filter @saptools/cf-live-trace test:e2e
The E2E test starts a local inspectable Node.js app and a fake cf executable that opens a real TCP proxy to the app inspector. No live SAP account is required.
History
Others providing
Compare all 22 on the Debugging page →- dbg_value_statementdbg_value_statementAn ABAP Debugger script that turns a variable's structure or table into the VALUE statement that recreates it, with a tree explorer, also callable as a function module from a report.independent, abapDebugger script generating a VALUE statement for a variablefrom ABAP
- dump_infodump_infoDisplays the variables an ABAP short dump captured, for dumps selected on a selection screen; its documentation does not state which dumps it reads, which releases it runs on or how it installs.independent, abapDisplays the variables of ABAP short dumpsfrom ABAP
- com.sap.cds:cds-feature-consolecom.sap.cds:cds-feature-consoleA CAP Java plugin that connects a running application to CAP console, which consumes its remote monitoring data; CAP console itself is installed separately and still being developed.sap official, capConnects a running CAP Java app to CAP console for monitoringfrom CAP
- com.sap.cds:cds-feature-dev-dashboardcom.sap.cds:cds-feature-dev-dashboardA browser dashboard for a running CAP Java service that shows and manages its messaging, resilience and multitenancy state while developing, open to users with the cds.Developer role.sap official, capBrowser dashboard for a running CAP Java service during developmentfrom CAP
- @cap-js/console@cap-js/consoleConnects a running CAP application to the CAP console.sap official, capConnects a running CAP application to the CAP consolefrom CAP
- @cap-js/data-inspector@cap-js/data-inspectorInspects database entities and their contents at the CAP service level.sap official, capInspects database entities and contents at CAP service levelfrom CAP
- abapsmithabapsmithAn MCP server that lets an LLM develop in ABAP on a live system over ADT, with writes off by default and every mutation recorded in a local journal that can undo it.independent, abapABAP MCP server over ADT with a local journal that can undo writesfrom ABAP
- sap-cap-debuggersap-cap-debuggerAttaches a debugger to a CAP application already running on Cloud Foundry — enables the Node inspector inside the container, assigns a port and hands you a Chrome DevTools or VS Code attach.independent, capAttaches a debugger to a CAP app running on Cloud Foundryfrom CAP
- ABAP-Object-VisualizerABAP-Object-VisualizerA debugger script that writes an object hierarchy to the clipboard at a breakpoint as a Graphviz description, for pasting into a renderer such as webgraphviz.com.independent, abapDebugger script exporting an object hierarchy as Graphvizfrom ABAP
- abap_debugger_object_graph_extensionabap_debugger_object_graph_extensionAn ABAP debugger extension that shows the object on the debugger's Objects tab as a Graphviz graph in a browser window, built on ABAP Graph and Graphviz-browser and tested on NetWeaver 7.5.independent, abapABAP debugger extension drawing objects as a Graphviz graphfrom ABAP
- Graphviz-browserGraphviz-browserA static page that draws a Graphviz graph in a browser, written for the ABAP debugger object graph extension and deployable as BSP pages in the system the debugger runs in.independent, abapStatic page drawing Graphviz graphs for the ABAP debugger extensionfrom ABAP
- ABAP remote filesystemABAP remote filesystemA Visual Studio Code extension that opens an ABAP system over ADT as an editable filesystem and exposes system tools to GitHub Copilot and external MCP clients.independent, abapVS Code extension editing ABAP systems over ADT as a filesystemfrom ABAP
- @sap/cds-dk@sap/cds-dkThe command line client and development toolkit for CAP projects, with the commands cds build, cds deploy, cds watch and cds add among them.sap official, capCommand line client and development toolkit for CAPfrom CAP
- @saptools/cf-debugger@saptools/cf-debuggerOpens a verified Node.js inspector tunnel over cf ssh to an app on SAP BTP Cloud Foundry from one command, with its own local port for each concurrent session.independent, btpNode.js inspector tunnel over cf ssh to Cloud Foundry appsfrom BTP/BAIP
- @saptools/cf-explorer@saptools/cf-explorerSearches the files of an app deployed to SAP BTP Cloud Foundry over cf ssh, finding the app root, grepping the deployed code and turning matches into file and line candidates.independent, btpFile search in apps deployed to SAP BTP Cloud Foundry over cf sshfrom BTP/BAIP
- @saptools/cf-function-trace@saptools/cf-function-traceRecords how one JavaScript function's state changes, step by step, in a Node.js process running locally or on SAP BTP Cloud Foundry, and stores the run as a redacted timeline that can be queried later.independent, btpStep-by-step state recorder for one JavaScript function in Node.jsfrom BTP/BAIP
- @saptools/cf-hana@saptools/cf-hanaA command line and TypeScript API that runs SQL against the SAP HANA Cloud database bound to a Cloud Foundry app, addressed by a region/org/space/app selector.independent, btpSQL runner against the SAP HANA Cloud database bound to a CF appfrom BTP/BAIP
- @saptools/cf-inspector@saptools/cf-inspectorSets breakpoints, captures variable snapshots and evaluates expressions on a remote Node.js process over the Chrome DevTools Protocol from the shell, with no IDE attached.independent, btpShell debugger for remote Node.js over the Chrome DevTools Protocolfrom BTP/BAIP
- @saptools/cf-request-runner@saptools/cf-request-runnerDiscovers every API endpoint of a CAP service already deployed to Cloud Foundry by walking its service documents, $metadata and endpoints catalog — falling back to container SSH to parse .cds files.independent, capEndpoint discovery for CAP services deployed to Cloud Foundryfrom CAP
- @saptools/service-flow@saptools/service-flowTraces one CAP operation end to end across several repositories without running anything — handlers, helper packages, local database access, remote OData calls, external HTTP and async channels.independent, capStatic end-to-end tracer of one CAP operation across repositoriesfrom CAP
- Smart DebuggerSmart DebuggerA debugger script for the SAP GUI New Debugger that records every step and variable change of an ABAP program, so execution can be stepped backwards with F5 and F8.independent, abapSAP GUI debugger script recording steps so execution can run backwardsfrom ABAP
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
History in the atlas
- First seen.
For your agent
- Ref
artifact:saptools-cf-live-trace- JSON
- /artifacts/saptools-cf-live-trace.json
- MCP
- Connecting an agent