Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "shar-telemetry", Short: "SHAR Telemetry Server", Long: ``, Run: func(cmd *cobra.Command, args []string) { cfg, err := config.GetEnvironment() if err != nil { panic(err) } if flags.Value.NatsConfig != "" { b, err := os.ReadFile(flags.Value.NatsConfig) if err != nil { slog.Error("read nats configuration file", slog.String("error", err.Error())) os.Exit(1) } storage.NatsConfig = string(b) } nc, err := nats.Connect(cfg.NatsURL) if err != nil { panic(err) } js, err := nc.JetStream() if err != nil { panic(err) } if len(os.Args) > 1 && os.Args[1] == "--remove" { err1 := js.DeleteConsumer("WORKFLOW_TELEMETRY", "Tracing") err2 := js.DeleteKeyValue(messages.KvTracking) if err1 != nil { panic(err1) } if err2 != nil { panic(err2) } return } ctx := context.Background() exp, err := exporterFor(ctx, cfg) if err != nil { panic(err) } svr := server.New(ctx, nc, js, nats.FileStorage, exp) if err := svr.Listen(); err != nil { panic(err) } time.Sleep(100 * time.Hour) }, PersistentPreRun: func(cmd *cobra.Command, args []string) { }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.