Skip to content

Commit

Permalink
fix flag check
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcb9ff9 committed Mar 21, 2023
1 parent 0728a09 commit c783e29
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 10 additions & 3 deletions command/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions command/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions network/peer_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c783e29

Please sign in to comment.