Documentation ¶
Overview ¶
Package tracing provides common functions for attaching values to trace spans
Index ¶
- Constants
- func AttachAPIClientClientIDToSpan(span trace.Span, clientID string)
- func AttachAPIClientDatabaseIDToSpan(span trace.Span, clientID string)
- func AttachAccountIDToSpan(span trace.Span, accountID string)
- func AttachActiveAccountIDToSpan(span trace.Span, accountID string)
- func AttachDatabaseQueryToSpan(span trace.Span, queryDescription, query string, args []interface{})
- func AttachErrorToSpan(span trace.Span, description string, err error)
- func AttachFilterToSpan(span trace.Span, page uint64, limit uint8, sortBy string)
- func AttachItemIDToSpan(span trace.Span, itemID string)
- func AttachQueryFilterToSpan(span trace.Span, filter *types.QueryFilter)
- func AttachRequestToSpan(span trace.Span, req *http.Request)
- func AttachRequestURIToSpan(span trace.Span, uri string)
- func AttachRequestingUserIDToSpan(span trace.Span, userID string)
- func AttachResponseToSpan(span trace.Span, res *http.Response)
- func AttachSearchQueryToSpan(span trace.Span, query string)
- func AttachSessionContextDataToSpan(span trace.Span, sessionCtxData *types.SessionContextData)
- func AttachToSpan(span trace.Span, key string, val interface{})
- func AttachURLToSpan(span trace.Span, u *url.URL)
- func AttachUserAgentDataToSpan(span trace.Span, ua *useragent.UserAgent)
- func AttachUserIDToSpan(span trace.Span, userID string)
- func AttachUserToSpan(span trace.Span, user *types.User)
- func AttachUsernameToSpan(span trace.Span, username string)
- func AttachWebhookIDToSpan(span trace.Span, webhookID string)
- func BuildTracedHTTPTransport(timeout time.Duration) http.RoundTripper
- func FormatSpan(operation string, req *http.Request) string
- func GetCallerName() string
- func NewInstrumentedSQLLogger(logger logging.Logger) instrumentedsql.Logger
- func NewInstrumentedSQLTracer(name string) instrumentedsql.Tracer
- func StartCustomSpan(ctx context.Context, name string) (context.Context, trace.Span)
- func StartSpan(ctx context.Context) (context.Context, trace.Span)
- type Config
- type JaegerConfig
- type Span
- type Tracer
Constants ¶
const (
// Jaeger represents the popular distributed tracing server.
Jaeger = "jaeger"
)
Variables ¶
This section is empty.
Functions ¶
func AttachAPIClientClientIDToSpan ¶
AttachAPIClientClientIDToSpan is a consistent way to attach an API client's ID to a span.
func AttachAPIClientDatabaseIDToSpan ¶
AttachAPIClientDatabaseIDToSpan is a consistent way to attach an API client's database row ID to a span.
func AttachAccountIDToSpan ¶
AttachAccountIDToSpan provides a consistent way to attach an account's ID to a span.
func AttachActiveAccountIDToSpan ¶
AttachActiveAccountIDToSpan provides a consistent way to attach an account's ID to a span.
func AttachDatabaseQueryToSpan ¶
AttachDatabaseQueryToSpan attaches a given search query to a span.
func AttachErrorToSpan ¶
AttachErrorToSpan attaches a given error to a span.
func AttachFilterToSpan ¶
AttachFilterToSpan provides a consistent way to attach a filter's info to a span.
func AttachItemIDToSpan ¶
AttachItemIDToSpan attaches an item ID to a given span.
func AttachQueryFilterToSpan ¶
func AttachQueryFilterToSpan(span trace.Span, filter *types.QueryFilter)
AttachQueryFilterToSpan attaches a given query filter to a span.
func AttachRequestToSpan ¶
AttachRequestToSpan attaches a given *http.Request to a span.
func AttachRequestURIToSpan ¶
AttachRequestURIToSpan attaches a given URI to a span.
func AttachRequestingUserIDToSpan ¶
AttachRequestingUserIDToSpan provides a consistent way to attach a user's ID to a span.
func AttachResponseToSpan ¶
AttachResponseToSpan attaches a given *http.Response to a span.
func AttachSearchQueryToSpan ¶
AttachSearchQueryToSpan attaches a given search query to a span.
func AttachSessionContextDataToSpan ¶
func AttachSessionContextDataToSpan(span trace.Span, sessionCtxData *types.SessionContextData)
AttachSessionContextDataToSpan provides a consistent way to attach a SessionContextData object to a span.
func AttachToSpan ¶
AttachToSpan allows a user to attach any value to a span.
func AttachURLToSpan ¶
AttachURLToSpan attaches a given URI to a span.
func AttachUserAgentDataToSpan ¶
AttachUserAgentDataToSpan attaches a given search query to a span.
func AttachUserIDToSpan ¶
AttachUserIDToSpan provides a consistent way to attach a user's ID to a span.
func AttachUserToSpan ¶
AttachUserToSpan provides a consistent way to attach a user to a span.
func AttachUsernameToSpan ¶
AttachUsernameToSpan provides a consistent way to attach a user's username to a span.
func AttachWebhookIDToSpan ¶
AttachWebhookIDToSpan provides a consistent way to attach a webhook's ID to a span.
func BuildTracedHTTPTransport ¶
func BuildTracedHTTPTransport(timeout time.Duration) http.RoundTripper
BuildTracedHTTPTransport constructs a new http.Transport.
func FormatSpan ¶
FormatSpan formats a span.
func GetCallerName ¶
func GetCallerName() string
GetCallerName is largely (and respectfully) inspired by/copied from https://stackoverflow.com/a/35213181
func NewInstrumentedSQLLogger ¶
func NewInstrumentedSQLLogger(logger logging.Logger) instrumentedsql.Logger
NewInstrumentedSQLLogger wraps a logging.Logger for instrumentedsql.
func NewInstrumentedSQLTracer ¶
func NewInstrumentedSQLTracer(name string) instrumentedsql.Tracer
NewInstrumentedSQLTracer wraps a Tracer for instrumentedsql.
func StartCustomSpan ¶
StartCustomSpan starts an anonymous custom span.
Types ¶
type Config ¶
type Config struct { // Jaeger configures the Jaeger tracer. Jaeger *JaegerConfig `json:"jaeger" mapstructure:"jaeger" toml:"jaeger,omitempty"` Provider string `json:"provider" mapstructure:"provider" toml:"provider,omitempty"` // SpanCollectionProbability indicates the probability that a collected span will be reported. SpanCollectionProbability float64 `json:"span_collection_probability" mapstructure:"span_collection_probability" toml:"span_collection_probability,omitempty"` // contains filtered or unexported fields }
Config contains settings related to tracing.
func (*Config) Initialize ¶
Initialize provides an instrumentation handler.
func (*Config) SetupJaeger ¶
SetupJaeger creates a new trace provider instance and registers it as global trace provider.
type JaegerConfig ¶
type JaegerConfig struct { CollectorEndpoint string `json:"collector_endpoint" mapstructure:"collector_endpoint" toml:"collector_endpoint,omitempty"` ServiceName string `json:"service_name" mapstructure:"service_name" toml:"service_name,omitempty"` // contains filtered or unexported fields }
JaegerConfig contains settings related to tracing with Jaeger.
func (*JaegerConfig) ValidateWithContext ¶
func (c *JaegerConfig) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates the config struct.