Documentation
¶
Index ¶
- type AppTracer
- type Config
- type Label
- type PlatformClient
- type SpanWrapper
- func (s *SpanWrapper) Context() context.Context
- func (s *SpanWrapper) Finish()
- func (s *SpanWrapper) GetSummary() []string
- func (s *SpanWrapper) NewChildSpan(name string) *SpanWrapper
- func (s *SpanWrapper) OutputSummary()
- func (s *SpanWrapper) SetEnvironment(env string) *SpanWrapper
- func (s *SpanWrapper) SetError(err error) *SpanWrapper
- func (s *SpanWrapper) SetLabel(key, value string) *SpanWrapper
- func (s *SpanWrapper) SetLabels(labels []Label) *SpanWrapper
- func (s *SpanWrapper) SetResponse(status int) *SpanWrapper
- func (s *SpanWrapper) SetSQL(sql string) *SpanWrapper
- func (s *SpanWrapper) SetServiceName(name string) *SpanWrapper
- func (s *SpanWrapper) SetUser(user string) *SpanWrapper
- func (s *SpanWrapper) SetVersion(ver string) *SpanWrapper
- type TraceWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppTracer ¶
type AppTracer struct { Config ClientList []PlatformClient }
AppTracer has multiple tracing platform clients to send tracing activity to the platforms.
func (*AppTracer) AddClient ¶
func (a *AppTracer) AddClient(c PlatformClient)
AddClient adds PlatformClient into ClientList.
func (*AppTracer) Close ¶ added in v0.1.1
func (a *AppTracer) Close()
Close closes all of the clients.
func (*AppTracer) Flush ¶ added in v0.1.1
func (a *AppTracer) Flush()
Flush waits for exported data to be uploaded.
func (*AppTracer) Trace ¶
func (a *AppTracer) Trace(ctx context.Context) *TraceWrapper
Trace creates *TraceWrapper from context. TraceWrapper contains platform clients and generates span data for the platforms. TraceWrapper is cached in the context and you can get same TraceWrapper when pass the same context.
type Config ¶
type Config struct { // Only if Enable is true then tracing data sends to tracing platform. Enable bool // DefaultLabels sets labels into every tracing data(span). DefaultLabels []Label // ServiceName is your application name. ServiceName string // Version is your application version. Version string // Environment is your application version. (e.g. dev, stage, prod) Environment string }
Config contains tracing settings.
type PlatformClient ¶
type PlatformClient interface { // NewTrace creates Trace of this tracing platform. // Trace could be generated for each request. NewTrace(context.Context) (platform.Trace, error) // Flush waits for exported data to be uploaded. Flush() // Close closes client. Close() }
PlatformClient is tracing platform client. It's singleton struct for each platform.
type SpanWrapper ¶
type SpanWrapper struct { IsRoot bool // contains filtered or unexported fields }
SpanWrapper contains multiple Span data for each platforms.
func (*SpanWrapper) Context ¶
func (s *SpanWrapper) Context() context.Context
Context returns context.Context in this SpanWrapper.
func (*SpanWrapper) Finish ¶
func (s *SpanWrapper) Finish()
Finish sends tracing data(span) for each platforms.
func (*SpanWrapper) GetSummary ¶
func (s *SpanWrapper) GetSummary() []string
GetSummary gets trace summary of the spans.
func (*SpanWrapper) NewChildSpan ¶
func (s *SpanWrapper) NewChildSpan(name string) *SpanWrapper
NewChildSpan creates SpanWrapper with child span data.
func (*SpanWrapper) OutputSummary ¶
func (s *SpanWrapper) OutputSummary()
OutputSummary prints trace summary of the spans.
func (*SpanWrapper) SetEnvironment ¶
func (s *SpanWrapper) SetEnvironment(env string) *SpanWrapper
SetEnvironment sets environment data into each spans.
func (*SpanWrapper) SetError ¶
func (s *SpanWrapper) SetError(err error) *SpanWrapper
SetError sets error data into each spans.
func (*SpanWrapper) SetLabel ¶
func (s *SpanWrapper) SetLabel(key, value string) *SpanWrapper
SetLabel sets labels into each spans.
func (*SpanWrapper) SetLabels ¶
func (s *SpanWrapper) SetLabels(labels []Label) *SpanWrapper
SetLabels sets multiple labels into each spans.
func (*SpanWrapper) SetResponse ¶
func (s *SpanWrapper) SetResponse(status int) *SpanWrapper
SetResponse sets response status code into each spans.
func (*SpanWrapper) SetSQL ¶
func (s *SpanWrapper) SetSQL(sql string) *SpanWrapper
SetSQL sets sql data into each spans.
func (*SpanWrapper) SetServiceName ¶
func (s *SpanWrapper) SetServiceName(name string) *SpanWrapper
SetServiceName sets service name into each spans.
func (*SpanWrapper) SetUser ¶
func (s *SpanWrapper) SetUser(user string) *SpanWrapper
SetUser sets user data into each spans.
func (*SpanWrapper) SetVersion ¶
func (s *SpanWrapper) SetVersion(ver string) *SpanWrapper
SetVersion sets version data into each spans.
type TraceWrapper ¶
type TraceWrapper struct {
// contains filtered or unexported fields
}
TraceWrapper contains multiple Trace data for each platforms.
func (*TraceWrapper) NewChildSpan ¶
func (t *TraceWrapper) NewChildSpan(name string) *SpanWrapper
NewChildSpan creates child *SpanWrapper.
func (*TraceWrapper) NewRootSpan ¶
func (t *TraceWrapper) NewRootSpan(name string) *SpanWrapper
NewRootSpan creates root *SpanWrapper, which is top of parent span.
func (*TraceWrapper) NewRootSpanFromRequest ¶
func (t *TraceWrapper) NewRootSpanFromRequest(r *http.Request) *SpanWrapper
NewRootSpanFromRequest creates root *SpanWrapper from *http.Request.