Documentation ¶
Index ¶
- Constants
- func AddRequestID(globalConfig *conf.GlobalConfiguration) func(next http.Handler) http.Handler
- func ConfigureLogging(config *conf.LoggingConfig) error
- func ConfigureMetrics(ctx context.Context, mc *conf.MetricsConfig) error
- func ConfigureProfiler(ctx context.Context, pc *conf.ProfilerConfig) error
- func ConfigureTracing(ctx context.Context, tc *conf.TracingConfig) error
- func GetLogEntry(r *http.Request) *logEntry
- func LogEntrySetField(r *http.Request, key string, value interface{})
- func LogEntrySetFields(r *http.Request, fields logrus.Fields)
- func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter
- func NewStructuredLogger(logger *logrus.Logger, config *conf.GlobalConfiguration) func(next http.Handler) http.Handler
- func ObtainMetricCounter(name, desc string) metric.Int64Counter
- func RequestTracing() func(http.Handler) http.Handler
- func Tracer(name string, opts ...trace.TracerOption) trace.Tracer
- func WaitForCleanup(ctx context.Context)
- type CustomFormatter
- type ProfilerHandler
Constants ¶
View Source
const ( LOG_SQL_ALL = "all" LOG_SQL_NONE = "none" LOG_SQL_STATEMENT = "statement" )
Variables ¶
This section is empty.
Functions ¶
func AddRequestID ¶
func ConfigureLogging ¶
func ConfigureLogging(config *conf.LoggingConfig) error
func ConfigureMetrics ¶
func ConfigureMetrics(ctx context.Context, mc *conf.MetricsConfig) error
func ConfigureProfiler ¶
func ConfigureProfiler(ctx context.Context, pc *conf.ProfilerConfig) error
func ConfigureTracing ¶
func ConfigureTracing(ctx context.Context, tc *conf.TracingConfig) error
ConfigureTracing sets up global tracing configuration for OpenTracing / OpenTelemetry. The context should be the global context. Cancelling this context will cancel tracing collection.
func GetLogEntry ¶
func LogEntrySetField ¶
func NewStructuredLogger ¶
func ObtainMetricCounter ¶
func ObtainMetricCounter(name, desc string) metric.Int64Counter
func RequestTracing ¶
RequestTracing returns an HTTP handler that traces all HTTP requests coming in. Supports Chi routers, so this should be one of the first middlewares on the router.
func WaitForCleanup ¶
WaitForCleanup waits until all observability long-running goroutines shut down cleanly or until the provided context signals done.
Types ¶
type CustomFormatter ¶
type CustomFormatter struct {
logrus.JSONFormatter
}
func NewCustomFormatter ¶
func NewCustomFormatter() *CustomFormatter
type ProfilerHandler ¶
type ProfilerHandler struct{}
func (*ProfilerHandler) ServeHTTP ¶
func (p *ProfilerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.