upstream

package
v0.6.104 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package upstream forwards the exception records an installation accepted to a configured OTLP/HTTP logs endpoint: typically a service of the installation, reached over the mesh's mutual TLS, that passes them on to the vendor (where errors group across installations by tenant.id). Records leave as they came (resource, scope and log record unchanged), through a bounded queue that never blocks local ingestion; what cannot be delivered is dropped and counted.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrURL     = errors.New("errors.upstream.url: want an absolute http(s) URL")
	ErrMeshURL = errors.New("errors.upstream.url: want https with errors.upstream.service (mutual TLS)")
)

Errors of Validate.

Functions

This section is empty.

Types

type Forwarder

type Forwarder struct {
	deps.Component
	// contains filtered or unexported fields
}

Forwarder sends accepted records to the upstream.

func New

func New(parent deps.Scope, settings Settings, opts ...Option) *Forwarder

New creates the forwarder of settings under parent; settings.URL must be set (an installation without one assembles None).

func (*Forwarder) Offer

func (f *Forwarder) Offer(ctx context.Context, records ...Record)

Offer queues accepted records without blocking: when the switch is off or the queue is full they are dropped and counted.

type None

type None struct{}

None forwards nothing: the installation has no upstream.

func (None) Offer

func (None) Offer(context.Context, ...Record)

Offer drops the records.

type Option

type Option func(*Forwarder)

Option configures New.

func WithTransport

func WithTransport(rt http.RoundTripper) Option

WithTransport sets the transport: the mesh's mutual TLS when settings.Service names the receiver; http.DefaultTransport otherwise.

type Record

type Record struct {
	Resource          *resourcepb.Resource
	ResourceSchemaURL string
	Scope             *commonpb.InstrumentationScope
	ScopeSchemaURL    string
	Log               *logspb.LogRecord
}

Record is one accepted exception record with where it came from: the messages as received, never modified.

type Settings

type Settings struct {
	// URL is the receiver's OTLP/HTTP logs endpoint
	// (https://core.service.consul:8443/v1/logs). Empty: nothing is
	// forwarded and no forwarder runs (an air-gapped installation leaves it
	// empty).
	URL string `json:"url,omitempty"`
	// Service is the receiver's mesh identity: set, the request goes over
	// mutual TLS (this installation's certificate, the server verified as
	// that service) and never through the environment's proxy; empty, a
	// plain HTTP(S) request.
	Service string `json:"service,omitempty"`
	// Enabled is the operator's switch, live from the console: off drops
	// the queue and forwards nothing until switched on again.
	Enabled config.Live[bool] `json:"enabled" schemapb:"default=true"`
	// Queue bounds the records waiting to be sent; past it new ones are
	// dropped and counted.
	Queue int `json:"queue" schemapb:"default=10000;gt=0"`
	// Batch is the most records one request carries.
	Batch int `json:"batch" schemapb:"default=512;gt=0"`
	// Flush is how long a record waits for a fuller batch.
	Flush time.Duration `json:"flush" schemapb:"default=5s;gt=0"`
	// Timeout bounds one request.
	Timeout time.Duration `json:"timeout" schemapb:"default=10s;gt=0"`
	// GiveUp is how long a batch is retried (network failures, 408, 429,
	// 5xx; Retry-After is honored) before it is dropped.
	GiveUp time.Duration `json:"give_up" schemapb:"default=15m;gt=0"`
}

Settings of the forwarding: BACKPLANE_ERRORS_UPSTREAM_*.

func (*Settings) Validate

func (s *Settings) Validate() error

Validate checks what the schema cannot.

Jump to

Keyboard shortcuts

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