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 more environment variables in configuration #323

Merged
merged 3 commits into from Jul 13, 2018

Conversation

Projects
None yet
4 participants
@danehans
Copy link
Contributor

commented Jul 12, 2018

Which problem is this PR solving?

Short description of the changes

  • Previously, the client could only send spans via UDP to the agent.
    This PR adds support for sending spans using HTTP to the collector
    by setting the JAEGER_ENDPOINT env var. Additionally, the HTTP
    transport can be secured through basic auth by setting the
    JAEGER_USER and JAEGER_PASSWORD env vars.

Signed-off-by: Daneyon Hansen danehans@cisco.com

@@ -369,5 +382,13 @@ func (rc *ReporterConfig) NewReporter(
}

func (rc *ReporterConfig) newTransport() (jaeger.Transport, error) {
var opts transport.HTTPOption
if rc.User != "" && rc.Password != "" {
opts = transport.HTTPBasicAuth(rc.User, rc.Password)

This comment has been minimized.

Copy link
@ghost

ghost Jul 12, 2018

ineffectual assignment to opts

@codecov

This comment has been minimized.

Copy link

commented Jul 12, 2018

Codecov Report

Merging #323 into master will decrease coverage by <.01%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #323      +/-   ##
==========================================
- Coverage   87.15%   87.14%   -0.01%     
==========================================
  Files          54       54              
  Lines        2965     2988      +23     
==========================================
+ Hits         2584     2604      +20     
- Misses        269      272       +3     
  Partials      112      112
Impacted Files Coverage Δ
config/config_env.go 100% <100%> (ø) ⬆️
config/config.go 93.19% <62.5%> (-1.81%) ⬇️

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 f7e0d47...4024f94. Read the comment docs.

Daneyon Hansen
Adds HTTP Collector Support
Previously, the client could only send spans via UDP to the agent.
This PR adds support for sending spans using HTTP to the collector
by setting the JAEGER_ENDPOINT env var. Additionally, the HTTP
transport can be secured through basic auth by setting the
JAEGER_USER and JAEGER_PASSWORD env vars.

Fixes: jaegertracing/jaeger#920

Signed-off-by: Daneyon Hansen <danehans@cisco.com>

@danehans danehans force-pushed the danehans:issue_920 branch from 0588790 to 00f963c Jul 12, 2018

@yurishkuro yurishkuro changed the title Adds HTTP Collector Support Support more environment variables in configuration Jul 13, 2018

@yurishkuro
Copy link
Member

left a comment

lgtm. Thanks! I'll let @black-adder to review as well.

@black-adder
Copy link
Contributor

left a comment

thanks for the contribution! just a couple of nits

@@ -157,11 +161,17 @@ func reporterConfigFromEnv() (*ReporterConfig, error) {

host := jaeger.DefaultUDPSpanServerHost
if e := os.Getenv(envAgentHost); e != "" {
if ep := os.Getenv(envEndpoint); ep != "" {

This comment has been minimized.

Copy link
@black-adder

black-adder Jul 13, 2018

Contributor

how about we read the envEndpoint once and use ep in all the checks?

This comment has been minimized.

Copy link
@danehans

danehans Jul 13, 2018

Author Contributor

ack

rc.CollectorEndpoint = fmt.Sprintf("%s", u)
}

if e := os.Getenv(envUser); e != "" {

This comment has been minimized.

Copy link
@black-adder

black-adder Jul 13, 2018

Contributor

can we use xor here instead and combine everything into 1 check? Albeit, it might not be a worthwhile optimization given this only happens during initialization but it's always fun to use xor every now and again.

Daneyon Hansen
Addresses @black-adder Feedback From Commit 00f963c
Signed-off-by: Daneyon Hansen <danehans@cisco.com>

@danehans danehans force-pushed the danehans:issue_920 branch from f569e5b to 630a8ca Jul 13, 2018

pswd := os.Getenv(envPassword)
if user != "" && pswd == "" || user == "" && pswd != "" {
return nil, errors.Errorf("you must set %s and %s env vars together", envUser, envPassword)
} else {

This comment has been minimized.

Copy link
@ghost

ghost Jul 13, 2018

if block ends with a return statement, so drop this else and outdent its block


user := os.Getenv(envUser)
pswd := os.Getenv(envPassword)
if user != "" && pswd == "" || user == "" && pswd != "" {

This comment has been minimized.

Copy link
@ghost

ghost Jul 13, 2018

File is not gofmt-ed with -s

Daneyon Hansen
Addresses golangci gofmt issues.
Signed-off-by: Daneyon Hansen <danehans@cisco.com>

@danehans danehans force-pushed the danehans:issue_920 branch from 7b50fae to 4024f94 Jul 13, 2018

@black-adder black-adder merged commit 252d853 into jaegertracing:master Jul 13, 2018

6 checks passed

DCO All commits have a DCO sign-off from the author
Details
GolangCI No issues found!
Details
WIP ready for review
Details
codecov/patch 87.5% of diff hit (target 87.15%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +0.34% compared to f7e0d47
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@black-adder

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2018

@danehans thanks!

@danehans danehans deleted the danehans:issue_920 branch Jul 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.