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

Remove Thanos ZLabel type in favour of identical LabelAdapter type #3345

Merged
merged 6 commits into from
Nov 3, 2022

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented Oct 31, 2022

This code was brought in with #3222, but exactly duplicated code we already had, except for the name.

(LabelAdapter isn't a hugely descriptive name, but it was widely used already)

All the types in storegateway/labelpb were removed: Label, LabelSet and ZLabelSet; the last two were entirely unused in Mimir.
Label was equivalent to LabelPair in Mimir, albeit using string instead of bytes type. According to here these are identical on the wire, but string should only contain valid UTF-8 data. (This is not checked in Go).

Checklist

  • Tests updated
  • NA Documentation added
  • NA CHANGELOG.md updated - not user-facing

@bboreham bboreham requested a review from a team as a code owner October 31, 2022 14:38
@bboreham bboreham mentioned this pull request Oct 31, 2022
3 tasks
@@ -31,7 +31,7 @@ message Chunk {
}

message Series {
repeated Label labels = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/grafana/mimir/pkg/storegateway/labelpb.ZLabel"];
repeated cortexpb.LabelPair labels = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/grafana/mimir/pkg/mimirpb.LabelAdapter"];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the change here to cortexpb.LabelPair?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I deleted Label.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh it was in types.proto. Sorry I missed that one.

Copy link
Contributor

Choose a reason for hiding this comment

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

So the proto will unmarshal even if the type name is different? In that case, should we create a task to rename cortexpb to mimirpb?

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 added more info to the PR description.

@pracucci
Copy link
Collaborator

pracucci commented Nov 3, 2022

@bboreham I've just merged #3288. Could you rebase, please?

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!

@pracucci pracucci enabled auto-merge (squash) November 3, 2022 10:56
@pracucci pracucci merged commit 3592c25 into main Nov 3, 2022
@pracucci pracucci deleted the no-zlabel branch November 3, 2022 11:09
masonmei pushed a commit to udmire/mimir that referenced this pull request Nov 4, 2022
…rafana#3345)

* labelpb: remove unused LabelSet type

* Replace ZLabel with alias to LabelAdapter

The implementations are identical.

* Remove unused storegateway/prompb

* storegateway: convert uses of ZLabel to LabelAdapter

Avoid having two names for the same thing.

* go mod tidy: xxhash dependency is now indirect

* Make imports of gogo.proto consistent

So everything compiles and lint errors go away.
masonmei pushed a commit to udmire/mimir that referenced this pull request Nov 4, 2022
…rafana#3345)

* labelpb: remove unused LabelSet type

* Replace ZLabel with alias to LabelAdapter

The implementations are identical.

* Remove unused storegateway/prompb

* storegateway: convert uses of ZLabel to LabelAdapter

Avoid having two names for the same thing.

* go mod tidy: xxhash dependency is now indirect

* Make imports of gogo.proto consistent

So everything compiles and lint errors go away.
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.

3 participants