sampler

package
v0.0.0-...-183aff7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PreHook

type PreHook struct {
	sampler.Sampler
}

PreHook is a types.PreHook implementation which samples the log entries. This is supposed to be used for performance reasons in high performance applications.

Setup example:

import (
	"github.com/facebookincubator/go-belt/pkg/sampler"
	samplerhook "github.com/facebookincubator/go-belt/tool/logger/hooks/sampler"
	"github.com/facebookincubator/go-belt/tool/logger/implementation/zap"
)

func main() {
	...
	ctx = logger.CtxWithLogger(ctx, zap.Default().WithPreHooks(
		samplerhook.NewPreHook(sampler.RandomSampler(0.1)),
	))
	...
}

func NewPreHook

func NewPreHook(sampler sampler.Sampler) *PreHook

NewPreHook returns a new instance of PreHook

func (*PreHook) ProcessInput

func (hook *PreHook) ProcessInput(traceIDs belt.TraceIDs, _ loggertypes.Level, _ ...any) loggertypes.PreHookResult

ProcessInput implements types.PreHook.

func (*PreHook) ProcessInputFields

func (hook *PreHook) ProcessInputFields(traceIDs belt.TraceIDs, _ loggertypes.Level, _ string, _ field.AbstractFields) loggertypes.PreHookResult

ProcessInputFields implements types.PreHook.

func (*PreHook) ProcessInputf

func (hook *PreHook) ProcessInputf(traceIDs belt.TraceIDs, _ loggertypes.Level, _ string, _ ...any) loggertypes.PreHookResult

ProcessInputf implements types.PreHook.

Jump to

Keyboard shortcuts

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