MimirAnalytics.Ingest.GatewayPull (mimir_analytics v0.8.1)

Copy Markdown View Source

Pulls the gateway's read-only Observability API (updated_since cursor) and buffers each page as run-record JSONL — the same line shapes the gateway-export mapper ingests, so the buffer file is the contract wherever the bytes came from. Plain HTTP + maps only (dependency-direction invariant).

Routing decisions are not a top-level API field: they ride inside each row's turn_events (as ai.bizinsights.mimir.routing.decision CloudEvents, or as bare routing_decision entries on rows predating CloudEvents) and are lifted out here into their own routing_decision buffer lines.

The endpoint below is the contract this module is written against. The gateway now serves it behind its own read-only credential, so this module is live-runnable; the cursor it echoes is composite (<rfc3339>|<uuid>) and is passed back verbatim, never parsed here.

Buffer filenames are collision-free by construction (page_filename/3) — the buffer file is the ingest contract, and a name collision would drop a page silently.

Summary

Functions

pull(opts)

@spec pull(keyword()) :: {:ok, %{files: [Path.t()], last_cursor: String.t() | nil}}