Class CompositeTracer

java.lang.Object
org.pipservices3.components.trace.CompositeTracer
All Implemented Interfaces:
org.pipservices3.commons.refer.IReferenceable, ITracer

public class CompositeTracer extends Object implements ITracer, org.pipservices3.commons.refer.IReferenceable
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 Also:
  • Field Details

  • Constructor Details

    • CompositeTracer

      public CompositeTracer(org.pipservices3.commons.refer.IReferences references) throws org.pipservices3.commons.refer.ReferenceException, org.pipservices3.commons.errors.ConfigException
      Creates a new instance of the tracer.
      Parameters:
      references - references to locate the component dependencies.
      Throws:
      org.pipservices3.commons.refer.ReferenceException
      org.pipservices3.commons.errors.ConfigException
    • CompositeTracer

      public CompositeTracer()
  • Method Details

    • setReferences

      public void setReferences(org.pipservices3.commons.refer.IReferences references)
      Sets references to dependent components.
      Specified by:
      setReferences in interface org.pipservices3.commons.refer.IReferenceable
      Parameters:
      references - references to locate the component dependencies.
    • trace

      public void trace(String correlationId, String component, String operation, Long duration)
      Records an operation trace with its name and duration
      Specified by:
      trace in interface ITracer
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      component - a name of called component
      operation - a name of the executed operation.
      duration - execution duration in milliseconds.
    • failure

      public void failure(String correlationId, String component, String operation, Exception error, long duration)
      Records an operation failure with its name, duration and error
      Specified by:
      failure in interface ITracer
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      component - a name of called component
      operation - a name of the executed operation.
      error - an error object associated with this trace.
      duration - execution duration in milliseconds.
    • beginTrace

      public TraceTiming beginTrace(String correlationId, String component, String operation)
      Begings recording an operation trace
      Specified by:
      beginTrace in interface ITracer
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      component - a name of called component
      operation - a name of the executed operation.
      Returns:
      a trace timing object.