Documentation
¶
Overview ¶
Package metricexport provides a small OTLP metrics egress path for parca-agent. It is deliberately generic: a Producer collects gauge/sum metrics in the background and renders them into a pmetric.MetricSlice on demand, and the Exporter periodically batches every producer's output into a single OTLP ExportMetricsServiceRequest and ships it over an existing remote-store gRPC connection (the same one used for profiles).
The GPU metrics collector (package gpumetrics) is the first Producer, but nothing here is GPU-specific — any subsystem that wants to emit metrics to the remote store can register a Producer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter periodically renders all registered producers into a single OTLP metrics request and sends it over conn.
func NewExporter ¶
func NewExporter(conn *grpc.ClientConn, interval time.Duration, resourceAttrs map[string]any) *Exporter
NewExporter builds an Exporter that ships metrics over conn (typically the agent's existing remote-store connection) every interval. resourceAttrs are attached to the OTLP Resource (e.g. {"node": <node name>}).
func (*Exporter) AddProducer ¶
func (e *Exporter) AddProducer(p ProducerConfig)
AddProducer registers a producer. Call before Run/Collect.
type Producer ¶
type Producer interface {
// Produce appends the metrics collected since the last call to ms.
Produce(ms pmetric.MetricSlice) error
// Collect runs the background collection loop until ctx is cancelled.
Collect(ctx context.Context) error
}
Producer collects metrics in the background (Collect, blocking until ctx is cancelled) and renders the metrics accumulated so far into ms (Produce, called periodically by the Exporter). Implementations must be safe for Produce and Collect to run concurrently.
type ProducerConfig ¶
ProducerConfig pairs a Producer with the OTLP instrumentation scope its metrics are reported under.