v0.24.0 Latest Latest

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 12 Imported by: 147



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



This section is empty.


This section is empty.


This section is empty.


type LogExporter added in v0.21.0

type LogExporter struct {
	// contains filtered or unexported fields

LogExporter exports metrics and span to log file

func NewLogExporter added in v0.21.0

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

NewLogExporter creates new log exporter.

func (*LogExporter) Close added in v0.21.0

func (e *LogExporter) Close()

Close closes any files that were opened for logging.

func (*LogExporter) ExportMetrics added in v0.21.0

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

ExportMetrics exports to log.

func (*LogExporter) ExportSpan added in v0.21.0

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

ExportSpan exports a SpanData to log

func (*LogExporter) Start added in v0.21.0

func (e *LogExporter) Start() error

Start starts the metric and span data exporter.

func (*LogExporter) Stop added in v0.21.0

func (e *LogExporter) Stop()

Stop stops the metric and span data exporter.

type Options added in v0.21.0

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

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

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

ExportSpan logs the trace span.

func (*PrintExporter) ExportView

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

ExportView logs the view data.

Jump to

Keyboard shortcuts

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