observability

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

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 AddRequestID(globalConfig *conf.GlobalConfiguration) func(next http.Handler) http.Handler

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 GetLogEntry(r *http.Request) *logEntry

func LogEntrySetField

func LogEntrySetField(r *http.Request, key string, value interface{})

func LogEntrySetFields

func LogEntrySetFields(r *http.Request, fields logrus.Fields)

func Meter

func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter

func NewStructuredLogger

func NewStructuredLogger(
	logger *logrus.Logger,
	config *conf.GlobalConfiguration,
) func(next http.Handler) http.Handler

func ObtainMetricCounter

func ObtainMetricCounter(name, desc string) metric.Int64Counter

func RequestTracing

func RequestTracing() func(http.Handler) http.Handler

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 Tracer

func Tracer(name string, opts ...trace.TracerOption) trace.Tracer

func WaitForCleanup

func WaitForCleanup(ctx context.Context)

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

func (*CustomFormatter) Format

func (f *CustomFormatter) Format(entry *logrus.Entry) ([]byte, error)

type ProfilerHandler

type ProfilerHandler struct{}

func (*ProfilerHandler) ServeHTTP

func (p *ProfilerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL