-
Notifications
You must be signed in to change notification settings - Fork 21
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
Use log.Fatal when JAEGER_SERVICE_NAME is not present #299
base: master
Are you sure you want to change the base?
Conversation
@@ -137,7 +137,6 @@ func init() { | |||
if cfg.ApplicationName == "-" { | |||
names := []string{ | |||
os.Getenv("JAEGER_SERVICE_NAME"), | |||
os.Getenv("SERVICE_NAME"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is safe to remove, because we never actually used it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overall logic is highly confusing. I would rather keep the SERVICE_NAME
and in case, none is given log a warning that the JAEGER_SERVICE_NAME
was used as fallback option to make the behaviour more transparent to the user.
@@ -31,8 +31,7 @@ func init() { | |||
return | |||
} | |||
if cfg.ServiceName == "" { | |||
log.Warn("Using Jaeger noop tracer since no JAEGER_SERVICE_NAME is present") | |||
return | |||
log.Fatal("JAEGER_SERVICE_NAME is not present") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage is: we get a non-zero exit code of the program now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not change the behaviour to fatal since this is called in an init function what can have unexpected behaviour changes at other places. If a missing ServiceName
results in a program failure, we should instead make the original warning a valid case ("Using noop ...")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then let's restructure it completely and dump the code in init() and move it somewhere explicit?
No description provided.