Documentation
¶
Index ¶
- Constants
- func CaptureError(ctx context.Context, err error)
- func Fatal(ctx context.Context, err error)
- func Middleware(name string) func(http.Handler) http.Handler
- func Open(driver, dsn string) (*sqlx.DB, error)
- func Start(ctx context.Context, name string) (context.Context, trace.Span)
- func StartAuto(ctx context.Context, symbol any) (context.Context, trace.Span)
- func StartRequest(r *http.Request, name string) (*http.Request, trace.Span)
- type Monitor
Constants ¶
const Name = "internal/telemetry"
Name is the instrumentation scope name for telemetry.
Variables ¶
This section is empty.
Functions ¶
func CaptureError ¶
CaptureError logs an error that occured in a request.
func Middleware ¶
Middleware returns a middleware that instruments requests with telemetry.
func Open ¶
Open creates a new instrumented *sqlx.DB without pinging. It wraps otelsql.Open and sqlx.NewDb for full compatibility.
func Start ¶
Start is a wrapper to tracer.Start and expvar.NewInt.
Calling the function adds a span to the current context. The name should be a symbol reference for the caller. For best results, combine the package, symbol and function into a name like `user.service.Login`.
func StartAuto ¶
StartAuto tries to fill the span name from the symbol.
It's intended to pass a function, or a type. The package name, type name, and function name are combined with `.` to delimit them. See tests under pkg/reflect for more information.
StartAuto uses reflection and may not work correctly under various conditions. If performance or build restrictions are impacting use, use `Start`.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor adds expvar instrumentation over the telemetry API.
func NewMonitor ¶
func NewMonitor() *Monitor
NewMonitor creates a new Monitor for telemetry tracking.
func (*Monitor) SetEnabled ¶
SetEnabled enables or disables telemetry monitoring.