Documentation
¶
Index ¶
- Constants
- func BucketCount()
- func Close() error
- func Configure(logf LoggerFunc, statsHouseAddr string, defaultEnv string)
- func ConfigureEx(args ConfigureArgs)
- func ConfigureNetwork(logf LoggerFunc, network string, statsHouseAddr string, defaultEnv string)
- func Count(name string, tags Tags, n float64)
- func CountHistoric(name string, tags Tags, n float64, tsUnixSec uint32)
- func LexDecode(x int32) float32
- func LexEncode(x float32) int32
- func LexEncodeStr(x float32) string
- func NamedCount(name string, tags NamedTags, n float64)
- func NamedCountHistoric(name string, tags NamedTags, n float64, tsUnixSec uint32)
- func NamedStringTop(name string, tags NamedTags, value string)
- func NamedStringTopHistoric(name string, tags NamedTags, value string, tsUnixSec uint32)
- func NamedStringsTop(name string, tags NamedTags, values []string)
- func NamedStringsTopHistoric(name string, tags NamedTags, values []string, tsUnixSec uint32)
- func NamedUnique(name string, tags NamedTags, value int64)
- func NamedUniqueHistoric(name string, tags NamedTags, value int64, tsUnixSec uint32)
- func NamedUniques(name string, tags NamedTags, values []int64)
- func NamedUniquesHistoric(name string, tags NamedTags, values []int64, tsUnixSec uint32)
- func NamedValue(name string, tags NamedTags, value float64)
- func NamedValueHistoric(name string, tags NamedTags, value float64, tsUnixSec uint32)
- func NamedValues(name string, tags NamedTags, values []float64)
- func NamedValuesHistoric(name string, tags NamedTags, values []float64, tsUnixSec uint32)
- func StartRegularMeasurement(f func(*Client)) (id int)
- func StopRegularMeasurement(id int)
- func StringTop(name string, tags Tags, value string)
- func StringTopHistoric(name string, tags Tags, value string, tsUnixSec uint32)
- func StringsTop(name string, tags Tags, values []string)
- func StringsTopHistoric(name string, tags Tags, values []string, tsUnixSec uint32)
- func TrackBucketCount()
- func Unique(name string, tags Tags, value int64)
- func UniqueHistoric(name string, tags Tags, value int64, tsUnixSec uint32)
- func Uniques(name string, tags Tags, values []int64)
- func Value(name string, tags Tags, value float64)
- func ValueHistoric(name string, tags Tags, value float64, tsUnixSec uint32)
- func Values(name string, tags Tags, values []float64)
- func ValuesHistoric(name string, tags Tags, values []float64, tsUnixSec uint32)
- type Client
- func (c *Client) BucketCount() int32
- func (c *Client) Close() error
- func (c *Client) ConfigureEx(args ConfigureArgs)
- func (c *Client) Count(name string, tags Tags, n float64)
- func (c *Client) CountHistoric(name string, tags Tags, n float64, tsUnixSec uint32)
- func (c *Client) Metric(metric string, tags Tags) *MetricRefdeprecated
- func (c *Client) MetricNamed(metric string, tags NamedTags) *MetricRefdeprecated
- func (c *Client) MetricNamedRef(metric string, tags NamedTags) MetricRef
- func (c *Client) MetricRef(metric string, tags Tags) MetricRef
- func (c *Client) NamedCount(name string, tags NamedTags, n float64)
- func (c *Client) NamedCountHistoric(name string, tags NamedTags, n float64, tsUnixSec uint32)
- func (c *Client) NamedStringTop(name string, tags NamedTags, value string)
- func (c *Client) NamedStringTopHistoric(name string, tags NamedTags, value string, tsUnixSec uint32)
- func (c *Client) NamedStringsTop(name string, tags NamedTags, values []string)
- func (c *Client) NamedStringsTopHistoric(name string, tags NamedTags, values []string, tsUnixSec uint32)
- func (c *Client) NamedUnique(name string, tags NamedTags, value int64)
- func (c *Client) NamedUniqueHistoric(name string, tags NamedTags, value int64, tsUnixSec uint32)
- func (c *Client) NamedUniques(name string, tags NamedTags, values []int64)
- func (c *Client) NamedUniquesHistoric(name string, tags NamedTags, values []int64, tsUnixSec uint32)
- func (c *Client) NamedValue(name string, tags NamedTags, value float64)
- func (c *Client) NamedValueHistoric(name string, tags NamedTags, value float64, tsUnixSec uint32)
- func (c *Client) NamedValues(name string, tags NamedTags, values []float64)
- func (c *Client) NamedValuesHistoric(name string, tags NamedTags, values []float64, tsUnixSec uint32)
- func (c *Client) SetEnv(env string)
- func (c *Client) StartRegularMeasurement(f func(*Client)) (id int)
- func (c *Client) StopRegularMeasurement(id int)
- func (c *Client) StringTop(name string, tags Tags, value string)
- func (c *Client) StringTopHistoric(name string, tags Tags, value string, tsUnixSec uint32)
- func (c *Client) StringsTop(name string, tags Tags, values []string)
- func (c *Client) StringsTopHistoric(name string, tags Tags, values []string, tsUnixSec uint32)
- func (c *Client) TrackBucketCount()
- func (c *Client) Unique(name string, tags Tags, value int64)
- func (c *Client) UniqueHistoric(name string, tags Tags, value int64, tsUnixSec uint32)
- func (c *Client) Uniques(name string, tags Tags, values []int64)
- func (c *Client) UniquesHistoric(name string, tags Tags, values []int64, tsUnixSec uint32)
- func (c *Client) Value(name string, tags Tags, value float64)
- func (c *Client) ValueHistoric(name string, tags Tags, value float64, tsUnixSec uint32)
- func (c *Client) Values(name string, tags Tags, values []float64)
- func (c *Client) ValuesHistoric(name string, tags Tags, values []float64, tsUnixSec uint32)
- type ConfigureArgs
- type LoggerFunc
- type MetricRef
- func (m *MetricRef) Count(n float64)
- func (m *MetricRef) CountHistoric(n float64, tsUnixSec uint32)
- func (m *MetricRef) Equal(other MetricRef) bool
- func (m *MetricRef) IsNil() bool
- func (m *MetricRef) IsValid() bool
- func (m *MetricRef) StringTop(value string)
- func (m *MetricRef) StringTopHistoric(value string, tsUnixSec uint32)
- func (m *MetricRef) StringsTop(values []string)
- func (m *MetricRef) StringsTopHistoric(values []string, tsUnixSec uint32)
- func (m *MetricRef) Unique(value int64)
- func (m *MetricRef) UniqueHistoric(value int64, tsUnixSec uint32)
- func (m *MetricRef) Uniques(values []int64)
- func (m *MetricRef) UniquesHistoric(values []int64, tsUnixSec uint32)
- func (m *MetricRef) Value(value float64)
- func (m *MetricRef) ValueHistoric(value float64, tsUnixSec uint32)
- func (m *MetricRef) Values(values []float64)
- func (m *MetricRef) ValuesHistoric(values []float64, tsUnixSec uint32)
- type NamedTags
- type Tags
Constants ¶
const ( DefaultAddr = "127.0.0.1:13337" DefaultNetwork = "tcp" // You can add this tag instead of calling StringTop functions family. // This is especialy useful, if you are going to send value or unique, as StringTop family is for counters only. StringTopTag = 47 StringTopNamedTag = "47" )
Variables ¶
This section is empty.
Functions ¶
func BucketCount ¶
func BucketCount()
func Close ¶
func Close() error
Close calls *Client.Close on the global Client. Make sure to call Close during app exit to avoid losing the last batch of metrics.
func Configure ¶
func Configure(logf LoggerFunc, statsHouseAddr string, defaultEnv string)
Configure is expected to be called once during app startup to configure the global Client. Specifying empty StatsHouse address will make the client silently discard all metrics.
func ConfigureEx ¶
func ConfigureEx(args ConfigureArgs)
func ConfigureNetwork ¶
func ConfigureNetwork(logf LoggerFunc, network string, statsHouseAddr string, defaultEnv string)
network must be either "tcp", "udp" or "unixgram"
func LexEncode ¶
Advanced feature. Encodes float as a raw tag in a special format, used by Statshouse. Ordering of all float values is preserved after encoding. Except all NaNs map to single value which is > +inf, and both zeroes map to 0.
func LexEncodeStr ¶
func NamedCount ¶
func NamedCountHistoric ¶
func NamedStringTop ¶
func NamedStringTopHistoric ¶
func NamedStringsTop ¶
func NamedStringsTopHistoric ¶
func NamedUnique ¶
func NamedUniqueHistoric ¶
func NamedUniques ¶
func NamedUniquesHistoric ¶
func NamedValue ¶
func NamedValueHistoric ¶
func NamedValues ¶
func NamedValuesHistoric ¶
func StartRegularMeasurement ¶
StartRegularMeasurement calls *Client.StartRegularMeasurement on the global Client. It is valid to call StartRegularMeasurement before Configure.
func StopRegularMeasurement ¶
func StopRegularMeasurement(id int)
StopRegularMeasurement calls *Client.StopRegularMeasurement on the global Client. It is valid to call StopRegularMeasurement before Configure.
func StringTopHistoric ¶
func StringsTop ¶
func StringsTopHistoric ¶
func TrackBucketCount ¶
func TrackBucketCount()
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(logf LoggerFunc, network string, statsHouseAddr string, defaultEnv string) *Client
NewClient creates a new Client to send metrics. Use NewClient only if you are sending metrics to two or more StatsHouse clusters. Otherwise, simply Configure the default global Client.
Specifying empty StatsHouse address will make the client silently discard all metrics. if you get compiler error after updating to recent version of library, pass statshouse.DefaultNetwork to network parameter
func NewClientEx ¶
func NewClientEx(args ConfigureArgs) *Client
func (*Client) BucketCount ¶
For debug purposes. Panics if Client.TrackBucketCount wasn't called.
func (*Client) Close ¶
Close the Client and flush unsent metrics to the StatsHouse agent. No data will be sent after Close has returned.
func (*Client) ConfigureEx ¶
func (c *Client) ConfigureEx(args ConfigureArgs)
func (*Client) CountHistoric ¶
func (*Client) Metric
deprecated
Deprecated: causes unnecessary memory allocation. Use either Client.MetricRef or direct write func like Client.Count.
func (*Client) MetricNamed
deprecated
Deprecated: causes unnecessary memory allocation. Use either Client.MetricNamedRef or direct write func like Client.Count.
func (*Client) MetricNamedRef ¶
MetricNamedRef is similar to *Client.MetricRef but slightly slower, and allows to specify tags by name.
func (*Client) MetricRef ¶
MetricRef is the preferred way to record observations, save the result for later use:
var countPacketOK = statshouse.GetMetricRef("foo", statshouse.Tags{1: "ok"})
countPacketOK.Count(1) // lowest overhead possible
func (*Client) NamedCountHistoric ¶
func (*Client) NamedStringTop ¶
func (*Client) NamedStringTopHistoric ¶
func (*Client) NamedStringsTop ¶
func (*Client) NamedStringsTopHistoric ¶
func (*Client) NamedUniqueHistoric ¶
func (*Client) NamedUniques ¶
func (*Client) NamedUniquesHistoric ¶
func (*Client) NamedValueHistoric ¶
func (*Client) NamedValues ¶
func (*Client) NamedValuesHistoric ¶
func (*Client) StartRegularMeasurement ¶
StartRegularMeasurement will call f once per collection interval with no gaps or drift, until StopRegularMeasurement is called with the same ID.
func (*Client) StopRegularMeasurement ¶
StopRegularMeasurement cancels StartRegularMeasurement with the specified ID.
func (*Client) StringTopHistoric ¶
func (*Client) StringsTopHistoric ¶
func (*Client) TrackBucketCount ¶
func (c *Client) TrackBucketCount()
For debug purposes. If necessary then it should be first method called on Client.
func (*Client) UniqueHistoric ¶
func (*Client) UniquesHistoric ¶
func (*Client) ValueHistoric ¶
type ConfigureArgs ¶
type LoggerFunc ¶
type LoggerFunc func(format string, args ...interface{})
type MetricRef ¶
type MetricRef struct {
SurviveNilWrite bool
// contains filtered or unexported fields
}
MetricRef pointer is obtained via *Client.Metric or *Client.MetricNamed and is used to record attributes of observed events.
func GetMetricRef ¶
GetMetricRef calls *Client.MetricRef on the global Client. It is valid to call Metric before Configure.
func Metric
deprecated
Deprecated: causes unnecessary memory allocation. Use either Client.MetricRef or direct write func like Client.Count.
func MetricNamed
deprecated
Deprecated: causes unnecessary memory allocation. Use either Client.MetricNamedRef or direct write func like Client.Count.
func MetricNamedRef ¶
MetricNamedRef calls *Client.MetricNamedRef on the global Client. It is valid to call MetricNamedRef before Configure.
func (*MetricRef) CountHistoric ¶
func (*MetricRef) StringTopHistoric ¶
func (*MetricRef) StringsTop ¶
StringsTop records the observed values for popularity estimation.
func (*MetricRef) StringsTopHistoric ¶
func (*MetricRef) UniqueHistoric ¶
func (*MetricRef) UniquesHistoric ¶
func (*MetricRef) ValueHistoric ¶
func (*MetricRef) ValuesHistoric ¶
type Tags ¶
type Tags [maxTags]string // TODO - refactor all functions to receive []string instead
Tags are used to call *Client.Metric.