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 Debug(msg string, projectRef string, metadata map[string]interface{})
- func Error(msg string, projectRef string, metadata map[string]interface{})
- func GetLogEntry(r *http.Request) *logEntry
- func GetLogEntryFromContext(ctx context.Context) *logEntry
- func Info(msg string, projectRef string, metadata map[string]interface{})
- func Log(entry 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 NewLogEntry(le *logrus.Entry) chimiddleware.LogEntry
- 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 SetLogEntryWithContext(ctx context.Context, entry chimiddleware.LogEntry) context.Context
- func Tracer(name string, opts ...trace.TracerOption) trace.Tracer
- func WaitForCleanup(ctx context.Context)
- func Warn(msg string, projectRef string, metadata map[string]interface{})
- type CustomFormatter
- type LogEntry
- 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 GetLogEntryFromContext ¶
func LogEntrySetField ¶
func NewLogEntry ¶
func NewLogEntry(le *logrus.Entry) chimiddleware.LogEntry
NewLogEntry returns a new chimiddleware.LogEntry from a *logrus.Entry.
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 SetLogEntryWithContext ¶
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 LogEntry ¶
type LogEntry struct {
Timestamp string `json:"timestamp"`
Level string `json:"level"`
Service string `json:"service"`
ProjectRef string `json:"project_ref,omitempty"`
RequestID string `json:"request_id,omitempty"`
Message string `json:"message"`
DurationMs int64 `json:"duration_ms,omitempty"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
StatusCode int `json:"status_code,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
LogEntry represents a structured log entry
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.