gosnowth

package module
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: BSD-3-Clause Imports: 32 Imported by: 2

README

gosnowth

Go Reference

An IRONdb API client package for Go programs

This codebase contains client code for accessing IRONdb API's. IRONdb is deployed as a cluster of database nodes which can be queried directly through an exposed HTTP API. For reference, see the the IRONdb API Documentation.

Each of the documented interfaces are implemented as methods of the SnowthClient structure defined in this repository. Documentation for this package is available through the go doc tool using the following command:

go doc github.com/circonus-labs/gosnowth

Testing

The following command will run the unit tests for this package:

go test -cover github.com/circonus-labs/gosnowth

Using

Examples of using this package are provided in the in the /examples directory which shows how to instantiate a new SnowthClient value, as well as how to use the SnowthClient to perform operations on IRONdb nodes.

To run the examples use the following command:

go run github.com/circonus-labs/gosnowth/examples <host:port> ...

Where <host:port> ... is a list of one or more space separated IRONdb nodes.

Other IRONdb Clients

Here is a comparison of functionality between gosnowth and some other IRONdb client libraries.

Documentation

Overview

Package gosnowth contains an IRONdb client library written in Go.

Examples can be found at github.com/circonus-labs/gosnowth/tree/master/examples

Index

Constants

View Source
const Df4FlatbufferAccept = "x-irondb-df4-flatbuffer"

Df4FlatbufferAccept is the accept header for flatbuffer df4 data.

View Source
const FetchFlatbufferContentType = "x-irondb-fetch-flatbuffer"

FetchFlatbufferContentType is the content type header for flatbuffer fetch data.

View Source
const MetriclistFlatbufferContentType = "application/x-circonus-metric-list-flatbuffer"

MetriclistFlatbufferContentType is the content type header for flatbuffer raw data.

Variables

This section is empty.

Functions

func ConvertSeriesSelector added in v1.13.7

func ConvertSeriesSelector(selector string) (string, error)

ConvertSeriesSelector will convert a PromQL series selector into an IRONdb tag query.

Types

type CAQLError

type CAQLError struct {
	Locals    []string               `json:"locals"`
	Method    string                 `json:"method"`
	Trace     []string               `json:"trace"`
	UserError map[string]interface{} `json:"user_error"`
	Status    string                 `json:"status"`
	Arguments map[string]interface{} `json:"arguments"`
	Success   bool                   `json:"success"`
}

CAQLError values contain information about an error returned by the CAQL extension.

func (*CAQLError) Error

func (ce *CAQLError) Error() string

Error returns this error as a JSON format string.

func (*CAQLError) Message

func (ce *CAQLError) Message() string

Message returns the user_error.message of a CAQL error, if it exists.

func (*CAQLError) String

func (ce *CAQLError) String() string

String returns this value as a JSON format string.

type CAQLQuery

type CAQLQuery struct {
	Explain              bool     `json:"explain"`
	IgnoreDurationLimits bool     `json:"ignore_duration_limits,omitempty"`
	Debug                byte     `json:"_debug,omitempty"`
	Period               int64    `json:"period,omitempty"`
	ID                   int64    `json:"_id,omitempty"`
	AccountID            int64    `json:"account_id,string,omitempty"`
	Start                int64    `json:"start_time,omitempty"`
	Timeout              int64    `json:"_timeout,omitempty"`
	MinPrefill           int64    `json:"min_prefill,omitempty"`
	End                  int64    `json:"end_time,omitempty"`
	Format               string   `json:"format,omitempty"`
	Query                string   `json:"q,omitempty"`
	PrepareResults       string   `json:"prepare_results,omitempty"`
	Method               string   `json:"method,omitempty"`
	Expansion            []string `json:"expansion,omitempty"`
}

CAQLQuery values represent CAQL queries and associated parameters.

type CheckTags

type CheckTags map[string][]string

CheckTags values contain check tag data from IRONdb.

type Config

type Config struct {
	DialTimeout    time.Duration `json:"dial_timeout,omitempty"`
	Timeout        time.Duration `json:"timeout,omitempty"`
	WatchInterval  time.Duration `json:"watch_interval,omitempty"`
	Retries        int64         `json:"retries,omitempty"`
	ConnectRetries int64         `json:"connect_retries,omitempty"`
	Servers        []string      `json:"servers,omitempty"`
	DenyHosts      []string      `json:"deny_hosts,omitempty"`
	CtxKeyTraceID  interface{}   `json:"-"`
}

Config values represent configuration information SnowthClient values.

func NewConfig

func NewConfig(servers ...string) *Config

NewConfig creates and initializes a new SnowthClient configuration value using default values.

type DF4Data

type DF4Data []interface{}

DF4Data values contain slices of data points of DF4 format time series data.

func (*DF4Data) Histogram

func (dd *DF4Data) Histogram() []*map[string]int64

Histogram retrieves the data in this value as a slice of map[string]int64 values.

func (*DF4Data) NullEmpty

func (d *DF4Data) NullEmpty()

NullEmpty sets values within a DF4Data value equal to an empty array to nil.

func (*DF4Data) Numeric

func (dd *DF4Data) Numeric() []*float64

Numeric retrieves the data in this value as a slice of float64 values.

func (*DF4Data) Text

func (dd *DF4Data) Text() []*string

Text retrieves the data in this value as a slice of string values.

type DF4Head

type DF4Head struct {
	Count   int64           `json:"count"`
	Start   int64           `json:"start"`
	Period  int64           `json:"period"`
	Error   []string        `json:"error,omitempty"`
	Warning []string        `json:"warning,omitempty"`
	Explain json.RawMessage `json:"explain,omitempty"`
}

DF4Head values contain information about the time range of the data elements in a DF4 time series data response.

func (*DF4Head) MarshalJSON

func (h *DF4Head) MarshalJSON() ([]byte, error)

MarshalJSON encodes a DF4Head value into a JSON format byte slice.

func (*DF4Head) UnmarshalJSON

func (h *DF4Head) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a DF4Head value from a JSON format byte slice.

type DF4Meta

type DF4Meta struct {
	Kind  string   `json:"kind"`
	Label string   `json:"label"`
	Tags  []string `json:"tags,omitempty"`
}

DF4Meta values contain information and metadata about the metrics in a DF4 time series data response.

type DF4Response

type DF4Response struct {
	Ver   string    `json:"version,omitempty"`
	Head  DF4Head   `json:"head"`
	Meta  []DF4Meta `json:"meta"`
	Data  []DF4Data `json:"data"`
	Query string    `json:"-"`
}

DF4Response values represent time series data in the DF4 format.

func (*DF4Response) Copy

func (dr *DF4Response) Copy() *DF4Response

Copy returns a deep copy of the base DF4 response.

type ExtParam

type ExtParam struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

ExtParam values contain parameter values to use when executing extensions.

type ExtensionParam

type ExtensionParam struct {
	Type        string      `json:"type"`
	Optional    bool        `json:"optional"`
	Default     interface{} `json:"default,omitempty"`
	Description string      `json:"description,omitempty"`
	AliasList   []string    `json:"alias_list,omitempty"`
	Name        string      `json:"name,omitempty"`
}

ExtensionParam values contain information about an extension parameter.

type Features

type Features struct {
	TextStore               bool `json:"text:store"`
	HistogramStore          bool `json:"histogram:store"`
	NNTSecondOrder          bool `json:"nnt:second_order"`
	HistogramDynamicRollups bool `json:"histogram:dynamic_rollups"`
	NNTStore                bool `json:"nnt:store"`
	FeatureFlags            bool `json:"features"`
}

Features values represent features supported by the node.

func (*Features) UnmarshalJSON

func (f *Features) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a features value from a JSON format byte slice.

type FetchQuery

type FetchQuery struct {
	Start   time.Time     `json:"start"`
	Period  time.Duration `json:"period"`
	Count   int64         `json:"count"`
	Streams []FetchStream `json:"streams"`
	Reduce  []FetchReduce `json:"reduce"`
}

FetchQuery values represent queries used to fetch IRONdb data.

func (*FetchQuery) MarshalJSON

func (fq *FetchQuery) MarshalJSON() ([]byte, error)

MarshalJSON encodes a FetchQuery value into a JSON format byte slice.

func (*FetchQuery) Timestamp

func (fq *FetchQuery) Timestamp() string

Timestamp returns the FetchQuery start time as a string in the IRONdb timestamp format.

func (*FetchQuery) UnmarshalJSON

func (fq *FetchQuery) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a HistogramValue value.

type FetchReduce

type FetchReduce struct {
	Label        string   `json:"label"`
	Method       string   `json:"method"`
	MethodParams []string `json:"method_params,omitempty"`
}

FetchReduce values represent reduce operations to perform on specified data streams in an IRONdb fetch request.

type FetchStream

type FetchStream struct {
	UUID            string   `json:"uuid"`
	Name            string   `json:"name"`
	Kind            string   `json:"kind"`
	Label           string   `json:"label,omitempty"`
	Transform       string   `json:"transform"`
	TransformParams []string `json:"transform_params,omitempty"`
}

FetchStream values represent queries for individual data streams in an IRONdb fetch request.

type FileSystemDetails

type FileSystemDetails struct {
	ID      uint64  `json:"id"`
	TotalMB float64 `json:"totalMb"`
	FreeMB  float64 `json:"availMb"`
}

FileSystemDetails values represent details about a nodes file system.

type FindTagsItem

type FindTagsItem struct {
	UUID       string          `json:"uuid"`
	CheckTags  []string        `json:"check_tags,omitempty"`
	MetricName string          `json:"metric_name"`
	Type       string          `type:"type"`
	AccountID  int64           `json:"account_id"`
	Activity   [][]int64       `json:"activity,omitempty"`
	Latest     *FindTagsLatest `json:"latest,omitempty"`
}

FindTagsItem values represent results returned from IRONdb tag queries.

type FindTagsLatest

type FindTagsLatest struct {
	Numeric   []FindTagsLatestNumeric   `json:"numeric,omitempty"`
	Text      []FindTagsLatestText      `json:"text,omitempty"`
	Histogram []FindTagsLatestHistogram `json:"histogram,omitempty"`
}

FindTagsLatest values contain the most recent data values for a metric.

type FindTagsLatestHistogram

type FindTagsLatestHistogram struct {
	Time  int64
	Value *string
}

FindTagsLatestHistogram values contain recent metric histogram data.

func (*FindTagsLatestHistogram) MarshalJSON

func (ftl *FindTagsLatestHistogram) MarshalJSON() ([]byte, error)

MarshalJSON encodes a FindTagsLatestHistogram value into a JSON format byte slice.

func (*FindTagsLatestHistogram) UnmarshalJSON

func (ftl *FindTagsLatestHistogram) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a FindTagsLatestHistogram value.

type FindTagsLatestNumeric

type FindTagsLatestNumeric struct {
	Time  int64
	Value *float64
}

FindTagsLatestNumeric values contain recent metric numeric data.

func (*FindTagsLatestNumeric) MarshalJSON

func (ftl *FindTagsLatestNumeric) MarshalJSON() ([]byte, error)

MarshalJSON encodes a FindTagsLatestNumeric value into a JSON format byte slice.

func (*FindTagsLatestNumeric) UnmarshalJSON

func (ftl *FindTagsLatestNumeric) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a FindTagsLatestNumeric value.

type FindTagsLatestText

type FindTagsLatestText struct {
	Time  int64
	Value *string
}

FindTagsLatestText values contain recent metric text data.

func (*FindTagsLatestText) MarshalJSON

func (ftl *FindTagsLatestText) MarshalJSON() ([]byte, error)

MarshalJSON encodes a FindTagsLatestText value into a JSON format byte slice.

func (*FindTagsLatestText) UnmarshalJSON

func (ftl *FindTagsLatestText) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a FindTagsLatestText value.

type FindTagsOptions

type FindTagsOptions struct {
	Start     time.Time
	End       time.Time
	StartStr  string `json:"activity_start_secs"`
	EndStr    string `json:"activity_end_secs"`
	Activity  int64  `json:"activity"`
	Latest    int64  `json:"latest"`
	CountOnly int64  `json:"count_only"`
	Limit     int64  `json:"limit"`
}

FindTagsOptions values contain optional parameters to be passed to the IRONdb find tags call by a FindTags operation.

type FindTagsResult

type FindTagsResult struct {
	Items    []FindTagsItem `json:"items,omitempty"`
	Count    int64          `json:"count"`
	Estimate bool           `json:"estimate"`
}

FindTagsResult values contain the results of a find tags request.

type Gossip

type Gossip []GossipDetail

Gossip values contain gossip information from a node. This structure includes information on how the nodes are communicating with each other, and if any nodes are behind with each other with regards to data replication.

type GossipDetail

type GossipDetail struct {
	ID          string        `json:"id"`
	Time        float64       `json:"gossip_time,string"`
	Age         float64       `json:"gossip_age,string"`
	CurrentTopo string        `json:"topo_current"`
	NextTopo    string        `json:"topo_next"`
	TopoState   string        `json:"topo_state"`
	Latency     GossipLatency `json:"latency"`
}

GossipDetail values represent gossip information about a node.

type GossipLatency

type GossipLatency map[string]string

GossipLatency values contain a map of node UUID's to latencies in seconds.

type GraphiteDatapoints

type GraphiteDatapoints struct {
	From   int64                 `json:"from"`
	To     int64                 `json:"to"`
	Step   int64                 `json:"step"`
	Series map[string][]*float64 `json:"series"`
}

GraphiteDatapoints values are used to represent series of graphite datapoints.

type GraphiteLookup

type GraphiteLookup struct {
	Start int64    `json:"start"`
	End   int64    `json:"end"`
	Names []string `json:"names"`
}

GraphiteLookup values are used to provide information needed to retrieve graphite datapoints.

type GraphiteMetric

type GraphiteMetric struct {
	Leaf bool              `json:"leaf"`
	Name string            `json:"name"`
	Data map[string]string `json:"leaf_data,omitempty"`
}

GraphiteMetric values are used to describe metrics in graphite format.

type GraphiteOptions

type GraphiteOptions struct {
	Limit int64 `json:"limit"`
}

GraphiteOptions values contain optional parameters to be passed to the IRONdb graphite API call operations.

type HistogramData

type HistogramData struct {
	AccountID int64                     `json:"account_id"`
	Metric    string                    `json:"metric"`
	ID        string                    `json:"id"`
	CheckName string                    `json:"check_name"`
	Offset    int64                     `json:"offset"`
	Period    int64                     `json:"period"`
	Histogram *circonusllhist.Histogram `json:"histogram"`
}

HistogramData values represent histogram data records in IRONdb.

type HistogramValue

type HistogramValue struct {
	Time   time.Time
	Period time.Duration
	Data   map[string]int64
}

HistogramValue values are individual data points of a histogram metric.

func (*HistogramValue) MarshalJSON

func (hv *HistogramValue) MarshalJSON() ([]byte, error)

MarshalJSON encodes a HistogramValue value into a JSON format byte slice.

func (*HistogramValue) Timestamp

func (hv *HistogramValue) Timestamp() string

Timestamp returns the HistogramValue time as a string in the IRONdb timestamp format.

func (*HistogramValue) UnmarshalJSON

func (hv *HistogramValue) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a HistogramValue value.

type IRONdbPutResponse

type IRONdbPutResponse struct {
	Errors      uint64 `json:"errors"`
	Misdirected uint64 `json:"misdirected"`
	Records     uint64 `json:"records"`
	Updated     uint64 `json:"updated"`
}

IRONdbPutResponse values represent raw IRONdb PUT/POST responses.

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
}

Logger values implement the behavior used by SnowthClient for logging, if the client has been assigned a logger with this interface.

type LuaExtension

type LuaExtension struct {
	Documentation    string                     `json:"documentation,omitempty"`
	Method           string                     `json:"method"`
	ParseJSONPayload bool                       `json:"PARSE_JSON_PAYLOAD,omitempty"`
	Params           map[string]*ExtensionParam `json:"params"`
	Man              string                     `json:"man,omitempty"`
	Name             string                     `json:"name,omitempty"`
	Description      string                     `json:"description"`
}

LuaExtension values contain information about a Lua extension.

type LuaExtensions

type LuaExtensions map[string]*LuaExtension

LuaExtensions is a map of information about Lua extensions.

func (*LuaExtensions) UnmarshalJSON

func (le *LuaExtensions) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a byte slice of JSON data into a LuaExtensions map.

type MetricName

type MetricName struct {
	CanonicalName   string
	Name            string
	StreamTags      []Tag
	MeasurementTags []Tag
}

MetricName values represent metric names.

func NewMetricName

func NewMetricName() *MetricName

NewMetricName creates and initializes a new metric name value.

func ParseMetricName

func ParseMetricName(name string) (*MetricName, error)

ParseMetricName takes a canonical metric name as a string and parses it into a MetricName value containing separated stream tags.

type MetricParser

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

MetricParser values are used to parse metric names and stream tags.

func NewMetricParser

func NewMetricParser(r io.Reader) *MetricParser

NewMetricParser returns a new instance of MetricParser.

func (*MetricParser) Parse

func (mp *MetricParser) Parse() (*MetricName, error)

Parse scans and parses a metric name value.

type ModifyTags

type ModifyTags struct {
	Add    []string `json:"add,omitempty"`
	Remove []string `json:"remove,omitempty"`
}

ModifyTags values contain lists of check tags to add and remove.

type NNTAllValue

type NNTAllValue struct {
	Time              time.Time `json:"-"`
	Count             int64     `json:"count"`
	Value             int64     `json:"value"`
	StdDev            int64     `json:"stddev"`
	Derivative        int64     `json:"derivative"`
	DerivativeStdDev  int64     `json:"derivative_stddev"`
	Counter           int64     `json:"counter"`
	CounterStdDev     int64     `json:"counter_stddev"`
	Derivative2       int64     `json:"derivative2"`
	Derivative2StdDev int64     `json:"derivative2_stddev"`
	Counter2          int64     `json:"counter2"`
	Counter2StdDev    int64     `json:"counter2_stddev"`
}

NNTAllValue values represent NNT data.

type NNTAllValueResponse

type NNTAllValueResponse struct {
	Data []NNTAllValue
}

NNTAllValueResponse values represent NNT data responses from IRONdb.

func (*NNTAllValueResponse) UnmarshalJSON

func (nv *NNTAllValueResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into an NNTAllValueResponse.

type NNTData

type NNTData struct {
	Count            int64  `json:"count"`
	Value            int64  `json:"value"`
	Derivative       int64  `json:"derivative"`
	Counter          int64  `json:"counter"`
	StdDev           int64  `json:"stddev"`
	DerivativeStdDev int64  `json:"derivative_stddev"`
	CounterStdDev    int64  `json:"counter_stddev"`
	Metric           string `json:"metric"`
	ID               string `json:"id"`
	Offset           int64  `json:"offset"`
	Parts            Parts  `json:"parts"`
}

NNTData values represent NNT data.

type NNTPartsData

type NNTPartsData struct {
	Count            int64 `json:"count"`
	Value            int64 `json:"value"`
	Derivative       int64 `json:"derivative"`
	Counter          int64 `json:"counter"`
	StdDev           int64 `json:"stddev"`
	DerivativeStdDev int64 `json:"derivative_stddev"`
	CounterStdDev    int64 `json:"counter_stddev"`
}

NNTPartsData values represent NNT base data parts.

type NNTValue

type NNTValue struct {
	Time  time.Time
	Value int64
}

NNTValue values represent individual NNT data values.

type NNTValueResponse

type NNTValueResponse struct {
	Data []NNTValue
}

NNTValueResponse values represent responses containing NNT data.

func (*NNTValueResponse) UnmarshalJSON

func (nv *NNTValueResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into an NNTValueResponse.

type NodeState

type NodeState struct {
	Identity      string   `json:"identity"`
	Current       string   `json:"current"`
	Next          string   `json:"next"`
	NNT           Rollup   `json:"nnt"`
	NNTBS         *Rollup  `json:"nntbs"`
	Text          Rollup   `json:"text"`
	Histogram     Rollup   `json:"histogram"`
	BaseRollup    uint64   `json:"base_rollup"`
	Rollups       []uint64 `json:"rollups"`
	NNTCacheSize  uint64   `json:"nnt_cache_size"`
	RUsageUTime   float64  `json:"rusage.utime"`
	RUsageSTime   float64  `json:"rusage.stime"`
	RUsageMaxRSS  uint64   `json:"rusage.maxrss"`
	RUsageMinFLT  uint64   `json:"rusage.minflt"`
	RUsageMajFLT  uint64   `json:"rusage.majflt"`
	RUsageNSwap   uint64   `json:"rusage.nswap"`
	RUsageInBlock uint64   `json:"rusage.inblock"`
	RUsageOuBlock uint64   `json:"rusage.oublock"`

	RUsageMsgSnd   uint64  `json:"rusage.msgsnd"`
	RUsageMsgRcv   uint64  `json:"rusage.msgrcv"`
	RUsageNSignals uint64  `json:"rusage.nsignals"`
	RUsageNvcSW    uint64  `json:"rusage.nvcsw"`
	RUsageNivcSW   uint64  `json:"rusage.nivcsw"`
	MaxPeerLag     float64 `json:"max_peer_lag"`
	AvgPeerLag     float64 `json:"avg_peer_lag"`

	Features Features `json:"features"`

	Version     string `json:"version"`
	Application string `json:"application"`
}

NodeState values represent the state of an IRONdb node.

type NumericAllValue

type NumericAllValue struct {
	Time              time.Time `json:"-"`
	Count             int64     `json:"count"`
	Value             int64     `json:"value"`
	StdDev            int64     `json:"stddev"`
	Derivative        int64     `json:"derivative"`
	DerivativeStdDev  int64     `json:"derivative_stddev"`
	Counter           int64     `json:"counter"`
	CounterStdDev     int64     `json:"counter_stddev"`
	Derivative2       int64     `json:"derivative2"`
	Derivative2StdDev int64     `json:"derivative2_stddev"`
	Counter2          int64     `json:"counter2"`
	Counter2StdDev    int64     `json:"counter2_stddev"`
}

NumericAllValue values represent numeric data.

type NumericAllValueResponse

type NumericAllValueResponse struct {
	Data []NumericAllValue
}

NumericAllValueResponse values represent numeric data responses from IRONdb.

func (*NumericAllValueResponse) UnmarshalJSON

func (nv *NumericAllValueResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a NumericAllValueResponse.

type NumericParts

type NumericParts struct {
	Period int64              `json:"period"`
	Data   []NumericPartsData `json:"data"`
}

NumericParts values contain the NumericWrite submission parts of an numeric rollup.

func (*NumericParts) MarshalJSON

func (p *NumericParts) MarshalJSON() ([]byte, error)

MarshalJSON marshals a NumericParts value into a JSON format byte slice.

type NumericPartsData

type NumericPartsData struct {
	Count            int64 `json:"count"`
	Value            int64 `json:"value"`
	Derivative       int64 `json:"derivative"`
	Counter          int64 `json:"counter"`
	StdDev           int64 `json:"stddev"`
	DerivativeStdDev int64 `json:"derivative_stddev"`
	CounterStdDev    int64 `json:"counter_stddev"`
}

NumericPartsData values represent numeric base data parts.

type NumericValue

type NumericValue struct {
	Time  time.Time
	Value int64
}

NumericValue values represent individual numeric data values.

type NumericValueResponse

type NumericValueResponse struct {
	Data []NumericValue
}

NumericValueResponse values represent responses containing numeric data.

func (*NumericValueResponse) UnmarshalJSON

func (nv *NumericValueResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a NumericValueResponse.

type NumericWrite

type NumericWrite struct {
	Count            int64        `json:"count"`
	Value            int64        `json:"value"`
	Derivative       int64        `json:"derivative"`
	Counter          int64        `json:"counter"`
	StdDev           int64        `json:"stddev"`
	DerivativeStdDev int64        `json:"derivative_stddev"`
	CounterStdDev    int64        `json:"counter_stddev"`
	Metric           string       `json:"metric"`
	ID               string       `json:"id"`
	Offset           int64        `json:"offset"`
	Parts            NumericParts `json:"parts"`
}

NumericWrite values represent numeric data.

type Parts

type Parts struct {
	Period int64          `json:"period"`
	Data   []NNTPartsData `json:"data"`
}

Parts values contain the NNTData submission parts of an NNT rollup.

func (*Parts) MarshalJSON

func (p *Parts) MarshalJSON() ([]byte, error)

MarshalJSON marshals a Parts value into a JSON format byte slice.

type PromQLError added in v1.12.4

type PromQLError struct {
	Status    string      `json:"status,omitempty"`
	Data      interface{} `json:"data,omitempty"`
	ErrorType string      `json:"errorType,omitempty"`
	Err       string      `json:"error,omitempty"`
	Warnings  []string    `json:"warnings,omitempty"`
}

PromQLError values represent a PromQL response envelope containing an error.

func (*PromQLError) Error added in v1.12.4

func (pe *PromQLError) Error() string

Error returns this error as a JSON format string.

func (*PromQLError) String added in v1.12.4

func (pe *PromQLError) String() string

String returns this value as a JSON format string.

type PromQLInstantQuery added in v1.13.5

type PromQLInstantQuery struct {
	Query     string `json:"query,omitempty"`
	Time      string `json:"time,omitempty"`
	Timeout   string `json:"timeout,omitempty"`
	AccountID string `json:"account_id,omitempty"`
}

PromQLInstantQuery values represent Prometheus queries for data from a single point in time. These values are accepted as strings and will accept the same values as would be passed to the prometheus /api/v1/query endpoint.

type PromQLLabelQuery added in v1.13.7

type PromQLLabelQuery struct {
	Match     []string `json:"match[],omitempty"`
	Start     string   `json:"start,omitempty"`
	End       string   `json:"end,omitempty"`
	AccountID string   `json:"account_id,omitempty"`
}

PromQLLabelQuery values represent Prometheus queries for labels or label values optionally from time series matching specified label sets. These values are accepted as strings and will accept the same values as would be passed to the prometheus /api/v1/labels endpoint.

type PromQLMetadataQuery added in v1.13.8

type PromQLMetadataQuery struct {
	Limit     string `json:"limit,omitempty"`
	Metric    string `json:"metric,omitempty"`
	AccountID string `json:"account_id,omitempty"`
}

PromQLMetadataQuery values represent Prometheus queries for series metadata. These values are accepted as strings and will accept the same values as would be passed to the prometheus /api/v1/metadata endpoint.

type PromQLRangeQuery

type PromQLRangeQuery struct {
	Query     string `json:"query,omitempty"`
	Start     string `json:"start,omitempty"`
	End       string `json:"end,omitempty"`
	Step      string `json:"step,omitempty"`
	Timeout   string `json:"timeout,omitempty"`
	AccountID string `json:"account_id,omitempty"`
}

PromQLRangeQuery values represent Prometheus range queries. These values are accepted as strings and will accept the same values as would be passed to the prometheus /api/v1/query_range endpoint.

type PromQLResponse

type PromQLResponse struct {
	Status    string      `json:"status,omitempty"`
	Data      interface{} `json:"data,omitempty"`
	ErrorType string      `json:"errorType,omitempty"`
	Error     string      `json:"error,omitempty"`
	Warnings  []string    `json:"warnings,omitempty"`
}

PromQLResponse values represent response envelopes for all PromQL queries. Note, the various response formats are not parsed by gosnowth, and all data is returned in a map[string]interface{} as generated by the Go JSON decoder, and is left to subsequent parsing and decoding by the user. This is intentional to avoid tight coupling to PromQL protocol formats.

type PromQLSeriesQuery added in v1.13.7

type PromQLSeriesQuery struct {
	Match     []string `json:"match[],omitempty"`
	Start     string   `json:"start,omitempty"`
	End       string   `json:"end,omitempty"`
	AccountID string   `json:"account_id,omitempty"`
}

PromQLSeriesQuery values represent Prometheus queries for time series matching specified label sets. These values are accepted as strings and will accept the same values as would be passed to the prometheus /api/v1/series endpoint.

type RawNumericValue

type RawNumericValue struct {
	Time  time.Time
	Value float64
}

RawNumericValue values represent raw numeric data.

type RawNumericValueResponse

type RawNumericValueResponse struct {
	Data []RawNumericValue
}

RawNumericValueResponse values represent raw numeric data responses from IRONdb.

func (*RawNumericValueResponse) UnmarshalJSON

func (rv *RawNumericValueResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a RawNumericValueResponse.

type RebuildActivityRequest

type RebuildActivityRequest struct {
	UUID   string `json:"check_uuid"`
	Metric string `json:"metric_name"`
}

RebuildActivityRequest values represent a request to rebuild activity tracking data.

type Rollup

type Rollup struct {
	RollupEntries
	RollupList []uint64      `json:"rollups"`
	Aggregate  RollupDetails `json:"aggregate"`
}

Rollup values represent node state rollups.

func (*Rollup) UnmarshalJSON

func (r *Rollup) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a rollup value from a JSON format byte slice.

type RollupAllData

type RollupAllData struct {
	Count             int64
	Counter           float64
	Counter2          float64
	CounterStddev     float64
	Counter2Stddev    float64
	Derivative        float64
	Derivative2       float64
	DerivativeStddev  float64
	Derivative2Stddev float64
	Stddev            float64
	Value             float64
}

RollupAllData values contain the data values of an individual rollup data point.

type RollupAllValue

type RollupAllValue struct {
	Time time.Time
	Data *RollupAllData
}

RollupAllValue values contain all parts of an individual rollup data point.

func (*RollupAllValue) MarshalJSON

func (rv *RollupAllValue) MarshalJSON() ([]byte, error)

MarshalJSON encodes a RollupValue value into a JSON format byte slice.

func (*RollupAllValue) Timestamp

func (rv *RollupAllValue) Timestamp() string

Timestamp returns the RollupAllValue time as a string in the IRONdb timestamp format.

func (*RollupAllValue) UnmarshalJSON

func (rv *RollupAllValue) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a RollupValue value.

type RollupDetails

type RollupDetails struct {
	FilesSystem   FileSystemDetails `json:"fs"`
	PutCalls      uint64            `json:"put.calls"`
	PutElapsedUS  uint64            `json:"put.elapsed_us"`
	GetCalls      uint64            `json:"get.calls"`
	GetProxyCalls uint64            `json:"get.proxy_calls"`
	GetCount      uint64            `json:"get.count"`
	GetElapsedUS  uint64            `json:"get.elapsed_us"`
	ExtendCalls   uint64            `json:"extend.calls"`
}

RollupDetails values represent node state rollup information.

type RollupEntries

type RollupEntries map[string]RollupDetails

RollupEntries values contain node state rollup information.

type RollupValue

type RollupValue struct {
	Time  time.Time
	Value *float64
}

RollupValue values are individual data points of a rollup.

func (*RollupValue) MarshalJSON

func (rv *RollupValue) MarshalJSON() ([]byte, error)

MarshalJSON encodes a RollupValue value into a JSON format byte slice.

func (*RollupValue) Timestamp

func (rv *RollupValue) Timestamp() string

Timestamp returns the RollupValue time as a string in the IRONdb timestamp format.

func (*RollupValue) UnmarshalJSON

func (rv *RollupValue) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a RollupValue value.

type SnowthClient

type SnowthClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SnowthClient values provide client functionality for accessing IRONdb.

func NewClient

func NewClient(ctx context.Context, cfg *Config,
	logs ...Logger,
) (*SnowthClient, error)

NewClient creates and performs initial setup of a new SnowthClient.

func (*SnowthClient) ActivateNodes

func (sc *SnowthClient) ActivateNodes(nodes ...*SnowthNode)

ActivateNodes makes provided nodes active.

func (*SnowthClient) ActivateTopology

func (sc *SnowthClient) ActivateTopology(hash string, node *SnowthNode) error

ActivateTopology activates a new topology on the node. WARNING THIS IS DANGEROUS.

func (*SnowthClient) ActivateTopologyContext

func (sc *SnowthClient) ActivateTopologyContext(ctx context.Context,
	hash string, node *SnowthNode,
) error

ActivateTopologyContext is the context aware version of ActivateTopology. WARNING THIS IS DANGEROUS.

func (*SnowthClient) AddNodes

func (sc *SnowthClient) AddNodes(nodes ...*SnowthNode)

AddNodes adds node values to the inactive node list.

func (*SnowthClient) ConnectRetries

func (sc *SnowthClient) ConnectRetries() int64

ConnectRetries gets the number of retries a SnowthClient will attempt when connection errors occur to a snowth node. When a connection error occurs the affected node will be deactivated, then a retries will happen on another node. A value of -1 will retry until no nodes are available, The watch routine can reactivate nodes that have been deactivated by retries when their connectivity is restored.

func (*SnowthClient) DeactivateNodes

func (sc *SnowthClient) DeactivateNodes(nodes ...*SnowthNode)

DeactivateNodes makes provided nodes inactive.

func (*SnowthClient) DeleteCheckTags

func (sc *SnowthClient) DeleteCheckTags(checkUUID string,
	nodes ...*SnowthNode,
) error

DeleteCheckTags removes check tags from IRONdb for a specified check.

func (*SnowthClient) DeleteCheckTagsContext

func (sc *SnowthClient) DeleteCheckTagsContext(ctx context.Context,
	checkUUID string, nodes ...*SnowthNode,
) error

DeleteCheckTagsContext is the context aware version of DeleteCheckTags.

func (*SnowthClient) DoRequest

func (sc *SnowthClient) DoRequest(node *SnowthNode,
	method string, url string, body io.Reader,
	headers http.Header,
) (io.Reader, http.Header, error)

DoRequest sends a request to IRONdb. If the client is set to retry using other nodes on network failures, this will perform those retries.

func (*SnowthClient) DoRequestContext

func (sc *SnowthClient) DoRequestContext(ctx context.Context, node *SnowthNode,
	method string, url string, body io.Reader,
	headers http.Header,
) (io.Reader, http.Header, error)

DoRequestContext is the context aware version of DoRequest. If the client is set to retry using other nodes on network failures, this will perform those retries.

func (*SnowthClient) ExecLuaExtension

func (sc *SnowthClient) ExecLuaExtension(name string,
	params []ExtParam, nodes ...*SnowthNode,
) (map[string]interface{}, error)

ExecLuaExtension executes the specified Lua extension and returns the response as a JSON map.

func (*SnowthClient) ExecLuaExtensionContext

func (sc *SnowthClient) ExecLuaExtensionContext(ctx context.Context,
	name string, params []ExtParam,
	nodes ...*SnowthNode,
) (map[string]interface{}, error)

ExecLuaExtensionContext is the context aware version of ExecLuaExtension.

func (*SnowthClient) FetchValues

func (sc *SnowthClient) FetchValues(q *FetchQuery, nodes ...*SnowthNode) (*DF4Response, error)

FetchValues retrieves data values using the IRONdb fetch API.

func (*SnowthClient) FetchValuesContext

func (sc *SnowthClient) FetchValuesContext(ctx context.Context,
	q *FetchQuery, nodes ...*SnowthNode,
) (*DF4Response, error)

FetchValuesContext is the context aware version of FetchValues.

func (*SnowthClient) FetchValuesFb

func (sc *SnowthClient) FetchValuesFb(node *SnowthNode,
	q *fetch.FetchT,
) (*fetch.DF4T, error)

FetchValuesFb retrieves data values using the IRONdb fetch API with FlatBuffers.

func (*SnowthClient) FetchValuesFbContext

func (sc *SnowthClient) FetchValuesFbContext(ctx context.Context,
	node *SnowthNode, q *fetch.FetchT,
) (*fetch.DF4T, error)

FetchValuesFbContext is the context aware version of FetchValuesFb.

func (*SnowthClient) FindMetricNodeIDs

func (sc *SnowthClient) FindMetricNodeIDs(uuid, metric string) []string

FindMetricNodeIDs returns (possibly) as list of uuid node identifiers that own the metric.

func (*SnowthClient) FindTagCats

func (sc *SnowthClient) FindTagCats(accountID int64, query string,
	nodes ...*SnowthNode,
) ([]string, error)

FindTagCats retrieves tag categories that are associated with the provided query.

func (*SnowthClient) FindTagCatsContext

func (sc *SnowthClient) FindTagCatsContext(ctx context.Context,
	accountID int64, query string, nodes ...*SnowthNode,
) ([]string, error)

FindTagCatsContext is the context aware version of FindTagCats.

func (*SnowthClient) FindTagVals

func (sc *SnowthClient) FindTagVals(accountID int64, query, category string,
	nodes ...*SnowthNode,
) ([]string, error)

FindTagVals retrieves tag values that are associated with the provided query.

func (*SnowthClient) FindTagValsContext

func (sc *SnowthClient) FindTagValsContext(ctx context.Context,
	accountID int64, query, category string,
	nodes ...*SnowthNode,
) ([]string, error)

FindTagValsContext is the context aware version of FindTagVals.

func (*SnowthClient) FindTags

func (sc *SnowthClient) FindTags(accountID int64, query string,
	options *FindTagsOptions, nodes ...*SnowthNode,
) (*FindTagsResult, error)

FindTags retrieves metrics that are associated with the provided tag query.

func (*SnowthClient) FindTagsContext

func (sc *SnowthClient) FindTagsContext(ctx context.Context, accountID int64,
	query string, options *FindTagsOptions,
	nodes ...*SnowthNode,
) (*FindTagsResult, error)

FindTagsContext is the context aware version of FindTags.

func (*SnowthClient) GetActiveNode

func (sc *SnowthClient) GetActiveNode(idsets ...[]string) *SnowthNode

GetActiveNode returns a random active node in the cluster.

func (*SnowthClient) GetCAQLQuery

func (sc *SnowthClient) GetCAQLQuery(q *CAQLQuery,
	nodes ...*SnowthNode,
) (*DF4Response, error)

GetCAQLQuery retrieves data values for metrics matching a CAQL format.

func (*SnowthClient) GetCAQLQueryContext

func (sc *SnowthClient) GetCAQLQueryContext(ctx context.Context, q *CAQLQuery,
	nodes ...*SnowthNode,
) (*DF4Response, error)

GetCAQLQueryContext is the context aware version of GetCAQLQuery.

func (*SnowthClient) GetCheckTags

func (sc *SnowthClient) GetCheckTags(checkUUID string,
	nodes ...*SnowthNode,
) (CheckTags, error)

GetCheckTags retrieves check tags from IRONdb for a specified check.

func (*SnowthClient) GetCheckTagsContext

func (sc *SnowthClient) GetCheckTagsContext(ctx context.Context,
	checkUUID string, nodes ...*SnowthNode,
) (CheckTags, error)

GetCheckTagsContext is the context aware version of GetCheckTags.

func (*SnowthClient) GetGossipInfo

func (sc *SnowthClient) GetGossipInfo(nodes ...*SnowthNode) (*Gossip, error)

GetGossipInfo fetches the gossip information from an IRONdb node. The gossip response body will include a list of "GossipDetail" which provide the identifier of the node, the node's gossip_time, gossip_age, as well as topology state, current and next topology.

func (*SnowthClient) GetGossipInfoContext

func (sc *SnowthClient) GetGossipInfoContext(ctx context.Context,
	nodes ...*SnowthNode,
) (*Gossip, error)

GetGossipInfoContext is the context aware version of GetGossipInfo.

func (*SnowthClient) GetLuaExtensions

func (sc *SnowthClient) GetLuaExtensions(nodes ...*SnowthNode) (LuaExtensions,
	error,
)

GetLuaExtensions retrieves information about available Lua extensions.

func (*SnowthClient) GetLuaExtensionsContext

func (sc *SnowthClient) GetLuaExtensionsContext(ctx context.Context,
	nodes ...*SnowthNode,
) (LuaExtensions, error)

GetLuaExtensionsContext is the context aware version of GetLuaExtensions.

func (*SnowthClient) GetNodeState

func (sc *SnowthClient) GetNodeState(nodes ...*SnowthNode) (*NodeState, error)

GetNodeState retrieves the state of an IRONdb node.

func (*SnowthClient) GetNodeStateContext

func (sc *SnowthClient) GetNodeStateContext(ctx context.Context,
	nodes ...*SnowthNode,
) (*NodeState, error)

GetNodeStateContext is the context aware version of GetNodeState.

func (*SnowthClient) GetStats

func (sc *SnowthClient) GetStats(nodes ...*SnowthNode) (*Stats, error)

GetStats retrieves the metrics about the status of an IRONdb node.

func (*SnowthClient) GetStatsContext

func (sc *SnowthClient) GetStatsContext(ctx context.Context,
	nodes ...*SnowthNode,
) (*Stats, error)

GetStatsContext is the context aware version of GetStats.

func (*SnowthClient) GetStatsNodeContext

func (sc *SnowthClient) GetStatsNodeContext(ctx context.Context,
	node *SnowthNode,
) (*Stats, error)

GetStatsNodeContext gets the status metrics for a single specified node.

func (*SnowthClient) GetTopologyInfo

func (sc *SnowthClient) GetTopologyInfo(nodes ...*SnowthNode) (*Topology, error)

GetTopologyInfo retrieves topology information from a node.

func (*SnowthClient) GetTopologyInfoContext

func (sc *SnowthClient) GetTopologyInfoContext(ctx context.Context,
	nodes ...*SnowthNode,
) (*Topology, error)

GetTopologyInfoContext is the context aware version of GetTopologyInfo.

func (*SnowthClient) GraphiteFindMetrics

func (sc *SnowthClient) GraphiteFindMetrics(accountID int64,
	prefix, query string, options *GraphiteOptions,
	nodes ...*SnowthNode,
) ([]GraphiteMetric, error)

GraphiteFindMetrics retrieves metrics that are associated with the provided graphite metric search query.

func (*SnowthClient) GraphiteFindMetricsContext

func (sc *SnowthClient) GraphiteFindMetricsContext(ctx context.Context,
	accountID int64, prefix, query string, options *GraphiteOptions,
	nodes ...*SnowthNode,
) ([]GraphiteMetric, error)

GraphiteFindMetricsContext is the context aware version of GraphiteFindMetrics.

func (*SnowthClient) GraphiteFindTags

func (sc *SnowthClient) GraphiteFindTags(accountID int64,
	prefix, query string, options *GraphiteOptions,
	nodes ...*SnowthNode,
) ([]GraphiteMetric, error)

GraphiteFindTags retrieves metrics that are associated with the provided graphite tag search query.

func (*SnowthClient) GraphiteFindTagsContext

func (sc *SnowthClient) GraphiteFindTagsContext(ctx context.Context,
	accountID int64, prefix, query string, options *GraphiteOptions,
	nodes ...*SnowthNode,
) ([]GraphiteMetric, error)

GraphiteFindTagsContext is the context aware version of GraphiteFindTags.

func (*SnowthClient) GraphiteGetDatapoints

func (sc *SnowthClient) GraphiteGetDatapoints(accountID int64,
	prefix string, lookup *GraphiteLookup, options *GraphiteOptions,
	nodes ...*SnowthNode,
) (*GraphiteDatapoints, error)

GraphiteGetDatapoints retrieves graphite datapoint series for specified metrics for a specified time range.

func (*SnowthClient) GraphiteGetDatapointsContext

func (sc *SnowthClient) GraphiteGetDatapointsContext(ctx context.Context,
	accountID int64, prefix string, lookup *GraphiteLookup,
	options *GraphiteOptions,
	nodes ...*SnowthNode,
) (*GraphiteDatapoints, error)

GraphiteGetDatapointsContext is the context aware version of GraphiteGetDatapoints.

func (*SnowthClient) ListActiveNodes

func (sc *SnowthClient) ListActiveNodes() []*SnowthNode

ListActiveNodes lists all of the currently active nodes.

func (*SnowthClient) ListInactiveNodes

func (sc *SnowthClient) ListInactiveNodes() []*SnowthNode

ListInactiveNodes lists all of the currently inactive nodes.

func (*SnowthClient) LoadTopology

func (sc *SnowthClient) LoadTopology(hash string, t *Topology,
	nodes ...*SnowthNode,
) error

LoadTopology loads a new topology on a node without activating it.

func (*SnowthClient) LoadTopologyContext

func (sc *SnowthClient) LoadTopologyContext(ctx context.Context, hash string,
	t *Topology, node *SnowthNode,
) error

LoadTopologyContext is the context aware version of LoadTopology.

func (*SnowthClient) LocateMetric

func (sc *SnowthClient) LocateMetric(uuid string, metric string,
	node ...*SnowthNode,
) ([]TopologyNode, error)

LocateMetric returns a list of nodes owning the specified metric.

func (*SnowthClient) LocateMetricContext

func (sc *SnowthClient) LocateMetricContext(ctx context.Context, uuid string,
	metric string, node ...*SnowthNode,
) ([]TopologyNode, error)

LocateMetricContext is the context aware version of LocateMetric.

func (*SnowthClient) LocateMetricRemote

func (sc *SnowthClient) LocateMetricRemote(uuid string, metric string,
	node *SnowthNode,
) ([]TopologyNode, error)

LocateMetricRemote locates which nodes contain specified metric data.

func (*SnowthClient) LocateMetricRemoteContext

func (sc *SnowthClient) LocateMetricRemoteContext(ctx context.Context,
	uuid string, metric string, node *SnowthNode,
) ([]TopologyNode, error)

LocateMetricRemoteContext is the context aware version of LocateMetricRemote.

func (*SnowthClient) LogDebugf

func (sc *SnowthClient) LogDebugf(format string, args ...interface{})

LogDebugf writes a log entry at the debug level.

func (*SnowthClient) LogErrorf

func (sc *SnowthClient) LogErrorf(format string, args ...interface{})

LogErrorf writes a log entry at the error level.

func (*SnowthClient) LogInfof

func (sc *SnowthClient) LogInfof(format string, args ...interface{})

LogInfof writes a log entry at the information level.

func (*SnowthClient) LogWarnf

func (sc *SnowthClient) LogWarnf(format string, args ...interface{})

LogWarnf writes a log entry at the warning level.

func (*SnowthClient) PromQLInstantQuery added in v1.13.5

func (sc *SnowthClient) PromQLInstantQuery(query *PromQLInstantQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLInstantQuery evaluates a PromQL query at a single point in time.

func (*SnowthClient) PromQLInstantQueryContext added in v1.13.5

func (sc *SnowthClient) PromQLInstantQueryContext(ctx context.Context,
	query *PromQLInstantQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLInstantQueryContext is the context aware version of PromQLInstantQuery.

func (*SnowthClient) PromQLLabelQuery added in v1.13.7

func (sc *SnowthClient) PromQLLabelQuery(query *PromQLLabelQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLLabelQuery returns a list of all label names, or those from any time series matching the specified query.

func (*SnowthClient) PromQLLabelQueryContext added in v1.13.7

func (sc *SnowthClient) PromQLLabelQueryContext(ctx context.Context,
	query *PromQLLabelQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLLabelQueryContext is the context aware version of PromQLLabelQuery.

func (*SnowthClient) PromQLLabelValuesQuery added in v1.13.7

func (sc *SnowthClient) PromQLLabelValuesQuery(label string,
	query *PromQLLabelQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLLabelValuesQuery returns a list of all label values, or those from any time series matching the specified query.

func (*SnowthClient) PromQLLabelValuesQueryContext added in v1.13.7

func (sc *SnowthClient) PromQLLabelValuesQueryContext(ctx context.Context,
	label string,
	query *PromQLLabelQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLLabelValuesQueryContext is the context aware version of PromQLLabelValuesQuery.

func (*SnowthClient) PromQLMetadataQuery added in v1.13.8

func (sc *SnowthClient) PromQLMetadataQuery(query *PromQLMetadataQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLMetadataQuery returns all time series metadata for a specified metric.

func (*SnowthClient) PromQLMetadataQueryContext added in v1.13.8

func (sc *SnowthClient) PromQLMetadataQueryContext(
	ctx context.Context,
	query *PromQLMetadataQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLMetadataQueryContext is the context aware version of PromQLMetadataQuery.

func (*SnowthClient) PromQLRangeQuery

func (sc *SnowthClient) PromQLRangeQuery(query *PromQLRangeQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLRangeQuery evaluates a PromQL query over a range of time.

func (*SnowthClient) PromQLRangeQueryContext

func (sc *SnowthClient) PromQLRangeQueryContext(ctx context.Context,
	query *PromQLRangeQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLRangeQueryContext is the context aware version of PromQLRangeQuery.

func (*SnowthClient) PromQLSeriesQuery added in v1.13.7

func (sc *SnowthClient) PromQLSeriesQuery(query *PromQLSeriesQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLSeriesQuery returns all time series matching specified labels sets.

func (*SnowthClient) PromQLSeriesQueryContext added in v1.13.7

func (sc *SnowthClient) PromQLSeriesQueryContext(
	ctx context.Context,
	query *PromQLSeriesQuery,
	nodes ...*SnowthNode,
) (*PromQLResponse, error)

PromQLSeriesQueryContext is the context aware version of PromQLSeriesQuery.

func (*SnowthClient) ReadHistogramValues

func (sc *SnowthClient) ReadHistogramValues(
	uuid, metric string, period time.Duration,
	start, end time.Time, nodes ...*SnowthNode,
) ([]HistogramValue, error)

ReadHistogramValues reads histogram data from a node.

func (*SnowthClient) ReadHistogramValuesContext

func (sc *SnowthClient) ReadHistogramValuesContext(ctx context.Context,
	uuid, metric string, period time.Duration,
	start, end time.Time, nodes ...*SnowthNode,
) ([]HistogramValue, error)

ReadHistogramValuesContext is the context aware version of ReadHistogramValues.

func (*SnowthClient) ReadNNTAllValues

func (sc *SnowthClient) ReadNNTAllValues(start, end time.Time, period int64,
	id, metric string, nodes ...*SnowthNode,
) ([]NNTAllValue, error)

ReadNNTAllValues reads all NNT data from a node.

func (*SnowthClient) ReadNNTAllValuesContext

func (sc *SnowthClient) ReadNNTAllValuesContext(ctx context.Context,
	start, end time.Time, period int64,
	id, metric string, nodes ...*SnowthNode,
) ([]NNTAllValue, error)

ReadNNTAllValuesContext is the context aware version of ReadNNTAllValues.

func (*SnowthClient) ReadNNTValues

func (sc *SnowthClient) ReadNNTValues(start, end time.Time, period int64,
	t, id, metric string, nodes ...*SnowthNode,
) ([]NNTValue, error)

ReadNNTValues reads NNT data from a node.

func (*SnowthClient) ReadNNTValuesContext

func (sc *SnowthClient) ReadNNTValuesContext(ctx context.Context,
	start, end time.Time, period int64,
	t, id, metric string, nodes ...*SnowthNode,
) ([]NNTValue, error)

ReadNNTValuesContext is the context aware version of ReadNNTValues.

func (*SnowthClient) ReadNumericAllValues

func (sc *SnowthClient) ReadNumericAllValues(start, end time.Time, period int64,
	id, metric string, nodes ...*SnowthNode,
) ([]NumericAllValue, error)

ReadNumericAllValues reads all numeric data from a node.

func (*SnowthClient) ReadNumericAllValuesContext

func (sc *SnowthClient) ReadNumericAllValuesContext(ctx context.Context,
	start, end time.Time, period int64,
	id, metric string, nodes ...*SnowthNode,
) ([]NumericAllValue, error)

ReadNumericAllValuesContext is the context aware version of ReadNumericAllValues.

func (*SnowthClient) ReadNumericValues

func (sc *SnowthClient) ReadNumericValues(start, end time.Time, period int64,
	t, id, metric string, nodes ...*SnowthNode,
) ([]NumericValue, error)

ReadNumericValues reads numeric data from a node.

func (*SnowthClient) ReadNumericValuesContext

func (sc *SnowthClient) ReadNumericValuesContext(ctx context.Context,
	start, end time.Time, period int64,
	t, id, metric string, nodes ...*SnowthNode,
) ([]NumericValue, error)

ReadNumericValuesContext is the context aware version of ReadNumericValues.

func (*SnowthClient) ReadRawNumericValues

func (sc *SnowthClient) ReadRawNumericValues(start time.Time, end time.Time,
	uuid string, metric string,
	nodes ...*SnowthNode,
) ([]RawNumericValue, error)

ReadRawNumericValues reads raw numeric data from a node.

func (*SnowthClient) ReadRawNumericValuesContext

func (sc *SnowthClient) ReadRawNumericValuesContext(ctx context.Context,
	start, end time.Time, uuid, metric string,
	nodes ...*SnowthNode,
) ([]RawNumericValue, error)

ReadRawNumericValuesContext is the context aware version of ReadRawNumericValues.

func (*SnowthClient) ReadRollupAllValues

func (sc *SnowthClient) ReadRollupAllValues(
	uuid, metric string, period time.Duration,
	start, end time.Time, nodes ...*SnowthNode,
) ([]RollupAllValue, error)

ReadRollupAllValues reads rollup data from a node.

func (*SnowthClient) ReadRollupAllValuesContext

func (sc *SnowthClient) ReadRollupAllValuesContext(ctx context.Context,
	uuid, metric string, period time.Duration,
	start, end time.Time, nodes ...*SnowthNode,
) ([]RollupAllValue, error)

ReadRollupAllValuesContext is the context aware version of ReadRollupValues.

func (*SnowthClient) ReadRollupValues

func (sc *SnowthClient) ReadRollupValues(uuid, metric string, period time.Duration,
	start, end time.Time, dataType string, nodes ...*SnowthNode,
) ([]RollupValue, error)

ReadRollupValues reads rollup data from a node.

func (*SnowthClient) ReadRollupValuesContext

func (sc *SnowthClient) ReadRollupValuesContext(ctx context.Context,
	uuid, metric string, period time.Duration, start, end time.Time,
	dataType string, nodes ...*SnowthNode,
) ([]RollupValue, error)

ReadRollupValuesContext is the context aware version of ReadRollupValues.

func (*SnowthClient) ReadTextValues

func (sc *SnowthClient) ReadTextValues(uuid, metric string,
	start, end time.Time, nodes ...*SnowthNode,
) ([]TextValue, error)

ReadTextValues reads text data values from an IRONdb node.

func (*SnowthClient) ReadTextValuesContext

func (sc *SnowthClient) ReadTextValuesContext(ctx context.Context,
	uuid, metric string, start, end time.Time,
	nodes ...*SnowthNode,
) ([]TextValue, error)

ReadTextValuesContext is the context aware version of ReadTextValues.

func (*SnowthClient) RebuildActivity

func (sc *SnowthClient) RebuildActivity(node *SnowthNode,
	rebuildRequest []RebuildActivityRequest,
) (*IRONdbPutResponse, error)

RebuildActivity rebuilds IRONdb activity tracking data for a list of metrics.

func (*SnowthClient) RebuildActivityContext

func (sc *SnowthClient) RebuildActivityContext(ctx context.Context,
	node *SnowthNode,
	rebuildRequest []RebuildActivityRequest,
) (*IRONdbPutResponse, error)

RebuildActivityContext is the context aware version of RebuildActivity.

func (*SnowthClient) Retries

func (sc *SnowthClient) Retries() int64

Retries gets the number of retries a SnowthClient will attempt when errors other than connection errors occur with a snowth node. Retires will repeat the request with exponential backoff until this number of retries is reached.

func (*SnowthClient) SetConnectRetries

func (sc *SnowthClient) SetConnectRetries(num int64)

SetConnectRetries sets the number of retries a SnowthClient will attempt when connection errors occur to a snowth node. When a connection error occurs the affected node will be deactivated, then a retries will happen on another node. A value of -1 will retry until no nodes are available, The watch routine can reactivate nodes that have been deactivated by retries when their connectivity is restored.

func (*SnowthClient) SetLog

func (sc *SnowthClient) SetLog(log Logger)

SetLog assigns a logger to the snowth client.

func (*SnowthClient) SetRequestFunc

func (sc *SnowthClient) SetRequestFunc(f func(r *http.Request) error)

SetRequestFunc sets an optional middleware function that is used to modify the HTTP request before it is used by SnowthClient to connect with IRONdb. Tracing headers or other context information provided by the user of this library can be added by this function.

func (*SnowthClient) SetRetries

func (sc *SnowthClient) SetRetries(num int64)

SetRetries sets the number of retries a SnowthClient will attempt when errors other than connection errors occur with a snowth node. Retires will repeat the request with exponential backoff until this number of retries is reached.

func (*SnowthClient) SetWatchInterval

func (sc *SnowthClient) SetWatchInterval(d time.Duration)

SetWatchInterval sets the interval at which the watch process executes.

func (*SnowthClient) Topology

func (sc *SnowthClient) Topology() (*Topology, error)

Topology returns the currently active topology.

func (*SnowthClient) UpdateCheckTags

func (sc *SnowthClient) UpdateCheckTags(checkUUID string,
	tags []string, nodes ...*SnowthNode,
) (int64, error)

UpdateCheckTags adds and removes tags for a specified check. DANGER: Ths function should not be used to set IRONdb check tags independently of the Circonus API. Doing so could result in tag data corruption, and malfunctioning metric searches.

func (*SnowthClient) UpdateCheckTagsContext

func (sc *SnowthClient) UpdateCheckTagsContext(ctx context.Context,
	checkUUID string, tags []string, nodes ...*SnowthNode,
) (int64, error)

UpdateCheckTagsContext is the context aware version of UpdateCheckTags.

func (*SnowthClient) WatchAndUpdate

func (sc *SnowthClient) WatchAndUpdate(ctx context.Context)

WatchAndUpdate watches gossip data for all nodes, and move the nodes to the active or inactive pools as required. It returns a function to cancel the operation if needed. It accepts a context value as an argument which will also cancel the operation if the context is cancelled or expired. If context cancellation is not needed, nil can be passed as the argument.

func (*SnowthClient) WriteHistogram

func (sc *SnowthClient) WriteHistogram(data []HistogramData,
	nodes ...*SnowthNode,
) error

WriteHistogram sends a list of histogram data values to be written to an IRONdb node.

func (*SnowthClient) WriteHistogramContext

func (sc *SnowthClient) WriteHistogramContext(ctx context.Context,
	data []HistogramData, nodes ...*SnowthNode,
) error

WriteHistogramContext is the context aware version of WriteHistogram.

func (*SnowthClient) WriteNNT

func (sc *SnowthClient) WriteNNT(data []NNTData, nodes ...*SnowthNode) error

WriteNNT writes NNT data to a node.

func (*SnowthClient) WriteNNTBSFlatbuffer

func (sc *SnowthClient) WriteNNTBSFlatbuffer(merge *nntbs.NNTMergeT,
	builder *flatbuffers.Builder, nodes ...*SnowthNode,
) error

WriteNNTBSFlatbuffer writes flatbuffer format NNTBS data to an IRONdb node.

func (*SnowthClient) WriteNNTBSFlatbufferContext

func (sc *SnowthClient) WriteNNTBSFlatbufferContext(ctx context.Context,
	merge *nntbs.NNTMergeT, builder *flatbuffers.Builder,
	nodes ...*SnowthNode,
) error

WriteNNTBSFlatbufferContext is the context aware version of WriteNNTBSFlatbuffer.

func (*SnowthClient) WriteNNTContext

func (sc *SnowthClient) WriteNNTContext(ctx context.Context,
	data []NNTData, nodes ...*SnowthNode,
) error

WriteNNTContext is the context aware version of WriteNNT.

func (*SnowthClient) WriteNumeric

func (sc *SnowthClient) WriteNumeric(data []NumericWrite,
	nodes ...*SnowthNode,
) error

WriteNumeric writes numeric data to a node.

func (*SnowthClient) WriteNumericContext

func (sc *SnowthClient) WriteNumericContext(ctx context.Context,
	data []NumericWrite, nodes ...*SnowthNode,
) error

WriteNumericContext is the context aware version of WriteNumeric.

func (*SnowthClient) WriteRaw

func (sc *SnowthClient) WriteRaw(data io.Reader,
	fb bool, dataPoints uint64,
	nodes ...*SnowthNode,
) (*IRONdbPutResponse, error)

WriteRaw writes raw IRONdb data to a node.

func (*SnowthClient) WriteRawContext

func (sc *SnowthClient) WriteRawContext(ctx context.Context,
	data io.Reader, fb bool, dataPoints uint64,
	nodes ...*SnowthNode,
) (*IRONdbPutResponse, error)

WriteRawContext is the context aware version of WriteRaw.

func (*SnowthClient) WriteRawMetricList

func (sc *SnowthClient) WriteRawMetricList(metricList *noit.MetricListT,
	builder *flatbuffers.Builder,
	nodes ...*SnowthNode,
) (*IRONdbPutResponse, error)

WriteRawMetricList writes raw IRONdb data to a node with FlatBuffers.

func (*SnowthClient) WriteRawMetricListContext

func (sc *SnowthClient) WriteRawMetricListContext(ctx context.Context,
	metricList *noit.MetricListT, builder *flatbuffers.Builder,
	nodes ...*SnowthNode,
) (*IRONdbPutResponse, error)

WriteRawMetricListContext is the context aware version of WriteRawMetricList.

func (*SnowthClient) WriteText

func (sc *SnowthClient) WriteText(data []TextData, nodes ...*SnowthNode) error

WriteText writes text data to an IRONdb node.

func (*SnowthClient) WriteTextContext

func (sc *SnowthClient) WriteTextContext(ctx context.Context,
	data []TextData, nodes ...*SnowthNode,
) error

WriteTextContext is the context aware version of WriteText.

type SnowthNode

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

SnowthNode values represent a snowth node. An IRONdb cluster consists of several nodes. A SnowthNode has a URL to the API of that Node, an identifier, and a current topology. The identifier is how the node is identified within the cluster, and the topology is the current topology that the node falls within. A topology is a set of nodes that distribute data amongst each other.

func (*SnowthNode) GetCurrentTopology

func (sn *SnowthNode) GetCurrentTopology() string

GetCurrentTopology return the hash string representation of the node's current topology.

func (*SnowthNode) GetURL

func (sn *SnowthNode) GetURL() *url.URL

GetURL returns the *url.URL for a given SnowthNode. This is useful if you need the raw connection string of a given snowth node, such as when making a proxy for a snowth node.

func (*SnowthNode) SemVer

func (sn *SnowthNode) SemVer() string

SemVer returns a string containing the semantic version of IRONdb the node is currently running.

type Stats

type Stats map[string]interface{}

Stats values represent a collection of metric data describing the status of an IRONdb node.

func (*Stats) CurrentTopology

func (ns *Stats) CurrentTopology() string

CurrentTopology returns the current topology string value from a node state value.

func (*Stats) Identity

func (ns *Stats) Identity() string

Identity returns the identity string value from a node state value.

func (*Stats) NextTopology

func (ns *Stats) NextTopology() string

NextTopology returns the next topology string value from a node state value.

func (*Stats) SemVer

func (ns *Stats) SemVer() string

SemVer returns the semantic version string value from a node state value.

type Tag

type Tag struct {
	Category string
	Value    string
}

Tag values represent stream or measurment tags.

type TextData

type TextData struct {
	Metric string `json:"metric"`
	ID     string `json:"id"`
	Offset string `json:"offset"`
	Value  string `json:"value"`
}

TextData values represent text data to be written to IRONdb.

type TextValue

type TextValue struct {
	Time  time.Time
	Value *string
}

TextValue values represent text data read from IRONdb.

type TextValueResponse

type TextValueResponse []TextValue

TextValueResponse values represent text data responses.

func (*TextValueResponse) UnmarshalJSON

func (tvr *TextValueResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a JSON format byte slice into a TextValueResponse.

type TopoSide

type TopoSide uint8

TopoSide represent the (both = 0, a = 1, b = 2) side of a snowth ring.

func (TopoSide) MarshalXMLAttr

func (i TopoSide) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr handle side integral to enum transformation.

func (*TopoSide) UnmarshalXMLAttr

func (i *TopoSide) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr handle side enum to integral transformation.

type Topology

type Topology struct {
	XMLName        xml.Name `xml:"nodes" json:"-"`
	OldWriteCopies uint8    `xml:"n,attr" json:"-"`
	WriteCopies    uint8    `xml:"write_copies,attr" json:"-"`

	Hash  string         `xml:"-"`
	Nodes []TopologyNode `xml:"node"`
	// contains filtered or unexported fields
}

Topology values represent IRONdb topology structure.

func TopologyLoadXML

func TopologyLoadXML(xml string) (*Topology, error)

TopologyLoadXML creates a new Topology directly from an XML buffer.

func (*Topology) Find

func (topo *Topology) Find(s string) ([]TopologyNode, error)

Find finds topo.WriteCopies nodes on which s lives.

func (*Topology) FindMetric

func (topo *Topology) FindMetric(uuid, metric string) ([]TopologyNode, error)

FindMetric finds topo.WriteCopies nodes on which uuid-metric lives.

func (*Topology) FindMetricN

func (topo *Topology) FindMetricN(uuid, metric string, n int) ([]TopologyNode, error)

FindMetricN finds n nodes on which uuid-metric lives.

func (*Topology) FindMetricNodeIDs

func (topo *Topology) FindMetricNodeIDs(uuid, metric string) ([]string, error)

FindMetricNodeIDs finds topo.WriteCopies nodes on which uuid-metric lives.

func (*Topology) FindN

func (topo *Topology) FindN(s string, n int) ([]TopologyNode, error)

FindN finds n nodes on which s lives.

func (*Topology) Len

func (topo *Topology) Len() int

func (*Topology) Less

func (topo *Topology) Less(i, j int) bool

func (*Topology) Swap

func (topo *Topology) Swap(i, j int)

type TopologyNode

type TopologyNode struct {
	XMLName     xml.Name `xml:"node" json:"-"`
	ID          string   `xml:"id,attr" json:"id"`
	Address     string   `xml:"address,attr" json:"address"`
	Port        uint16   `xml:"port,attr" json:"port"`
	APIPort     uint16   `xml:"apiport,attr" json:"apiport"`
	Weight      uint16   `xml:"weight,attr" json:"weight"`
	Side        TopoSide `xml:"side,attr" json:"side"`
	WriteCopies uint8    `xml:"-" json:"n"`
}

TopologyNode represent a node in the IRONdb topology structure.

Directories

Path Synopsis
Package main contains code demonstrating how to use the gosnowth client library for various operations.
Package main contains code demonstrating how to use the gosnowth client library for various operations.
fb

Jump to

Keyboard shortcuts

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