Skip to content
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

Partial label matching in selects #38

Open
weeco opened this issue Oct 31, 2021 · 2 comments
Open

Partial label matching in selects #38

weeco opened this issue Oct 31, 2021 · 2 comments

Comments

@weeco
Copy link

weeco commented Oct 31, 2021

Unfortunately, it currently only returns data points with an exact match of the label combination, which means, let's say you run storage.Select("consumergroup_topic_lag", []tstorage.Label{"consumer_group": "foo"}) then:

  • consumergroup_topic_lag {"consumer_group": "foo"} will be returned
  • consumergroup_topic_lag {} will not be returned
  • consumergroup_topic_lag {"consumer_group": "foo", "another_label": "bar"} will not be returned

I think it would be beneficial if we had the option to query for metrics using partial labels. Example:

storage.Select("consumergroup_topic_lag", []tstorage.Label{"consumer_group": "foo"})

Returns all metrics where a label with key consumer_group equals to foo , regardless what other labels are set as long as the queried matches exist in the target:

consumergroup_topic_lag {"consumer_group": "foo", "topic": "bla"} 1000
consumergroup_topic_lag {"consumer_group": "foo", "topic": "bar"} 2000
consumergroup_topic_lag {"consumer_group": "foo", "topic": "basket"} 0
@nakabonne
Copy link
Owner

Ref: #36 (comment)

@nakabonne
Copy link
Owner

Currently, in order to simplify the file format, it calculates a hash value from labels and a metric name, and data points are stored close to each other within the disk using it as a key.

What we need to do first is investigate how other TSDBs deal with label indexes. I'll look into it when I have time 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants