Documentation
¶
Overview ¶
Package tracing provides distributed tracing utilities. samber/do: this package's wire.go exposes an empty provider set. No registration helpers are needed here; use observability/tracing/config.RegisterTracerProvider instead.
Index ¶
- Variables
- func AttachErrorToSpan(span trace.Span, description string, err error)
- func AttachQueryFilterToSpan(span trace.Span, filter *filtering.QueryFilter)
- func AttachRequestToSpan(span trace.Span, req *http.Request)
- func AttachResponseToSpan(span trace.Span, res *http.Response)
- func AttachSessionContextDataToSpan(span trace.Span, sessionCtxData SessionContextDataForTracing)
- func AttachToSpan[T any](span trace.Span, attachmentKey string, x T)
- func AttachUserAgentDataToSpan(span trace.Span, req *http.Request)
- func FormatSpan(operation string, req *http.Request) string
- func GetCallerName() string
- func NewInstrumentedSQLTracer(tracerProvider TracerProvider, 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 ServicePermissionChecker
- type SessionContextDataForTracing
- type Span
- type Tracer
- type TracerProvider
- type User
Constants ¶
This section is empty.
Variables ¶
var NewNoopTracerProvider = func() TracerProvider {
return &noopTracerProvider{}
}
NewNoopTracerProvider is a shadow for Otel's NewNoopTracerProvider.
var (
PackagePrefix = "github.com/verygoodsoftwarenotvirus/platform/v2/"
)
var ( // ProvidersTracing provided HTTP client construction; use httpclient.Providers instead. ProvidersTracing = wire.NewSet() )
Functions ¶
func AttachErrorToSpan ¶
AttachErrorToSpan attaches a given error to a span.
func AttachQueryFilterToSpan ¶
func AttachQueryFilterToSpan(span trace.Span, filter *filtering.QueryFilter)
AttachQueryFilterToSpan attaches a given query filter to a span.
func AttachRequestToSpan ¶
AttachRequestToSpan attaches a given HTTP request to a span.
func AttachResponseToSpan ¶
AttachResponseToSpan attaches a given *http.Response to a span.
func AttachSessionContextDataToSpan ¶
func AttachSessionContextDataToSpan(span trace.Span, sessionCtxData SessionContextDataForTracing)
AttachSessionContextDataToSpan provides a consistent way to attach a SessionContextData object to a span.
func AttachUserAgentDataToSpan ¶
AttachUserAgentDataToSpan attaches a given search query to a span.
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 NewInstrumentedSQLTracer ¶
func NewInstrumentedSQLTracer(tracerProvider TracerProvider, name string) instrumentedsql.Tracer
NewInstrumentedSQLTracer wraps a Tracer for instrumentedsql.
func StartCustomSpan ¶
StartCustomSpan starts an anonymous custom span.
Types ¶
type ServicePermissionChecker ¶
type ServicePermissionChecker interface {
IsServiceAdmin() bool
}
ServicePermissionChecker is a minimal interface for attaching permission state to spans. Export it so the app can adapt authorization.ServiceRolePermissionChecker.
type SessionContextDataForTracing ¶
type SessionContextDataForTracing interface {
GetUserID() string
GetServicePermissions() ServicePermissionChecker
GetActiveAccountID() string
}
SessionContextDataForTracing is a minimal interface for attaching session context to spans. Export it so the app can adapt sessions.ContextData.
type Tracer ¶
type Tracer interface {
StartSpan(ctx context.Context) (context.Context, Span)
StartCustomSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, Span)
}
Tracer describes a tracer.
func NewTracerForTest ¶
NewTracerForTest creates a Tracer.
type TracerProvider ¶
type TracerProvider interface {
trace.TracerProvider
ForceFlush(context.Context) error
}
TracerProvider is a simple alias for trace.TracerProvider.
func EnsureTracerProvider ¶
func EnsureTracerProvider(tracerProvider TracerProvider) TracerProvider
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cloudtrace provides common functions for attaching values to trace spans
|
Package cloudtrace provides common functions for attaching values to trace spans |
|
Package oteltrace provides common functions for attaching values to trace spans
|
Package oteltrace provides common functions for attaching values to trace spans |