(ctx context.Context, serviceId string, logId string)
| 106 | } |
| 107 | |
| 108 | func (i *imlServiceModule) RestLogInfo(ctx context.Context, serviceId string, logId string) (*service_dto.RestLogInfo, error) { |
| 109 | c, err := i.clusterService.Get(ctx, cluster.DefaultClusterID) |
| 110 | if err != nil { |
| 111 | return nil, fmt.Errorf("cluster %s not found", cluster.DefaultClusterID) |
| 112 | } |
| 113 | info, err := i.logService.LogInfo(ctx, "loki", c.Cluster, logId) |
| 114 | if err != nil { |
| 115 | return nil, err |
| 116 | } |
| 117 | if info.Service != serviceId { |
| 118 | return nil, errors.New("service not match") |
| 119 | } |
| 120 | |
| 121 | logInfo := &service_dto.RestLogInfo{ |
| 122 | Id: info.ID, |
| 123 | API: auto.UUID(info.API), |
| 124 | Consumer: auto.UUID(info.Consumer), |
| 125 | Status: info.StatusCode, |
| 126 | Ip: info.RemoteIP, |
| 127 | ResponseTime: common.FormatTime(info.ResponseTime), |
| 128 | Traffic: common.FormatByte(info.Traffic), |
| 129 | LogTime: auto.TimeLabel(info.RecordTime), |
| 130 | Request: service_dto.OriginRequest{ |
| 131 | Header: formatHeader(info.RequestHeader), |
| 132 | Origin: info.RequestBody, |
| 133 | Body: info.RequestBody, |
| 134 | }, |
| 135 | Response: service_dto.OriginRequest{ |
| 136 | Header: formatHeader(info.ResponseHeader), |
| 137 | Origin: info.ResponseBody, |
| 138 | Body: info.ResponseBody, |
| 139 | }, |
| 140 | } |
| 141 | |
| 142 | if info.Consumer == "apipark-global" { |
| 143 | logInfo.IsSystemConsumer = true |
| 144 | logInfo.Consumer = auto.Label{ |
| 145 | Id: info.Consumer, |
| 146 | Name: "System Consumer", |
| 147 | } |
| 148 | } |
| 149 | return logInfo, nil |
| 150 | } |
| 151 | |
| 152 | func (i *imlServiceModule) AILogInfo(ctx context.Context, serviceId string, logId string) (*service_dto.AILogInfo, error) { |
| 153 | c, err := i.clusterService.Get(ctx, cluster.DefaultClusterID) |
nothing calls this directly
no test coverage detected