Skip to content

Commit a44f56c

Browse files
committed
update tracing version
1 parent b3526ac commit a44f56c

File tree

10 files changed

+351
-95
lines changed

10 files changed

+351
-95
lines changed

example/grpc/grpcClient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"time"
88

99
tracing "github.com/codeandcode0x/traceandtrace-go"
10-
pb "github.com/codeandcode0x/traceandtrace-go/example/helloworld/proto"
10+
pb "github.com/codeandcode0x/traceandtrace-go/example/protos/helloworld"
1111
"google.golang.org/grpc"
1212
)
1313

example/grpc/grpcServer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"net"
77

8-
pb "github.com/codeandcode0x/traceandtrace-go/example/helloworld/proto"
8+
pb "github.com/codeandcode0x/traceandtrace-go/example/protos/helloworld"
99

1010
tracing "github.com/codeandcode0x/traceandtrace-go"
1111
opentracing "github.com/opentracing/opentracing-go"

example/grpc/userGRPCClient.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
8+
tracing "github.com/codeandcode0x/traceandtrace-go"
9+
user "github.com/codeandcode0x/traceandtrace-go/example/protos/user"
10+
11+
"google.golang.org/grpc"
12+
)
13+
14+
func main() {
15+
// add gRPC client tracing
16+
rpcOption, closer := tracing.AddRpcClientTracing("UserRpcClient")
17+
defer closer.Close()
18+
19+
conn, err := grpc.Dial(":22530", grpc.WithInsecure(), rpcOption)
20+
if err != nil {
21+
log.Printf("faild to connect: %v", err)
22+
}
23+
defer conn.Close()
24+
25+
c := user.NewUserRPCClient(conn)
26+
r, err := c.GetAllUsers(context.Background(), &user.UserMsgRequest{Count: 100})
27+
if err != nil {
28+
log.Printf("could not request: %v", err)
29+
}
30+
31+
fmt.Printf("get user count : %s !\n", r.Message)
32+
}

example/helloworld/client.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

example/helloworld/server.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

example/http/httpServer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func main() {
2020
// http to gRPC
2121
func httpServer() {
2222
http.HandleFunc("/rpc/tracing", func(w http.ResponseWriter, r *http.Request) {
23+
log.Println(".............. header ", r.Header)
2324
pctx, cancel := tracing.AddHttpTracing("HttpServer", "/rpc/tracing GET", r.Header, map[string]string{"version": "v1"})
2425
defer cancel()
2526
// rpc tracing

example/helloworld/proto/helloworld.pb.go renamed to example/protos/helloworld/helloworld.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)