MCPcopy
hub / github.com/grpc/grpc-go / traceEvent

Method traceEvent

internal/channelz/channelmap.go:191–221  ·  view source on GitHub ↗
(id int64, desc *TraceEvent)

Source from the content-addressed store, hash-verified

189}
190
191func (c *channelMap) traceEvent(id int64, desc *TraceEvent) {
192 c.mu.Lock()
193 defer c.mu.Unlock()
194 child := c.findEntry(id)
195 childTC, ok := child.(tracedChannel)
196 if !ok {
197 return
198 }
199 childTC.getChannelTrace().append(&traceEvent{Desc: desc.Desc, Severity: desc.Severity, Timestamp: time.Now()})
200 if desc.Parent != nil {
201 parent := c.findEntry(child.getParentID())
202 var chanType RefChannelType
203 switch child.(type) {
204 case *Channel:
205 chanType = RefChannel
206 case *SubChannel:
207 chanType = RefSubChannel
208 }
209 if parentTC, ok := parent.(tracedChannel); ok {
210 parentTC.getChannelTrace().append(&traceEvent{
211 Desc: desc.Parent.Desc,
212 Severity: desc.Parent.Severity,
213 Timestamp: time.Now(),
214 RefID: id,
215 RefName: childTC.getRefName(),
216 RefType: chanType,
217 })
218 childTC.incrTraceRefCount()
219 }
220 }
221}
222
223type int64Slice []int64
224

Callers 1

AddTraceEventFunction · 0.80

Calls 9

findEntryMethod · 0.95
appendMethod · 0.80
NowMethod · 0.80
getChannelTraceMethod · 0.65
getParentIDMethod · 0.65
getRefNameMethod · 0.65
incrTraceRefCountMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected