Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Fix set tags for complex targets #1948

Closed
wants to merge 2 commits into from

Conversation

fkaleo
Copy link
Contributor

@fkaleo fkaleo commented Nov 14, 2020

When a target is more complex than just containing a raw series, ie. when it contains at least one function, then SetTags should consider as tags only the tag expressions (ie. ;tag=value) that are found after the end of the last function of the target.

Fix #1917

@fkaleo fkaleo requested a review from shanson7 November 14, 2020 01:49
@@ -120,7 +120,8 @@ func (a SeriesMeta) CopyWithChange(fn func(in SeriesMetaProperties) SeriesMetaPr
// SetTags fills in the Tags property with tags parsed out of s.Target
// the "name" tag is always set from s.Target, overriding any attempted override
func (s *Series) SetTags() {
numTags := strings.Count(s.Target, ";")
lastClosingParenthesis := strings.LastIndexByte(s.Target, ')')
numTags := strings.Count(s.Target[lastClosingParenthesis+1:], ";")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the scenario where numTags >= 1 I don't believe this solution works.

@stale
Copy link

stale bot commented Feb 16, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 16, 2021
@stale stale bot closed this Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

groupByTags tag parsing adds bad tags
2 participants