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 --jaeger.tags CLI flag #2753

Merged
merged 4 commits into from
Feb 1, 2021
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ Changes by Version

* Remove deprecated flag `--es.max-num-spans`, please use `--es.max-doc-count` ([#2482](https://github.com/jaegertracing/jaeger/pull/2482),[@BernardTolosajr](https://github.com/BernardTolosajr))

* Remove deprecated flag `--jaeger.tags`, please use `--agent.tags` ([#2753](https://github.com/jaegertracing/jaeger/pull/2753), [@yurishkuro](https://github.com/yurishkuro))

#### New Features

* Add TLS Support for GRPC and HTTP endpoints of the Query server ([#2337](https://github.com/jaegertracing/jaeger/pull/2337), [@rjs211](https://github.com/rjs211))

Enabling TLS in either or both of GRPC or HTTP endpoints forces the server to use dedicated host-port for the two endpoints. The dedicated host-ports are set using the flags `--query.http-server.host-port` (defaults to `:16686`) and `--query.grpc-server.host-port` (defaults to `:16685`) for the HTTP and GRPC endpoints respectively. If either of both of the dedicated host-ports' flags are not explicitly set, the default values are used.


If TLS is disabled in both endpoints (default), dedicated host-ports are used if either or both of `--query.http-server.host-port` or `--query.grpc-server.host-port` is explicitly set. If only one of the dedicated host-port flags is set, the other flag uses its corresponding default value. If neither of the dedicated host-port flags are explicitly set, the common host-port infered from `--query.host-port` (defaults to `:16686`) is used for both the GRPC and HTTP endpoints.
If TLS is disabled in both endpoints (default), dedicated host-ports are used if either or both of `--query.http-server.host-port` or `--query.grpc-server.host-port` is explicitly set. If only one of the dedicated host-port flags is set, the other flag uses its corresponding default value. If neither of the dedicated host-port flags are explicitly set, the common host-port infered from `--query.host-port` (defaults to `:16686`) is used for both the GRPC and HTTP endpoints.

### UI Changes

Expand Down
10 changes: 2 additions & 8 deletions cmd/agent/app/reporter/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ import (
const (
// Reporter type
reporterType = "reporter.type"
// AgentTagsDeprecated is a configuration property name for adding process tags to incoming spans.
AgentTagsDeprecated = "jaeger.tags"
agentTags = "agent.tags"
// GRPC is name of gRPC reporter.
GRPC Type = "grpc"

agentTags = "agent.tags"
)

// Type defines type of reporter.
Expand All @@ -48,7 +47,6 @@ type Options struct {
func AddFlags(flags *flag.FlagSet) {
flags.String(reporterType, string(GRPC), fmt.Sprintf("Reporter type to use e.g. %s", string(GRPC)))
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}")
}
}
Expand All @@ -57,10 +55,6 @@ func AddFlags(flags *flag.FlagSet) {
func (b *Options) InitFromViper(v *viper.Viper, logger *zap.Logger) *Options {
b.ReporterType = Type(v.GetString(reporterType))
if !setupcontext.IsAllInOne() {
if len(v.GetString(AgentTagsDeprecated)) > 0 {
logger.Warn("Using deprecated configuration", zap.String("option", AgentTagsDeprecated))
b.AgentTags = flags.ParseJaegerTags(v.GetString(AgentTagsDeprecated))
}
if len(v.GetString(agentTags)) > 0 {
b.AgentTags = flags.ParseJaegerTags(v.GetString(agentTags))
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/opentelemetry/app/processor/resourceprocessor/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ package resourceprocessor

import (
"flag"
"fmt"

"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
)

// AddFlags adds flags for Options.
func AddFlags(flags *flag.FlagSet) {
flags.String(reporter.AgentTagsDeprecated, "", fmt.Sprintf("(deprecated, use --%s) One or more tags to be added to the Process tags of all spans passing through this agent. Ex: key1=value1,key2=${envVar:defaultValue}", resourceLabels))
flags.String(resourceLabels, "", "One or more tags to be added to the Process tags of all spans passing through this agent. Ex: key1=value1,key2=${envVar:defaultValue}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"go.opentelemetry.io/collector/processor/processorhelper"
"go.opentelemetry.io/collector/processor/resourceprocessor"

"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
"github.com/jaegertracing/jaeger/cmd/flags"
)

Expand Down Expand Up @@ -54,17 +53,7 @@ func (f Factory) CreateDefaultConfig() configmodels.Processor {

// GetTags returns tags to be added to all spans.
func (f Factory) GetTags() map[string]string {
tagsLegacy := flags.ParseJaegerTags(f.Viper.GetString(reporter.AgentTagsDeprecated))
tags := flags.ParseJaegerTags(f.Viper.GetString(resourceLabels))
if tags == nil {
return tagsLegacy
}
for k, v := range tagsLegacy {
if _, ok := tags[k]; !ok {
tags[k] = v
}
}
return tags
return flags.ParseJaegerTags(f.Viper.GetString(resourceLabels))
}

// CreateTracesProcessor creates resource processor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestDefaultValues(t *testing.T) {

func TestDefaultValueFromViper(t *testing.T) {
v, c := jConfig.Viperize(AddFlags)
err := c.ParseFlags([]string{"--resource.attributes=foo=bar,orig=fake", "--jaeger.tags=foo=legacy,leg=head"})
err := c.ParseFlags([]string{"--resource.attributes=foo=bar,orig=fake"})
require.NoError(t, err)

f := &Factory{
Expand All @@ -65,35 +65,10 @@ func TestDefaultValueFromViper(t *testing.T) {
})
assert.Equal(t, []processorhelper.ActionKeyValue{
{Key: "foo", Value: "bar", Action: processorhelper.UPSERT},
{Key: "leg", Value: "head", Action: processorhelper.UPSERT},
{Key: "orig", Value: "fake", Action: processorhelper.UPSERT},
}, cfg.AttributesActions)
}

func TestLegacyJaegerTagsOnly(t *testing.T) {
v, c := jConfig.Viperize(AddFlags)
err := c.ParseFlags([]string{"--jaeger.tags=foo=legacy,leg=head"})
require.NoError(t, err)

f := &Factory{
Wrapped: resourceprocessor.NewFactory(),
Viper: v,
}

cfg := f.CreateDefaultConfig().(*resourceprocessor.Config)
p, err := f.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, &componenttest.ExampleExporterConsumer{})
require.NoError(t, err)
assert.NotNil(t, p)

sort.Slice(cfg.AttributesActions, func(i, j int) bool {
return strings.Compare(cfg.AttributesActions[i].Key, cfg.AttributesActions[j].Key) < 0
})
assert.Equal(t, []processorhelper.ActionKeyValue{
{Key: "foo", Value: "legacy", Action: processorhelper.UPSERT},
{Key: "leg", Value: "head", Action: processorhelper.UPSERT},
}, cfg.AttributesActions)
}

func TestLoadConfigAndFlags(t *testing.T) {
factories, err := componenttest.ExampleComponents()
require.NoError(t, err)
Expand Down