Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CompositeTracer

Aggregates all tracers from component references under a single component.

It allows to record traces and conveniently send them to multiple destinations.

References

  • *:tracer:*:*:1.0 (optional) ITracer components to pass operation traces
see

ITracer

Example

class MyComponent implements IReferenceable {
    private _tracer: CompositeTracer = new CompositeTracer();

    public setReferences(references: IReferences): void {
        this._tracer.setReferences(references);
        ...
    }

    public myMethod(correlatonId: string): void {
        var timing = this._tracer.beginTrace(correlationId, "mycomponent", "mymethod");
        try {
            ...
            timing.endTrace();
        } catch (err) {
            timing.endFailure(err);
        }
    }
}

Hierarchy

  • CompositeTracer

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Creates a new instance of the tracer.

    Parameters

    • Default value references: IReferences = null

      references to locate the component dependencies.

    Returns CompositeTracer

Properties

Protected _tracers

_tracers: ITracer[] = []

Methods

beginTrace

  • beginTrace(correlationId: string, component: string, operation: string): TraceTiming
  • Begings recording an operation trace

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • component: string

      a name of called component

    • operation: string

      a name of the executed operation.

    Returns TraceTiming

    a trace timing object.

failure

  • failure(correlationId: string, component: string, operation: string, error: Error, duration: number): void
  • Records an operation failure with its name, duration and error

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • component: string

      a name of called component

    • operation: string

      a name of the executed operation.

    • error: Error

      an error object associated with this trace.

    • duration: number

      execution duration in milliseconds.

    Returns void

setReferences

  • setReferences(references: IReferences): void
  • Sets references to dependent components.

    Parameters

    • references: IReferences

      references to locate the component dependencies.

    Returns void

trace

  • trace(correlationId: string, component: string, operation: string, duration: number): void
  • Records an operation trace with its name and duration

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • component: string

      a name of called component

    • operation: string

      a name of the executed operation.

    • duration: number

      execution duration in milliseconds.

    Returns void

Generated using TypeDoc