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

Implement series lookup and filtering by meta tag #1423

Merged
merged 23 commits into from
Aug 13, 2019

Conversation

replay
Copy link
Contributor

@replay replay commented Aug 9, 2019

This PR implements the step 3 as described here: #660 (comment)

It is based on the branch of this PR:
#1373

I already commented a lot and added many unit tests, so I hope that helps in making it more understandable. I'll post a flow chart tomorrow, trying to illustrate how the different parts interact with each other.

This implements everything that's required to query by meta tags (or querying by mixed combinations of meta- and metric tags).

@replay replay force-pushed the implement_series_lookup_by_meta_tag branch 2 times, most recently from f16544f to 036518a Compare August 9, 2019 14:25
@replay
Copy link
Contributor Author

replay commented Aug 9, 2019

rebased onto master

@replay
Copy link
Contributor Author

replay commented Aug 9, 2019

This illustrates how all the different parts interact with each other in a FindByTag() call:
tag query evaluation with meta tags

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.

Other than some minor variable naming changes it looks pretty solid. Let's discuss it later today.


index TagIndex // the tag index, hierarchy of tags & values, set by Run()/RunGetTags()
byId map[schema.MKey]*idx.Archive // the metric index by ID, set by Run()/RunGetTags()
mti metaTagIndex // the meta tag index
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
mti metaTagIndex // the meta tag index
metaIndex metaTagIndex // the meta tag index

There are a few other places this appears where it should be changed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'll make the naming more consistent.

many properties are called "queries", but in the context of all other
packages tag deal with tag query expressions those properties are
usually called "expressions", so this fixes that inconsistency
this makes sense for 2 reasons:
1) tagquery.Expression is an interface type, which the json
   marshaller can't marshall properly automatically
2) when calling /metaTags, the format of the returned meta tags
   now matches the format that's expected when upserting meta
   tag records via /metaTags/upsert
this doesn't actually change the tag query evaluation logic, but it
should make the code much easier to understand for whoever needs to read
it.
it also makes it easier to write unit tests for this part of the code
- make id selector a member of tag query context
- avoid unnecessarily passing index reference around
this doesn't change the evaluation logic, but it should make the code
more readabale and more testable
because I think that way it's easier to understand what this is supposed
to be
also deduplicates results now when selecting by meta tag
when receiving a new meta tag record upsert request we shouldn't only
validate the given query expressions, but also that the given set of
expressions can be used to instantiate a query. if that's not the case,
then the given meta tag record should be considered invalid and should
get rejected.
@replay replay force-pushed the implement_series_lookup_by_meta_tag branch from 978287a to ea822b5 Compare August 12, 2019 21:09
@replay
Copy link
Contributor Author

replay commented Aug 12, 2019

rebased onto master

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.

LGTM

@replay replay merged commit 514301f into master Aug 13, 2019
@replay replay deleted the implement_series_lookup_by_meta_tag branch August 13, 2019 18:26
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.

None yet

2 participants