Documentation
¶
Index ¶
- Variables
- func CompactionFNV128a(input string) string
- func CompactionFNV32a(input string) string
- func CompactionFNV64a(input string) string
- func MatchAll() func(context.Context, *slog.Record) string
- func MatchByAttribute(groups []string, key string) func(context.Context, *slog.Record) string
- func MatchByContextValue(key any) func(context.Context, *slog.Record) string
- func MatchByLevel() func(context.Context, *slog.Record) string
- func MatchByLevelAndMessage() func(context.Context, *slog.Record) string
- func MatchByMessage() func(context.Context, *slog.Record) string
- func MatchBySource() func(context.Context, *slog.Record) string
- type AbsoluteSamplingOption
- type CustomSamplingOption
- type Matcher
- type ThresholdSamplingOption
- type UniformSamplingOption
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultMatcher = MatchByLevelAndMessage()
Functions ¶
func CompactionFNV128a ¶ added in v1.3.0
func CompactionFNV32a ¶ added in v1.3.0
func CompactionFNV64a ¶ added in v1.3.0
func MatchByAttribute ¶ added in v1.1.0
func MatchByContextValue ¶ added in v1.1.0
func MatchByLevelAndMessage ¶ added in v1.1.0
func MatchByMessage ¶ added in v1.1.0
Types ¶
type AbsoluteSamplingOption ¶ added in v1.2.0
type AbsoluteSamplingOption struct {
// This will log all entries with the same hash until max is reached,
// in a `Tick` interval as-is. Following that, it will reduce log throughput
// depending on previous interval.
Tick time.Duration
Max uint64
// Group similar logs (default: by level and message)
Matcher Matcher
Buffer func(generator func(string) any) buffer.Buffer[string]
// Optional hooks
OnAccepted func(context.Context, slog.Record)
OnDropped func(context.Context, slog.Record)
// contains filtered or unexported fields
}
func (AbsoluteSamplingOption) NewMiddleware ¶ added in v1.2.0
func (o AbsoluteSamplingOption) NewMiddleware() slogmulti.Middleware
NewMiddleware returns a slog-multi middleware.
type CustomSamplingOption ¶ added in v0.2.0
type CustomSamplingOption struct {
// The sample rate for sampling traces in the range [0.0, 1.0].
Sampler func(context.Context, slog.Record) float64
// Optional hooks
OnAccepted func(context.Context, slog.Record)
OnDropped func(context.Context, slog.Record)
}
func (CustomSamplingOption) NewMiddleware ¶ added in v0.2.0
func (o CustomSamplingOption) NewMiddleware() slogmulti.Middleware
NewMiddleware returns a slog-multi middleware.
type Matcher ¶ added in v1.1.0
Matcher is a function that returns a string hash for a given record. Returning []byte would have been much much better, but go's hashmap doesn't support it. 🤬
type ThresholdSamplingOption ¶ added in v0.2.0
type ThresholdSamplingOption struct {
// This will log the first `Threshold` log entries with the same hash,
// in a `Tick` interval as-is. Following that, it will allow `Rate` in the range [0.0, 1.0].
Tick time.Duration
Threshold uint64
Rate float64
// Group similar logs (default: by level and message)
Matcher Matcher
Buffer func(generator func(string) any) buffer.Buffer[string]
// Optional hooks
OnAccepted func(context.Context, slog.Record)
OnDropped func(context.Context, slog.Record)
// contains filtered or unexported fields
}
func (ThresholdSamplingOption) NewMiddleware ¶ added in v0.2.0
func (o ThresholdSamplingOption) NewMiddleware() slogmulti.Middleware
NewMiddleware returns a slog-multi middleware.
type UniformSamplingOption ¶ added in v0.2.0
type UniformSamplingOption struct {
// The sample rate for sampling traces in the range [0.0, 1.0].
Rate float64
// Optional hooks
OnAccepted func(context.Context, slog.Record)
OnDropped func(context.Context, slog.Record)
}
func (UniformSamplingOption) NewMiddleware ¶ added in v0.2.0
func (o UniformSamplingOption) NewMiddleware() slogmulti.Middleware
NewMiddleware returns a slog-multi middleware.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.