Documentation
¶
Index ¶
- func ParseTags(stat string) (string, map[string]string)
- func ReplaceChars(s string) string
- func SerializeTags(name string, tags map[string]string) string
- type Tag
- type TagSet
- func (t TagSet) Contains(key string) bool
- func (t TagSet) Insert(p Tag) TagSet
- func (t TagSet) Len() int
- func (t TagSet) Less(i, j int) bool
- func (t TagSet) MergePerInstanceTags(tags map[string]string) TagSet
- func (t TagSet) MergeTags(tags map[string]string) TagSet
- func (t TagSet) Search(key string) int
- func (t TagSet) Serialize(name string) string
- func (t TagSet) Sort()
- func (t TagSet) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceChars ¶
ReplaceChars replaces any invalid chars ([.:|]) in value s with '_'.
Types ¶
type TagSet ¶
type TagSet []Tag
A TagSet is a collection of Tags. All methods apart from Sort() require the TagSet to be sorted. Tags with empty keys or values should never be inserted into the TagSet since most methods rely on all the tags being valid.
func ParseTagSet ¶
ParseTagSet parses the statsd stat name and tags (if any) from stat. It is like ParseTags, but returns a TagSet instead of a map[string]string.
func (TagSet) Insert ¶
Insert inserts Tag p into TagSet t, returning a copy unless Tag p already existed.
func (TagSet) MergePerInstanceTags ¶
MergePerInstanceTags returns a TagSet that is the union of subScope's tags and the provided tags map with. If any keys overlap the values from the provided map are used.
The returned TagSet will have a per-instance key ("_f") and if neither the subScope or tags have this key it's value will be the default per-instance value ("i").
The method does not optimize for the case where there is only one tag because it is used less frequently.
func (TagSet) MergeTags ¶
MergeTags returns a TagSet that is the union of subScope's tags and the provided tags map. If any keys overlap the values from the provided map are used.
func (TagSet) Serialize ¶
Serialize serializes name and tags into a statsd stat. Note: the TagSet t must be sorted and have clean tag keys and values.