components

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchSize

func BatchSize(size int) func(*BatchClientConfig)

func EnqueueTimeout

func EnqueueTimeout(timeout time.Duration) func(*BatchClientConfig)

func FlushInterval

func FlushInterval(interval time.Duration) func(*BatchClientConfig)

Types

type APIClient

type APIClient interface {
	IngestLogs(ctx context.Context, entries []Entry) error
}

type APIClientImpl

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

func NewAPIClient

func NewAPIClient(cfg Config) (*APIClientImpl, error)

func (*APIClientImpl) IngestLogs

func (a *APIClientImpl) IngestLogs(ctx context.Context, entries []Entry) error

type BatchClient

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

func NewBatchClient

func NewBatchClient(client APIClient, opts ...func(*BatchClientConfig)) *BatchClient

func (*BatchClient) IngestLogs

func (b *BatchClient) IngestLogs(ctx context.Context, entries []Entry) error

func (*BatchClient) Run

func (b *BatchClient) Run(ctx context.Context) error

type BatchClientConfig

type BatchClientConfig struct {
	EnqueueTimeout time.Duration
	FlushInterval  time.Duration
	BatchSize      int
}

type Config

type Config struct {
	APIBaseURL          string
	APIKey              string
	ClusterID           string
	Component           string
	Version             string
	TLSCert             string
	MaxRetries          int // Number of retries on failure (-1 = no retries)
	MaxRetryBackoffWait time.Duration
}

type Entry

type Entry struct {
	Level   string            `json:"level"`
	Message string            `json:"message"`
	Time    time.Time         `json:"time"`
	Fields  map[string]string `json:"fields"`
}

type IngestLogsRequest

type IngestLogsRequest struct {
	Version string  `json:"version"`
	Entries []Entry `json:"entries"`
}

type LogLevel

type LogLevel string
const (
	LogLevelDebug   LogLevel = "LOG_LEVEL_DEBUG"
	LogLevelInfo    LogLevel = "LOG_LEVEL_INFO"
	LogLevelWarning LogLevel = "LOG_LEVEL_WARNING"
	LogLevelError   LogLevel = "LOG_LEVEL_ERROR"
	LogLevelUnknown LogLevel = "LOG_LEVEL_UNKNOWN"
)

Jump to

Keyboard shortcuts

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