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, externalLabels map[string]string) *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 host's OTLP Resource (e.g. {"host.name": <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. Metrics about
// the host go into host, which is under the Exporter's resource and the
// producer's scope. Metrics about some other entity, such as a process,
// go into resources as ResourceMetrics of their own, which the producer
// fills in completely: resource, schema URL, and scope.
Produce(host pmetric.MetricSlice, resources pmetric.ResourceMetricsSlice) 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 (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.