opencensus

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetSamplingRate

func SetSamplingRate(fraction float64)

SetSamplingRate sets sampling probability. (e.g. '1' means 100%, '0' means 0%)

Types

type Client

type Client struct {
	Exporters []Exporter
}

Client is a trace client for OpenCensus.

func NewClient

func NewClient(exporters ...Exporter) *Client

NewClient returns initialized *Client.

func (*Client) AddExporter

func (c *Client) AddExporter(exporters ...Exporter)

func (*Client) Close added in v0.1.1

func (c *Client) Close()

Close closes all of clients.

func (*Client) Flush

func (c *Client) Flush()

Flush waits for exported data to be uploaded.

func (*Client) NewTrace

func (c *Client) NewTrace(ctx context.Context) (platform.Trace, error)

NewTrace creates stackdriver trace.

type Exporter

type Exporter interface {
	// Flush waits for exported data to be uploaded.
	Flush()
	// Close closes client.
	Close()
}

Exporter is tracing backend client. (e.g. Stackdriver client)

type Span

type Span struct {
	*trace.Span
	// contains filtered or unexported fields
}

Span is wrapper struct of opencensus.Span.

func (*Span) CanGetSummary

func (s *Span) CanGetSummary() bool

CanGetSummary determines Span can call GetSummary().

func (*Span) Finish

func (s *Span) Finish()

Finish sends trace data asynchronously.

func (*Span) FinishWait

func (s *Span) FinishWait()

Finish sends trace data asynchronously. (dummy method for lightstep)

func (*Span) GetSummary

func (s *Span) GetSummary() []string

GetSummary is dummy method.

func (*Span) NewChild

func (s *Span) NewChild(name string) platform.Span

NewChild creates child span data from this Span.

func (*Span) OutputSummary

func (s *Span) OutputSummary()

OutputSummary is dummy method.

func (*Span) SetEnvironment

func (s *Span) SetEnvironment(env string) platform.Span

SetEnvironment sets environment data into span.

func (*Span) SetError

func (s *Span) SetError(err error) platform.Span

SetError sets error data into span.

func (*Span) SetLabel

func (s *Span) SetLabel(key, value string) platform.Span

SetLabel sets label data into span.

func (*Span) SetResponse

func (s *Span) SetResponse(status int) platform.Span

SetResponse sets HTTP response status into span.

func (*Span) SetSQL

func (s *Span) SetSQL(sql string) platform.Span

SetSQL sets SQL query data into span.

func (*Span) SetServiceName

func (s *Span) SetServiceName(name string) platform.Span

SetServiceName sets service name into span.

func (*Span) SetUser

func (s *Span) SetUser(user string) platform.Span

SetUser sets user's id or name data into span.

func (*Span) SetVersion

func (s *Span) SetVersion(ver string) platform.Span

SetVersion sets version data into span.

func (*Span) TraceID

func (s *Span) TraceID() string

TraceID returns TraceID of Span.

type Trace

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

Trace generates spans.

func (*Trace) NewSpan

func (t *Trace) NewSpan(name string) platform.Span

NewSpan returns initialized span data with name.

func (*Trace) NewSpanFromRequest

func (t *Trace) NewSpanFromRequest(r *http.Request) platform.Span

NewSpanFromRequest returns initialized span data with *http.Request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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