(ctx context.Context)
| 14 | ) |
| 15 | |
| 16 | func (x *XrayHandler) GetSysStats(ctx context.Context) (*common.BackendStatsResponse, error) { |
| 17 | client := *x.StatsServiceClient |
| 18 | resp, err := client.GetSysStats(ctx, &command.SysStatsRequest{}) |
| 19 | if err != nil { |
| 20 | code := codes.Unknown |
| 21 | if st, ok := status.FromError(err); ok { |
| 22 | code = st.Code() |
| 23 | } |
| 24 | return nil, status.Errorf(code, "failed to get sys stats: %v", err) |
| 25 | } |
| 26 | |
| 27 | return &common.BackendStatsResponse{ |
| 28 | NumGoroutine: resp.NumGoroutine, |
| 29 | NumGc: resp.NumGC, |
| 30 | Alloc: resp.Alloc, |
| 31 | TotalAlloc: resp.TotalAlloc, |
| 32 | Sys: resp.Sys, |
| 33 | Mallocs: resp.Mallocs, |
| 34 | Frees: resp.Frees, |
| 35 | LiveObjects: resp.LiveObjects, |
| 36 | PauseTotalNs: resp.PauseTotalNs, |
| 37 | Uptime: resp.Uptime, |
| 38 | }, nil |
| 39 | } |
| 40 | |
| 41 | func (x *XrayHandler) QueryStats(ctx context.Context, pattern string, reset bool) (*command.QueryStatsResponse, error) { |
| 42 | client := *x.StatsServiceClient |
nothing calls this directly
no test coverage detected