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

Method GetStreamStats

profiling/service/service.go:136–150  ·  view source on GitHub ↗
(context.Context, *ppb.GetStreamStatsRequest)

Source from the content-addressed store, hash-verified

134}
135
136func (s *profilingServer) GetStreamStats(context.Context, *ppb.GetStreamStatsRequest) (*ppb.GetStreamStatsResponse, error) {
137 // Since the drain operation is destructive, only one client request should
138 // be served at a time.
139 logger.Infof("profilingServer: GetStreamStats: processing request")
140 s.drainMutex.Lock()
141 results := profiling.StreamStats.Drain()
142 s.drainMutex.Unlock()
143
144 logger.Infof("profilingServer: GetStreamStats: returning %v records", len(results))
145 streamStats := make([]*ppb.Stat, 0)
146 for _, stat := range results {
147 streamStats = append(streamStats, statToProtoStat(stat.(*profiling.Stat)))
148 }
149 return &ppb.GetStreamStatsResponse{StreamStats: streamStats}, nil
150}

Callers

nothing calls this directly

Calls 5

statToProtoStatFunction · 0.85
InfofMethod · 0.65
DrainMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected