Module Contents

set_as_recording(decorated_func, wrapped)
subsegment_decorator(wrapped, instance, args, kwargs)
class SubsegmentContextManager(recorder, name=None, **subsegment_kwargs)

Wrapper for segment and recorder to provide segment context manager.

__call__(self, wrapped, instance, args, kwargs)
__exit__(self, exc_type, exc_val, exc_tb)
class Subsegment(name, namespace, segment)


The work done in a single segment can be broke down into subsegments. Subsegments provide more granular timing information and details about downstream calls that your application made to fulfill the original request. A subsegment can contain additional details about a call to an AWS service, an external HTTP API, or an SQL database.

add_subsegment(self, subsegment)

Add input subsegment as a child subsegment and increment reference counter and total subsegments counter of the parent segment.

remove_subsegment(self, subsegment)

Remove input subsegment from child subsegemnts and decrement parent segment total subsegments count.

Parameters:Subsegment – subsegment to remove.
close(self, end_time=None)

Close the trace entity by setting end_time and flip the in progress flag to False. Also decrement parent segment’s ref counter by 1.

Parameters:end_time (int) – Epoch in seconds. If not specified current time will be used.
set_sql(self, sql)

Set sql related metadata. This function is used by patchers for database connectors and is not recommended to invoke manually.

Parameters:sql (dict) – sql related metadata