MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / generateTopN

Function generateTopN

module/monitor/iml.go:372–385  ·  view source on GitHub ↗
(id string, name string, item *monitor.TopN, apiKind string)

Source from the content-addressed store, hash-verified

370}
371
372func generateTopN(id string, name string, item *monitor.TopN, apiKind string) *monitor_dto.TopN {
373 n := &monitor_dto.TopN{
374 Id: id,
375 Name: name,
376 Request: common.FormatCountInt64(item.Request),
377 }
378 switch apiKind {
379 case "rest":
380 n.Traffic = common.FormatByte(item.Traffic)
381 case "ai":
382 n.Token = common.FormatCountInt64(item.Token)
383 }
384 return n
385}
386
387func (i *imlMonitorStatisticModule) Top(ctx context.Context, serviceId string, start int64, end int64, limit int, apiKind string) ([]*monitor_dto.TopN, []*monitor_dto.TopN, error) {
388 wheres, err := i.genOverviewWhere(ctx, serviceId, []string{apiKind})

Callers 1

TopMethod · 0.85

Calls 2

FormatCountInt64Function · 0.92
FormatByteFunction · 0.92

Tested by

no test coverage detected