This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Commit 724bd0b
Fix gRPC client interceptor for channels reused across traces (#539)
In a typical web server gRPC clients/channels are reused across multiple
requests and hence across multiple traces. Previously the
`OpenCensusClientInterceptor` was instantiated for each channel with the
current tracer from the execution context. This would then lead to all rpcs
going through that channel to have the same tracer, essentially grouping all
rpcs under whatever happened to be the current trace when the channel was
created.
Instead instantiate `OpenCensusClientInterceptor` without a tracer by default.
The current tracer will be retrieved from the execution context at the start of
every rpc span.1 parent 913d588 commit 724bd0b
File tree
5 files changed
+8
-57
lines changed- contrib
- opencensus-ext-google-cloud-clientlibs
- opencensus/ext/google_cloud_clientlibs
- tests
- opencensus-ext-grpc
- opencensus/ext/grpc
- tests
5 files changed
+8
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
Lines changed: 3 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 91 | + | |
97 | 92 | | |
98 | 93 | | |
99 | 94 | | |
| |||
112 | 107 | | |
113 | 108 | | |
114 | 109 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 110 | + | |
120 | 111 | | |
121 | 112 | | |
122 | 113 | | |
| |||
135 | 126 | | |
136 | 127 | | |
137 | 128 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 129 | + | |
143 | 130 | | |
144 | 131 | | |
145 | 132 | | |
| |||
Lines changed: 3 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 80 | | |
87 | 81 | | |
88 | 82 | | |
89 | 83 | | |
90 | 84 | | |
91 | 85 | | |
92 | | - | |
| 86 | + | |
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
96 | 90 | | |
97 | 91 | | |
98 | | - | |
99 | 92 | | |
100 | 93 | | |
101 | 94 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 95 | | |
107 | 96 | | |
108 | 97 | | |
109 | 98 | | |
110 | 99 | | |
111 | 100 | | |
112 | | - | |
| 101 | + | |
113 | 102 | | |
114 | 103 | | |
115 | 104 | | |
116 | 105 | | |
117 | 106 | | |
118 | | - | |
119 | 107 | | |
120 | 108 | | |
121 | 109 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 110 | | |
127 | 111 | | |
128 | 112 | | |
129 | 113 | | |
130 | 114 | | |
131 | 115 | | |
132 | | - | |
| 116 | + | |
133 | 117 | | |
134 | 118 | | |
135 | 119 | | |
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 89 | | |
93 | 90 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 91 | | |
99 | 92 | | |
100 | 93 | | |
| |||
139 | 132 | | |
140 | 133 | | |
141 | 134 | | |
142 | | - | |
143 | 135 | | |
144 | 136 | | |
145 | 137 | | |
| |||
Lines changed: 0 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 64 | | |
79 | 65 | | |
80 | 66 | | |
| |||
0 commit comments