Documentation
¶
Index ¶
- Variables
- type Config
- type Metric
- type Namespace
- func (n Namespace) AddDynamicElement(name, description string) Namespace
- func (n Namespace) AddStaticElement(value string) Namespace
- func (n Namespace) AddStaticElements(values ...string) Namespace
- func (n Namespace) Element(idx int) NamespaceElement
- func (n Namespace) IsDynamic() (bool, []int)
- func (n Namespace) String() string
- func (n Namespace) Strings() []string
- type NamespaceElement
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyKey is returned when a Rule with an empty key is created ErrEmptyKey = fmt.Errorf("Key cannot be Empty") // ErrConfigNotFound is returned when a config doesn't exist in the config map ErrConfigNotFound = fmt.Errorf("config item not found") // ErrNotA<type> is returned when the found config item doesn't have the expected type ErrNotAString = fmt.Errorf("config item is not a string") ErrNotAnInt = fmt.Errorf("config item is not an int64") ErrNotABool = fmt.Errorf("config item is not a boolean") ErrNotAFloat = fmt.Errorf("config item is not a float64") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config map[string]interface{}
Config is a type alias for map[string]interface{} to allow the helper functions Get{String,Bool,Float,Int} to be defined.
func (Config) GetBool ¶
GetBool takes a given key and checks the config for both that the key exists, and that it is of type bool. Returns an error if either of these is false.
func (Config) GetFloat ¶
GetFloat takes a given key and checks the config for both that the key exists, and that it is of type float64. Returns an error if either of these is false.
type Metric ¶
type Metric struct { Namespace Namespace Version int64 Config Config Data interface{} Tags map[string]string Timestamp time.Time Unit string Description string // contains filtered or unexported fields }
Metric contains all info related to a Snap Metric
type Namespace ¶
type Namespace []NamespaceElement
func CopyNamespace ¶
CopyNamespace copies array of namespace elements to new array
func NewNamespace ¶
Newnamespace takes an array of strings and returns a namespace. A namespace is an array of namespaceElements. The provided array of strings is used to set the corresponding Value fields in the array of namespaceElements.
func (Namespace) AddDynamicElement ¶
AddDynamicElement adds a dynamic element to the given Namespace. A dynamic namespaceElement is defined by having a nonempty Name field.
func (Namespace) AddStaticElement ¶
AddStaticElement adds a static element to the given Namespace. A static namespaceElement is defined by having an empty Name field.
func (Namespace) AddStaticElements ¶
AddStaticElements adds a static elements to the given Namespace. A static namespaceElement is defined by having an empty Name field.
func (Namespace) Element ¶
func (n Namespace) Element(idx int) NamespaceElement
func (Namespace) IsDynamic ¶
IsDynamic returns true if there is any element of the namespace which is dynamic. If the namespace is dynamic the second return value will contain an array of namespace elements (indexes) where there are dynamic namespace elements. A dynamic component of the namespace are those elements that contain variable data.
type NamespaceElement ¶
namespaceElement provides meta data related to the namespace. This is of particular importance when the namespace contains data.
func NewNamespaceElement ¶
func NewNamespaceElement(e string) NamespaceElement
NewNamespaceElement tasks a string and returns a namespaceElement where the Value field is set to the provided string argument.
func (*NamespaceElement) IsDynamic ¶
func (n *NamespaceElement) IsDynamic() bool
IsDynamic returns true if the namespace element contains data. A namespace element that has a nonempty Name field is considered dynamic.