Documentation
¶
Index ¶
- Variables
- type Exporter
- func (x *Exporter) Begin(q usage.Request) usage.Watch
- func (x *Exporter) Bodies() usage.Bodies
- func (x *Exporter) Ledger(r Record)
- func (x *Exporter) Serve() func()
- func (x *Exporter) Session(agent, session string) bool
- func (x *Exporter) SessionAgent(agent string) bool
- func (x *Exporter) SessionFresh(agent, session string) bool
- type OTelSpan
- type Record
Constants ¶
This section is empty.
Variables ¶
var OTelEvery, OTelSessionsEvery = 5 * time.Second, 2 * time.Second
OTelEvery is how often the exporter sends what it holds, and OTelSessionsEvery how often it reads the agents' transcripts for sessions. Read once when Serve starts an exporter; tests shorten them so a test that waits for an export doesn't wait seconds.
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter sends the gateway's requests, the ledger's rows and the agents' sessions to an OpenTelemetry collector, as settings.OTel says. It is a usage.Observer: plugins/otel registers one while it is on, and magpie's core never exports on its own.
func (*Exporter) Begin ¶
Begin watches a gateway request while the export is on. A local agent's own turn whose transcript the exporter already reads is left to the transcript.
func (*Exporter) Bodies ¶
Bodies is how much of the bodies go with the spans (#538): the gateway fills Record.BodyIn/BodyOut only for some, and keeps a reply whole for it only for whole.
func (*Exporter) Ledger ¶
Ledger offers a usage row. One of a request the gateway sent as spans (Watched), or a local agent's turn its own transcript sends, is passed over.
func (*Exporter) Serve ¶
func (x *Exporter) Serve() func()
Serve runs only in the process serving the gateway (usage.ServeObservers). Stopping drains accepted metadata for at most three seconds, after in-flight calls finish.
func (*Exporter) Session ¶
Session reports whether this exact agent/session has recent local observations. Only requests without an ID fall back to agent-level readiness. Callers must also verify loopback and absence of a gateway key.
func (*Exporter) SessionAgent ¶
SessionAgent reports recent observations for callers without a session ID.
func (*Exporter) SessionFresh ¶
SessionFresh resolves a cached miss once before the gateway exports its first attempt. Requests without a native ID retain observed-agent readiness.