Skip to content

TagDrop does not work as documented #2860

Closed
@zhang8473

Description

Bug report

Current behavior (here is your code):

func (f *Filter) shouldTagsPass(tags map[string]string) bool {
if f.TagPass != nil {
for _, pat := range f.TagPass {
if pat.filter == nil {
continue
}
if tagval, ok := tags[pat.Name]; ok {
if pat.filter.Match(tagval) {
return true
}
}
}
return false
}

if f.TagDrop != nil {
	for _, pat := range f.TagDrop {
		if pat.filter == nil {
			continue
		}
		if tagval, ok := tags[pat.Name]; ok {
			if pat.filter.Match(tagval) {
				return false
			}
		}
	}
	return true
}

return true

}

Desired behavior:

tagdrop: The inverse of tagpass. If a match is found the point is discarded. This is tested on points after they have passed the tagpass test.

e.g. I have:
abc, tag1=1, tag2=2 values tms
abc, tag1=1, tag2=3 values tms
abc, tag1=8, tag2=2 values tms

I want all metrics with tag1=1 and tag2!=3.

Based on your document, I could set tagpass tag1=1 and set tagdrop tag2=3. However, based on your code, it is not possible.

Use case: [Why is this important (helps with prioritizing requests)]

further filter tags after tagpass

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions