Documentation

Overview

Package metricexport contains support for exporting metric data.

This is an EXPERIMENTAL package, and may change in arbitrary ways without notice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter interface {
	ExportMetrics(ctx context.Context, data []*metricdata.Metric) error
}

Exporter is an interface that exporters implement to export the metric data.

type IntervalReader

type IntervalReader struct {
	// ReportingInterval it the time duration between two consecutive
	// metrics reporting. defaultReportingDuration  is used if it is not set.
	// It cannot be set lower than minimumReportingDuration.
	ReportingInterval time.Duration
	// contains filtered or unexported fields
}

IntervalReader periodically reads metrics from all producers registered with producer manager and exports those metrics using provided exporter. Call Reader.Stop() to stop the reader.

func NewIntervalReader

func NewIntervalReader(reader *Reader, exporter Exporter) (*IntervalReader, error)

NewIntervalReader creates a reader. Once started it periodically reads metrics from all producers and exports them using provided exporter.

func (*IntervalReader) Start

func (ir *IntervalReader) Start() error

Start starts the IntervalReader which periodically reads metrics from all producers registered with global producer manager. If the reporting interval is not set prior to calling this function then default reporting interval is used.

func (*IntervalReader) Stop

func (ir *IntervalReader) Stop()

Stop stops the reader from reading and exporting metrics. Additional call to Stop are no-ops.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads metrics from all producers registered with producer manager and exports those metrics using provided exporter.

func NewReader

func NewReader(o ...ReaderOption) *Reader

NewReader returns a reader configured with specified options.

func (*Reader) ReadAndExport

func (r *Reader) ReadAndExport(exporter Exporter)

ReadAndExport reads metrics from all producer registered with producer manager and then exports them using provided exporter.

type ReaderOption

type ReaderOption func(*ReaderOptions)

ReaderOption apply changes to ReaderOptions.

func WithSpanName

func WithSpanName(spanName string) ReaderOption

WithSpanName makes new reader to use given span name when exporting metrics.

type ReaderOptions

type ReaderOptions struct {
	// SpanName is the name used for span created to export metrics.
	SpanName string
}

ReaderOptions contains options pertaining to metrics reader.