diff --git a/command/helper/helper.go b/command/helper/helper.go index 6d71e95127..53ab3703c2 100644 --- a/command/helper/helper.go +++ b/command/helper/helper.go @@ -276,10 +276,17 @@ func RegisterJaegerFlag(cmd *cobra.Command) { // GetJaegerFlag extracts the telemetry flag func GetJaegerFlag(cmd *cobra.Command) (bool, string) { - v, _ := cmd.Flags().GetBool(command.JaegerFlag) - addr, _ := cmd.Flags().GetString(command.JaegerAddressFlag) + enableJaeger, err := cmd.Flags().GetBool(command.JaegerFlag) + if err != nil && enableJaeger { + addr, err := cmd.Flags().GetString(command.JaegerAddressFlag) + if err != nil { + return false, "" + } + + return true, addr + } - return v, addr + return false, "" } // ParseGraphQLAddress parses the passed in GraphQL address diff --git a/command/server/server.go b/command/server/server.go index e4a53c73ed..8ea9f0fc5e 100644 --- a/command/server/server.go +++ b/command/server/server.go @@ -484,8 +484,8 @@ func runCommand(cmd *cobra.Command, _ []string) { params.rawConfig.EnablePprof = helper.GetPprofFlag(cmd) // jaeger flag - if enable, jaegerURL := helper.GetJaegerFlag(cmd); enable { - params.rawConfig.Telemetry.EnableJaeger = enable + if enableJaeger, jaegerURL := helper.GetJaegerFlag(cmd); enableJaeger { + params.rawConfig.Telemetry.EnableJaeger = enableJaeger params.rawConfig.Telemetry.JaegerURL = jaegerURL } diff --git a/network/peer_connect.go b/network/peer_connect.go index fc8f9e67b6..8a1bd53a64 100644 --- a/network/peer_connect.go +++ b/network/peer_connect.go @@ -58,6 +58,8 @@ func (pci *PeerConnInfo) cleanProtocolStreams(ctx context.Context, trace telemet errs := []error{} span := trace.StartWithContext(ctx, "PeerConnInfo.cleanProtocolStreams") + defer span.End() + for protocolName, clt := range pci.protocolClient { if clt != nil { err := clt.Close()