Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TraceAgent

TraceAgent exposes a number of methods to create trace spans and propagate trace context across asynchronous boundaries.

Hierarchy

  • TraceAgent

Implements

Index

Constructors

constructor

  • Constructs a new TraceAgent instance.

    Parameters

    • name: string

      A string identifying this TraceAgent instance in logs.

    Returns TraceAgent

Properties

constants

constants: object = Constants

Type declaration

labels

labels: object = TraceLabels

Type declaration

policy

policy: TracePolicy | null = null

spanTypes

spanTypes: SpanType = SpanType

Methods

createChildSpan

Private disable

  • disable(): void
  • Disable this instance. This function is only for internal use and unit tests.

    Returns void

Private enable

  • Enables this instance. This function is only for internal use and unit tests. A separate TraceWriter instance should be initialized beforehand.

    Parameters

    • config: TraceAgentConfig

      An object specifying how this instance should be configured.

    • logger: Logger

      A logger object.

    Returns void

enhancedDatabaseReportingEnabled

  • enhancedDatabaseReportingEnabled(): boolean

getCurrentContextId

  • getCurrentContextId(): string | null

getCurrentRootSpan

getProjectId

  • getProjectId(): Promise<string>

getResponseTraceContext

  • getResponseTraceContext(incomingTraceContext: string | null, isTraced: boolean): string

getWriterProjectId

  • getWriterProjectId(): string | null

Private isActive

  • isActive(): boolean
  • Returns whether the TraceAgent instance is active. This function is only for internal use and unit tests; under normal circumstances it will always return true.

    Returns boolean

isRealSpan

  • isRealSpan(span: Span): boolean

runInRootSpan

wrap

wrapEmitter

  • wrapEmitter(emitter: EventEmitter): void

Generated using TypeDoc