go.opencensus.io: go.opencensus.io/examples/exporter Index | Files

package exporter

import "go.opencensus.io/examples/exporter"

Package exporter contains a log exporter that supports exporting OpenCensus metrics and spans to a logging framework.


Package Files

exporter.go logexporter.go

type LogExporter Uses

type LogExporter struct {
    // contains filtered or unexported fields

LogExporter exports metrics and span to log file

func NewLogExporter Uses

func NewLogExporter(options Options) (*LogExporter, error)

NewLogExporter creates new log exporter.

func (*LogExporter) Close Uses

func (e *LogExporter) Close()

Close closes any files that were opened for logging.

func (*LogExporter) ExportMetrics Uses

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

ExportMetrics exports to log.

func (*LogExporter) ExportSpan Uses

func (e *LogExporter) ExportSpan(sd *trace.SpanData)

ExportSpan exports a SpanData to log

func (*LogExporter) Start Uses

func (e *LogExporter) Start() error

Start starts the metric and span data exporter.

func (*LogExporter) Stop Uses

func (e *LogExporter) Stop()

Stop stops the metric and span data exporter.

type Options Uses

type Options struct {
    // ReportingInterval is a time interval between two successive metrics
    // export.
    ReportingInterval time.Duration

    // MetricsLogFile is path where exported metrics are logged.
    // If it is nil then the metrics are logged on console
    MetricsLogFile string

    // TracesLogFile is path where exported span data are logged.
    // If it is nil then the span data are logged on console
    TracesLogFile string

Options provides options for LogExporter

type PrintExporter Uses

type PrintExporter struct{}

PrintExporter is a stats and trace exporter that logs the exported data to the console.

The intent is help new users familiarize themselves with the capabilities of opencensus.

This should NOT be used for production workloads.

func (*PrintExporter) ExportSpan Uses

func (e *PrintExporter) ExportSpan(vd *trace.SpanData)

ExportSpan logs the trace span.

func (*PrintExporter) ExportView Uses

func (e *PrintExporter) ExportView(vd *view.Data)

ExportView logs the view data.

Package exporter imports 12 packages (graph) and is imported by 12 packages. Updated 2019-04-25. Refresh now. Tools for package owners.