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

Refactor everywhere uses ESClient to have a Switch #6168

Merged
merged 6 commits into from
Jul 17, 2024

Conversation

bowenxia
Copy link
Contributor

@bowenxia bowenxia commented Jul 16, 2024

What changed?
Refactor everywhere uses ESClient to have a switch to deal with different clients
Also added more unit tests

Why?
We need to add Pinot client in this analyzer to make it a VisibilityAnalyzer instead of an ESAnalzyer.

How did you test it?
Unit test

Potential risks

Release notes

Documentation Changes

idls Outdated
Copy link
Member

Choose a reason for hiding this comment

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

idls updated by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Trying to remove those

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 95.91837% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.79%. Comparing base (3248455) to head (210cf5f).
Report is 2 commits behind head on master.

Additional details and impacted files
Files Coverage Δ
service/worker/esanalyzer/analyzer.go 37.25% <100.00%> (+37.25%) ⬆️
...rker/esanalyzer/domainWorkflowTypeCountWorkflow.go 74.50% <95.55%> (+31.49%) ⬆️
service/worker/esanalyzer/workflow.go 81.55% <95.65%> (+30.48%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3248455...210cf5f. Read the comment docs.

case ES:
err = w.emitWorkflowTypeCountMetricsES(ctx, domainName, logger)
default:
err = w.emitWorkflowTypeCountMetricsES(ctx, domainName, logger)
Copy link
Member

Choose a reason for hiding this comment

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

both cases doing to same thing. did you mean to emit a metric for pinot here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I'll add pinot in the next PR

@@ -283,6 +283,7 @@ func (s *Service) startESAnalyzer() {
s.GetFrontendClient(),
s.GetClientBean(),
s.params.ESClient,
s.params.PinotClient,
Copy link
Member

Choose a reason for hiding this comment

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

nit: it's fine for this PR but as a general pattern we should avoid passing multiple client objects to a component and having it decide based on which one is nil. Ideally there would be one parameter here of visibilityClient type or something like that and the bootstrap code (this file) determines which one to pass there.

Comment on lines +119 to +124
var mode readMode
if esClient != nil {
mode = ES
} else if pinotClient != nil {
mode = Pinot
}
Copy link
Member

Choose a reason for hiding this comment

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

since this prefers ES if both are present:
could this mode be replaced by "just use the non-nil client" and only pass one?

or is there more stuff coming that'll use both sometimes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it can be. It's just that Pinot and ES has different GenericClients, there'll need a lot efforts to do a refactor.

Copy link
Member

@Groxx Groxx Jul 17, 2024

Choose a reason for hiding this comment

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

aaah, because esClient is used by other things too, and there is / will be shadowing, so these fields are not just for this mode.
alrighty, makes sense 👍

@bowenxia bowenxia merged commit b73052c into master Jul 17, 2024
21 checks passed
@bowenxia bowenxia deleted the xbowen_refactor_esanalyser00 branch July 17, 2024 20:11
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