-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 collector mains #2060
Refactor collector mains #2060
Conversation
} | ||
|
||
// Close the component and all its underlying dependencies | ||
func (c *Collector) Close() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You either forget to return error or you can change the signature without error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type is part of the io.Closer
interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then return the error. There are several return assignments in this function and none error being returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no error that we would want to bubble up from here. For instance, when issuing a Close()
, we don't want to break the routine when the HTTP server failed to close, as that would result in the Zipkin server not being closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not mean that the error has to be returned immediatelly. It can be wrapped and returned at the end of the function. Hopefully, this function is not used by many clients...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea. If the HTTP server and Zipkin fails, Zipkin will end up wrapping the HTTP server failure. Not sure that's intuitive from the perspective of the admin looking at the logs.
Hopefully, this function is not used by many clients...
It's being used by the main.go
of both the Collector and All In One.
Codecov Report
@@ Coverage Diff @@
## master #2060 +/- ##
==========================================
- Coverage 97.41% 96.38% -1.04%
==========================================
Files 209 214 +5
Lines 10351 10525 +174
==========================================
+ Hits 10083 10144 +61
- Misses 224 325 +101
- Partials 44 56 +12
Continue to review full report at Codecov.
|
Review addressed + conflicts solved. |
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
The rename of |
Coverage is failing, which is kinda expected, as the refactored code didn't have any tests at all, except for the gRPC server, which was kept. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except the function signatures which return an error but in reality they do not return any error - serveZipkin
, serverThrift
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@@ -0,0 +1,93 @@ | |||
// Copyright (c) 2020 The Jaeger Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file seems to be replacing cmd/collector/app/grpcserver/grpc_server.go
, which was deleted (git didn't recognize it as a move).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to set the copyright headers to // Copyright (c) 2018 The Jaeger Authors.
here, as it was in the grpc_server.go
file?
} | ||
|
||
grpcPortStr := ":" + strconv.Itoa(params.Port) | ||
listener, err := net.Listen("tcp", grpcPortStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future TODO: similar to query-service that runs both http and grpc servers on the same port, we could do the same for collector.
type HTTPServerParams struct { | ||
Port int | ||
Handler handler.JaegerBatchesHandler | ||
RecoveryHandler func(http.Handler) http.Handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to be exposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I get the question. The HTTPServerParams
instance is created by the Collector#Start
in cmd/collector/app
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the recovery handler is a mechanical thing that can be added silently, it's weird to have it exposed via API like this.
I'll work on @yurishkuro's comments as soon as #2031 is merged, as there's potential for conflicts here. |
Which problem is this PR solving?
Short description of the changes
make test
and bothall-in-one
andcollector
start successfullygrpcserver
intoserver/grpc.go
.I think this PR is already big enough on its own, so, I won't continue the refactoring of
all-in-one
as part of this commit.