redis_timeseries_go

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

license CircleCI GitHub issues Codecov GoDoc

redistimeseries-go

Forum Gitter

Go client for RedisTimeSeries (https://github.com/RedisTimeSeries/redistimeseries), based on redigo.

Client and ConnPool based on the work of dvirsky and mnunberg on https://github.com/RediSearch/redisearch-go

Installing

$ go get github.com/RedisTimeSeries/redistimeseries-go

Running tests

A simple test suite is provided, and can be run with:

$ go test

The tests expect a Redis server with the RedisTimeSeries module loaded to be available at localhost:6379

Example Code

package main 

import (
        "fmt"
        redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
)

func main() {
		// Connect to localhost with no password
        var client = redistimeseries.NewClient("localhost:6379", "nohelp", nil)
        var keyname = "mytest"
        _, haveit := client.Info(keyname)
        if haveit != nil {
			client.CreateKeyWithOptions(keyname, redistimeseries.DefaultCreateOptions)
			client.CreateKeyWithOptions(keyname+"_avg", redistimeseries.DefaultCreateOptions)
			client.CreateRule(keyname, redistimeseries.AvgAggregation, 60, keyname+"_avg")
        }
		// Add sample with timestamp from server time and value 100
        // TS.ADD mytest * 100 
        _, err := client.AddAutoTs(keyname, 100)
        if err != nil {
                fmt.Println("Error:", err)
        }
}

Supported RedisTimeSeries Commands

Command Recommended API and godoc
TS.CREATE CreateKeyWithOptions
TS.ALTER AlterKeyWithOptions
TS.ADD
TS.MADD MultiAdd
TS.INCRBY/TS.DECRBY IncrBy / DecrBy
TS.CREATERULE CreateRule
TS.DELETERULE DeleteRule
TS.RANGE RangeWithOptions
TS.REVRANGE ReverseRangeWithOptions
TS.MRANGE MultiRangeWithOptions
TS.MREVRANGE MultiReverseRangeWithOptions
TS.GET Get
TS.MGET
TS.INFO Info
TS.QUERYINDEX QueryIndex

License

redistimeseries-go is distributed under the Apache-2 license - see LICENSE

Documentation

Index

Examples

Constants

View Source
const TimeRangeFull = int64(-1)
View Source
const TimeRangeMaximum = math.MaxInt64
View Source
const TimeRangeMinimum = 0

Variables

View Source
var DefaultCreateOptions = CreateOptions{
	Uncompressed:   false,
	RetentionMSecs: 0,
	Labels:         map[string]string{},
}
View Source
var DefaultMultiGetOptions = MultiGetOptions{
	WithLabels: false,
}

MultiGetOptions are the default options for querying across multiple time-series

View Source
var DefaultMultiRangeOptions = MultiRangeOptions{
	AggType:    "",
	TimeBucket: -1,
	Count:      -1,
	WithLabels: false,
}

MultiRangeOptions are the default options for querying across multiple time-series

View Source
var DefaultRangeOptions = *NewRangeOptions()

DefaultRangeOptions are the default options for querying across a time-series range

Functions

func AddCounterArgs added in v1.3.0

func AddCounterArgs(key string, timestamp int64, value float64, options CreateOptions) (redis.Args, error)

Add counter args for command TS.INCRBY/TS.DECRBY

func MakeStringPtr

func MakeStringPtr(s string) *string

Helper function to create a string pointer from a string literal. Useful for calls to NewClient with an auth pass that is known at compile time.

func ParseLabels added in v1.2.0

func ParseLabels(res interface{}) (labels map[string]string, err error)

Types

type AggregationType

type AggregationType string
const (
	AvgAggregation   AggregationType = "AVG"
	SumAggregation   AggregationType = "SUM"
	MinAggregation   AggregationType = "MIN"
	MaxAggregation   AggregationType = "MAX"
	CountAggregation AggregationType = "COUNT"
	FirstAggregation AggregationType = "FIRST"
	LastAggregation  AggregationType = "LAST"
	StdPAggregation  AggregationType = "STD.P"
	StdSAggregation  AggregationType = "STD.S"
	VarPAggregation  AggregationType = "VAR.P"
	VarSAggregation  AggregationType = "VAR.S"
)

type Client

type Client struct {
	Pool ConnPool
	Name string
}

Client is an interface to time series redis commands

func NewClient

func NewClient(addr, name string, authPass *string) *Client

NewClient creates a new client connecting to the redis host, and using the given name as key prefix. Addr can be a single host:port pair, or a comma separated list of host:port,host:port... In the case of multiple hosts we create a multi-pool and select connections at random

func NewClientFromPool added in v1.3.0

func NewClientFromPool(pool *redis.Pool, name string) *Client

NewClientFromPool creates a new Client with the given pool and client name

Example

exemplifies the NewClientFromPool function

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")
	client.Add("ts", 1, 5)
	datapoints, _ := client.RangeWithOptions("ts", 0, 1000, redistimeseries.DefaultRangeOptions)
	fmt.Println(datapoints[0])
}
Output:

{1 5}

func (*Client) Add

func (client *Client) Add(key string, timestamp int64, value float64) (storedTimestamp int64, err error)

Add - Append (or create and append) a new sample to the series args: key - time series key name timestamp - time of value value - value

func (*Client) AddAutoTs added in v1.2.0

func (client *Client) AddAutoTs(key string, value float64) (storedTimestamp int64, err error)

AddAutoTs - Append (or create and append) a new sample to the series, with DB automatic timestamp (using the system clock) args: key - time series key name value - value

func (*Client) AddAutoTsWithOptions added in v1.2.0

func (client *Client) AddAutoTsWithOptions(key string, value float64, options CreateOptions) (storedTimestamp int64, err error)

AddAutoTsWithOptions - Append (or create and append) a new sample to the series, with the specified CreateOptions and DB automatic timestamp (using the system clock) args: key - time series key name value - value options - define options for create key on add

func (*Client) AddWithOptions added in v0.3.0

func (client *Client) AddWithOptions(key string, timestamp int64, value float64, options CreateOptions) (storedTimestamp int64, err error)

AddWithOptions - Append (or create and append) a new sample to the series, with the specified CreateOptions args: key - time series key name timestamp - time of value value - value options - define options for create key on add

func (*Client) AddWithRetention added in v0.3.0

func (client *Client) AddWithRetention(key string, timestamp int64, value float64, duration int64) (storedTimestamp int64, err error)

AddWithRetention - append a new value to the series with a duration args: key - time series key name timestamp - time of value value - value duration - value Deprecated: This function has been deprecated, use AddWithOptions instead

func (*Client) AggMultiRange added in v0.3.0

func (client *Client) AggMultiRange(fromTimestamp int64, toTimestamp int64, aggType AggregationType,
	bucketSizeSec int, filters ...string) (ranges []Range, err error)

AggMultiRange - Query a timestamp range across multiple time-series by filters. args: fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. aggType - aggregation type bucketSizeSec - time bucket for aggregation filters - list of filters e.g. "a=bb", "b!=aa" Deprecated: This function has been deprecated, use MultiRangeWithOptions instead

func (*Client) AggRange

func (client *Client) AggRange(key string, fromTimestamp int64, toTimestamp int64, aggType AggregationType,
	bucketSizeSec int) (dataPoints []DataPoint, err error)

AggRange - aggregation over a ranged query args: key - time series key name fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. aggType - aggregation type bucketSizeSec - time bucket for aggregation Deprecated: This function has been deprecated, use RangeWithOptions instead

func (*Client) AlterKeyWithOptions added in v1.3.0

func (client *Client) AlterKeyWithOptions(key string, options CreateOptions) (err error)

Update the retention, labels of an existing key. The parameters are the same as TS.CREATE.

func (*Client) CreateKey

func (client *Client) CreateKey(key string, retentionTime time.Duration) (err error)

CreateKey create a new time-series Deprecated: This function has been deprecated, use CreateKeyWithOptions instead

func (*Client) CreateKeyWithOptions added in v0.3.0

func (client *Client) CreateKeyWithOptions(key string, options CreateOptions) (err error)

func (*Client) CreateRule

func (client *Client) CreateRule(sourceKey string, aggType AggregationType, bucketSizeMSec uint, destinationKey string) (err error)

CreateRule - create a compaction rule args: sourceKey - key name for source time series aggType - AggregationType bucketSizeMSec - Time bucket for aggregation in milliseconds destinationKey - key name for destination time series

func (*Client) DecrBy added in v1.3.0

func (client *Client) DecrBy(key string, timestamp int64, value float64, options CreateOptions) (int64, error)

Creates a new sample that decrements the latest sample's value

func (*Client) DeleteRule

func (client *Client) DeleteRule(sourceKey string, destinationKey string) (err error)

DeleteRule - delete a compaction rule args: sourceKey - key name for source time series destinationKey - key name for destination time series

func (*Client) Get added in v1.2.0

func (client *Client) Get(key string) (dataPoint *DataPoint,
	err error)

Get - Get the last sample of a time-series. args: key - time-series key name

func (*Client) IncrBy added in v1.3.0

func (client *Client) IncrBy(key string, timestamp int64, value float64, options CreateOptions) (int64, error)

Creates a new sample that increments the latest sample's value

func (*Client) Info

func (client *Client) Info(key string) (res KeyInfo, err error)

Returns information and statistics on the time-series. args: key - time-series key name

func (*Client) MultiAdd added in v1.3.0

func (client *Client) MultiAdd(samples ...Sample) (timestamps []interface{}, err error)

Append new samples to a list of series.

Example

Exemplifies the usage of MultiAdd.

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
	"log"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")

	labels1 := map[string]string{
		"machine": "machine-1",
		"az":      "us-east-1",
	}
	labels2 := map[string]string{
		"machine": "machine-2",
		"az":      "us-east-1",
	}

	err := client.CreateKeyWithOptions("timeserie-1", redistimeseries.CreateOptions{Labels: labels1})
	if err != nil {
		log.Fatal(err)
	}
	err = client.CreateKeyWithOptions("timeserie-2", redistimeseries.CreateOptions{Labels: labels2})
	if err != nil {
		log.Fatal(err)
	}

	// Adding multiple datapoints to multiple series
	datapoints := []redistimeseries.Sample{
		{"timeserie-1", redistimeseries.DataPoint{1, 10.5}},
		{"timeserie-1", redistimeseries.DataPoint{2, 40.5}},
		{"timeserie-2", redistimeseries.DataPoint{1, 60.5}},
	}
	timestamps, err := client.MultiAdd(datapoints...)

	fmt.Println(fmt.Sprintf("Example adding multiple datapoints to multiple series. Added timestamps: %v", timestamps))

	// Adding multiple datapoints to the same serie
	datapointsSameSerie := []redistimeseries.Sample{
		{"timeserie-1", redistimeseries.DataPoint{3, 10.5}},
		{"timeserie-1", redistimeseries.DataPoint{4, 40.5}},
		{"timeserie-1", redistimeseries.DataPoint{5, 60.5}},
	}
	timestampsSameSerie, err := client.MultiAdd(datapointsSameSerie...)

	fmt.Println(fmt.Sprintf("Example of adding multiple datapoints to the same serie. Added timestamps: %v", timestampsSameSerie))

}
Output:

Example adding multiple datapoints to multiple series. Added timestamps: [1 2 1]
Example of adding multiple datapoints to the same serie. Added timestamps: [3 4 5]

func (*Client) MultiGet added in v1.2.0

func (client *Client) MultiGet(filters ...string) (ranges []Range, err error)

MultiGet - Get the last sample across multiple time-series, matching the specific filters. args: filters - list of filters e.g. "a=bb", "b!=aa"

func (*Client) MultiGetWithOptions added in v1.3.0

func (client *Client) MultiGetWithOptions(multiGetOptions MultiGetOptions, filters ...string) (ranges []Range, err error)

MultiGetWithOptions - Get the last samples matching the specific filters. args: multiGetOptions - MultiGetOptions options. You can use the default DefaultMultiGetOptions filters - list of filters e.g. "a=bb", "b!=aa"

Example

Exemplifies the usage of MultiGetWithOptions function while using the default MultiGetOptions and while using user defined MultiGetOptions.

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")

	labels1 := map[string]string{
		"machine": "machine-1",
		"az":      "us-east-1",
	}
	client.AddWithOptions("time-serie-1", 2, 1.0, redistimeseries.CreateOptions{Labels: labels1})
	client.Add("time-serie-1", 4, 2.0)

	labels2 := map[string]string{
		"machine": "machine-2",
		"az":      "us-east-1",
	}
	client.AddWithOptions("time-serie-2", 1, 5.0, redistimeseries.CreateOptions{Labels: labels2})
	client.Add("time-serie-2", 4, 10.0)

	ranges, _ := client.MultiGetWithOptions(redistimeseries.DefaultMultiGetOptions, "az=us-east-1")

	rangesWithLabels, _ := client.MultiGetWithOptions(*redistimeseries.NewMultiGetOptions().SetWithLabels(true), "az=us-east-1")

	fmt.Println(fmt.Sprintf("Ranges: %v", ranges))
	fmt.Println(fmt.Sprintf("Ranges with labels: %v", rangesWithLabels))

}
Output:

Ranges: [{time-serie-1 map[] [{4 2}]} {time-serie-2 map[] [{4 10}]}]
Ranges with labels: [{time-serie-1 map[az:us-east-1 machine:machine-1] [{4 2}]} {time-serie-2 map[az:us-east-1 machine:machine-2] [{4 10}]}]

func (*Client) MultiRangeWithOptions added in v1.2.0

func (client *Client) MultiRangeWithOptions(fromTimestamp int64, toTimestamp int64, mrangeOptions MultiRangeOptions, filters ...string) (ranges []Range, err error)

MultiRangeWithOptions - Query a timestamp range across multiple time-series by filters. args: fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. mrangeOptions - MultiRangeOptions options. You can use the default DefaultMultiRangeOptions filters - list of filters e.g. "a=bb", "b!=aa"

Example

Exemplifies the usage of MultiRangeWithOptions function.

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")

	labels1 := map[string]string{
		"machine": "machine-1",
		"az":      "us-east-1",
	}
	client.AddWithOptions("time-serie-1", 2, 1.0, redistimeseries.CreateOptions{Labels: labels1})
	client.Add("time-serie-1", 4, 2.0)

	labels2 := map[string]string{
		"machine": "machine-2",
		"az":      "us-east-1",
	}
	client.AddWithOptions("time-serie-2", 1, 5.0, redistimeseries.CreateOptions{Labels: labels2})
	client.Add("time-serie-2", 4, 10.0)

	ranges, _ := client.MultiRangeWithOptions(1, 10, redistimeseries.DefaultMultiRangeOptions, "az=us-east-1")

	fmt.Println(fmt.Sprintf("Ranges: %v", ranges))
}
Output:

Ranges: [{time-serie-1 map[] [{2 1} {4 2}]} {time-serie-2 map[] [{1 5} {4 10}]}]

func (*Client) MultiReverseRangeWithOptions added in v1.4.0

func (client *Client) MultiReverseRangeWithOptions(fromTimestamp int64, toTimestamp int64, mrangeOptions MultiRangeOptions, filters ...string) (ranges []Range, err error)

MultiReverseRangeWithOptions - Query a timestamp range across multiple time-series by filters, in reverse direction. args: fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. mrangeOptions - MultiRangeOptions options. You can use the default DefaultMultiRangeOptions filters - list of filters e.g. "a=bb", "b!=aa"

Example

Exemplifies the usage of MultiReverseRangeWithOptions function.

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")

	labels1 := map[string]string{
		"machine": "machine-1",
		"az":      "us-east-1",
	}
	client.AddWithOptions("time-serie-1", 2, 1.0, redistimeseries.CreateOptions{Labels: labels1})
	client.Add("time-serie-1", 4, 2.0)

	labels2 := map[string]string{
		"machine": "machine-2",
		"az":      "us-east-1",
	}
	client.AddWithOptions("time-serie-2", 1, 5.0, redistimeseries.CreateOptions{Labels: labels2})
	client.Add("time-serie-2", 4, 10.0)

	ranges, _ := client.MultiReverseRangeWithOptions(1, 10, redistimeseries.DefaultMultiRangeOptions, "az=us-east-1")

	fmt.Println(fmt.Sprintf("Ranges: %v", ranges))
}
Output:

Ranges: [{time-serie-1 map[] [{4 2} {2 1}]} {time-serie-2 map[] [{4 10} {1 5}]}]

func (*Client) QueryIndex added in v1.3.0

func (client *Client) QueryIndex(filters ...string) (keys []string, err error)

Get all the keys matching the filter list.

func (*Client) Range

func (client *Client) Range(key string, fromTimestamp int64, toTimestamp int64) (dataPoints []DataPoint, err error)

Range - ranged query args: key - time series key name fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. Deprecated: This function has been deprecated, use RangeWithOptions instead

func (*Client) RangeWithOptions added in v1.2.0

func (client *Client) RangeWithOptions(key string, fromTimestamp int64, toTimestamp int64, rangeOptions RangeOptions) (dataPoints []DataPoint, err error)

RangeWithOptions - Query a timestamp range on a specific time-series args: key - time-series key name fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. rangeOptions - RangeOptions options. You can use the default DefaultRangeOptions

Example

Exemplifies the usage of RangeWithOptions function

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")
	for ts := 1; ts < 10; ts++ {
		client.Add("ts", int64(ts), float64(ts))
	}

	datapoints, _ := client.RangeWithOptions("ts", 0, 1000, redistimeseries.DefaultRangeOptions)
	fmt.Println(fmt.Sprintf("Datapoints: %v", datapoints))
}
Output:

Datapoints: [{1 1} {2 2} {3 3} {4 4} {5 5} {6 6} {7 7} {8 8} {9 9}]

func (*Client) ReverseRangeWithOptions added in v1.4.0

func (client *Client) ReverseRangeWithOptions(key string, fromTimestamp int64, toTimestamp int64, rangeOptions RangeOptions) (dataPoints []DataPoint, err error)

ReverseRangeWithOptions - Query a timestamp range on a specific time-series in reverse order args: key - time-series key name fromTimestamp - start of range. You can use TimeRangeMinimum to express the minimum possible timestamp. toTimestamp - end of range. You can use TimeRangeFull or TimeRangeMaximum to express the maximum possible timestamp. rangeOptions - RangeOptions options. You can use the default DefaultRangeOptions

Example

Exemplifies the usage of ReverseRangeWithOptions function

package main

import (
	"fmt"
	redistimeseries "github.com/RedisTimeSeries/redistimeseries-go"
	"github.com/gomodule/redigo/redis"
)

func main() {
	host := "localhost:6379"
	password := ""
	pool := &redis.Pool{Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", host, redis.DialPassword(password))
	}}
	client := redistimeseries.NewClientFromPool(pool, "ts-client-1")
	for ts := 1; ts < 10; ts++ {
		client.Add("ts", int64(ts), float64(ts))
	}

	datapoints, _ := client.ReverseRangeWithOptions("ts", 0, 1000, redistimeseries.DefaultRangeOptions)
	fmt.Println(fmt.Sprintf("Datapoints: %v", datapoints))
}
Output:

Datapoints: [{9 9} {8 8} {7 7} {6 6} {5 5} {4 4} {3 3} {2 2} {1 1}]

type ConnPool

type ConnPool interface {
	Get() redis.Conn
	Close() error
}

type CreateOptions added in v0.3.0

type CreateOptions struct {
	Uncompressed   bool
	RetentionMSecs time.Duration
	Labels         map[string]string
}

func (*CreateOptions) Serialize added in v1.2.0

func (options *CreateOptions) Serialize(args []interface{}) (result []interface{}, err error)

Serialize options to args

type DataPoint

type DataPoint struct {
	Timestamp int64
	Value     float64
}

func NewDataPoint added in v1.2.0

func NewDataPoint(timestamp int64, value float64) *DataPoint

func ParseDataPoint added in v1.2.0

func ParseDataPoint(rawDataPoint interface{}) (dataPoint *DataPoint, err error)

func ParseDataPoints added in v1.2.0

func ParseDataPoints(info interface{}) (dataPoints []DataPoint, err error)

type KeyInfo

type KeyInfo struct {
	ChunkCount         int64
	MaxSamplesPerChunk int64
	LastTimestamp      int64
	RetentionTime      int64
	Rules              []Rule
	Labels             map[string]string
}

func ParseInfo

func ParseInfo(result interface{}, err error) (info KeyInfo, outErr error)

type MultiGetOptions added in v1.3.0

type MultiGetOptions struct {
	WithLabels bool
}

MultiGetOptions represent the options for querying across multiple time-series

func NewMultiGetOptions added in v1.3.0

func NewMultiGetOptions() *MultiGetOptions

func (*MultiGetOptions) SetWithLabels added in v1.3.0

func (mgetopts *MultiGetOptions) SetWithLabels(value bool) *MultiGetOptions

type MultiHostPool

type MultiHostPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMultiHostPool

func NewMultiHostPool(hosts []string, authPass *string) *MultiHostPool

func (*MultiHostPool) Close added in v1.3.0

func (p *MultiHostPool) Close() (err error)

func (*MultiHostPool) Get

func (p *MultiHostPool) Get() redis.Conn

type MultiRangeOptions added in v1.2.0

type MultiRangeOptions struct {
	AggType    AggregationType
	TimeBucket int
	Count      int64
	WithLabels bool
}

MultiRangeOptions represent the options for querying across multiple time-series

func NewMultiRangeOptions added in v1.2.0

func NewMultiRangeOptions() *MultiRangeOptions

func (*MultiRangeOptions) SetAggregation added in v1.2.0

func (mrangeopts *MultiRangeOptions) SetAggregation(aggType AggregationType, timeBucket int) *MultiRangeOptions

func (*MultiRangeOptions) SetCount added in v1.2.0

func (mrangeopts *MultiRangeOptions) SetCount(count int64) *MultiRangeOptions

func (*MultiRangeOptions) SetWithLabels added in v1.2.0

func (mrangeopts *MultiRangeOptions) SetWithLabels(value bool) *MultiRangeOptions

type Range added in v0.3.0

type Range struct {
	Name       string
	Labels     map[string]string
	DataPoints []DataPoint
}

func ParseRanges added in v1.2.0

func ParseRanges(info interface{}) (ranges []Range, err error)

func ParseRangesSingleDataPoint added in v1.2.0

func ParseRangesSingleDataPoint(info interface{}) (ranges []Range, err error)

type RangeOptions added in v1.2.0

type RangeOptions struct {
	AggType    AggregationType
	TimeBucket int
	Count      int64
}

MultiRangeOptions represent the options for querying across multiple time-series

func NewRangeOptions added in v1.2.0

func NewRangeOptions() *RangeOptions

func (*RangeOptions) SetAggregation added in v1.2.0

func (rangeopts *RangeOptions) SetAggregation(aggType AggregationType, timeBucket int) *RangeOptions

func (*RangeOptions) SetCount added in v1.2.0

func (rangeopts *RangeOptions) SetCount(count int64) *RangeOptions

type Rule

type Rule struct {
	DestKey       string
	BucketSizeSec int
	AggType       AggregationType
}

func ParseRules

func ParseRules(ruleInterface interface{}, err error) (rules []Rule, retErr error)

type Sample added in v1.3.0

type Sample struct {
	Key       string
	DataPoint DataPoint
}

type SingleHostPool

type SingleHostPool struct {
	*redis.Pool
}

func NewSingleHostPool

func NewSingleHostPool(host string, authPass *string) *SingleHostPool

Jump to

Keyboard shortcuts

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