nemoguardrails.tracing.span_formatting

View as Markdown

Simple span formatting functions for different output formats.

Module Contents

Functions

NameDescription
extract_span_attributesExtract OpenTelemetry attributes from any span type.
format_span_for_filesystemFormat any span type for JSON filesystem storage.
get_schema_version_for_filesystemReturn the schema version string based on the span type.

API

nemoguardrails.tracing.span_formatting.extract_span_attributes(
span
) -> typing.Dict[str, typing.Any]

Extract OpenTelemetry attributes from any span type.

Parameters:

span

Either SpanLegacy or typed span

Returns: Dict[str, Any]

Dictionary of OpenTelemetry attributes

nemoguardrails.tracing.span_formatting.format_span_for_filesystem(
span
) -> typing.Dict[str, typing.Any]

Format any span type for JSON filesystem storage.

Parameters:

span

Either SpanLegacy or typed span (InteractionSpan, RailSpan, etc.)

Returns: Dict[str, Any]

Dictionary with all span data for JSON serialization

nemoguardrails.tracing.span_formatting.get_schema_version_for_filesystem(
span
) -> str

Return the schema version string based on the span type.