Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Project string `json:"project"` BaseURL string `json:"baseUrl"` Token string `json:"token"` Expires time.Time `json:"expires"` }
Config required for statsum client to submit metrics.
type Configurer ¶
A Configurer is a function that given a project name returns Config options required for submitting metrics.
func StaticConfigurer ¶
func StaticConfigurer(baseURL string, secret []byte) Configurer
StaticConfigurer computes a JWT that is valid for 25 minutes, and rotated every 10 minutes. This allows for 15 minutes clock drift, while ensuring that all credentials being transmitted are temporary.
type Options ¶
type Options struct { MaxDataPoints int // Maximum data points before sending, default 10k MaxDelay time.Duration // Maximum delay before sending, default 90s MinDelay time.Duration // Minimum delay before sending, default 30s OnError func(error) // Error callback, ignored by default }
Options for Statsum client.
type ServerError ¶
A ServerError represents a server-side error from statsum.
func (*ServerError) Error ¶
func (s *ServerError) Error() string
type Statsum ¶
type Statsum struct {
// contains filtered or unexported fields
}
Statsum client for collecting metrics
func New ¶
func New(project string, configurer Configurer, options Options) *Statsum
New returns a new Statum client.
func (*Statsum) Time ¶
Time measures the time it takes to execute fn in milliseconds and reports it as a measure for the given name.
func (*Statsum) WithPrefix ¶
WithPrefix returns a Statsum client object that prefixes all values with the given prefix.
The new Statsum client object uses the same underlying cache as its parent, making this a cheap operation that does not number of increase submission requests, or require additional Flush calls.
Directories ¶
Path | Synopsis |
---|---|
Package aggregator contains the data structures responsible for aggregating payloads recevied by the server.
|
Package aggregator contains the data structures responsible for aggregating payloads recevied by the server. |
cmd
|
|
statsum
Package main contains the main function which loads configuration, initializes and starts the server.
|
Package main contains the main function which loads configuration, initializes and starts the server. |
Package payload contains payload structures and logic for serializing and deserializing these structures.
|
Package payload contains payload structures and logic for serializing and deserializing these structures. |