Tracepanel

Configuration

The environment variables that turn the JavaScript SDK on and off, name your app, move the store and set the thresholds of issues.

Tracepanel for JavaScript reads its settings from environment variables. They are named as in the Python SDK.

Turn it on and off

Tracepanel is on unless NODE_ENV is production. TRACEPANEL_ENABLED=0 turns it off, and TRACEPANEL_ENABLED=1 turns it on even in production mode. tracepanel run sets TRACEPANEL_ENABLED=1 for the command it runs.

When it is off, Tracepanel installs nothing, and span() and trace() run their function and nothing else.

Settings

VariableDefaultWhat it sets
TRACEPANEL_ENABLEDon unless NODE_ENV=production0 turns Tracepanel off, 1 turns it on
TRACEPANEL_SERVICEthe name in package.jsonthe app's name in the console
TRACEPANEL_DIR.tracepanelthe store, where the agent keeps the traces
TRACEPANEL_ROOTthe current directorythe project's directory, that paths in stacks are relative to
TRACEPANEL_MAX_TRACES2000how many traces the agent keeps
TRACEPANEL_AGENT_BINthe agent npm installedthe agent to start, such as a build of your own
TRACEPANEL_AGENTautoan agent that runs elsewhere, as tcp:host:port, which Tracepanel never starts
TRACEPANEL_OTLP127.0.0.1:4318where the agent takes OpenTelemetry spans, as HOST:PORT, or off. See The OTLP port
TRACEPANEL_CONSOLEthe backend's agentfor the Vite plugin, the console's address, as its console option
TRACEPANEL_WIDGETon0 leaves the app's HTML pages without the widget's script; the Vitest plugin turns it off
TRACEPANEL_CAPTURE_REQUESTon0 leaves out what each request carried: headers, query, cookies, body, session
TRACEPANEL_CAPTURE_BODYon0 leaves out the bodies of requests and of their responses. See What a request carried
TRACEPANEL_MAX_BODY_KB64how much of a body is kept, in KiB: a longer one is cut there and marked as cut
TRACEPANEL_CAPTURE_LOCALSon0 leaves out the local variables of an error's frames
TRACEPANEL_DUMPSon0 records a console.log() of an object as a log line, and console.dir() and console.table() not at all. See Dumps
TRACEPANEL_PROFILEoff1 profiles every trace, not only the requests the panel asks for
TRACEPANEL_PROFILE_MEMORYoff1 profiles every profiled trace's memory too
TRACEPANEL_PROFILE_ENABLEDon0 profiles nothing
TRACEPANEL_PROFILE_INTERVAL_MS1how often a profiled trace is sampled, in milliseconds

Thresholds

The agent finds the issues by these thresholds:

VariableDefaultWhat it sets
TRACEPANEL_N_PLUS_ONE_THRESHOLD3how many repeats make an N+1
TRACEPANEL_N_PLUS_ONE_MIN_MS5for Redis and other fast stores, the time the repeats must take together
TRACEPANEL_SLOW_SQL_MS100a slow query, SQL or MongoDB
TRACEPANEL_SLOW_HTTP_MS500a slow outgoing HTTP call
TRACEPANEL_LONG_TRANSACTION_MS500a long transaction
TRACEPANEL_QUEUE_WAIT_MS1000a task that waited long for a worker
TRACEPANEL_LARGE_RESULT_ROWS1000a query without a LIMIT that read too many rows

A limit per database

TRACEPANEL_SLOW_SQL_MS and TRACEPANEL_LONG_TRANSACTION_MS take a limit per database too, by its db.system:

export TRACEPANEL_SLOW_SQL_MS=100,snowflake=3000

This holds every database to 100 ms, and Snowflake to 3 s. The names are OpenTelemetry's, such as postgresql, mysql, sqlite and mongodb. Without a limit of its own, the agent holds an analytical warehouse, such as Snowflake, BigQuery, Databricks, Redshift or ClickHouse, to 2 s per query and 10 s per transaction.

See what the SDK records

TRACEPANEL_DEBUG=1 prints each span the SDK records to stderr, with its attributes. Use it when a call doesn't show in a trace.

On this page