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

storegateway: small refactor to simplify #5444

Merged
merged 6 commits into from
Dec 8, 2023
Merged

storegateway: small refactor to simplify #5444

merged 6 commits into from
Dec 8, 2023

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented Jul 7, 2023

What this PR does

Remove some unused code and move other code that was not relevant to the prompb protobuf package.

I was trying to understand the package, and found that this stuff detracted from that task.

Checklist

  • Tests updated
  • NA Documentation added
  • NA CHANGELOG.md updated

@bboreham bboreham requested a review from a team as a code owner July 7, 2023 11:14
@bboreham bboreham changed the title storegateway: refactor to simplify storegateway: small refactor to simplify Jul 7, 2023
@@ -719,12 +719,23 @@ func logSeriesRequestToSpan(ctx context.Context, l log.Logger, minT, maxT int64,
"msg", "BucketStore.Series",
"request min time", time.UnixMilli(minT).UTC().Format(time.RFC3339Nano),
"request max time", time.UnixMilli(maxT).UTC().Format(time.RFC3339Nano),
"request matchers", storepb.PromMatchersToString(matchers...),
"request block matchers", storepb.PromMatchersToString(blockMatchers...),
"request matchers", promMatchersToString(matchers...),
Copy link
Member

Choose a reason for hiding this comment

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

Can we use util.MatchersStringer(matchers).String()?

Copy link
Contributor

@aknuds1 aknuds1 Jul 7, 2023

Choose a reason for hiding this comment

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

While util.MatchersStringer(matchers).String() should be suitable, there is the difference that promMatchersToString surrounds the string with curly braces. It's probably no big deal if we stop doing that (surround with curly braces), as it's just for debug logs? Also util.MatchersStringer(matchers).String() is more performant due to using strings.Builder instead of concatenating strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even better: we can pass the stringer, since both go-kit and OpenTracing allow that as a value.
That means if the trace is not sampled and debug logging is off, we don't format them at all.

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@dimitarvdimitrov dimitarvdimitrov merged commit 0a7eb89 into main Dec 8, 2023
28 checks passed
@dimitarvdimitrov dimitarvdimitrov deleted the sgw-unused branch December 8, 2023 12:57
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.

None yet

4 participants