backend

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-2-Clause Imports: 4 Imported by: 2

Documentation

Overview

Package backend defines an interface and RPC methods for communication with Graphite backends.

Example use:

var b Backend
metrics, err := Render(ctx, b, from, until, targets)

The package will transparently handle concurrent requests to multiple backends:

var bs []Backend
metrics, err := Renders(ctx, bs, from, until, targets)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Finds

func Finds(ctx context.Context, backends []Backend, request types.FindRequest) (types.Matches, []error)

Finds makes Find calls to multiple backends.

func Infos

func Infos(ctx context.Context, backends []Backend, request types.InfoRequest) ([]types.Info, []error)

Infos makes Info calls to multiple backends.

func Renders

func Renders(
	ctx context.Context,
	backends []Backend,
	request types.RenderRequest,
	replicaMismatchConfig cfg.RenderReplicaMismatchConfig,
	logger *zap.Logger) ([]types.Metric, types.MetricRenderStats, []error)

Renders makes Render calls to multiple backends. replicaMatchMode indicates how data points of the metrics fetched from replicas will be checked and applied on the final metrics. replicaMismatchReportLimit limits the number of mismatched metrics reported in log for each render request.

Types

type Backend

type Backend interface {
	Find(context.Context, types.FindRequest) (types.Matches, error)
	Info(context.Context, types.InfoRequest) ([]types.Info, error)
	Render(context.Context, types.RenderRequest) ([]types.Metric, error)

	Contains([]string) bool // Reports whether a backend contains any of the given targets.
	Logger() *zap.Logger    // A logger used to communicate non-fatal warnings.
	GetServerAddress() string
}

Backend codifies the RPC calls a Graphite backend responds to.

func Filter

func Filter(backends []Backend, targets []string) []Backend

Filter filters the given backends by whether they Contain() the given targets.

Directories

Path Synopsis
Package mock defines a mock backend for testing.
Package mock defines a mock backend for testing.
Package net implements a backend that communicates over a network.
Package net implements a backend that communicates over a network.

Jump to

Keyboard shortcuts

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