heroic

package
v0.0.0-...-dc9f2f5 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultURL is the default host to use when none is given.
	DefaultURL = "http://localhost"

	// DefaultPort is the default host to use when none is given.
	DefaultPort = 8080
)
View Source
const (
	Milliseconds = TimeUnit("MILLISECONDS")
	Seconds      = TimeUnit("SECONDS")
	Minutes      = TimeUnit("MINUTES")
	Hours        = TimeUnit("HOURS")
	Days         = TimeUnit("DAYS")
	Weeks        = TimeUnit("WEEKS")
	Months       = TimeUnit("MONTHS")
)
View Source
const (
	Absolute = TimeRangeType("absolute")
	Relative = TimeRangeType("relative")
)
View Source
const (
	// sampling
	Min     = AggregationType("min")
	Max     = AggregationType("max")
	Average = AggregationType("average")
	Sum     = AggregationType("sum")

	// chaining
	Chain = AggregationType("chain")

	// grouping
	Group = AggregationType("group")

	// filtering
	TopK    = AggregationType("topk")
	BottomK = AggregationType("bottomk")
	AboveK  = AggregationType("abovek")
	BelowK  = AggregationType("belowk")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AbsoluteTimeRange

type AbsoluteTimeRange struct {
	Type  TimeRangeType `json:"type,omitempty"`
	Start int64         `json:"start"`
	End   int64         `json:"end"`
}

type Aggregation

type Aggregation interface{}

type AggregationType

type AggregationType string

type Backend

type Backend struct {
	*Status
}

type ChainingAggregation

type ChainingAggregation struct {
	Type  AggregationType `json:"type"`
	Chain []Aggregation   `json:"chain"`
}

type Client

type Client struct {
	// Base URL for API requests. Must include a trailing slash.
	BaseURL *url.URL
	// contains filtered or unexported fields
}

Client is a heroic client

func NewClient

func NewClient(baseURL *url.URL, httpClient *http.Client, clientId *string) *Client

NewClient returns a new heroic client with the given baseURL and httpClient. If no baseURL is provided, the DefaultURL and DefaultPort will be used. If no httpClient is provided, the http.DefaultClient will be used. If clientId provided it will be send as the X-Client-Id header.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlstr string, body interface{}) (*http.Request, error)

func (*Client) QueryMetrics

func (c *Client) QueryMetrics(ctx context.Context, query *QueryMetricsRequest) (*QueryMetricsResponse, error)

func (*Client) Status

func (c *Client) Status(ctx context.Context) (*StatusResponse, error)

type Cluster

type Cluster struct {
	*Status
}

type Consumer

type Consumer struct {
	*Status
	Errors           int64 `json:"errors"`
	ConsumingThreads int64 `json:"consumingThreads"`
	TotalThreads     int64 `json:"totalThreads"`
}

type Filter

type Filter []interface{}

type FilteringAggregation

type FilteringAggregation struct {
	Type AggregationType `json:"type"`
	K    int             `json:"k"`
}

type GroupingAggregation

type GroupingAggregation struct {
	Type AggregationType `json:"type"`
	Of   []string        `json:"of"`
	Each Aggregation     `json:"each"`
}

type MetadataBackend

type MetadataBackend struct {
	*Status
}

type NodeError

type NodeError struct {
	Type   string            `json:"type"`
	Error  string            `json:"error"`
	NodeID string            `json:"nodeId"`
	Node   string            `json:"node"`
	Tags   map[string]string `json:"tags"`
}

type QueryError

type QueryError struct {
	Type  string `json:"type"`
	Error string `json:"error"`
}

type QueryMetricsRequest

type QueryMetricsRequest struct {
	Range       TimeRange   `json:"range"`
	Filter      Filter      `json:"filter"`
	Aggregation Aggregation `json:"aggregation"`
}

type QueryMetricsResponse

type QueryMetricsResponse struct {
	Range      AbsoluteTimeRange    `json:"range"`
	Errors     []RequestError       `json:"errors"`
	Result     []ShardedResultGroup `json:"result"`
	Statistics Statistics           `json:"statistics"`
}

type RelativeTimeRange

type RelativeTimeRange struct {
	Type  TimeRangeType `json:"type"`
	Unit  TimeUnit      `json:"unit"`
	Value int           `json:"value"`
}

type RequestError

type RequestError struct {
	Type string `json:"type"`
}

type Sample

type Sample struct {
	Unit   TimeUnit `json:"unit"`
	Value  int      `json:"value"`
	Size   int      `json:"size,omitempty"`
	Extent int      `json:"extent,omitempty"`
}

type SamplingAggregation

type SamplingAggregation struct {
	Type     AggregationType `json:"type"`
	Sampling Sample          `json:"sampling"`
}

type ServiceInfo

type ServiceInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Id      string `json:"id"`
}

type ShardError

type ShardError struct {
	Type  string            `json:"type"`
	Error string            `json:"error"`
	Nodes []string          `json:"nodes"`
	Shard map[string]string `json:"shard"`
}

type ShardedResultGroup

type ShardedResultGroup struct {
	Type      string            `json:"type"`
	Hash      string            `json:"hash"`
	Shard     map[string]string `json:"shard"`
	Cadence   int64             `json:"cadence"`
	Values    [][]interface{}   `json:"values"`
	Tags      map[string]string `json:"tags"`
	TagCounts map[string]int    `json:"tagCounts"`
}

type Statistics

type Statistics struct {
	Counters map[string]int `json:"counters"`
}

type Status

type Status struct {
	Ok        bool `json:"ok"`
	Available int  `json:"available"`
	Ready     int  `json:"ready"`
}

type StatusResponse

type StatusResponse struct {
	Ok               bool            `json:"ok"`
	Service          ServiceInfo     `json:"service"`
	Consumers        Consumer        `json:"consumers"`
	Backends         Backend         `json:"backends"`
	MetadataBackends MetadataBackend `json:"metadataBackends"`
	Cluster          Cluster         `json:"cluster"`
}

type TimeRange

type TimeRange interface{}

type TimeRangeType

type TimeRangeType string

type TimeUnit

type TimeUnit string

Jump to

Keyboard shortcuts

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