For the complete documentation index, see llms.txt. This page is also available as Markdown.

TritonUtils

Overview

The tritonUtils module provides utility functions for stack-trace analysis, transaction ID generation, and runtime information capture. Import the named exports you need:

import { isNotTriton, generateTransactionId, captureRuntimeInfo, getFunctionName } from 'c/tritonUtils';

Stack Trace Analysis

isNotTriton(stackTraceLine)

  • Description: Checks whether a stack-trace line is not from an internal Triton file or method — used to filter Triton frames out of captured stacks.

  • Parameters:

    • stackTraceLine: {string} Line from a stack trace

  • Returns: {boolean} true if the line is not from Triton internals

  • Example:

const isUserCode = isNotTriton('at MyComponent.handleClick (/modules/c/myComponent.js:15:10)');

getFunctionName(stackTraceLine)

  • Description: Extracts the function name from a stack-trace line.

  • Parameters:

    • stackTraceLine: {string} Line from a stack trace

  • Returns: {string} The function name, or an empty string if none is found

  • Example:

Transaction Management

generateTransactionId()

  • Description: Generates a UUID v4 (random UUID). Used for transaction and span IDs.

  • Returns: {string} A UUID in the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

  • Example:

Runtime Information

captureRuntimeInfo()

  • Description: Captures comprehensive runtime information about the current environment. Each capture group is wrapped in try/catch so a failure in one area never blocks the others.

  • Returns: {Object} Object containing environment, viewport, theme, performance, memory, network, and device details

  • Example:

The returned object includes:

Last updated