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

[BUG] App name in metric is unknown_ go_ service #453

Open
kklinan opened this issue Jan 12, 2022 · 1 comment · May be fixed by #457
Open

[BUG] App name in metric is unknown_ go_ service #453

kklinan opened this issue Jan 12, 2022 · 1 comment · May be fixed by #457
Labels
good first issue Good for newcomers

Comments

@kklinan
Copy link

kklinan commented Jan 12, 2022

Issue Description

Type: bug report

Describe what happened

func init() {
exporter = newPrometheusExporter()
host, _ = os.Hostname()
if host == "" {
host = "unknown"
}
app = config.AppName()
pid = strconv.Itoa(os.Getpid())
namespace = "sentinel_go"
}

Since the above code (code 1) uses the init function and is executed before the following code (code 2), the app variable in code 1 is an error.

func InitWithConfig(confEntity *config.Entity) (err error) {
defer func() {
if r := recover(); r != nil {
var ok bool
err, ok = r.(error)
if !ok {
err = fmt.Errorf("%v", r)
}
}
}()
err = config.CheckValid(confEntity)
if err != nil {
return err
}
config.ResetGlobalConfig(confEntity)
if err = config.OverrideConfigFromEnvAndInitLog(); err != nil {
return err
}
return initCoreComponents()
}

@sczyh30 sczyh30 added the good first issue Good for newcomers label Jan 19, 2022
@sczyh30
Copy link
Member

sczyh30 commented Jan 19, 2022

Would you like to contribute a PR to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
2 participants