trace

package module
v0.0.0-...-c443caa Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Attributes recorded on the span for the requests.
	// Only trace exporters will need them.
	HostAttribute       = "http.host"
	MethodAttribute     = "http.method"
	PathAttribute       = "http.path"
	URLAttribute        = "http.url"
	UserAgentAttribute  = "http.user_agent"
	StatusCodeAttribute = "http.status_code"
)

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context) func(o *options)

WithContext sets the context that trace exporter and metric exporter relies on.

func WithOnError

func WithOnError(onError func(err error)) func(o *options)

WithOnError sets the hook to be called when there is an error occurred on uploading the span data to Stackdriver. If no custom hook is set, errors are logged.

func WithProjectID

func WithProjectID(projectID string) func(o *options)

WithProjectID sets Google Cloud Platform project as projectID. Without using this option, it automatically detects the project ID from the default credential detection process. Please find the detailed order of the default credentail detection proecess on the doc: https://godoc.org/golang.org/x/oauth2/google#FindDefaultCredentials

func WithTimeout

func WithTimeout(t time.Duration) func(o *options)

WithTimeout sets the timeout for trace exporter and metric exporter

func WithTraceClientOptions

func WithTraceClientOptions(opts []option.ClientOption) func(o *options)

WithTraceClientOptions sets additionial client options for tracing.

Types

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter is a trace exporter that uploads data to Stackdriver.

TODO(yoshifumi): add a metrics exporter once the spec definition process and the sampler implementation are done.

func NewExporter

func NewExporter(opts ...Option) (*Exporter, error)

NewExporter creates a new Exporter thats implements trace.Exporter.

TODO(yoshifumi): add a metrics exporter one the spec definition process and the sampler implementation are done.

func (*Exporter) ExportSpan

func (e *Exporter) ExportSpan(ctx context.Context, sd *export.SpanData)

ExportSpan exports a SpanData to Stackdriver Trace.

func (*Exporter) ExportSpans

func (e *Exporter) ExportSpans(ctx context.Context, sds []*export.SpanData)

ExportSpans exports a slice of SpanData to Stackdriver Trace in batch

type Option

type Option func(*options)

Option is function type that is passed to the exporter initialization function.

Jump to

Keyboard shortcuts

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