MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / LogRecordsByService

Method LogRecordsByService

service/log/iml.go:30–62  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, start time.Time, end time.Time, page int, size int)

Source from the content-addressed store, hash-verified

28}
29
30func (i *imlLogService) LogRecordsByService(ctx context.Context, serviceId string, start time.Time, end time.Time, page int, size int) ([]*Item, int64, error) {
31 list, total, err := i.logRecordStore.ListPage(ctx, "`record_time` between ? and ? and `service` = ?", page, size, []interface{}{
32 start,
33 end,
34 serviceId,
35 }, "record_time desc")
36 if err != nil {
37 return nil, 0, err
38 }
39 return utils.SliceToSlice(list, func(s *log_source.LogRecord) *Item {
40 return &Item{
41 ID: s.UUID,
42 Strategy: s.Strategy,
43 Service: s.Service,
44 API: s.API,
45 Method: s.Method,
46 Url: s.Url,
47 RemoteIP: s.RemoteIP,
48 Consumer: s.Consumer,
49 Authorization: s.Authorization,
50 InputToken: s.InputToken,
51 OutputToken: s.OutputToken,
52 TotalToken: s.TotalToken,
53 AIProvider: s.AIProvider,
54 AIModel: s.AIModel,
55 StatusCode: s.StatusCode,
56 ResponseTime: s.ResponseTime,
57 Traffic: s.Traffic,
58 RecordTime: s.RecordTime,
59 }
60 }), total, nil
61
62}
63
64func (i *imlLogService) InsertLog(ctx context.Context, driver string, input *InsertLog) error {
65 // 判断日志是否已存在,若已存在,则不插入

Callers

nothing calls this directly

Calls 1

ListPageMethod · 0.65

Tested by

no test coverage detected