nat.plugins.weave.weave_exporter#

Attributes#

Classes#

WeaveExporter

A Weave exporter that exports telemetry traces to Weights & Biases Weave using OpenTelemetry.

Module Contents#

logger#
presidio_filter#
class WeaveExporter(
context_state=None,
entity: str | None = None,
project: str | None = None,
verbose: bool = False,
)#

Bases: nat.observability.exporter.span_exporter.SpanExporter[nat.data_models.span.Span, nat.data_models.span.Span]

A Weave exporter that exports telemetry traces to Weights & Biases Weave using OpenTelemetry.

Initialize the processing exporter.

Args:

context_state (ContextState | None): The context state to use for the exporter. drop_nones (bool): Whether to drop items when processors return None (default: True).

_weave_calls: nat.observability.exporter.base_exporter.IsolatedAttribute[dict[str, weave.trace.weave_client.Call]]#
_entity = None#
_project = None#
_gc#
async export_processed(
item: nat.data_models.span.Span | list[nat.data_models.span.Span],
) None#

Dummy implementation of export_processed.

Args:

item (Span | list[Span]): The span or list of spans to export.

_process_start_event(
event: nat.data_models.intermediate_step.IntermediateStep,
)#

Process the start event for a Weave call.

Args:

event (IntermediateStep): The intermediate step event.

_process_end_event(
event: nat.data_models.intermediate_step.IntermediateStep,
)#

Process the end event for a Weave call.

Args:

event (IntermediateStep): The intermediate step event.

parent_call(
trace_id: str,
parent_call_id: str,
) collections.abc.Generator[None]#

Create a dummy Weave call for the parent span.

Args:

trace_id (str): The trace ID of the parent span. parent_call_id (str): The ID of the parent call.

Yields:

None: The dummy Weave call.

_create_weave_call(
step: nat.data_models.intermediate_step.IntermediateStep,
span: nat.data_models.span.Span,
) weave.trace.weave_client.Call#

Create a Weave call directly from the span and step data, connecting to existing framework traces if available.

Args:

step (IntermediateStep): The intermediate step event. span (Span): The span associated with the intermediate step.

Returns:

Call: The Weave call created from the span and step data.

_finish_weave_call(
step: nat.data_models.intermediate_step.IntermediateStep,
) None#

Finish a previously created Weave call.

Args:

step (IntermediateStep): The intermediate step event.

async _cleanup_weave_calls() None#

Clean up any lingering Weave calls.

async _cleanup() None#

Perform cleanup once the exporter is stopped.