types

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: 8 Imported by: 21

Documentation

Overview

Package types defines the main Graphite types we use internally.

The definitions correspond to the types of responses to the /render, /info, and /metrics/find handlers in graphite-web and go-carbon.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMetricsNotFound = ErrNotFound("No metrics returned")
	ErrMatchesNotFound = ErrNotFound("No matches found")
	ErrInfoNotFound    = ErrNotFound("No information found")
)

Functions

func AreFloatsApproximatelyEqual added in v0.3.0

func AreFloatsApproximatelyEqual(a, b float64) bool

func MergeMetrics

func MergeMetrics(metrics [][]Metric, replicaMismatchConfig cfg.RenderReplicaMismatchConfig, logger *zap.Logger) ([]Metric, MetricRenderStats)

MergeMetrics merges metrics by name. It returns merged metrics, number of rendered data points for the returned metrics, and number of mismatched data points seen (if mismatchCheck is true).

func MetricsEqual

func MetricsEqual(a, b Metric) bool

Types

type ErrNotFound

type ErrNotFound string

ErrNotFound signals the HTTP not found error

func (ErrNotFound) Error

func (err ErrNotFound) Error() string

Error makes ErrNotFound compliant with the error interface

type FindRequest

type FindRequest struct {
	Query string
	Trace
}

func NewFindRequest

func NewFindRequest(query string) FindRequest

type Info

type Info struct {
	Host              string
	Name              string
	AggregationMethod string
	MaxRetention      int32
	XFilesFactor      float32
	Retentions        []Retention
}

Info contains metadata about a metric in Graphite.

func MergeInfos

func MergeInfos(infos [][]Info) []Info

MergeInfos merges Info structures.

type InfoRequest

type InfoRequest struct {
	Target string
	Trace
}

func NewInfoRequest

func NewInfoRequest(target string) InfoRequest

type Match

type Match struct {
	Path   string
	IsLeaf bool
}

Match describes a single glob match

type Matches

type Matches struct {
	Name    string
	Matches []Match
}

Matches describes a glob match from a Graphite store.

func MergeMatches

func MergeMatches(matches []Matches) Matches

MergeMatches merges Match structures.

type Metric

type Metric struct {
	Name      string
	StartTime int32
	StopTime  int32
	StepTime  int32
	Values    []float64
	IsAbsent  []bool
}

Metric represents a part of a time series.

type MetricRenderStats added in v0.3.0

type MetricRenderStats struct {
	DataPointCount     int
	MismatchCount      int
	FixedMismatchCount int
}

MetricRenderStats represents the stats of rendering and merging metrics.

type RenderRequest

type RenderRequest struct {
	Targets []string
	From    int32
	Until   int32
	Trace
}

func NewRenderRequest

func NewRenderRequest(targets []string, from int32, until int32) RenderRequest

type Retention

type Retention struct {
	SecondsPerPoint int32
	NumberOfPoints  int32
}

Retention is the Graphite retention schema for a metric archive.

type Trace

type Trace struct {
	OutDuration *prometheus.HistogramVec
	// contains filtered or unexported fields
}

func NewTrace

func NewTrace() Trace

func (Trace) AddHTTPCall

func (t Trace) AddHTTPCall(start time.Time)

func (Trace) AddLimiter

func (t Trace) AddLimiter(start time.Time)

func (Trace) AddMarshal

func (t Trace) AddMarshal(start time.Time)

func (Trace) AddReadBody

func (t Trace) AddReadBody(start time.Time)

func (Trace) AddUnmarshal

func (t Trace) AddUnmarshal(start time.Time)

func (Trace) IncCall

func (t Trace) IncCall()

func (Trace) ObserveOutDuration added in v0.2.0

func (t Trace) ObserveOutDuration(ti time.Duration, dc string, cluster string)

func (Trace) Report

func (t Trace) Report() []int64

Directories

Path Synopsis
encoding
carbonapi_v2
Package carbonapi_v2 defines encoding and decoding methods for Find, Info and Render responses.
Package carbonapi_v2 defines encoding and decoding methods for Find, Info and Render responses.
json
Package json defines encoding and decoding methods for Find, Info and Render responses.
Package json defines encoding and decoding methods for Find, Info and Render responses.
pickle
Package pickle defines encoding methods for Find and Render responses.
Package pickle defines encoding methods for Find and Render responses.

Jump to

Keyboard shortcuts

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