tools

package
v2.18.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MetricForm string = "testMetric-"
View Source
const TagKeyForm string = "testTagKey-"
View Source
const TagValueForm string = "testTagValue-"

Variables

View Source
var Sleep2 = 3 * time.Second
View Source
var Sleep3 = 5 * time.Second
View Source
var (
	TTLKeyspaceMap = map[int]string{
		1:  "one_day",
		3:  "three_days",
		7:  "one_week",
		14: "two_weeks",
		30: "one_month",
		90: "three_months",
	}
)

Functions

func GenerateRandomName

func GenerateRandomName() string

func GetHashFromMetricAndTags

func GetHashFromMetricAndTags(metric string, tags map[string]string) string

func GetTSUIDFromPayload

func GetTSUIDFromPayload(payload *Payload, number bool) string

func GetTextHashFromMetricAndTags

func GetTextHashFromMetricAndTags(metric string, tags map[string]string) string

Types

type CassandraSettings

type CassandraSettings struct {
	Keyspace       string
	Consistency    string
	Nodes          []string
	Username       string
	Password       string
	Connections    int
	Retry          int
	DiscoverHosts  bool
	DiscoverySleep int
	PageSize       int
	Timeout        string
	ProtoVersion   int
}

CassandraSettings abstracts the configuration of a cassandra cluster

type DeleteJSON

type DeleteJSON struct {
	Query string `json:"query"`
}

type Error

type Error struct {
	Error   string `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

type Headers

type Headers struct {
	User   *User
	Header map[string]string
	Cookie *bytes.Buffer
}

type Keyspace

type Keyspace struct {
	Name              string `json:"name,omitempty"`
	Datacenter        string `json:"datacenter,omitempty"`
	ReplicationFactor int    `json:"replicationFactor,omitempty"`
	Contact           string `json:"contact,omitempty"`
	TTL               int    `json:"ttl,omitempty`
}

func (Keyspace) Marshal

func (k Keyspace) Marshal() []byte

type KeyspaceAttributes

type KeyspaceAttributes struct {
	Name               string
	Replication_factor int
	Datacenter         string
	Contact            string
}

type KeyspaceProperties

type KeyspaceProperties struct {
	Keyspace_name  string
	Durable_writes bool
	Replication    map[string]string
}

type KeyspaceResp

type KeyspaceResp struct {
	KSID string `json:"ksid"`
}

type KeyspaceUpdate

type KeyspaceUpdate struct {
	Contact string `json:"contact"`
}

func (KeyspaceUpdate) Marshal

func (k KeyspaceUpdate) Marshal() []byte

type LookupResult

type LookupResult struct {
	TSUID  string            `json:"tsuid"`
	Metric string            `json:"metric"`
	Tags   map[string]string `json:"tags"`
}

type LookupResultObject

type LookupResultObject struct {
	Type         string         `json:"type"`
	Metric       string         `json:"metric"`
	Tags         []string       `json:"tags,omitempty"`
	Limit        int            `json:"limit"`
	Time         int            `json:"time"`
	Results      []LookupResult `json:"results"`
	StartIndex   int            `json:"startIndex"`
	TotalResults int            `json:"totalResults"`
}

type MsgV2

type MsgV2 struct {
	Value     float32           `json:"value,omitempty"`
	Text      string            `json:"text,omitempty"`
	Metric    string            `json:"metric,omitempty"`
	Tags      map[string]string `json:"tags,omitempty"`
	Timestamp int64             `json:"timestamp,omitempty"`
}

type MycenaePoints

type MycenaePoints struct {
	Payload map[string]respPoints `json:"payload"`
}

type MycenaePointsText

type MycenaePointsText struct {
	Payload map[string]respPointsText `json:"payload"`
}

type PayPoints

type PayPoints struct {
	Count int             `json:"count"`
	Total int             `json:"total"`
	Ts    [][]interface{} `json:"ts"`
}

type Payload

type Payload struct {
	Value     *float32          `json:"value,omitempty"`
	Text      *string           `json:"text,omitempty"`
	Metric    string            `json:"metric"`
	Tags      map[string]string `json:"tags"`
	TagKey    string            `json:"-"`
	TagValue  string            `json:"-"`
	TagKey2   string            `json:"-"`
	TagValue2 string            `json:"-"`
	Timestamp *int64            `json:"timestamp,omitempty"`
	Random    int               `json:"-"`
	TSID      string            // to use in the tests only
}

func CreatePayload

func CreatePayload(v float32, m string, t map[string]string) Payload

func CreatePayloadTS

func CreatePayloadTS(v float32, m string, t map[string]string, ts int64) Payload

func CreateTextPayload

func CreateTextPayload(txt string, m string, t map[string]string) Payload

func CreateTextPayloadTS

func CreateTextPayloadTS(txt string, m string, t map[string]string, ts int64) Payload

func (Payload) Marshal

func (p Payload) Marshal() []byte

func (Payload) StringArray

func (p Payload) StringArray() string

type PayloadSlice

type PayloadSlice struct {
	PS []Payload
}

func (PayloadSlice) Marshal

func (p PayloadSlice) Marshal() []byte

type Point

type Point struct {
	Value     float32           `json:"value"`
	Metric    string            `json:"metric"`
	Tags      map[string]string `json:"tags"`
	Timestamp int64             `json:"timestamp"`
}

type ResponseMeta

type ResponseMeta struct {
	TotalRecord int      `json:"totalRecords"`
	Payload     []TsMeta `json:"payload"`
}

type ResponseMetricTags

type ResponseMetricTags struct {
	TotalRecords int      `json:"totalRecords,omitempty"`
	Payload      []string `json:"payload,omitempty"`
}

type ResponseQuery

type ResponseQuery struct {
	Metric  string                 `json:"metric"`
	Tags    map[string]string      `json:"tags"`
	AggTags []string               `json:"aggregateTags"`
	Tsuuids []string               `json:"tsuids"`
	Dps     map[string]interface{} `json:"dps"`
	Query   *structs.TSDBquery     `json:"query,omitempty"`
}

type RestAPISettings

type RestAPISettings struct {
	Node    string
	Port    string
	Timeout time.Duration
}

RestAPISettings abstracts the configuration of an Elastic Search cluster

type RestError

type RestError struct {
	Datapoint *MsgV2 `json:"datapoint"`
	Error     string `json:"error"`
}

type SolrDocument

type SolrDocument struct {
	ID     string            `json:"id"`
	Metric string            `json:"metric"`
	TSType string            `json:"type"`
	Tags   []SolrDocumentTag `json:"_childDocuments_"`
}

type SolrDocumentTag

type SolrDocumentTag struct {
	ID       string `json:"id"`
	TagKey   string `json:"tag_key"`
	TagValue string `json:"tag_value"`
}

type SolrResponse

type SolrResponse struct {
	Total int            `json:"numFound"`
	Docs  []SolrDocument `json:"docs"`
}

type SolrResult

type SolrResult struct {
	Response SolrResponse `json:response`
}

type TSDBfilter

type TSDBfilter struct {
	Ftype   string `json:"type"`
	Tagk    string `json:"tagk"`
	Filter  string `json:"filter"`
	GroupBy bool   `json:"groupBy"`
}

type TSDBquery

type TSDBquery struct {
	Aggregator  string            `json:"aggregator"`
	Downsample  string            `json:"downsample"`
	Metric      string            `json:"metric"`
	Tags        map[string]string `json:"tags"`
	Rate        bool              `json:"rate"`
	RateOptions TSDBrateOptions   `json:"rateOptions"`
	Order       []string          `json:"order"`
	FilterValue string            `json:"filterValue"`
	Filters     []TSDBfilter      `json:"filters"`
}

type TSDBqueryPayload

type TSDBqueryPayload struct {
	Relative string      `json:"relative"`
	Queries  []TSDBquery `json:"queries"`
}

type TSDBrateOptions

type TSDBrateOptions struct {
	Counter    bool   `json:"counter"`
	CounterMax *int64 `json:"counterMax"`
	ResetValue int64  `json:"resetValue"`
}

type TableProperties

type TableProperties struct {
	Bloom_filter_fp_chance      float64
	Caching                     map[string]string
	Comment                     string
	Compaction                  map[string]string
	Compression                 map[string]string
	Dclocal_read_repair_chance  float64
	Default_time_to_live        int
	Gc_grace_seconds            int
	Max_index_interval          int
	Memtable_flush_period_in_ms int
	Min_index_interval          int
	Read_repair_chance          float64
	Speculative_retry           string
}

type TextPoint

type TextPoint struct {
	Text      string            `json:"text"`
	Metric    string            `json:"metric"`
	Tags      map[string]string `json:"tags"`
	Timestamp int64             `json:"timestamp"`
}

type Tool

type Tool struct {
	Cassandra *cassTool
	Solr      *solrTool
	HTTP      *httpTool
	UDP       *udpTool
	Mycenae   *mycenaeTool
}

Tool is the main structure to be created from this package

func (*Tool) InitCass

func (t *Tool) InitCass(cassSet CassandraSettings)

InitCass initializes the cassandra session

func (*Tool) InitHTTP

func (t *Tool) InitHTTP(hostname string, port string, timeout time.Duration)

InitHTTP initializes the http toolkit

func (*Tool) InitMycenae

func (t *Tool) InitMycenae(mSet RestAPISettings)

InitMycenae initializes the Mycenae connection

func (*Tool) InitSolr

func (t *Tool) InitSolr(s RestAPISettings)

InitSolr initializes the Solr connection

func (*Tool) InitUDP

func (t *Tool) InitUDP(hostname string, port string)

InitUDP initializes the UDP toolkit

type TsError

type TsError struct {
	ID      string
	Error   string
	Message string
	Date    time.Time
}

type TsErrorV2

type TsErrorV2 struct {
	Metric string
	Tags   []TsTagV2 `json:"tagsError"`
}

type TsMeta

type TsMeta struct {
	TsID   string            `json:"id"`
	Metric string            `json:"metric,omitempty"`
	Tags   map[string]string `json:"tags,omitempty"`
}

type TsTagV2

type TsTagV2 struct {
	TagKey   string
	TagValue string
}

type UpdateJSON

type UpdateJSON struct {
	Delete DeleteJSON `json:"delete"`
}

type User

type User struct {
	Name     string
	PassWord string
}

Jump to

Keyboard shortcuts

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