otel: go.opentelemetry.io/otel/exporter/metric/stdout Index | Examples | Files

package stdout

import "go.opentelemetry.io/otel/exporter/metric/stdout"



Package Files


func InstallNewPipeline Uses

func InstallNewPipeline(config Config) (*push.Controller, error)

InstallNewPipeline instantiates a NewExportPipeline and registers it globally. Typically called as:

pipeline, err := stdout.InstallNewPipeline(stdout.Config{...})
if err != nil {
defer pipeline.Stop()
... Done

func NewExportPipeline Uses

func NewExportPipeline(config Config) (*push.Controller, error)

NewExportPipeline sets up a complete export pipeline with the recommended setup, chaining a NewRawExporter into the recommended selectors and batchers.


// Create a meter
pusher, err := stdout.NewExportPipeline(stdout.Config{
    PrettyPrint:    true,
    DoNotPrintTime: true,
if err != nil {
    log.Fatal("Could not initialize stdout exporter:", err)
defer pusher.Stop()

ctx := context.Background()

key := key.New("key")
meter := pusher.Meter("example")

// Create and update a single counter:
counter := meter.NewInt64Counter("a.counter", metric.WithKeys(key))
labels := meter.Labels(key.String("value"))

counter.Add(ctx, 100, labels)


	"updates": [
			"name": "a.counter{key=value}",
			"sum": 100

type Config Uses

type Config struct {
    // Writer is the destination.  If not set, os.Stdout is used.
    Writer io.Writer

    // PrettyPrint will pretty the json representation of the span,
    // making it print "pretty". Default is false.
    PrettyPrint bool

    // DoNotPrintTime suppresses timestamp printing.  This is
    // useful to create deterministic test conditions.
    DoNotPrintTime bool

    // Quantiles are the desired aggregation quantiles for measure
    // metric data, used when the configured aggregator supports
    // quantiles.
    // Note: this exporter is meant as a demonstration; a real
    // exporter may wish to configure quantiles on a per-metric
    // basis.
    Quantiles []float64

Config is the configuration to be used when initializing a stdout export.

type Exporter Uses

type Exporter struct {
    // contains filtered or unexported fields

func NewRawExporter Uses

func NewRawExporter(config Config) (*Exporter, error)

NewRawExporter creates a stdout Exporter for use in a pipeline.

func (*Exporter) Export Uses

func (e *Exporter) Export(_ context.Context, checkpointSet export.CheckpointSet) error

Package stdout imports 14 packages (graph) and is imported by 1 packages. Updated 2020-02-21. Refresh now. Tools for package owners.