loki

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GTagMiddleware added in v0.6.0

func GTagMiddleware(loki *Loki) gtaghttp.Middleware

func MPv2MessageHandler added in v0.4.0

func MPv2MessageHandler(loki *Loki) message.NoPublishHandlerFunc

func MPv2Middleware added in v0.6.0

func MPv2Middleware(loki *Loki) mpv2http.Middleware

Types

type Line

type Line struct {
	Name               sesamy.EventName  `json:"name"`
	Params             any               `json:"params,omitempty"`
	ClientID           string            `json:"client_id,omitempty"`
	UserID             string            `json:"user_id,omitempty"`
	UserProperties     map[string]any    `json:"user_properties,omitempty"`
	Consent            *mpv2.ConsentData `json:"consent,omitempty"`
	UserData           *mpv2.UserData    `json:"user_data,omitempty"`
	DebugMode          bool              `json:"debug_mode,omitempty"`
	SessionID          string            `json:"session_id,omitempty"`
	EngagementTimeMSec int64             `json:"engagement_time_msec,omitempty"`
}

func (*Line) Marshal

func (l *Line) Marshal() ([]byte, error)

type Loki

type Loki struct {
	// contains filtered or unexported fields
}

func New

func New(l *zap.Logger, addr string, opts ...Option) *Loki

New creates an instance of `Push` which writes logs directly to given `lokiAddr`

func (*Loki) Start

func (l *Loki) Start(ctx context.Context)

Start pulls lines out of the channel and sends them to Loki

func (*Loki) Stop

func (l *Loki) Stop()

Stop will cancel any ongoing requests and stop the goroutine listening for requests

func (*Loki) Write

func (l *Loki) Write(payload mpv2.Payload[any])

type Option

type Option func(*Loki)

func WithBackoffConfig

func WithBackoffConfig(v *backoff.Config) Option

func WithBatchSize

func WithBatchSize(v int) Option

func WithBufferSize

func WithBufferSize(v int) Option

func WithHTTPClient

func WithHTTPClient(v *http.Client) Option

func WithUserAgent

func WithUserAgent(v string) Option

type Service added in v0.4.0

type Service struct {
	// contains filtered or unexported fields
}

func NewService added in v0.4.0

func NewService(loki *Loki) *Service

func (*Service) Close added in v0.4.0

func (s *Service) Close(ctx context.Context) error

Close will cancel any ongoing requests and stop the goroutine listening for requests

func (*Service) Name added in v0.4.0

func (s *Service) Name() string

func (*Service) Start added in v0.4.0

func (s *Service) Start(ctx context.Context) error

Start pulls lines out of the channel and sends them to Loki

Jump to

Keyboard shortcuts

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