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

Move all query service HTTP handlers into one function #6128

Merged
merged 5 commits into from
Oct 27, 2024
Merged

Conversation

yurishkuro
Copy link
Member

Which problem is this PR solving?

Description of the changes

  • Consolidate business logic handlers into a single function initRouter
  • Move tenancy handling to the same function, remove it from API and APIv3 handlers

How was this change tested?

  • go test ./cmd/query/app/...

@yurishkuro yurishkuro requested a review from a team as a code owner October 27, 2024 04:22
@yurishkuro yurishkuro changed the title Refactor query service HTTP handlers Move all query service HTTP handlers into one function Oct 27, 2024
Copy link

codecov bot commented Oct 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.43%. Comparing base (a4efe57) to head (bd95e6a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6128      +/-   ##
==========================================
+ Coverage   96.41%   96.43%   +0.01%     
==========================================
  Files         353      353              
  Lines       20137    20135       -2     
==========================================
+ Hits        19416    19417       +1     
+ Misses        535      533       -2     
+ Partials      186      185       -1     
Flag Coverage Δ
badger_v1 8.32% <ø> (ø)
badger_v2 1.68% <ø> (ø)
cassandra-4.x-v1 14.39% <ø> (ø)
cassandra-4.x-v2 1.62% <ø> (ø)
cassandra-5.x-v1 14.39% <ø> (ø)
cassandra-5.x-v2 1.62% <ø> (ø)
elasticsearch-6.x-v1 18.51% <ø> (+<0.01%) ⬆️
elasticsearch-7.x-v1 18.59% <ø> (ø)
elasticsearch-8.x-v1 18.75% <ø> (ø)
elasticsearch-8.x-v2 1.68% <ø> (+0.01%) ⬆️
grpc_v1 9.53% <ø> (+<0.01%) ⬆️
grpc_v2 7.01% <ø> (ø)
kafka-v1 8.88% <ø> (ø)
kafka-v2 1.68% <ø> (ø)
memory_v2 1.68% <ø> (ø)
opensearch-1.x-v1 18.64% <ø> (ø)
opensearch-2.x-v1 18.63% <ø> (-0.01%) ⬇️
opensearch-2.x-v2 1.67% <ø> (ø)
tailsampling-processor 0.47% <ø> (ø)
unittests 95.34% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro
Copy link
Member Author

yurishkuro commented Oct 27, 2024

@mahadzaryab1 please review

Copy link
Collaborator

@mahadzaryab1 mahadzaryab1 left a comment

Choose a reason for hiding this comment

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

lgtm

cmd/query/app/server.go Outdated Show resolved Hide resolved
}

if queryOpts.HTTP.TLSSetting != nil {
tlsCfg, err := queryOpts.HTTP.TLSSetting.LoadTLSConfig(ctx) // This checks if the certificates are correctly provided
if err != nil {
return nil, err
return nil, errors.Join(err, staticHandlerCloser.Close())
Copy link
Collaborator

Choose a reason for hiding this comment

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

ah that's why I was seeing the goleak errors - need to close the handler before exiting

@@ -203,14 +203,13 @@ type httpServer struct {

var _ io.Closer = (*httpServer)(nil)

func createHTTPServer(
ctx context.Context,
func initRouter(
Copy link
Collaborator

Choose a reason for hiding this comment

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

will it be okay to have redundant handlers with the otel implementation? specifically asking about the response headers handler and the compression handler.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@yurishkuro yurishkuro merged commit bf06acf into main Oct 27, 2024
49 checks passed
@yurishkuro yurishkuro deleted the query-cleanup branch October 27, 2024 14:28
yurishkuro added a commit to yurishkuro/jaeger that referenced this pull request Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants