metrics

package
v1.1.0-beta2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Gauge = iota
	Availability
	Counter
	Generic
)
View Source
const (
	// ASC Ascending
	ASC = iota
	// DESC Descending
	DESC
)

Variables

This section is empty.

Functions

func ConvertToFloat64

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

ConvertToFloat64 Return float64 from most numeric types

func UnixMilli

func UnixMilli(t time.Time) int64

UnixMilli Returns milliseconds since epoch

Types

type Bucketpoint

type Bucketpoint struct {
	Start       int64        `json:"start"`
	End         int64        `json:"end"`
	Min         float64      `json:"min"`
	Max         float64      `json:"max"`
	Avg         float64      `json:"avg"`
	Median      float64      `json:"median"`
	Empty       bool         `json:"empty"`
	Samples     int64        `json:"samples"`
	Percentiles []Percentile `json:"percentiles"`
}

Bucketpoint Return structure for bucketed data

type Client

type Client struct {
	Tenant string

	Token string
	// contains filtered or unexported fields
}

Client HawkularClient's data structure

func NewHawkularClient

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

NewHawkularClient Initialization

func (*Client) Close

func (c *Client) Close()

Close Safely close the Hawkular-Metrics client and flush remaining work

func (*Client) Create

func (c *Client) Create(md MetricDefinition, o ...Modifier) (bool, error)

Create Creates new metric Definition

func (*Client) Definition

func (c *Client) Definition(t MetricType, id string, o ...Modifier) (*MetricDefinition, error)

Definition Return a single definition

func (*Client) Definitions

func (c *Client) Definitions(o ...Modifier) ([]*MetricDefinition, error)

Definitions Fetch metric definitions

func (*Client) DeleteTags

func (c *Client) DeleteTags(t MetricType, id string, tags map[string]string, o ...Modifier) error

DeleteTags Delete given tags from the definition

func (*Client) ReadBuckets

func (c *Client) ReadBuckets(t MetricType, o ...Modifier) ([]*Bucketpoint, error)

ReadBuckets Read datapoints from the server with in buckets (aggregates)

func (*Client) ReadMetric added in v0.18.1

func (c *Client) ReadMetric(t MetricType, id string, o ...Modifier) ([]*Datapoint, error)

ReadMetric Read metric datapoints from the server

func (*Client) Send added in v0.18.1

func (c *Client) Send(o ...Modifier) (*http.Response, error)

Send Sends a constructed request to the Hawkular-Metrics server

func (*Client) Tags

func (c *Client) Tags(t MetricType, id string, o ...Modifier) (map[string]string, error)

Tags Fetch metric definition's tags

func (*Client) UpdateTags

func (c *Client) UpdateTags(t MetricType, id string, tags map[string]string, o ...Modifier) error

UpdateTags Update tags of a metric (or create if not existing)

func (*Client) Url added in v0.18.1

func (c *Client) Url(method string, e ...Endpoint) Modifier

URL Set the request URL

func (*Client) Write

func (c *Client) Write(metrics []MetricHeader, o ...Modifier) error

Write Write datapoints to the server

type Datapoint

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

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

type Endpoint added in v0.18.1

type Endpoint func(u *url.URL)

Endpoint Endpoint type to define request URL

func DataEndpoint added in v0.18.1

func DataEndpoint() Endpoint

DataEndpoint URL endpoint for inserting / requesting datapoints

func SingleMetricEndpoint added in v0.18.1

func SingleMetricEndpoint(id string) Endpoint

SingleMetricEndpoint URL endpoint for requesting single metricID

func TagEndpoint added in v0.18.1

func TagEndpoint() Endpoint

TagEndpoint URL endpoint to check tags information

func TagsEndpoint added in v0.18.1

func TagsEndpoint(tags map[string]string) Endpoint

TagsEndpoint URL endpoint which adds tags query

func TypeEndpoint added in v0.18.1

func TypeEndpoint(t MetricType) Endpoint

TypeEndpoint URL endpoint setting metricType

type Filter added in v0.18.1

type Filter func(r *http.Request)

Filter Filter type for querying

func BucketsFilter added in v0.18.1

func BucketsFilter(buckets int) Filter

BucketsFilter Query parameter to define amount of buckets

func EndTimeFilter added in v0.18.1

func EndTimeFilter(endTime time.Time) Filter

EndTimeFilter Query parameter to filter with end time

func IdFilter added in v0.18.1

func IdFilter(regexp string) Filter

IdFilter Query parameter to add filtering by id name

func LimitFilter

func LimitFilter(limit int) Filter

LimitFilter Query parameter to limit result count

func OrderFilter

func OrderFilter(order Order) Filter

OrderFilter Query parameter to define the ordering of datapoints

func Param added in v0.18.1

func Param(k string, v string) Filter

Param Add query parameters

func PercentilesFilter

func PercentilesFilter(percentiles []float64) Filter

PercentilesFilter Query parameter to define the requested percentiles

func StackedFilter

func StackedFilter() Filter

StackedFilter Force downsampling of stacked return values

func StartFromBeginningFilter

func StartFromBeginningFilter() Filter

StartFromBeginningFilter Return data from the oldest stored datapoint

func StartTimeFilter added in v0.18.1

func StartTimeFilter(startTime time.Time) Filter

StartTimeFilter Query parameter to filter with start time

func TagsFilter added in v0.18.1

func TagsFilter(t map[string]string) Filter

TagsFilter Query parameter filtering with tags

func TypeFilter added in v0.18.1

func TypeFilter(t MetricType) Filter

TypeFilter Query parameter filtering with type

type HawkularClient added in v0.18.1

type HawkularClient interface {
	Send(*http.Request) (*http.Response, error)
}

HawkularClient HawkularClient base type to define available functions..

type HawkularClientError

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

HawkularClientError Extracted error information from Hawkular-Metrics server

func (*HawkularClientError) Error

func (c *HawkularClientError) Error() string

type HawkularError

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

HawkularError Return payload from Hawkular-Metrics if processing failed

type MetricDefinition

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

type MetricHeader

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

type MetricType

type MetricType int

MetricType restrictions

func (MetricType) MarshalJSON added in v0.18.1

func (mt MetricType) MarshalJSON() ([]byte, error)

MarshalJSON Custom marshaller for MetricType

func (MetricType) String

func (mt MetricType) String() string

String Get string representation of type

func (*MetricType) UnmarshalJSON added in v0.18.1

func (mt *MetricType) UnmarshalJSON(b []byte) error

UnmarshalJSON Custom unmarshaller for MetricType

type Modifier added in v0.18.1

type Modifier func(*http.Request) error

Modifier Modifiers base type

func Data added in v0.18.1

func Data(data interface{}) Modifier

Data Add payload to the request

func Filters added in v0.18.1

func Filters(f ...Filter) Modifier

Filters Multiple Filter types to execute

func Tenant added in v0.18.1

func Tenant(tenant string) Modifier

Tenant Override function to replace the Tenant (defaults to Client default)

type Order

type Order int

Order Basetype for selecting the sorting of datapoints

func (Order) String

func (o Order) String() string

String Get string representation of type

type Parameters

type Parameters struct {
	Tenant      string // Technically optional, but requires setting Tenant() option everytime
	Url         string
	TLSConfig   *tls.Config
	Token       string
	Concurrency int
}

Parameters Initialization parameters to the client

type Percentile

type Percentile struct {
	Quantile float64 `json:"quantile"`
	Value    float64 `json:"value"`
}

Percentile Hawkular-Metrics calculated percentiles representation

Jump to

Keyboard shortcuts

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