Inherits: ITracer, IReferenceable
Description
The CompositeTracer class allows you to aggregate all tracers from component references under a single component.
References
- *:tracer:*:*:1.0 - (optional) ITracer components to pass operation traces source
Constructors
Creates a new instance of the tracer.
public
CompositeTracer(IReferences references = null)
- references: IReferences - references to locate the component dependencies.
Fields
Instance methods
BeginTrace
Begings recording an operation trace
public
TraceTiming BeginTrace(string correlationId, string component, string operation)
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- component: string - name of the called component
- operation: string - name of the executed operation.
- return: TraceTiming - a trace timing object.
Failure
Records an operation failure with its name, duration and error
public
void Failure(string correlationId, string component, string operation, Exception error, long duration)
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- component: string - name of the called component
- operation: string - name of the executed operation.
- error: Exception - error object associated with this trace.
- duration: long - execution duration in milliseconds.
SetReferences
Sets references to dependent components.
public
void SetReferences(references: IReferences)
- references: IReferences - references to locate the component’s dependencies.
Trace
Records an operation trace with its name and duration.
public
void Trace(string correlationId, string component, string operation, long duration)
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- component: string - name of called component
- operation: string - name of the executed operation.
- duration: long - execution duration in milliseconds.
Examples
class MyComponent: IReferenceable {
private CompositeTracer _tracer = new CompositeTracer();
public void SetReferences(IReferences references)
{
_tracer.SetReferences(references);
...
}
public void MyMethod(string correlatonId)
{
var timing = this._tracer.BeginTrace(correlationId, "mycomponent", "mymethod");
try {
...
timing.EndTrace();
} catch {
timing.EndFailure(err);
}
}
}