当前位置: 首页>>代码示例>>Golang>>正文


Golang api.Timeseries类代码示例

本文整理汇总了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
}
开发者ID:jmptrader,项目名称:metrics,代码行数:10,代码来源:aggregate.go

示例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
}
开发者ID:jmptrader,项目名称:metrics,代码行数:10,代码来源:tag.go

示例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
}
开发者ID:jmptrader,项目名称:metrics,代码行数:11,代码来源:tag.go


注:本文中的github.com/square/metrics/api.Timeseries类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。