Documentation
¶
Index ¶
- type CachedTracer
- func (c *CachedTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
- func (c *CachedTracer) Clear()
- func (c *CachedTracer) Configure(config *cconf.ConfigParams)
- func (c *CachedTracer) Dump()
- func (c *CachedTracer) Failure(correlationId string, component string, operation string, err error, ...)
- func (c *CachedTracer) SetReferences(references cref.IReferences)
- func (c *CachedTracer) Trace(correlationId string, component string, operation string, duration int64)
- func (c *CachedTracer) Update()
- func (c *CachedTracer) Write(correlationId string, component string, operation string, err error, ...)
- type CompositeTracer
- func (c *CompositeTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
- func (c *CompositeTracer) Failure(correlationId string, component string, operation string, err error, ...)
- func (c *CompositeTracer) SetReferences(references cref.IReferences)
- func (c *CompositeTracer) Trace(correlationId string, component string, operation string, duration int64)
- type DefaultTracerFactory
- type ICachedTraceSaver
- type ITracer
- type LogTracer
- func (c *LogTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
- func (c *LogTracer) Configure(config *cconf.ConfigParams)
- func (c *LogTracer) Failure(correlationId string, component string, operation string, err error, ...)
- func (c *LogTracer) SetReferences(references cref.IReferences)
- func (c *LogTracer) Trace(correlationId string, component string, operation string, duration int64)
- type NullTracer
- func (c *NullTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
- func (c *NullTracer) Failure(correlationId string, component string, operation string, err error, ...)
- func (c *NullTracer) Trace(correlationId string, component string, operation string, duration int64)
- type OperationTrace
- type TraceTiming
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedTracer ¶
type CachedTracer struct { Cache []*OperationTrace // contains filtered or unexported fields }
func InheritCachedTracer ¶
func InheritCachedTracer(saver ICachedTraceSaver) *CachedTracer
Creates a new instance of the logger.
func (*CachedTracer) BeginTrace ¶
func (c *CachedTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
Begings recording an operation trace
- 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.
func (*CachedTracer) Clear ¶
func (c *CachedTracer) Clear()
Clears (removes) all cached log messages.
func (*CachedTracer) Configure ¶
func (c *CachedTracer) Configure(config *cconf.ConfigParams)
Configures component by passing configuration parameters.
- config configuration parameters to be set.
func (*CachedTracer) Dump ¶
func (c *CachedTracer) Dump()
Dumps (writes) the currently cached log messages. See [[Write]]
func (*CachedTracer) Failure ¶
func (c *CachedTracer) Failure(correlationId string, component string, operation string, err error, duration int64)
Records an operation failure with its name, duration and error
- 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.
func (*CachedTracer) SetReferences ¶
func (c *CachedTracer) SetReferences(references cref.IReferences)
Sets references to dependent components.
- references references to locate the component dependencies.
func (*CachedTracer) Trace ¶
func (c *CachedTracer) Trace(correlationId string, component string, operation string, duration int64)
Records an operation trace with its name and duration
- 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.
func (*CachedTracer) Update ¶
func (c *CachedTracer) Update()
Makes trace cache as updated and dumps it when timeout expires. See [[Dump]]
func (*CachedTracer) Write ¶
func (c *CachedTracer) Write(correlationId string, component string, operation string, err error, duration int64)
Writes a log message to the logger destination.
- 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.
type CompositeTracer ¶
type CompositeTracer struct {
Tracers []ITracer
}
func NewCompositeTracer ¶
func NewCompositeTracer(references cref.IReferences) *CompositeTracer
func (*CompositeTracer) BeginTrace ¶
func (c *CompositeTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
func (*CompositeTracer) Failure ¶
func (c *CompositeTracer) Failure(correlationId string, component string, operation string, err error, duration int64)
Records an operation failure with its name, duration and error - 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.
func (*CompositeTracer) SetReferences ¶
func (c *CompositeTracer) SetReferences(references cref.IReferences)
Sets references to dependent components. - references references to locate the component dependencies.
func (*CompositeTracer) Trace ¶
func (c *CompositeTracer) Trace(correlationId string, component string, operation string, duration int64)
Records an operation trace with its name and duration - 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.
type DefaultTracerFactory ¶
type DefaultTracerFactory struct { cbuild.Factory NullTracerDescriptor *cref.Descriptor LogTracerDescriptor *cref.Descriptor CompositeTracerDescriptor *cref.Descriptor }
func NewDefaultTracerFactory ¶
func NewDefaultTracerFactory() *DefaultTracerFactory
Create a new instance of the factory.
type ICachedTraceSaver ¶
type ICachedTraceSaver interface {
Save(operations []*OperationTrace) error
}
type ITracer ¶
type ITracer interface { //Records an operation trace with its name and duration // //- 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. Trace(correlationId string, component string, operation string, duration int64) //Records an operation failure with its name, duration and error //- 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. Failure(correlationId string, component string, operation string, err error, duration int64) //Begings recording an operation trace //- 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. BeginTrace(correlationId string, component string, operation string) *TraceTiming }
Interface for tracer components that capture operation traces.
type LogTracer ¶
type LogTracer struct {
// contains filtered or unexported fields
}
func (*LogTracer) BeginTrace ¶
func (c *LogTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
Begings recording an operation trace - 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.
func (*LogTracer) Configure ¶
func (c *LogTracer) Configure(config *cconf.ConfigParams)
Configures component by passing configuration parameters. - config configuration parameters to be set.
func (*LogTracer) Failure ¶
func (c *LogTracer) Failure(correlationId string, component string, operation string, err error, duration int64)
Records an operation failure with its name, duration and error - 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.
func (*LogTracer) SetReferences ¶
func (c *LogTracer) SetReferences(references cref.IReferences)
Sets references to dependent components. - references references to locate the component dependencies.
type NullTracer ¶
type NullTracer struct { }
func (*NullTracer) BeginTrace ¶
func (c *NullTracer) BeginTrace(correlationId string, component string, operation string) *TraceTiming
Begings recording an operation trace - 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.
func (*NullTracer) Trace ¶
func (c *NullTracer) Trace(correlationId string, component string, operation string, duration int64)
Records an operation trace with its name and duration - 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.
type OperationTrace ¶
type OperationTrace struct { // The time when operation was executed Time time.Time // The source (context name) Source string `json:"source"` // The name of component Component string `json:"component"` // The name of the executed operation Operation string `json:"operation"` // The transaction id to trace execution through call chain. CorrelationId string `json:"correlation_id"` // The duration of the operation in milliseconds Duration int64 `json:"duration"` //The description of the captured error //ErrorDescription //ApplicationException Error cerr.ErrorDescription `json:"error"` }
type TraceTiming ¶
type TraceTiming struct {
// contains filtered or unexported fields
}
func NewTraceTiming ¶
func NewTraceTiming(correlationId string, component string, operation string, tracer ITracer) *TraceTiming
Creates a new instance of the timing callback object.
- correlationId (optional) transaction id to trace execution through call chain. - component an associated component name - operation an associated operation name - callback a callback that shall be called when endTiming is called.
func (*TraceTiming) EndFailure ¶
func (c *TraceTiming) EndFailure(err error)
Ends timing of a failed block, calculates elapsed time and records the associated trace. - error an error object associated with this trace.
func (*TraceTiming) EndTrace ¶
func (c *TraceTiming) EndTrace()
Ends timing of an execution block, calculates elapsed time and records the associated trace.