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

Remove deprecated collector flags #2751

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ Changes by Version

### Backend Changes

#### Breaking changes
#### Breaking Changes

* Remove deprecated CLI flags ([#2751](https://github.com/jaegertracing/jaeger/issues/2751), [@LostLaser](https://github.com/LostLaser)):
* `--collector.http-port` is replaced by `--collector.http-server.host-port`
* `--collector.grpc-port` is replaced by `--collector.grpc-server.host-port`
* `--collector.zipkin.http-port` is replaced by `--collector.zipkin.host-port`

* Remove deprecated flags `--health-check-http-port` & `--admin-http-port`, please use `--admin.http.host-port` ([#2752](https://github.com/jaegertracing/jaeger/pull/2752), [@pradeepnnv](https://github.com/pradeepnnv))

Expand Down
18 changes: 4 additions & 14 deletions cmd/collector/app/builder_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,15 @@ const (
collectorDynQueueSizeMemory = "collector.queue-size-memory"
collectorQueueSize = "collector.queue-size"
collectorNumWorkers = "collector.num-workers"
collectorHTTPPort = "collector.http-port"
collectorGRPCPort = "collector.grpc-port"
// CollectorHTTPHostPort is the flag for collector HTTP port
CollectorHTTPHostPort = "collector.http-server.host-port"
// CollectorGRPCHostPort is the flag for collector gRPC port
CollectorGRPCHostPort = "collector.grpc-server.host-port"
collectorZipkinHTTPPort = "collector.zipkin.http-port"
CollectorGRPCHostPort = "collector.grpc-server.host-port"
// CollectorZipkinHTTPHostPort is the flag for Zipkin HTTP port
CollectorZipkinHTTPHostPort = "collector.zipkin.host-port"
collectorTags = "collector.tags"
collectorZipkinAllowedOrigins = "collector.zipkin.allowed-origins"
collectorZipkinAllowedHeaders = "collector.zipkin.allowed-headers"

collectorHTTPPortWarning = "(deprecated, will be removed after 2020-06-30 or in release v1.20.0, whichever is later)"
collectorGRPCPortWarning = "(deprecated, will be removed after 2020-06-30 or in release v1.20.0, whichever is later)"
collectorZipkinHTTPPortWarning = "(deprecated, will be removed after 2020-06-30 or in release v1.20.0, whichever is later)"
)

var tlsFlagsConfig = tlscfg.ServerFlagsConfig{
Expand Down Expand Up @@ -81,9 +74,6 @@ type CollectorOptions struct {
func AddFlags(flags *flag.FlagSet) {
flags.Int(collectorQueueSize, DefaultQueueSize, "The queue size of the collector")
flags.Int(collectorNumWorkers, DefaultNumWorkers, "The number of workers pulling items from the queue")
flags.Int(collectorHTTPPort, 0, collectorHTTPPortWarning+" see --"+CollectorHTTPHostPort)
flags.Int(collectorGRPCPort, 0, collectorGRPCPortWarning+" see --"+CollectorGRPCHostPort)
flags.Int(collectorZipkinHTTPPort, 0, collectorZipkinHTTPPortWarning+" see --"+CollectorZipkinHTTPHostPort)
flags.Uint(collectorDynQueueSizeMemory, 0, "(experimental) The max memory size in MiB to use for the dynamic queue.")
flags.String(collectorTags, "", "One or more tags to be added to the Process tags of all spans passing through this collector. Ex: key1=value1,key2=${envVar:defaultValue}")
flags.String(collectorZipkinAllowedOrigins, "*", "Comma separated list of allowed origins for the Zipkin collector service, default accepts all")
Expand All @@ -109,9 +99,9 @@ func (cOpts *CollectorOptions) InitFromViper(v *viper.Viper) *CollectorOptions {
cOpts.DynQueueSizeMemory = v.GetUint(collectorDynQueueSizeMemory) * 1024 * 1024 // we receive in MiB and store in bytes
cOpts.QueueSize = v.GetInt(collectorQueueSize)
cOpts.NumWorkers = v.GetInt(collectorNumWorkers)
cOpts.CollectorHTTPHostPort = ports.GetAddressFromCLIOptions(v.GetInt(collectorHTTPPort), v.GetString(CollectorHTTPHostPort))
cOpts.CollectorGRPCHostPort = ports.GetAddressFromCLIOptions(v.GetInt(collectorGRPCPort), v.GetString(CollectorGRPCHostPort))
cOpts.CollectorZipkinHTTPHostPort = ports.GetAddressFromCLIOptions(v.GetInt(collectorZipkinHTTPPort), v.GetString(CollectorZipkinHTTPHostPort))
cOpts.CollectorHTTPHostPort = ports.FormatHostPort(v.GetString(CollectorHTTPHostPort))
cOpts.CollectorGRPCHostPort = ports.FormatHostPort(v.GetString(CollectorGRPCHostPort))
cOpts.CollectorZipkinHTTPHostPort = ports.FormatHostPort(v.GetString(CollectorZipkinHTTPHostPort))
cOpts.CollectorTags = flags.ParseJaegerTags(v.GetString(collectorTags))
cOpts.CollectorZipkinAllowedOrigins = v.GetString(collectorZipkinAllowedOrigins)
cOpts.CollectorZipkinAllowedHeaders = v.GetString(collectorZipkinAllowedHeaders)
Expand Down
5 changes: 5 additions & 0 deletions ports/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ func GetAddressFromCLIOptions(port int, hostPort string) string {
return PortToHostPort(port)
}

return FormatHostPort(hostPort)
}

// FormatHostPort returns hostPort in a usable format (host:port) if it wasn't already
func FormatHostPort(hostPort string) string {
if hostPort == "" {
return ""
}
Expand Down
7 changes: 7 additions & 0 deletions ports/ports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ func TestGetAddressFromCLIOptionsLegacy(t *testing.T) {
})
}
}

func TestFormatHostPort(t *testing.T) {
assert.Equal(t, ":42", FormatHostPort("42"))
assert.Equal(t, ":831", FormatHostPort(":831"))
assert.Equal(t, "", FormatHostPort(""))
assert.Equal(t, "localhost:42", FormatHostPort("localhost:42"))
}