Documentation ¶
Index ¶
- Constants
- func ConvertToFloat64(v interface{}) (float64, error)
- func FromUnixMilli(milli int64) time.Time
- func ToUnixMilli(t time.Time) int64
- func URLEscape(input string) string
- type Bucketpoint
- type Client
- func (c *Client) AllDefinitions(o ...Modifier) ([]*MetricDefinition, error)
- func (c *Client) Close()
- func (c *Client) Create(md MetricDefinition, o ...Modifier) (bool, error)
- func (c *Client) CreateTenant(tenant TenantDefinition, o ...Modifier) (bool, error)
- func (c *Client) Definition(t MetricType, id string, o ...Modifier) (*MetricDefinition, error)
- func (c *Client) Definitions(o ...Modifier) ([]*MetricDefinition, error)
- func (c *Client) DeleteTags(t MetricType, id string, tags []string, o ...Modifier) error
- func (c *Client) ReadBuckets(t MetricType, o ...Modifier) ([]*Bucketpoint, error)
- func (c *Client) ReadRaw(t MetricType, id string, o ...Modifier) ([]*Datapoint, error)
- func (c *Client) Send(o ...Modifier) (*http.Response, error)
- func (c *Client) TagValues(tagQuery map[string]string, o ...Modifier) (map[string][]string, error)
- func (c *Client) Tags(t MetricType, id string, o ...Modifier) (map[string]string, error)
- func (c *Client) Tenants(o ...Modifier) ([]*TenantDefinition, error)
- func (c *Client) URL(method string, e ...Endpoint) Modifier
- func (c *Client) UpdateTags(t MetricType, id string, tags map[string]string, o ...Modifier) error
- func (c *Client) Write(metrics []MetricHeader, o ...Modifier) error
- type Datapoint
- type Endpoint
- func OpenshiftEndpoint() Endpoint
- func RawEndpoint() Endpoint
- func SingleMetricEndpoint(id string) Endpoint
- func StatsEndpoint() Endpoint
- func TagEndpoint() Endpoint
- func TagNamesEndpoint(tagNames []string) Endpoint
- func TagsEndpoint(tags map[string]string) Endpoint
- func TenantEndpoint() Endpoint
- func TypeEndpoint(t MetricType) Endpoint
- type Filter
- func BucketsDurationFilter(duration time.Duration) Filter
- func BucketsFilter(buckets int) Filter
- func EndTimeFilter(endTime time.Time) Filter
- func IdFilter(regexp string) Filter
- func LimitFilter(limit int) Filter
- func OrderFilter(order Order) Filter
- func Param(k string, v string) Filter
- func PercentilesFilter(percentiles []float64) Filter
- func StackedFilter() Filter
- func StartFromBeginningFilter() Filter
- func StartTimeFilter(startTime time.Time) Filter
- func TagsFilter(t map[string]string) Filter
- func TagsQueryFilter(query ...string) Filter
- func TypeFilter(t MetricType) Filter
- type HawkularClient
- type HawkularClientError
- type HawkularError
- type MetricDefinition
- type MetricHeader
- type MetricType
- type Modifier
- type Order
- type Parameters
- type Percentile
- type TenantDefinition
Constants ¶
const ( Gauge MetricType = "gauge" Availability = "availability" Counter = "counter" Generic = "metrics" String = "string" )
const ( // ASC Ascending ASC = iota // DESC Descending DESC )
Variables ¶
This section is empty.
Functions ¶
func ConvertToFloat64 ¶
ConvertToFloat64 Return float64 from most numeric types
func FromUnixMilli ¶ added in v0.6.1
FromUnixMilli returns time.Time from milliseconds since epoch
func ToUnixMilli ¶ added in v0.6.1
ToUnixMilli returns milliseconds since epoch from time.Time
Types ¶
type Bucketpoint ¶ added in v0.5.2
type Bucketpoint struct { Start time.Time `json:"-"` End time.Time `json:"-"` Min float64 `json:"min"` Max float64 `json:"max"` Avg float64 `json:"avg"` Median float64 `json:"median"` Empty bool `json:"empty"` Samples uint64 `json:"samples"` Percentiles []Percentile `json:"percentiles"` }
Bucketpoint is a return structure for bucketed data requests (stats endpoint)
func (*Bucketpoint) UnmarshalJSON ¶ added in v0.6.1
func (b *Bucketpoint) UnmarshalJSON(payload []byte) error
UnmarshalJSON is a custom unmarshaller to transform int64 timestamps to time.Time
type Client ¶
type Client struct { Tenant string Credentials string // base64 encoded username/password for Basic header Token string // authentication token for Bearer header AdminToken string // authentication for items behind admin token // contains filtered or unexported fields }
Client is HawkularClient's internal data structure
func NewHawkularClient ¶
func NewHawkularClient(p Parameters) (*Client, error)
NewHawkularClient returns a new initialized instance of client
func (*Client) AllDefinitions ¶ added in v0.6.1
func (c *Client) AllDefinitions(o ...Modifier) ([]*MetricDefinition, error)
AllDefinitions fetches all metric definitions (for every tenant) from the server. Requires admin/service rights
func (*Client) Close ¶ added in v0.6.0
func (c *Client) Close()
Close safely closes the Hawkular-Metrics client and flushes remaining writes to the server
func (*Client) Create ¶
func (c *Client) Create(md MetricDefinition, o ...Modifier) (bool, error)
Create creates a new metric definition
func (*Client) CreateTenant ¶ added in v0.6.1
func (c *Client) CreateTenant(tenant TenantDefinition, o ...Modifier) (bool, error)
CreateTenant creates a tenant definition on the server
func (*Client) Definition ¶
func (c *Client) Definition(t MetricType, id string, o ...Modifier) (*MetricDefinition, error)
Definition returns a single metric definition
func (*Client) Definitions ¶
func (c *Client) Definitions(o ...Modifier) ([]*MetricDefinition, error)
Definitions fetches metric definitions from the server
func (*Client) DeleteTags ¶
DeleteTags deletes given tags from the definition
func (*Client) ReadBuckets ¶ added in v0.5.2
func (c *Client) ReadBuckets(t MetricType, o ...Modifier) ([]*Bucketpoint, error)
ReadBuckets reads datapoints from the server, aggregated to buckets with given parameters.
func (*Client) ReadRaw ¶ added in v0.6.1
ReadRaw reads metric datapoints from the server for the given metric
func (*Client) Send ¶ added in v0.4.0
Send sends a constructed request to the Hawkular-Metrics server. All the requests are pooled and limited by set concurrency limits
func (*Client) Tenants ¶ added in v0.6.1
func (c *Client) Tenants(o ...Modifier) ([]*TenantDefinition, error)
Tenants returns a list of tenants from the server
func (*Client) UpdateTags ¶
UpdateTags modifies the tags of a metric definition
type Datapoint ¶
type Datapoint struct { Timestamp time.Time `json:"-"` Value interface{} `json:"value"` Tags map[string]string `json:"tags,omitempty"` }
Datapoint is a struct that represents a single time series value. Value should be convertible to float64 for gauge/counter series. Timestamp accuracy is milliseconds since epoch
func (Datapoint) MarshalJSON ¶ added in v0.6.1
MarshalJSON is modified JSON marshalling for Datapoint object to modify time.Time to milliseconds since epoch
func (*Datapoint) UnmarshalJSON ¶ added in v0.6.1
UnmarshalJSON is a custom unmarshaller for Datapoint for timestamp modifications
type Endpoint ¶ added in v0.4.0
Endpoint Endpoint type to define request URL
func OpenshiftEndpoint ¶ added in v0.6.1
func OpenshiftEndpoint() Endpoint
OpenshiftEndpoint is a URL endpoint only available in the origin-metrics installation
func RawEndpoint ¶ added in v0.6.1
func RawEndpoint() Endpoint
RawEndpoint is an endpoint to read and write raw datapoints
func SingleMetricEndpoint ¶ added in v0.4.0
SingleMetricEndpoint is a URL endpoint for requesting single metricID
func StatsEndpoint ¶ added in v0.6.1
func StatsEndpoint() Endpoint
StatsEndpoint is an endpoint to read aggregated metrics
func TagEndpoint ¶ added in v0.4.0
func TagEndpoint() Endpoint
TagEndpoint is a URL endpoint to check tags information
func TagNamesEndpoint ¶ added in v0.6.1
TagNamesEndpoint is a URL endpoint which adds tags names (no values)
func TagsEndpoint ¶ added in v0.4.0
TagsEndpoint is a URL endpoint which adds tags query
func TenantEndpoint ¶ added in v0.6.1
func TenantEndpoint() Endpoint
TenantEndpoint is a URL endpoint to fetch tenant related information
func TypeEndpoint ¶ added in v0.4.0
func TypeEndpoint(t MetricType) Endpoint
TypeEndpoint is a URL endpoint setting metricType
type Filter ¶ added in v0.4.0
Filter Filter type for querying
func BucketsDurationFilter ¶ added in v0.6.1
BucketsDurationFilter is a query parameter to set the size of a bucket based on duration Minimum supported bucket is 1 millisecond
func BucketsFilter ¶ added in v0.4.0
BucketsFilter is a query parameter to define amount of buckets
func EndTimeFilter ¶ added in v0.4.0
EndTimeFilter is a query parameter to filter with end time
func LimitFilter ¶ added in v0.6.0
LimitFilter is a query parameter to limit result count
func OrderFilter ¶ added in v0.6.0
OrderFilter Query parameter to define the ordering of datapoints
func PercentilesFilter ¶ added in v0.5.2
PercentilesFilter is a query parameter to define the requested percentiles
func StackedFilter ¶ added in v0.6.0
func StackedFilter() Filter
StackedFilter forces downsampling of stacked return values
func StartFromBeginningFilter ¶ added in v0.6.0
func StartFromBeginningFilter() Filter
StartFromBeginningFilter returns data from the oldest stored datapoint
func StartTimeFilter ¶ added in v0.4.0
StartTimeFilter is a query parameter to filter with start time
func TagsFilter ¶ added in v0.4.0
TagsFilter is a query parameter to filter with tags query
func TagsQueryFilter ¶ added in v0.6.1
TagsQueryFilter is a query parameter for the new style tags query language
func TypeFilter ¶ added in v0.4.0
func TypeFilter(t MetricType) Filter
TypeFilter is a query parameter to filter by type
type HawkularClient ¶ added in v0.4.0
HawkularClient is a base type to define available functions of the client
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 is the 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"` }
MetricDefinition is a struct that describes the stored definition of a time serie
type MetricHeader ¶
type MetricHeader struct { Tenant string `json:"-"` Type MetricType `json:"-"` ID string `json:"id"` Data []Datapoint `json:"data"` }
MetricHeader is the header struct for time series, which has identifiers (tenant, type, id) for uniqueness and []Datapoint to describe the actual time series values.
type Modifier ¶ added in v0.4.0
Modifier Modifiers base type
func AdminAuthentication ¶ added in v0.6.1
AdminAuthentication function to add metrics' admin token to the request
type Order ¶ added in v0.6.0
type Order int
Order is a basetype for selecting the sorting of requested datapoints
type Parameters ¶
type Parameters struct { Tenant string // Technically optional, but requires setting Tenant() option every time Url string TLSConfig *tls.Config Username string Password string Token string Concurrency int AdminToken string }
Parameters is a struct used as initialization parameters to the client
type Percentile ¶ added in v0.5.2
Percentile is Hawkular-Metrics' estimated (not exact) percentile
type TenantDefinition ¶ added in v0.6.1
type TenantDefinition struct { ID string `json:"id"` Retentions map[MetricType]int `json:"retentions"` }
TenantDefinition is the structure that defines a tenant