func Test_Proto_Thrift(t *testing.T) { t.Skip() server := &TServer{} err := server.Start(thrift.NewTTransportFactory()) assert.NoError(t, err) defer server.Server.Stop() var transport thrift.TTransport transport, err = thrift.NewTSocket(fmt.Sprintf("127.0.0.1:%d", server.Port)) assert.NoError(t, err) transportFactory := thrift.NewTTransportFactory() transport = transportFactory.GetTransport(transport) err = transport.Open() assert.NoError(t, err) defer transport.Close() protoFactory := thrift.NewTBinaryProtocolFactoryDefault() client := srv.NewTSrvClientFactory(transport, protoFactory) req := srv.TestRep{ ID: "test", Data: []byte("mama myla ramy"), } res, err := client.Test(&req) assert.NoError(t, err) assert.EqualValues(t, req, *res) }
func Benchmark_Proto_Thrift_Buffered(b *testing.B) { b.Skip() server := &TServer{} err := server.Start(thrift.NewTBufferedTransportFactory(thrift_buffer)) assert.NoError(b, err) defer server.Server.Stop() var transport thrift.TTransport transport, err = thrift.NewTSocket(fmt.Sprintf("127.0.0.1:%d", server.Port)) assert.NoError(b, err) transportFactory := thrift.NewTBufferedTransportFactory(thrift_buffer) transport = transportFactory.GetTransport(transport) err = transport.Open() assert.NoError(b, err) defer transport.Close() protoFactory := thrift.NewTBinaryProtocolFactoryDefault() client := srv.NewTSrvClientFactory(transport, protoFactory) b.Log(server.Port, b.N) b.ResetTimer() for i := 0; i < b.N; i++ { b.StartTimer() req := srv.TestRep{ ID: fmt.Sprintf("%d", i), Data: []byte("mama myla ramy"), } res, err := client.Test(&req) b.StopTimer() assert.NoError(b, err) assert.EqualValues(b, req, *res) b.SetBytes(int64(len(req.Data) * 2)) } }
func main() { flag.Usage = Usage var host string var port int var protocol string var urlString string var framed bool var useHttp bool var parsedUrl url.URL var trans thrift.TTransport _ = strconv.Atoi _ = math.Abs flag.Usage = Usage flag.StringVar(&host, "h", "localhost", "Specify host and port") flag.IntVar(&port, "p", 9090, "Specify port") flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") flag.StringVar(&urlString, "u", "", "Specify the url") flag.BoolVar(&framed, "framed", false, "Use framed transport") flag.BoolVar(&useHttp, "http", false, "Use http") flag.Parse() if len(urlString) > 0 { parsedUrl, err := url.Parse(urlString) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } host = parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" } else if useHttp { _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } } cmd := flag.Arg(0) var err error if useHttp { trans, err = thrift.NewTHttpClient(parsedUrl.String()) } else { portStr := fmt.Sprint(port) if strings.Contains(host, ":") { host, portStr, err = net.SplitHostPort(host) if err != nil { fmt.Fprintln(os.Stderr, "error with host:", err) os.Exit(1) } } trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) if err != nil { fmt.Fprintln(os.Stderr, "error resolving address:", err) os.Exit(1) } if framed { trans = thrift.NewTFramedTransport(trans) } } if err != nil { fmt.Fprintln(os.Stderr, "Error creating transport", err) os.Exit(1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case "compact": protocolFactory = thrift.NewTCompactProtocolFactory() break case "simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() break case "json": protocolFactory = thrift.NewTJSONProtocolFactory() break case "binary", "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() break default: fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) Usage() os.Exit(1) } client := add.NewAddServiceClientFactory(trans, protocolFactory) if err := trans.Open(); err != nil { fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) os.Exit(1) } switch cmd { case "Add": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "Add requires 2 args") flag.Usage() } argvalue0, err4 := (strconv.ParseInt(flag.Arg(1), 10, 64)) if err4 != nil { Usage() return } value0 := argvalue0 argvalue1, err5 := (strconv.ParseInt(flag.Arg(2), 10, 64)) if err5 != nil { Usage() return } value1 := argvalue1 fmt.Print(client.Add(value0, value1)) fmt.Print("\n") break case "": Usage() break default: fmt.Fprintln(os.Stderr, "Invalid function ", cmd) } }
func main() { flag.Usage = Usage var host string var port int var protocol string var urlString string var framed bool var useHttp bool var parsedUrl url.URL var trans thrift.TTransport _ = strconv.Atoi _ = math.Abs flag.Usage = Usage flag.StringVar(&host, "h", "localhost", "Specify host and port") flag.IntVar(&port, "p", 9090, "Specify port") flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") flag.StringVar(&urlString, "u", "", "Specify the url") flag.BoolVar(&framed, "framed", false, "Use framed transport") flag.BoolVar(&useHttp, "http", false, "Use http") flag.Parse() if len(urlString) > 0 { parsedUrl, err := url.Parse(urlString) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } host = parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" } else if useHttp { _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } } cmd := flag.Arg(0) var err error if useHttp { trans, err = thrift.NewTHttpClient(parsedUrl.String()) } else { portStr := fmt.Sprint(port) if strings.Contains(host, ":") { host, portStr, err = net.SplitHostPort(host) if err != nil { fmt.Fprintln(os.Stderr, "error with host:", err) os.Exit(1) } } trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) if err != nil { fmt.Fprintln(os.Stderr, "error resolving address:", err) os.Exit(1) } if framed { trans = thrift.NewTFramedTransport(trans) } } if err != nil { fmt.Fprintln(os.Stderr, "Error creating transport", err) os.Exit(1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case "compact": protocolFactory = thrift.NewTCompactProtocolFactory() break case "simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() break case "json": protocolFactory = thrift.NewTJSONProtocolFactory() break case "binary", "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() break default: fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) Usage() os.Exit(1) } client := scribe.NewScribeClientFactory(trans, protocolFactory) if err := trans.Open(); err != nil { fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) os.Exit(1) } switch cmd { case "Log": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "Log requires 1 args") flag.Usage() } arg5 := flag.Arg(1) mbTrans6 := thrift.NewTMemoryBufferLen(len(arg5)) defer mbTrans6.Close() _, err7 := mbTrans6.WriteString(arg5) if err7 != nil { Usage() return } factory8 := thrift.NewTSimpleJSONProtocolFactory() jsProt9 := factory8.GetProtocol(mbTrans6) containerStruct0 := scribe.NewLogArgs() err10 := containerStruct0.ReadField1(jsProt9) if err10 != nil { Usage() return } argvalue0 := containerStruct0.Messages value0 := argvalue0 fmt.Print(client.Log(value0)) fmt.Print("\n") break case "": Usage() break default: fmt.Fprintln(os.Stderr, "Invalid function ", cmd) } }
func main() { flag.Usage = Usage var host string var port int var protocol string var urlString string var framed bool var useHttp bool var parsedUrl url.URL var trans thrift.TTransport _ = strconv.Atoi _ = math.Abs flag.Usage = Usage flag.StringVar(&host, "h", "localhost", "Specify host and port") flag.IntVar(&port, "p", 9090, "Specify port") flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") flag.StringVar(&urlString, "u", "", "Specify the url") flag.BoolVar(&framed, "framed", false, "Use framed transport") flag.BoolVar(&useHttp, "http", false, "Use http") flag.Parse() if len(urlString) > 0 { parsedUrl, err := url.Parse(urlString) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } host = parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" } else if useHttp { _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } } cmd := flag.Arg(0) var err error if useHttp { trans, err = thrift.NewTHttpClient(parsedUrl.String()) } else { portStr := fmt.Sprint(port) if strings.Contains(host, ":") { host, portStr, err = net.SplitHostPort(host) if err != nil { fmt.Fprintln(os.Stderr, "error with host:", err) os.Exit(1) } } trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) if err != nil { fmt.Fprintln(os.Stderr, "error resolving address:", err) os.Exit(1) } if framed { trans = thrift.NewTFramedTransport(trans) } } if err != nil { fmt.Fprintln(os.Stderr, "Error creating transport", err) os.Exit(1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case "compact": protocolFactory = thrift.NewTCompactProtocolFactory() break case "simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() break case "json": protocolFactory = thrift.NewTJSONProtocolFactory() break case "binary", "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() break default: fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) Usage() os.Exit(1) } client := zipkincollector.NewZipkinCollectorClientFactory(trans, protocolFactory) if err := trans.Open(); err != nil { fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) os.Exit(1) } switch cmd { case "storeTopAnnotations": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "StoreTopAnnotations requires 2 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 arg10 := flag.Arg(2) mbTrans11 := thrift.NewTMemoryBufferLen(len(arg10)) defer mbTrans11.Close() _, err12 := mbTrans11.WriteString(arg10) if err12 != nil { Usage() return } factory13 := thrift.NewTSimpleJSONProtocolFactory() jsProt14 := factory13.GetProtocol(mbTrans11) containerStruct1 := zipkincollector.NewStoreTopAnnotationsArgs() err15 := containerStruct1.ReadField2(jsProt14) if err15 != nil { Usage() return } argvalue1 := containerStruct1.Annotations value1 := argvalue1 fmt.Print(client.StoreTopAnnotations(value0, value1)) fmt.Print("\n") break case "storeTopKeyValueAnnotations": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "StoreTopKeyValueAnnotations requires 2 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 arg17 := flag.Arg(2) mbTrans18 := thrift.NewTMemoryBufferLen(len(arg17)) defer mbTrans18.Close() _, err19 := mbTrans18.WriteString(arg17) if err19 != nil { Usage() return } factory20 := thrift.NewTSimpleJSONProtocolFactory() jsProt21 := factory20.GetProtocol(mbTrans18) containerStruct1 := zipkincollector.NewStoreTopKeyValueAnnotationsArgs() err22 := containerStruct1.ReadField2(jsProt21) if err22 != nil { Usage() return } argvalue1 := containerStruct1.Annotations value1 := argvalue1 fmt.Print(client.StoreTopKeyValueAnnotations(value0, value1)) fmt.Print("\n") break case "storeDependencies": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "StoreDependencies requires 1 args") flag.Usage() } arg23 := flag.Arg(1) mbTrans24 := thrift.NewTMemoryBufferLen(len(arg23)) defer mbTrans24.Close() _, err25 := mbTrans24.WriteString(arg23) if err25 != nil { Usage() return } factory26 := thrift.NewTSimpleJSONProtocolFactory() jsProt27 := factory26.GetProtocol(mbTrans24) argvalue0 := zipkincollector.NewDependencies() err28 := argvalue0.Read(jsProt27) if err28 != nil { Usage() return } value0 := argvalue0 fmt.Print(client.StoreDependencies(value0)) fmt.Print("\n") break case "Log": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "Log requires 1 args") flag.Usage() } arg29 := flag.Arg(1) mbTrans30 := thrift.NewTMemoryBufferLen(len(arg29)) defer mbTrans30.Close() _, err31 := mbTrans30.WriteString(arg29) if err31 != nil { Usage() return } factory32 := thrift.NewTSimpleJSONProtocolFactory() jsProt33 := factory32.GetProtocol(mbTrans30) containerStruct0 := zipkincollector.NewLogArgs() err34 := containerStruct0.ReadField1(jsProt33) if err34 != nil { Usage() return } argvalue0 := containerStruct0.Messages value0 := argvalue0 fmt.Print(client.Log(value0)) fmt.Print("\n") break case "": Usage() break default: fmt.Fprintln(os.Stderr, "Invalid function ", cmd) } }
func main() { flag.Usage = Usage var host string var port int var protocol string var urlString string var framed bool var useHttp bool var parsedUrl url.URL var trans thrift.TTransport _ = strconv.Atoi _ = math.Abs flag.Usage = Usage flag.StringVar(&host, "h", "localhost", "Specify host and port") flag.IntVar(&port, "p", 9090, "Specify port") flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") flag.StringVar(&urlString, "u", "", "Specify the url") flag.BoolVar(&framed, "framed", false, "Use framed transport") flag.BoolVar(&useHttp, "http", false, "Use http") flag.Parse() if len(urlString) > 0 { parsedUrl, err := url.Parse(urlString) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } host = parsedUrl.Host useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" } else if useHttp { _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) if err != nil { fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) flag.Usage() } } cmd := flag.Arg(0) var err error if useHttp { trans, err = thrift.NewTHttpClient(parsedUrl.String()) } else { portStr := fmt.Sprint(port) if strings.Contains(host, ":") { host, portStr, err = net.SplitHostPort(host) if err != nil { fmt.Fprintln(os.Stderr, "error with host:", err) os.Exit(1) } } trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) if err != nil { fmt.Fprintln(os.Stderr, "error resolving address:", err) os.Exit(1) } if framed { trans = thrift.NewTFramedTransport(trans) } } if err != nil { fmt.Fprintln(os.Stderr, "Error creating transport", err) os.Exit(1) } defer trans.Close() var protocolFactory thrift.TProtocolFactory switch protocol { case "compact": protocolFactory = thrift.NewTCompactProtocolFactory() break case "simplejson": protocolFactory = thrift.NewTSimpleJSONProtocolFactory() break case "json": protocolFactory = thrift.NewTJSONProtocolFactory() break case "binary", "": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() break default: fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) Usage() os.Exit(1) } client := zipkinquery.NewZipkinQueryClientFactory(trans, protocolFactory) if err := trans.Open(); err != nil { fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) os.Exit(1) } switch cmd { case "getTraceIds": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetTraceIds requires 1 args") flag.Usage() } arg77 := flag.Arg(1) mbTrans78 := thrift.NewTMemoryBufferLen(len(arg77)) defer mbTrans78.Close() _, err79 := mbTrans78.WriteString(arg77) if err79 != nil { Usage() return } factory80 := thrift.NewTSimpleJSONProtocolFactory() jsProt81 := factory80.GetProtocol(mbTrans78) argvalue0 := zipkinquery.NewQueryRequest() err82 := argvalue0.Read(jsProt81) if err82 != nil { Usage() return } value0 := argvalue0 fmt.Print(client.GetTraceIds(value0)) fmt.Print("\n") break case "getTraceIdsBySpanName": if flag.NArg()-1 != 5 { fmt.Fprintln(os.Stderr, "GetTraceIdsBySpanName requires 5 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 argvalue1 := flag.Arg(2) value1 := argvalue1 argvalue2, err85 := (strconv.ParseInt(flag.Arg(3), 10, 64)) if err85 != nil { Usage() return } value2 := argvalue2 tmp3, err86 := (strconv.Atoi(flag.Arg(4))) if err86 != nil { Usage() return } argvalue3 := int32(tmp3) value3 := argvalue3 tmp4, err := (strconv.Atoi(flag.Arg(5))) if err != nil { Usage() return } argvalue4 := zipkinquery.Order(tmp4) value4 := argvalue4 fmt.Print(client.GetTraceIdsBySpanName(value0, value1, value2, value3, value4)) fmt.Print("\n") break case "getTraceIdsByServiceName": if flag.NArg()-1 != 4 { fmt.Fprintln(os.Stderr, "GetTraceIdsByServiceName requires 4 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 argvalue1, err88 := (strconv.ParseInt(flag.Arg(2), 10, 64)) if err88 != nil { Usage() return } value1 := argvalue1 tmp2, err89 := (strconv.Atoi(flag.Arg(3))) if err89 != nil { Usage() return } argvalue2 := int32(tmp2) value2 := argvalue2 tmp3, err := (strconv.Atoi(flag.Arg(4))) if err != nil { Usage() return } argvalue3 := zipkinquery.Order(tmp3) value3 := argvalue3 fmt.Print(client.GetTraceIdsByServiceName(value0, value1, value2, value3)) fmt.Print("\n") break case "getTraceIdsByAnnotation": if flag.NArg()-1 != 6 { fmt.Fprintln(os.Stderr, "GetTraceIdsByAnnotation requires 6 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 argvalue1 := flag.Arg(2) value1 := argvalue1 argvalue2 := []byte(flag.Arg(3)) value2 := argvalue2 argvalue3, err93 := (strconv.ParseInt(flag.Arg(4), 10, 64)) if err93 != nil { Usage() return } value3 := argvalue3 tmp4, err94 := (strconv.Atoi(flag.Arg(5))) if err94 != nil { Usage() return } argvalue4 := int32(tmp4) value4 := argvalue4 tmp5, err := (strconv.Atoi(flag.Arg(6))) if err != nil { Usage() return } argvalue5 := zipkinquery.Order(tmp5) value5 := argvalue5 fmt.Print(client.GetTraceIdsByAnnotation(value0, value1, value2, value3, value4, value5)) fmt.Print("\n") break case "tracesExist": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "TracesExist requires 1 args") flag.Usage() } arg95 := flag.Arg(1) mbTrans96 := thrift.NewTMemoryBufferLen(len(arg95)) defer mbTrans96.Close() _, err97 := mbTrans96.WriteString(arg95) if err97 != nil { Usage() return } factory98 := thrift.NewTSimpleJSONProtocolFactory() jsProt99 := factory98.GetProtocol(mbTrans96) containerStruct0 := zipkinquery.NewTracesExistArgs() err100 := containerStruct0.ReadField1(jsProt99) if err100 != nil { Usage() return } argvalue0 := containerStruct0.TraceIds value0 := argvalue0 fmt.Print(client.TracesExist(value0)) fmt.Print("\n") break case "getTracesByIds": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "GetTracesByIds requires 2 args") flag.Usage() } arg101 := flag.Arg(1) mbTrans102 := thrift.NewTMemoryBufferLen(len(arg101)) defer mbTrans102.Close() _, err103 := mbTrans102.WriteString(arg101) if err103 != nil { Usage() return } factory104 := thrift.NewTSimpleJSONProtocolFactory() jsProt105 := factory104.GetProtocol(mbTrans102) containerStruct0 := zipkinquery.NewGetTracesByIdsArgs() err106 := containerStruct0.ReadField1(jsProt105) if err106 != nil { Usage() return } argvalue0 := containerStruct0.TraceIds value0 := argvalue0 arg107 := flag.Arg(2) mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107)) defer mbTrans108.Close() _, err109 := mbTrans108.WriteString(arg107) if err109 != nil { Usage() return } factory110 := thrift.NewTSimpleJSONProtocolFactory() jsProt111 := factory110.GetProtocol(mbTrans108) containerStruct1 := zipkinquery.NewGetTracesByIdsArgs() err112 := containerStruct1.ReadField2(jsProt111) if err112 != nil { Usage() return } argvalue1 := containerStruct1.Adjust value1 := argvalue1 fmt.Print(client.GetTracesByIds(value0, value1)) fmt.Print("\n") break case "getTraceTimelinesByIds": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "GetTraceTimelinesByIds requires 2 args") flag.Usage() } arg113 := flag.Arg(1) mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113)) defer mbTrans114.Close() _, err115 := mbTrans114.WriteString(arg113) if err115 != nil { Usage() return } factory116 := thrift.NewTSimpleJSONProtocolFactory() jsProt117 := factory116.GetProtocol(mbTrans114) containerStruct0 := zipkinquery.NewGetTraceTimelinesByIdsArgs() err118 := containerStruct0.ReadField1(jsProt117) if err118 != nil { Usage() return } argvalue0 := containerStruct0.TraceIds value0 := argvalue0 arg119 := flag.Arg(2) mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119)) defer mbTrans120.Close() _, err121 := mbTrans120.WriteString(arg119) if err121 != nil { Usage() return } factory122 := thrift.NewTSimpleJSONProtocolFactory() jsProt123 := factory122.GetProtocol(mbTrans120) containerStruct1 := zipkinquery.NewGetTraceTimelinesByIdsArgs() err124 := containerStruct1.ReadField2(jsProt123) if err124 != nil { Usage() return } argvalue1 := containerStruct1.Adjust value1 := argvalue1 fmt.Print(client.GetTraceTimelinesByIds(value0, value1)) fmt.Print("\n") break case "getTraceSummariesByIds": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "GetTraceSummariesByIds requires 2 args") flag.Usage() } arg125 := flag.Arg(1) mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125)) defer mbTrans126.Close() _, err127 := mbTrans126.WriteString(arg125) if err127 != nil { Usage() return } factory128 := thrift.NewTSimpleJSONProtocolFactory() jsProt129 := factory128.GetProtocol(mbTrans126) containerStruct0 := zipkinquery.NewGetTraceSummariesByIdsArgs() err130 := containerStruct0.ReadField1(jsProt129) if err130 != nil { Usage() return } argvalue0 := containerStruct0.TraceIds value0 := argvalue0 arg131 := flag.Arg(2) mbTrans132 := thrift.NewTMemoryBufferLen(len(arg131)) defer mbTrans132.Close() _, err133 := mbTrans132.WriteString(arg131) if err133 != nil { Usage() return } factory134 := thrift.NewTSimpleJSONProtocolFactory() jsProt135 := factory134.GetProtocol(mbTrans132) containerStruct1 := zipkinquery.NewGetTraceSummariesByIdsArgs() err136 := containerStruct1.ReadField2(jsProt135) if err136 != nil { Usage() return } argvalue1 := containerStruct1.Adjust value1 := argvalue1 fmt.Print(client.GetTraceSummariesByIds(value0, value1)) fmt.Print("\n") break case "getTraceCombosByIds": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "GetTraceCombosByIds requires 2 args") flag.Usage() } arg137 := flag.Arg(1) mbTrans138 := thrift.NewTMemoryBufferLen(len(arg137)) defer mbTrans138.Close() _, err139 := mbTrans138.WriteString(arg137) if err139 != nil { Usage() return } factory140 := thrift.NewTSimpleJSONProtocolFactory() jsProt141 := factory140.GetProtocol(mbTrans138) containerStruct0 := zipkinquery.NewGetTraceCombosByIdsArgs() err142 := containerStruct0.ReadField1(jsProt141) if err142 != nil { Usage() return } argvalue0 := containerStruct0.TraceIds value0 := argvalue0 arg143 := flag.Arg(2) mbTrans144 := thrift.NewTMemoryBufferLen(len(arg143)) defer mbTrans144.Close() _, err145 := mbTrans144.WriteString(arg143) if err145 != nil { Usage() return } factory146 := thrift.NewTSimpleJSONProtocolFactory() jsProt147 := factory146.GetProtocol(mbTrans144) containerStruct1 := zipkinquery.NewGetTraceCombosByIdsArgs() err148 := containerStruct1.ReadField2(jsProt147) if err148 != nil { Usage() return } argvalue1 := containerStruct1.Adjust value1 := argvalue1 fmt.Print(client.GetTraceCombosByIds(value0, value1)) fmt.Print("\n") break case "getServiceNames": if flag.NArg()-1 != 0 { fmt.Fprintln(os.Stderr, "GetServiceNames requires 0 args") flag.Usage() } fmt.Print(client.GetServiceNames()) fmt.Print("\n") break case "getSpanNames": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetSpanNames requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 fmt.Print(client.GetSpanNames(value0)) fmt.Print("\n") break case "setTraceTimeToLive": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "SetTraceTimeToLive requires 2 args") flag.Usage() } argvalue0, err150 := (strconv.ParseInt(flag.Arg(1), 10, 64)) if err150 != nil { Usage() return } value0 := argvalue0 tmp1, err151 := (strconv.Atoi(flag.Arg(2))) if err151 != nil { Usage() return } argvalue1 := int32(tmp1) value1 := argvalue1 fmt.Print(client.SetTraceTimeToLive(value0, value1)) fmt.Print("\n") break case "getTraceTimeToLive": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetTraceTimeToLive requires 1 args") flag.Usage() } argvalue0, err152 := (strconv.ParseInt(flag.Arg(1), 10, 64)) if err152 != nil { Usage() return } value0 := argvalue0 fmt.Print(client.GetTraceTimeToLive(value0)) fmt.Print("\n") break case "getDataTimeToLive": if flag.NArg()-1 != 0 { fmt.Fprintln(os.Stderr, "GetDataTimeToLive requires 0 args") flag.Usage() } fmt.Print(client.GetDataTimeToLive()) fmt.Print("\n") break case "getDependencies": if flag.NArg()-1 != 2 { fmt.Fprintln(os.Stderr, "GetDependencies requires 2 args") flag.Usage() } argvalue0, err153 := (strconv.ParseInt(flag.Arg(1), 10, 64)) if err153 != nil { Usage() return } value0 := argvalue0 argvalue1, err154 := (strconv.ParseInt(flag.Arg(2), 10, 64)) if err154 != nil { Usage() return } value1 := argvalue1 fmt.Print(client.GetDependencies(value0, value1)) fmt.Print("\n") break case "getTopAnnotations": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetTopAnnotations requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 fmt.Print(client.GetTopAnnotations(value0)) fmt.Print("\n") break case "getTopKeyValueAnnotations": if flag.NArg()-1 != 1 { fmt.Fprintln(os.Stderr, "GetTopKeyValueAnnotations requires 1 args") flag.Usage() } argvalue0 := flag.Arg(1) value0 := argvalue0 fmt.Print(client.GetTopKeyValueAnnotations(value0)) fmt.Print("\n") break case "getSpanDurations": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "GetSpanDurations requires 3 args") flag.Usage() } argvalue0, err157 := (strconv.ParseInt(flag.Arg(1), 10, 64)) if err157 != nil { Usage() return } value0 := argvalue0 argvalue1 := flag.Arg(2) value1 := argvalue1 argvalue2 := flag.Arg(3) value2 := argvalue2 fmt.Print(client.GetSpanDurations(value0, value1, value2)) fmt.Print("\n") break case "getServiceNamesToTraceIds": if flag.NArg()-1 != 3 { fmt.Fprintln(os.Stderr, "GetServiceNamesToTraceIds requires 3 args") flag.Usage() } argvalue0, err160 := (strconv.ParseInt(flag.Arg(1), 10, 64)) if err160 != nil { Usage() return } value0 := argvalue0 argvalue1 := flag.Arg(2) value1 := argvalue1 argvalue2 := flag.Arg(3) value2 := argvalue2 fmt.Print(client.GetServiceNamesToTraceIds(value0, value1, value2)) fmt.Print("\n") break case "": Usage() break default: fmt.Fprintln(os.Stderr, "Invalid function ", cmd) } }