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

Use log.Fatal when JAEGER_SERVICE_NAME is not present #299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arnold-iakab
Copy link
Contributor

No description provided.

@@ -137,7 +137,6 @@ func init() {
if cfg.ApplicationName == "-" {
names := []string{
os.Getenv("JAEGER_SERVICE_NAME"),
os.Getenv("SERVICE_NAME"),
Copy link
Contributor

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?

Copy link
Contributor

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")
Copy link
Contributor

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?

Copy link
Contributor

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 ...")

Copy link
Contributor

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?

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

Successfully merging this pull request may close these issues.

3 participants