Skip to content

Commit bf896b1

Browse files
authored
Merge pull request #103 from anuraaga/grpc-readme
Update README for gRPC.
2 parents f3b70f7 + afb47e0 commit bf896b1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,30 @@ For convenience `NewClient` is provided which returns a HTTP Client which embeds
5555
calling the `DoWithAppSpan()` method.
5656

5757
#### grpc
58-
gRPC middleware / interceptors are planned for the near future.
58+
Easy to use grpc.StatsHandler middleware are provided for tracing gRPC server and
59+
client requests.
60+
61+
For a server, pass `NewServerHandler` when calling `NewServer`, e.g.,
62+
63+
```go
64+
import (
65+
"google.golang.org/grpc"
66+
zipkingrpc "github.com/openzipkin/zipkin-go/middleware/grpc"
67+
)
68+
69+
server = grpc.NewServer(grpc.StatsHandler(zipkingrpc.NewServerHandler(tracer)))
70+
```
71+
72+
For a client, pass `NewClientHandler` when calling `Dial`, e.g.,
73+
74+
```go
75+
import (
76+
"google.golang.org/grpc"
77+
zipkingrpc "github.com/openzipkin/zipkin-go/middleware/grpc"
78+
)
79+
80+
conn, err = grpc.Dial(addr, grpc.WithStatsHandler(zipkingrpc.NewClientHandler(tracer)))
81+
```
5982

6083
### reporter
6184
The reporter package holds the interface which the various Reporter

0 commit comments

Comments
 (0)