Documentation

Overview

    Package test for testing code instrumented with the metric and stats packages.

    Index

    Examples

    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 keeps exported metric data in memory to aid in testing the instrumentation.

      Metrics can be retrieved with `GetPoint()`. In order to deterministically retrieve the most recent values, you must first invoke `ReadAndExport()`.

      Example (Metric)
      Output:
      
      1
      2
      3
      
      Example (Stats)
      Output:
      
      increased by 1
      increased by 3
      increased by 6
      

      func NewExporter

      func NewExporter(metricReader *metricexport.Reader) *Exporter

        NewExporter returns a new exporter.

        func (*Exporter) ExportMetrics

        func (e *Exporter) ExportMetrics(ctx context.Context, data []*metricdata.Metric) error

          ExportMetrics records the view data.

          func (*Exporter) GetPoint

          func (e *Exporter) GetPoint(metricName string, labels map[string]string) (metricdata.Point, bool)

            GetPoint returns the latest point for the time series identified by the given labels.

            func (*Exporter) ReadAndExport

            func (e *Exporter) ReadAndExport()

              ReadAndExport reads the current values for all metrics and makes them available to this exporter.

              func (*Exporter) String

              func (e *Exporter) String() string

                String defines the “native” format for the exporter.

                Source Files