receiver

package
v0.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultAddr        = "127.0.0.1:4318"
	DefaultMaxBody     = 8 << 20
	DefaultMaxInFlight = 16
)

Variables

View Source
var ErrFull = errors.New("buffer full")

ErrFull is wrapped by a sink to signal backpressure.

Functions

func CheckAddr

func CheckAddr(addr string, unsafeBind bool) (host string, err error)

CheckAddr lets callers such as service install reject a bad bind before serve ever runs.

Types

type LogsSink

type LogsSink func(ctx context.Context, ld plog.Logs) (rejected int64, msg string, err error)

LogsSink stores a decoded batch and reports how many records it rejected.

type Options

type Options struct {
	Addr        string
	UnsafeBind  bool
	MaxBody     int64
	MaxInFlight int
	Token       string
	Logger      *slog.Logger
}

type Server

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

func New

func New(opts Options, sinks Sinks) (*Server, error)

New validates the bind address and binds the listener, so a bad address fails before serving.

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve blocks until ctx is done, then shuts down gracefully.

func (*Server) Stats

func (s *Server) Stats() Stats

type Sinks

type Sinks struct {
	Logs   LogsSink
	Traces TracesSink
}

Sinks holds one sink per signal; a nil sink makes that signal's route return 404.

type Stats

type Stats struct {
	Requests        int64
	RecordsAccepted int64
	RecordsRejected int64
	SpansAccepted   int64
	SpansRejected   int64
	Responses429    int64
	MetricsDropped  int64
	Unauthorized    int64
}

type TracesSink

type TracesSink func(ctx context.Context, td ptrace.Traces) (rejected int64, msg string, err error)

TracesSink stores a decoded batch and reports how many spans it rejected.

Jump to

Keyboard shortcuts

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