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

LabelNames API with matchers #3

Merged
merged 26 commits into from
Jul 23, 2021
Merged

Conversation

colega
Copy link
Contributor

@colega colega commented Jul 14, 2021

What this PR does: Implements support for matchers in LabelQuerier.LabelNames() as in prometheus/prometheus#9083

Which issue(s) this PR fixes:
Fixes cortexproject/cortex#3658

Checklist

Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Could you open a preliminary PR to upgrade Prometheus, Alertmanager and Prometheus common (+ their deps)? It's fine if doesn't include your change yet, but will reduce the review surface, splitting the review effort into smaller subpieces.

@colega
Copy link
Contributor Author

colega commented Jul 15, 2021

@pracucci sure, I was just exploring the changes needed here to adopt my change.

I actually find other changes (in alert manager and tsdb constructor) more complicated tedious to implement.

@colega colega changed the base branch from main to colega/upgrade-prometheus-2021-07 July 16, 2021 07:29
@colega colega force-pushed the label-names-api-with-matchers branch from 7e4015b to fc1b460 Compare July 16, 2021 07:34
Base automatically changed from colega/upgrade-prometheus-2021-07 to main July 16, 2021 13:05
@colega colega force-pushed the label-names-api-with-matchers branch 2 times, most recently from 6b2ec46 to f056488 Compare July 16, 2021 13:17
@colega colega changed the title WIP: Label names api with matchers LabelNames API with matchers Jul 16, 2021
@colega
Copy link
Contributor Author

colega commented Jul 16, 2021

@pracucci the only thing pending here is prometheus/prometheus#9083 to be merged, however I don't expect any significant changes there so I would appreciate a first review on this to see if there's something important I'm missing.

No rush, obviously, because it's blocked until next week anyway.

@colega
Copy link
Contributor Author

colega commented Jul 20, 2021

prometheus/prometheus#9083 is merged, once we merge #16 I'll rebase this.

@pracucci
Copy link
Collaborator

prometheus/prometheus#9083 is merged, once we merge #16 I'll rebase this.

Merged! Could you rebase, please?

@colega colega force-pushed the label-names-api-with-matchers branch from ae707d5 to a149798 Compare July 20, 2021 14:22
@colega colega marked this pull request as ready for review July 20, 2021 14:23
colega added 14 commits July 20, 2021 17:02
Updated Prometheus to latest commit that includes changes in the
LabelQuerier.LabelNames method signature:

prometheus/prometheus#9083

Signed-off-by: Oleg Zaytsev <[email protected]>
Signed-off-by: Oleg Zaytsev <[email protected]>
And fix missing matchers in the call to Distributor

Signed-off-by: Oleg Zaytsev <[email protected]>
Signed-off-by: Oleg Zaytsev <[email protected]>
Signed-off-by: Oleg Zaytsev <[email protected]>
Signed-off-by: Oleg Zaytsev <[email protected]>
@colega colega force-pushed the label-names-api-with-matchers branch from a149798 to f9f5518 Compare July 20, 2021 15:04
@colega
Copy link
Contributor Author

colega commented Jul 20, 2021

And rebased again since there were new conflicting changes in main

Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Impeccable job! It's uncommon seeing such good PRs. Well done on tests too. I left few comments I would be glad if you could address: a part from this, LGTM!

expectedResult: []string{labels.MetricName, "status"},
expectedIngesters: numIngesters,
},
"should return all matching metrics even if their FastFingerprint collide": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test case comes from TestDistributor_MetricsForLabelMatchers but actually doesn't test that a fingerprint collision doesn't hide away label names (cause the two series have the same label names). Not sure it's worth spending time to write a better test case for the fingerprint collision, we could probably just get rid of the fingerprint collision test case of LabelNames().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the testcase until I find two labels with different names but same fingerprint

colega and others added 6 commits July 22, 2021 10:19
If multiple matchers didn't work, we wouldn't realize as the result set
was the same as for a single matcher.

Now the multiple matcher doesn't match the series with status=500 which
has a reason=broken label

Signed-off-by: Oleg Zaytsev <[email protected]>
All the StoreGateways (actually, one) are already supporting matchers in
the call so we don't need to use a feature flag on this.

Signed-off-by: Oleg Zaytsev <[email protected]>
Signed-off-by: Oleg Zaytsev <[email protected]>

Co-authored-by: Marco Pracucci <[email protected]>
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Still LGTM with a couple of final nits.

colega added 3 commits July 22, 2021 13:00
Signed-off-by: Oleg Zaytsev <[email protected]>
At least until we find a collision between two different label names.

Signed-off-by: Oleg Zaytsev <[email protected]>
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🚀

Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Great work!

I have a question about whether implementation in tenant-federation code is correct though. Please take a look.

colega added 2 commits July 23, 2021 10:43
Since there are three options, IMO, a switch is clearer than
if/continue/if/elseif structure.

Signed-off-by: Oleg Zaytsev <[email protected]>
@colega colega force-pushed the label-names-api-with-matchers branch from 0ee4c74 to 8f51e15 Compare July 23, 2021 08:44
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for great work and addressing my feedback.

@pstibrany pstibrany merged commit 17e3423 into main Jul 23, 2021
@pstibrany pstibrany deleted the label-names-api-with-matchers branch July 23, 2021 12:00
@bboreham
Copy link
Contributor

What this PR does: Implements support for matchers in LabelQuerier.LabelValues

That's a typo, right? Should say LabelNames ?

@colega
Copy link
Contributor Author

colega commented Aug 18, 2021

Oh yes, @bboreham definitely. Will edit the description.

simonswine pushed a commit that referenced this pull request Oct 14, 2021
Signed-off-by: Peter Štibraný <[email protected]>
Former-commit-id: 06bbda1
pstibrany added a commit that referenced this pull request Feb 28, 2022
Signed-off-by: Peter Štibraný <[email protected]>
krajorama added a commit that referenced this pull request Sep 29, 2022
# This is the 1st commit message:

Add MaxTotalQueryLength and fill it from MaxQueryLength if 0

Add the ability to define a higher total query length limit on the
frontend , compared to the current shared limit between querier and
query-frontend.

Ref: grafana/mimir-squad#889

Signed-off-by: György Krajcsovits <[email protected]>

# Conflicts:
#	CHANGELOG.md

# This is the commit message #2:

Update runbook

# This is the commit message #3:

Update pkg/util/validation/limits.go

Co-authored-by: Nick Pillitteri <[email protected]>
# This is the commit message #4:

Rename store.max-total-query-length to query-frontend...

Signed-off-by: György Krajcsovits <[email protected]>
replay pushed a commit that referenced this pull request Aug 8, 2024
check presence of recording rule data for query window
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

Successfully merging this pull request may close these issues.

Implement support for matchers in labels API
4 participants