forwarder

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forwarder

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

Forwarder fans out OTLP payloads to one or more upstream HTTP endpoints.

func New

func New(urls []string, sample float64) *Forwarder

New returns a Forwarder that will POST to each of the given base URLs. urls should be bare base URLs, e.g. "http://tempo:4318". sample is the per-payload forwarding probability in [0, 1]; values outside the range are clamped (NaN → 1.0).

func (*Forwarder) Forward

func (f *Forwarder) Forward(path, contentType string, body []byte)

Forward asynchronously POSTs body to each upstream at <base>/path. It is non-blocking: each upstream gets its own goroutine. Per-upstream sampling is applied: a draw >= sample increments Skipped and skips the send.

func (*Forwarder) Status

func (f *Forwarder) Status() []Status

Status returns a snapshot of each upstream's counters.

type Status

type Status struct {
	URL     string `json:"url"`
	Sent    int64  `json:"sent"`
	Errors  int64  `json:"errors"`
	Skipped int64  `json:"skipped"`
	LastErr string `json:"last_error,omitempty"`
}

Status is the serialisable snapshot of one upstream's counters.

Jump to

Keyboard shortcuts

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