Help us shape the future of Go! Take the 2026 Go Developer Survey

otlp

package
v0.1.1355 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 New

func New() *Exporter

New is an exporter, not yet serving.

func (*Exporter) Begin

func (x *Exporter) Begin(q usage.Request) usage.Watch

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

func (x *Exporter) Bodies() usage.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

func (x *Exporter) Ledger(r Record)

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

func (x *Exporter) Session(agent, session string) bool

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

func (x *Exporter) SessionAgent(agent string) bool

SessionAgent reports recent observations for callers without a session ID.

func (*Exporter) SessionFresh

func (x *Exporter) SessionFresh(agent, session string) bool

SessionFresh resolves a cached miss once before the gateway exports its first attempt. Requests without a native ID retain observed-agent readiness.

type OTelSpan

type OTelSpan struct {
	TraceID, SpanID, ParentID        string
	Root                             bool
	End                              time.Time
	Name, Type, SessionID, TraceName string
	Session, Inferred, Update        bool
}

OTelSpan carries explicit IDs for gateway requests and agent-session observations.

type Record

type Record = usage.Record

Record is a usage row as the exporter sends it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL