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

Function NewChannelMetricForTesting

internal/channelz/channel.go:160–169  ·  view source on GitHub ↗

NewChannelMetricForTesting creates a new instance of ChannelMetrics with specified initial values for testing purposes.

(state connectivity.State, target string, started, succeeded, failed, timestamp int64)

Source from the content-addressed store, hash-verified

158// NewChannelMetricForTesting creates a new instance of ChannelMetrics with
159// specified initial values for testing purposes.
160func NewChannelMetricForTesting(state connectivity.State, target string, started, succeeded, failed, timestamp int64) *ChannelMetrics {
161 c := &ChannelMetrics{}
162 c.State.Store(&state)
163 c.Target.Store(&target)
164 c.CallsStarted.Store(started)
165 c.CallsSucceeded.Store(succeeded)
166 c.CallsFailed.Store(failed)
167 c.LastCallStartedTimestamp.Store(timestamp)
168 return c
169}
170
171func (c *Channel) addChild(id int64, e entry) {
172 switch v := e.(type) {

Callers 1

TestGetTopChannelsMethod · 0.92

Calls

no outgoing calls

Tested by 1

TestGetTopChannelsMethod · 0.74