Back to

Package oc

Latest Go to latest

The highest tagged major version is .

Published: Sep 10, 2020 | License: BSD-3-Clause | Module:


Package oc provides a cmdutil.Server for opencensus.


func NewExporter

func NewExporter(tc trace.Config, opts ...ocagent.ExporterOption) (cmdutil.Server, error)

NewExporter creates and registers an open census trace exporter as a cmdutil.Server wit the provided trace.Config / ocagent.ExporterOptions.

type Config

type Config struct {
	// AgentAddress in the form of 'host:port'. Leave empty to disable.
	// (ocagent.WithAddress).
	AgentAddress string `env:"OC_AGENT_ADDR"`
	// ReconnectionPeriod to use when reconnecting to the agent. Defaults to
	// 5s.(ocagent.WithReconnectionPeriod).
	ReconnectionPeriod time.Duration `env:"OC_RECONNECTION_PERIOD,default=5s"`
	// WithInsecure. Defaults to false (ocagent.WithInsecure).
	WithInsecure bool `env:"OC_INSECURE,default=false"`

Config of Open Census, via

TODO[freeformz]: Support the other ocagent.WithXX options

func (Config) ExporterOptions

func (c Config) ExporterOptions(serviceName string) []ocagent.ExporterOption

ExporterOptions derived from the configuration.

func (Config) TraceConfig

func (c Config) TraceConfig() trace.Config

TraceConfig derived from the Config. This currently defaults to AlwaysSample and otherwise Default Max for the other trace.Config items.

TODO[freeformz]: implement determining trace.Config via environment.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier