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

skip meta tag enrichment when we can #1515

Merged

Conversation

replay
Copy link
Contributor

@replay replay commented Oct 31, 2019

when we lookup values of a tag to reply to an auto complete call, we can skip the meta tag enrichment if the given tag we're looking up the values for is a metric tag.

this slightly breaches the rules, because i'm of the opinion that we should inter-mix metric and meta tag values in this case, we only don't inter-mix them for a single metric, but let's do this for the sake of speed.

@Dieterbe
Copy link
Contributor

Can you explain this in a bit more detail please. I don't understand.

@replay
Copy link
Contributor Author

replay commented Oct 31, 2019

Sure, I'm happy to:

This change only affects situations where an auto complete request asks for the list of potential values for a tag which is a metric tag and also a meta tag at the same time. This is bad practice, and hopefully nobody does that, but it is possible to do it.
We have a rule in the design doc defining that each metric can only have each tag once (f.e. if metricX has the metric tag tag1=value1 then a meta record which tries to assign it the meta tag tag1=value2 would be ignored).
But this rule is only on a per-metric basis, it is possible to have metricX with a metric tag tag1=value1 and metricY with a meta tag tag1=value2. This means that when an auto complete request comes in for all potential values of the tag tag1, if the associated query expressions match both metricY and metricX, then we should gather all the potential values from the metric tag index and also from the meta tag index and the returned list for tag1 should be value1 and value2. This is what the code does before this PR.
Now, the problem is that the underlying query to also gather all the potential meta tags for the given query expression leads to a significant slow-down if the result that's generated based on the given query expressions is very large (in the millions). Since this additional and significant overhead is only necessary to handle this very unlikely case where a user inter-mixes metric tags with meta tags (which they really shouldn't), we can save that additional over head and skip the meta tag value evaluation if we see that the queried tag is present in the metric tag index. This means if the auto complete request asks for the values of a tag that's in the metric tag index, we don't return values of that tag which only exist in the meta tag index.

I hope that explains. The end goal is to make these auto complete requests faster when drilling down.

Copy link
Contributor

@robert-milan robert-milan left a comment

Choose a reason for hiding this comment

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

That makes sense, hopefully this will speed things up a bit in this case.

@replay replay merged commit d8f92ae into master Nov 1, 2019
@replay replay deleted the save_unnecesary_meta_tag_enrichment_in_tag_value_auto_complete branch November 1, 2019 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants