/utils/traceReport

The traceReport module creates a standalone HTML report for traces logged by the ConsoleTraceProcessor.

The report has a request list, the span waterfall, span details, and a summary of the time by span name. The traces are injected into the traceReport.html template.

The report is written by the ConsoleTraceProcessor with the OTEL_CONSOLE_HTML process environment variable in a local process, and by the pnpm traces --html script for traces fetched from the Vercel runtime logs.

Requires

  • module:node:fs

Methods

(inner) traceReport(items) → {string}

Returns the HTML report with the traces injected into the report template. The request list in the report follows the order of the items.

The JSON is escaped to prevent asequence in a trace from closing the script element.

Parameters:
NameTypeDescription
itemsArray.<Object>

Traces with log meta.

Properties
NameTypeAttributesDescription
item.traceObject

The logged trace.

item.metaObject<optional>

The log meta, eg. source, timestamp, requestPath, responseStatusCode.

Returns:

The HTML report.

Type: 
string