metricexport

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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.

func (*Exporter) Run

func (e *Exporter) Run(ctx context.Context) error

Run starts every producer's background collection loop and the periodic export loop, blocking until ctx is cancelled or a fatal error occurs.

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

type ProducerConfig struct {
	Producer  Producer
	ScopeName string
}

ProducerConfig pairs a Producer with the OTLP instrumentation scope its metrics are reported under.

Jump to

Keyboard shortcuts

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