Skip to content

Commit

Permalink
Remove deprecated collector flags (#2751)
Browse files Browse the repository at this point in the history
* Removing deprecated collectorHTTPPort from codebase

Signed-off-by: LostLaser <[email protected]>

* Reverting go.sum change

Signed-off-by: LostLaser <[email protected]>

* Removing deprecated grpc and zipkin port flags

Signed-off-by: LostLaser <[email protected]>

* Update PR reference for change entry

Co-authored-by: Yuri Shkuro <[email protected]>
Signed-off-by: LostLaser <[email protected]>

Co-authored-by: Yuri Shkuro <[email protected]>
  • Loading branch information
LostLaser and yurishkuro authored Feb 1, 2021
1 parent 165ac36 commit 27cb88f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
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"))
}

0 comments on commit 27cb88f

Please sign in to comment.