-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.9.3-nightly] regexs fails with empty tags #3773
Comments
@gallir the regex as written only matches actual values, not the absence of a value. Does a query like this address your needs? I haven't directly tested it but I think it should work.
|
Nope, it does not work. Test with actual values (with a last week nightly build because 0.9.2 stable died with "select * ..."):
Gosh! when testing different options while I was writing this I found one that works, /^$/
Unfortunately Grafana doesn't accept this regex :( But it's strange, it selects also empty tags when the regex requires the opposite. |
This may be really difficult for us to do. While we keep an index of what values correspond to which tag, we don't keep track of values that don't have a specific tag. I don't think there would be any practical way we could do that either as it would require us to know what tags are allowed to exist and will exist for every point ahead of time. The only way I can think of would be to iterate through all of the possible series, but I don't think that would be a good idea for performance. Something we may be able to do is allow an empty string as a tag value. If we allowed that, then it would likely be possible to index the empty tag value and probably wouldn't even require the query engine to change to support this kind of functionality. @pauldix what are your thoughts on this? This might also be something to consider if/when we redesign the line protocol like in #6037. |
If you just leave out the One thing we may want to do is to make sure |
@pauldix the second part is what I was referring to. When a tag isn't specified when writing a metric, it's not indexed anywhere so figuring out We could make it possible by allowing tags to be the empty string so the user would write:
And then this would work:
But anything that doesn't have a region would get ignored since it wasn't indexed when it was written. It would be difficult to implement |
No, they shouldn't be able to write tags with an empty string. If they're matching on the tag empty string in the query, it would be the same as pulling |
I think I might have a misunderstanding of what a missing tag counts as. For the series There seems to be a bit of inconsistency in regards to how a missing tag key is treated. Some places use the empty string and some places treat it as null. |
A missing tag on a point was sometimes treated as `""` and sometimes treated as a separate `null` entity. This change modifies the equality operations to always treat a missing tag as an empty string. Empty tags are *not* indexed and do not have the same performance as a tag that exists. Fixes #3773.
If some tags are missing/no used in some points they are no selected by regexes like the "All" used from grafana and similar.
Example, for
select * from serie where sparse_tag =~ /.*/
only those points what stored some value in sparse_tag will be retrieved. The same happens with expression like "sparse_tag = ''" but it's annoying with regexes because you cannot create filters (in grafana, for example, they are called "template variables") if the tag is not stored in every point in the measurement.
I don't know if this is a bug or a constraint, anyway it will be great if it worked as expected.
The text was updated successfully, but these errors were encountered: