AITrace.Exporter.File (AITrace v0.2.0)

Copy Markdown View Source

File exporter that writes traces to JSON files.

This exporter is useful for:

  • Permanent trace storage
  • Post-mortem debugging
  • Trace analysis with external tools
  • Building trace datasets

Options

  • :directory - Directory to write trace files (default: "./traces")
  • :release_manifest_ref - Release manifest or evidence bundle reference for this export
  • :evidence_owner_ref - Existing durable evidence owner that anchors this export
  • :source_node_ref - Stable node reference for per-node receipt discipline
  • :node_instance_id, :boot_generation, :node_role, :deployment_ref - optional node identity evidence
  • :commit_lsn, :commit_hlc - optional commit-order evidence to join receipts with proof tokens

File Format

Files are named: {trace_id}_{timestamp}.json Evidence receipts are named: {trace_id}_{timestamp}.evidence.json

Each file contains a JSON object with:

  • trace_id - The trace identifier
  • metadata - Trace metadata
  • created_at - Trace creation timestamp
  • spans - Array of all spans in the trace

The adjacent evidence receipt contains the exported trace artifact SHA-256, byte count, release-manifest or evidence-owner linkage, and proof posture.

Summary

Functions

Writes a replay bundle into a replay-specific export directory with evidence.

Verifies trace and replay bundle artifact/evidence pairs in an export directory.

Functions

export_replay_bundle(bundle_or_attrs, state)

@spec export_replay_bundle(AITrace.Trace.ReplayBundle.t() | map(), map()) ::
  {:ok, map()} | {:error, term()}

Writes a replay bundle into a replay-specific export directory with evidence.

verify_export_directory(directory)

@spec verify_export_directory(Path.t()) :: {:ok, map()} | {:error, map()}

Verifies trace and replay bundle artifact/evidence pairs in an export directory.