-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 tchannel packages to a single top level package #2112
Move all tchannel packages to a single top level package #2112
Conversation
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
cmd/agent/app/reporter/flags.go
Outdated
} | ||
|
||
// AddFlagsWithCustomTypes adds types to use message. | ||
func AddFlagsWithCustomTypes(types []string) func(*flag.FlagSet) { |
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 do we need types
?
Also - if GRPC
is the only supported reporter, we can deprecate the flag so that we can remove it later
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.
I made it backwars compatible, so in Uber's custom build the type can be added back.
Also - if GRPC is the only supported reporter, we can deprecate the flag so that we can remove it later
I would leave it for now as it is. It gives us more flexibility to extend.
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.
I am not sure what the intent of this function, can you elaborate?
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.
I have added a better description to the signature
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Codecov Report
@@ Coverage Diff @@
## master #2112 +/- ##
==========================================
- Coverage 96.29% 96.12% -0.17%
==========================================
Files 214 217 +3
Lines 10535 10541 +6
==========================================
- Hits 10145 10133 -12
- Misses 331 353 +22
+ Partials 59 55 -4
Continue to review full report at Codecov.
|
The coverage is failing bc of the new files in |
cmd/agent/app/builder.go
Outdated
} | ||
|
||
// ProxyBuilder is a func which builds CollectorProxy. | ||
type ProxyBuilder func(map[string]string, metrics.Factory, *zap.Logger) (CollectorProxy, 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.
nit: I'd prefer passing a ProxyBuilderParams struct
cmd/agent/app/reporter/flags.go
Outdated
} | ||
|
||
// AddFlagsWithCustomTypes adds types to use message. | ||
func AddFlagsWithCustomTypes(types []string) func(*flag.FlagSet) { |
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.
I am not sure what the intent of this function, can you elaborate?
cmd/agent/app/reporter/flags.go
Outdated
flags.String(reporterType, string(GRPC), fmt.Sprintf("Reporter type to use e.g. %s", types)) | ||
if !setupcontext.IsAllInOne() { | ||
flags.String(agentTagsDeprecated, "", "(deprecated) see --"+agentTags) | ||
flags.String(agentTags, "", "One or more tags to be added to the Process tags of all spans passing through this agent. Ex: key1=value1,key2=${envVar:defaultValue}") |
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.
if the intent is to do something with different reporters, why do agent tags need to be here, and not in the main function?
cmd/agent/main.go
Outdated
cp, err := app.CreateCollectorProxy(rOpts, tchanBuilder, grpcBuilder, logger, mFactory) | ||
builders := map[reporter.Type]app.ProxyBuilder{} | ||
builders[reporter.GRPC] = func(m map[string]string, factory metrics.Factory, logger *zap.Logger) (app.CollectorProxy, error) { | ||
return grpc.NewCollectorProxy(grpcBuilder, rOpts.AgentTags, mFactory, logger) |
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.
I would prefer to have a function in each package that matches the ProxyBuilder
signature, rather than using lambdas here.
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.
I have created proxy_builders.go
in agent/app
package. They cannot live in the reporter's package bc it creates cyclic imports
# github.com/jaegertracing/jaeger/cmd/agent/app/processors
FAIL github.com/jaegertracing/jaeger/cmd/agent/app/processors [setup failed]
import cycle not allowed in test
FAIL
package github.com/jaegertracing/jaeger/cmd/agent/app/processors (test)
imports github.com/jaegertracing/jaeger/tchannel/agent/app/reporter/tchannel
imports github.com/jaegertracing/jaeger/cmd/agent/app
imports github.com/jaegertracing/jaeger/cmd/agent/app/processors
GOROOT=/home/ploffay/bin/go #gosetup
GOPATH=/home/ploffay/projects/golang #gosetup
/home/ploffay/bin/go/bin/go test -c -o /tmp/___go_test_github_com_jaegertracing_jaeger_cmd_agent_app github.com/jaegertracing/jaeger/cmd/agent/app #gosetup
FAIL github.com/jaegertracing/jaeger/cmd/agent/app [setup failed]
# github.com/jaegertracing/jaeger/cmd/agent/app
FAIL
import cycle not allowed in test
package github.com/jaegertracing/jaeger/cmd/agent/app (test)
imports github.com/jaegertracing/jaeger/tchannel/agent/app/reporter
imports github.com/jaegertracing/jaeger/cmd/agent/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.
I wasn't suggesting importing the function type, just having functions in tch/grpc packages that match it on the signature.
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 was also a suggestion to pass pass Options
instead of listing the parameters. That creates cycle too.
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.
oh, but the struct, I see...
const ( | ||
// CollectorTChannel is the default port for TChannel server for sending spans | ||
CollectorTChannel = 14267 | ||
collectorPort = "collector.port" |
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 looks like we're going back to the deprecated flag name? Maybe we can remove the old one, as it's been quite a while since we deprecated it.
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 intent of this PR is to just move tchannel code to a separate package. The component itself will be removed in the follow-up PR along with flags bindings.
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.
nvm, I though we had another option similar to
--collector.grpc-port int The gRPC port for the collector service (default 14250)
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
cmd/agent/app/reporter/flags.go
Outdated
flags.String(reporterType, string(GRPC), fmt.Sprintf("Reporter type to use e.g. %s, %s[%s]", string(GRPC), string(TCHANNEL), "NOTE: Deprecated since 1.16")) | ||
func (f Flags) AddFlags(flags *flag.FlagSet) { | ||
reps := append([]string{string(GRPC)}, f.Reporters...) | ||
flags.String(reporterType, string(GRPC), fmt.Sprintf("Reporter type to use e.g. %s", reps)) |
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.
if all this complication just to include tchannel in the possible reporter types in the help string, I would say it's not worth it.
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.
Yes just for the help message, I am removing it
@@ -31,7 +31,7 @@ type ProxyBuilder struct { | |||
conn *grpc.ClientConn | |||
} | |||
|
|||
// NewCollectorProxy creates ProxyBuilder | |||
// NewCollectorProxy creates CollectorProxyBuilder |
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.
should revert this
const ( | ||
// CollectorTChannel is the default port for TChannel server for sending spans | ||
CollectorTChannel = 14267 | ||
collectorPort = "collector.port" |
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.
nvm, I though we had another option similar to
--collector.grpc-port int The gRPC port for the collector service (default 14250)
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@yurishkuro comments addressed and PR updated |
close #2109 ? I am waiting on our RPC team to resolve the conflict with grpc 1.26, then we can pull in this change to test, and then switch to the internal copy of the new tchannel package. |
Related to #2105
Supersedes #2109
The top level package is
./tchannel
. I have kept the original package structure. e.g../tchannel/agent/app/reporter/tchannel
.