Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Make JAEGER_ENDPOINT more priority over JAEGER_AGENT_XXX #342

Merged

Conversation

eundoosong
Copy link
Contributor

Signed-off-by: Eundoo Song [email protected]

Which problem is this PR solving?

If the two config options(JAEGER_ENDPOINT, JAEGER_AGENT_XXX) are set, the traces are sent to the endpoint using JAEGER_ENDPOINT, making the JAEGER_AGENT_XXX vars ineffective.
This is already implemented and documented in java/node client.
Also, go client doc also explains the same

If JAEGER_ENDPOINT is set, the client sends traces to the endpoint via HTTP, 
making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. 

But the code just returns an error, which is different.

IMO, there is no reason just for go-client to be different. should be same.

Short description of the changes

  • Not use JAEGER_AGENT_XXX env if JAEGER_ENDPOINT env is set.

if e := os.Getenv(envAgentPort); e != "" {
if ep != "" {
return nil, errors.Errorf("cannot set env vars %s and %s together", envAgentPort, envEndpoint)
rc.CollectorEndpoint = fmt.Sprintf("%s", u)

Choose a reason for hiding this comment

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

should use String() instead of fmt.Sprintf

@codecov
Copy link

codecov bot commented Oct 24, 2018

Codecov Report

Merging #342 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #342      +/-   ##
==========================================
- Coverage   87.21%   87.19%   -0.02%     
==========================================
  Files          54       54              
  Lines        3003     2999       -4     
==========================================
- Hits         2619     2615       -4     
  Misses        272      272              
  Partials      112      112
Impacted Files Coverage Δ
config/config_env.go 100% <100%> (ø) ⬆️

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 84fe9bc...3f546e9. Read the comment docs.

@eundoosong eundoosong force-pushed the fix_inconsistent_jaeger_endpoint branch from d358f81 to e4b1e58 Compare October 24, 2018 15:58
if user != "" && pswd == "" || user == "" && pswd != "" {
return nil, errors.Errorf("you must set %s and %s env vars together", envUser, envPassword)
// the side effect of this is that we are building the default value, even if none of the env vars
// were not explicitly passed
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove "not" (double negative)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Signed-off-by: Eundoo Song <[email protected]>
{
envVar: envAgentHost,
value: "user",
err: fmt.Sprintf("cannot set env vars %s and %s together", envAgentHost, envEndpoint),
Copy link
Member

Choose a reason for hiding this comment

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

this error is no longer tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we don't need that error any more.
With this PR, if both envEndpoint and envAgentHost are set, envEndpoint will be only used.

if user != "" && pswd == "" || user == "" && pswd != "" {
return nil, errors.Errorf("you must set %s and %s env vars together", envUser, envPassword)
// the side effect of this is that we are building the default value, even if none of the env vars
// were explicitly passed
Copy link
Member

Choose a reason for hiding this comment

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

let's remove this comment, II don't know what it is trying to say, only confuses people

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok let me remove.
It is there by original author.

Signed-off-by: Eundoo Song <[email protected]>
@yurishkuro yurishkuro merged commit c58709f into jaegertracing:master Nov 7, 2018
@yurishkuro
Copy link
Member

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants