Esempio n. 1
0
// 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
}
Esempio n. 2
0
// 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
}
Esempio n. 3
0
// 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
}