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

Support adding process tags in OTEL via env variable #2220

Merged
merged 5 commits into from
May 6, 2020

Conversation

pavolloffay
Copy link
Member

@pavolloffay pavolloffay commented May 5, 2020

Resolves #2161

This PR makes configurable collector/agent tags via env variables(or any viper manged config).

Changes:

Why haven't I used the current flags jaeger.tags/collector.tags/agent.tags?

This PR #1854 (comment) added collector.tags, agent.tags and deprecated jaeger.tags. It does not seem right to offer the same functionality via 2 different configuration properties. It creates confusion and additional (dedup) handling in all-in-one.

@pavolloffay pavolloffay requested a review from a team as a code owner May 5, 2020 10:54
@pavolloffay
Copy link
Member Author

collector.tags/agent.tags does not seem to be adopted in Jaeger operator or helm chart. I propose to also read values of jaeger.tags to provide better backward compatibility.

@pavolloffay pavolloffay requested review from objectiser and removed request for jpkrohling May 5, 2020 11:38
@codecov
Copy link

codecov bot commented May 5, 2020

Codecov Report

Merging #2220 into master will not change coverage.
The diff coverage is 25.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2220   +/-   ##
=======================================
  Coverage   96.18%   96.18%           
=======================================
  Files         219      219           
  Lines       10632    10632           
=======================================
  Hits        10226    10226           
  Misses        351      351           
  Partials       55       55           
Impacted Files Coverage Δ
cmd/agent/app/reporter/flags.go 78.57% <25.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b4bf08...7567a9c. Read the comment docs.

}

func getTags(v *viper.Viper) map[string]string {
tagsLegacy := flags.ParseJaegerTags(v.GetString(resourceTagsLegacy))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the handling for the legacy tag jaeger.tags. I am fine keeping this for a release or two. It's shot piece of code.

Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - only comment is that the resource processor is being added regardless of whether there are any tags to be added. Would it be possible to only add if the tags flag was specified?

@pavolloffay
Copy link
Member Author

the resource processor is being added regardless of whether there are any tags to be added. Would it be possible to only add if the tags flag was specified?

It is possible, however it might affect user configuration in OTEL config. Let me explain it. When resource processor is always added users don't have to specify the processor in the pipeline. If we decide to once added it and once not then there will be two ways how the processor is configured in the OTEL config. One could maybe argue that nobody will mix flag configuration and otel file. It's maybe unlikely but we should count with it.

// Agent tags
agentTagsDeprecated = "jaeger.tags"
// AgentTagsDeprecated is a configuration property name for adding process tags to incoming spans.
AgentTagsDeprecated = "jaeger.tags"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named JaegerTagsDeprecated as not specific to agent?
Assuming not specific to agent - the changes seem limited to the agent config at the moment - shouldn't they also be applied to collector?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collector uses only --collector.tags

Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
config map[string]interface{}
service configmodels.Service
}{
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry should have mentioned in preview review - there needs to be a test without the flag being specified to confirm resource processor is not added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was my intention when I refactored the test to use arrays, but I apparently forgot to add the second use case.

@@ -56,17 +56,20 @@ func CollectorConfig(storageType string, zipkinHostPort string, factories config
recTypes = append(recTypes, string(v.Type()))
}
hc := factories.Extensions["health_check"].CreateDefaultConfig()
resProcessor := factories.Processors["resource"].CreateDefaultConfig()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the same approach going to be used for collector, as with the agent default config, to only use the resource processor if labels defined?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, done

Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay pavolloffay merged commit 6cdaea8 into jaegertracing:master May 6, 2020
@pavolloffay pavolloffay modified the milestone: Release 1.18 May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support injecting span tags from environment: flags, env variable, conf file
2 participants