nat.observability.exporter.exporter#

Attributes#

Classes#

Exporter

Helper class that provides a standard way to create an ABC using

Module Contents#

logger#
class Exporter#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstractmethod start() collections.abc.AsyncGenerator[None]#
Async:

Subscribes to event stream and starts the exporter.

This is an async context manager that should be used with ‘async with’. The exporter is automatically stopped when exiting the context.

Usage:

.. code-block:: python

    async with exporter.start():
        # Exporter is now running and subscribed to events
        # Your workflow code here
        pass
Note:

Implementations should use the @asynccontextmanager decorator.

abstractmethod stop() None#
Async:

Unsubscribes to the event stream and stops the exporter.

abstractmethod export(
event: nat.data_models.intermediate_step.IntermediateStep,
) None#

This method is called on each event from the event stream to initiate the trace export.

Args:

event (IntermediateStep): The event to be exported.

abstractmethod on_error(exc: Exception) None#

Handle an error in the event subscription.

Args:

exc (Exception): The error to handle.

abstractmethod on_complete() None#

Handle the completion of the event stream.

This method is called when the event stream is complete.