File tree 1 file changed +40
-0
lines changed
instrumentation/google.golang.org/grpc/otelgrpc
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ package otelgrpc
2
+
3
+ import (
4
+ "context"
5
+ "sync"
6
+ "testing"
7
+
8
+ "google.golang.org/grpc/stats"
9
+ )
10
+
11
+ func TestHandleRPC (t * testing.T ) {
12
+ const iteration = 100
13
+ wg := & sync.WaitGroup {}
14
+ ctx := context .Background ()
15
+ h := NewClientHandler ()
16
+ ctx = h .TagRPC (ctx , & stats.RPCTagInfo {
17
+ FullMethodName : "test/method" ,
18
+ })
19
+ for i := 0 ; i < iteration ; i ++ {
20
+ wg .Add (1 )
21
+ go func () {
22
+ defer wg .Done ()
23
+ h .HandleRPC (ctx , & stats.Begin {})
24
+ wg .Add (3 )
25
+ go func () {
26
+ defer wg .Done ()
27
+ h .HandleRPC (ctx , & stats.InPayload {})
28
+ }()
29
+ go func () {
30
+ defer wg .Done ()
31
+ h .HandleRPC (ctx , & stats.OutPayload {})
32
+ }()
33
+ go func () {
34
+ defer wg .Done ()
35
+ h .HandleRPC (ctx , & stats.End {})
36
+ }()
37
+ }()
38
+ }
39
+ wg .Wait ()
40
+ }
You can’t perform that action at this time.
0 commit comments