Documentation ¶
Index ¶
- func MakeHTTPClient() *http.Client
- func Wrap0(ctx context.Context, t Tracer, spanName string, requireParentSpan bool, ...) error
- func Wrap1[T1 any](ctx context.Context, t Tracer, spanName string, requireParentSpan bool, ...) (T1, error)
- func Wrap2[T1 any, T2 any](ctx context.Context, t Tracer, spanName string, requireParentSpan bool, ...) (T1, T2, error)
- func Wrap3[T1 any, T2 any, T3 any](ctx context.Context, t Tracer, spanName string, requireParentSpan bool, ...) (T1, T2, T3, error)
- type Attribute
- type Span
- func (s Span) End()
- func (s Span) IsRecording() bool
- func (s Span) RecordError(err error)
- func (s Span) SetBoolAttribute(key Attribute, value bool)
- func (s Span) SetBoolSliceAttribute(key Attribute, value []bool)
- func (s Span) SetFloat64Attribute(key Attribute, value float64)
- func (s Span) SetFloat64SliceAttribute(key Attribute, value []float64)
- func (s Span) SetInt64Attribute(key Attribute, value int64)
- func (s Span) SetInt64SliceAttribute(key Attribute, value []int64)
- func (s Span) SetIntAttribute(key Attribute, value int)
- func (s Span) SetIntSliceAttribute(key Attribute, value []int)
- func (s Span) SetStringAttribute(key Attribute, value string)
- func (s Span) SetStringSliceAttribute(key Attribute, value []string)
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeHTTPClient ¶
MakeHTTPClient creates an HTTP client that will record spans for outgoing HTTP requests.
func Wrap0 ¶
func Wrap0(ctx context.Context, t Tracer, spanName string, requireParentSpan bool, f func(context.Context) error) error
Wrap0 takes a function that returns 0 values + potentially an error, and wraps its execution in a span. This is useful for capturing any returned errors and recording them in the span, since you'd otherwise need to find all the potential error return paths in your function and ensure you're recording those. (If you want to trace a function that doesn't return an error, just call tracer.Start() directly.)
func Wrap1 ¶
func Wrap1[T1 any](ctx context.Context, t Tracer, spanName string, requireParentSpan bool, f func(context.Context) (T1, error)) (T1, error)
Wrap1 wraps a function execution in a span. See comments above.
Types ¶
type Attribute ¶
type Attribute string
Attribute is an enum of UserClouds-specific properties that we want to attach to traces.
const ( // AttributeCompanyID captures the UUID of the company owning a tenant AttributeCompanyID Attribute = "uc.company_id" // AttributeCompanyName captures the name of the company owning a tenant AttributeCompanyName Attribute = "uc.company_name" // AttributeTenantID captures the UUID of the tenant AttributeTenantID Attribute = "uc.tenant_id" // AttributeTenantName captures the name of the tenant AttributeTenantName Attribute = "uc.tenant_name" // AttributeTenantURL captures the URL of the tenant AttributeTenantURL Attribute = "uc.tenant_url" // AttributeHandlerName captures the name of the handler that is processing // the request AttributeHandlerName Attribute = "uc.handler_name" // AttributeSdkVersion captures the version of the UC SDK that sent the request AttributeSdkVersion Attribute = "uc.sdk_version" // AttributeUserFriendlyError captures the user-friendly error message in the event of a Friendlyf error AttributeUserFriendlyError Attribute = "uc.user_friendly_error" )
type Span ¶
type Span struct { }
Span is the individual component of a trace.
func GetCurrentSpan ¶
GetCurrentSpan returns the current Span from the given context.
func (Span) IsRecording ¶
IsRecording returns the recording state of the Span. It will return true if the Span is active and events can be recorded.
func (Span) RecordError ¶
RecordError sets the span status to "error" and records an error event capturing the error message.
func (Span) SetBoolAttribute ¶
SetBoolAttribute sets the given bool attribute on the span.
func (Span) SetBoolSliceAttribute ¶
SetBoolSliceAttribute sets the given bool slice attribute on the span.
func (Span) SetFloat64Attribute ¶
SetFloat64Attribute sets the given float64 attribute on the span.
func (Span) SetFloat64SliceAttribute ¶
SetFloat64SliceAttribute sets the given float64 slice attribute on the span.
func (Span) SetInt64Attribute ¶
SetInt64Attribute sets the given int64 attribute on the span.
func (Span) SetInt64SliceAttribute ¶
SetInt64SliceAttribute sets the given int64 slice attribute on the span.
func (Span) SetIntAttribute ¶
SetIntAttribute sets the given int attribute on the span.
func (Span) SetIntSliceAttribute ¶
SetIntSliceAttribute sets the given int slice attribute on the span.
func (Span) SetStringAttribute ¶
SetStringAttribute sets the given string attribute on the span.
func (Span) SetStringSliceAttribute ¶
SetStringSliceAttribute sets the given string slice attribute on the span.