本文整理汇总了Golang中github.com/square/metrics/api.Timeseries类的典型用法代码示例。如果您正苦于以下问题:Golang Timeseries类的具体用法?Golang Timeseries怎么用?Golang Timeseries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Timeseries类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: filterTagSet
// filterTagSet takes a `series` and filters its `tags` based on whether it needs to `collapse` or group on these tags.
// if `collapses` is false, then tags not found in the `tags` list will be deleted. If `collapses` is true, then tags found in `tags` will be deleted.
func filterTagSet(series api.Timeseries, tags []string, collapses bool) api.Timeseries {
if collapses {
series.TagSet = startingCollase(series.TagSet, tags)
} else {
series.TagSet = startingGroup(series.TagSet, tags)
}
return series
}
示例2: setTagSeries
// setTagSeries returns a copy of the timeseries where the given `newTag` has been set to `newValue`, or added if it wasn't present.
func setTagSeries(series api.Timeseries, newTag string, newValue string) api.Timeseries {
tagSet := api.NewTagSet()
for tag, val := range series.TagSet {
tagSet[tag] = val
}
tagSet[newTag] = newValue
series.TagSet = tagSet
return series
}
示例3: dropTagSeries
// dropTagSeries returns a copy of the timeseries where the given `dropTag` has been removed from its TagSet.
func dropTagSeries(series api.Timeseries, dropTag string) api.Timeseries {
tagSet := api.NewTagSet()
for tag, val := range series.TagSet {
if tag != dropTag {
tagSet[tag] = val
}
}
series.TagSet = tagSet
return series
}