pip_services3_components.trace.CachedTracer module
-
class
pip_services3_components.trace.CachedTracer.
CachedTracer
Bases:
pip_services3_components.trace.ITracer.ITracer
,pip_services3_commons.config.IReconfigurable.IReconfigurable
,pip_services3_commons.refer.IReferenceable.IReferenceable
,abc.ABC
Abstract tracer that caches recorded traces in memory and periodically dumps them. Child classes implement saving cached traces to their specified destinations.
- ### Configuration parameters ###
source: source (context) name
- options:
interval: interval in milliseconds to save log messages (default: 10 seconds)
max_cache_size: maximum number of messages stored in this cache (default: 100)
- ### References ###
*:context-info:*:*:1.0 (optional)
ContextInfo
to detect the context id and specify counters source
See
ITracer
,OperationTrace
-
begin_trace
(correlation_id: Optional[str], component: str, operation: str) → pip_services3_components.trace.TraceTiming.TraceTiming Begings recording an operation trace
- Parameters
correlation_id – (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.
-
clear
() Clears (removes) all cached log messages.
-
configure
(config: pip_services3_commons.config.ConfigParams.ConfigParams) Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
-
dump
() Dumps (writes) the currently cached log messages.
See
_write
-
failure
(correlation_id: Optional[str], component: str, operation: str, error: Exception, duration: float) Records an operation failure with its name, duration and error
- Parameters
correlation_id – (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.
-
set_references
(references: pip_services3_commons.refer.IReferences.IReferences) Sets references to dependent components.
- Parameters
references – references to locate the component dependencies.
-
trace
(correlation_id: Optional[str], component: str, operation: str, duration: float) Records an operation trace with its name and duration
- Parameters
correlation_id – (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.