metrics

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Gauge = iota
	Availability
	Counter
	Generic
)

Variables

This section is empty.

Functions

func ConvertToFloat64

func ConvertToFloat64(v interface{}) (float64, error)

func UnixMilli

func UnixMilli(t time.Time) int64

Returns milliseconds since epoch

Types

type Client

type Client struct {
	Tenant string
	// contains filtered or unexported fields
}

func NewHawkularClient

func NewHawkularClient(p Parameters) (*Client, error)

func (*Client) Create

func (self *Client) Create(md MetricDefinition) (bool, error)

Creates a new metric, and returns true if creation succeeded, false if not (metric was already created). err is returned only in case of another error than 'metric already created'

func (*Client) Definition

func (self *Client) Definition(t MetricType, id string) (*MetricDefinition, error)

Return a single definition

func (*Client) Definitions

func (self *Client) Definitions(t MetricType) ([]*MetricDefinition, error)

Fetch metric definitions for one metric type

func (*Client) DeleteTags

func (self *Client) DeleteTags(t MetricType, id_str string, deleted map[string]string) error

Delete given tags from the definition

func (*Client) PushSingleGaugeMetric

func (self *Client) PushSingleGaugeMetric(id string, m Datapoint) error

Take input of single Metric instance. If Timestamp is not defined, use current time

func (*Client) SingleGaugeMetric

func (self *Client) SingleGaugeMetric(id string, options map[string]string) ([]*Datapoint, error)

Read single Gauge metric's datapoints. TODO: Remove and replace with better Read properties? Perhaps with iterators?

func (*Client) Tags

func (self *Client) Tags(t MetricType, id string) (*map[string]string, error)

Fetch metric definition tags

func (*Client) UpdateTags

func (self *Client) UpdateTags(t MetricType, id string, tags map[string]string) error

Replace metric definition tags TODO: Should this be "ReplaceTags" etc?

func (*Client) Write

func (self *Client) Write(metrics []MetricHeader) error

Write using mixedmultimetrics For now supports only single metricType per request

type Datapoint

type Datapoint struct {
	Timestamp int64             `json:"timestamp"`
	Value     interface{}       `json:"value"`
	Tags      map[string]string `json:"tags,omitempty"`
}

Value should be convertible to float64 for numeric values Timestamp is milliseconds since epoch

type HawkularClientError

type HawkularClientError struct {
	Code int
	// contains filtered or unexported fields
}

func (*HawkularClientError) Error

func (self *HawkularClientError) Error() string

type HawkularError

type HawkularError struct {
	ErrorMsg string `json:"errorMsg"`
}

type MetricDefinition

type MetricDefinition struct {
	Type          MetricType        `json:"-"`
	Id            string            `json:"id"`
	Tags          map[string]string `json:"tags,omitempty"`
	RetentionTime int               `json:"dataRetention,omitempty"`
}

type MetricHeader

type MetricHeader struct {
	Type MetricType  `json:"-"`
	Id   string      `json:"id"`
	Data []Datapoint `json:"data"`
}

type MetricType

type MetricType int

MetricType restrictions

func (MetricType) String

func (self MetricType) String() string

type Parameters

type Parameters struct {
	Tenant string
	Host   string
	Path   string // Optional
}

Jump to

Keyboard shortcuts

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