mirror of
https://github.com/Unkn0wnCat/matrix-veles.git
synced 2025-07-23 03:17:19 +02:00
Add tracing support
This commit is contained in:
parent
801cf8d84c
commit
8cfe042f11
8 changed files with 249 additions and 26 deletions
12
cmd/root.go
12
cmd/root.go
|
@ -18,6 +18,7 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/Unkn0wnCat/matrix-veles/internal/tracer"
|
||||
"github.com/spf13/viper"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -62,7 +63,18 @@ func init() {
|
|||
viper.SetDefault("bot.web.listen", "127.0.0.1:8123")
|
||||
viper.SetDefault("bot.web.secret", "hunter2")
|
||||
|
||||
viper.SetDefault("tracing.enable", false)
|
||||
viper.SetDefault("tracing.jaeger.endpoint", "http://localhost:14268/api/traces")
|
||||
|
||||
cobra.OnInitialize(loadConfig)
|
||||
cobra.OnInitialize(func() {
|
||||
if viper.GetBool("tracing.enable") {
|
||||
tracer.SetupJaeger()
|
||||
}
|
||||
if !viper.GetBool("tracing.enable") {
|
||||
tracer.SetupDummy()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func loadConfig() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue