backend

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package backend implements the backend TSDB server of load balancer app

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTypeAssertion = errors.New("failed type assertion")
)

Custom errors.

Functions

func PromResponseModifier

func PromResponseModifier(labelsToFilter []string) func(r *http.Response) error

PromResponseModifier modifies the TSDB response before sending to client.

Types

type Backend

type Backend struct {
	ID    string          `yaml:"id"`
	TSDBs []*ServerConfig `yaml:"tsdb"`
	Pyros []*ServerConfig `yaml:"pyroscope"`
}

Backend defines backend server.

type Server

type Server interface {
	SetAlive(alive bool)
	IsAlive() bool
	URL() *url.URL
	String() string
	ActiveConnections() int
	RetentionPeriod() time.Duration
	ReverseProxy() *httputil.ReverseProxy
	Serve(w http.ResponseWriter, r *http.Request)
}

Server is the interface each backend server (TSDB/Pyroscope) needs to implement.

func New

func New(t base.LBType, c *ServerConfig, logger *slog.Logger) (Server, error)

New returns a backend server of type `t`.

func NewPyroscope

func NewPyroscope(c *ServerConfig, logger *slog.Logger) (Server, error)

NewPyroscope returns an instance of backend Pyroscope server.

func NewTSDB

func NewTSDB(c *ServerConfig, logger *slog.Logger) (Server, error)

NewTSDB returns an instance of backend TSDB server.

type ServerConfig

type ServerConfig struct {
	Web          *models.WebConfig `yaml:"web"`
	FilterLabels []string          `yaml:"filter_labels"`
}

ServerConfig contains the configuration of backend server.

Jump to

Keyboard shortcuts

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