(ctx *gin.Context, serviceId string, start string, end string)
| 210 | } |
| 211 | |
| 212 | func (i *imlServiceController) RestChartOverview(ctx *gin.Context, serviceId string, start string, end string) (*monitor_dto.ServiceChartRestOverview, error) { |
| 213 | s, e, err := formatTime(start, end) |
| 214 | if err != nil { |
| 215 | return nil, err |
| 216 | } |
| 217 | if serviceId == "" { |
| 218 | return nil, fmt.Errorf("service is required") |
| 219 | } |
| 220 | so, err := i.module.ServiceOverview(ctx, serviceId) |
| 221 | if err != nil { |
| 222 | return nil, err |
| 223 | } |
| 224 | result := &monitor_dto.ServiceChartRestOverview{ |
| 225 | EnableMCP: so.EnableMCP, |
| 226 | SubscriberNum: so.SubscriberNum, |
| 227 | APINum: so.APINum, |
| 228 | ServiceKind: so.ServiceKind, |
| 229 | } |
| 230 | cfg, err := i.monitorConfigModule.GetMonitorConfig(ctx) |
| 231 | if err != nil { |
| 232 | return nil, err |
| 233 | } |
| 234 | if len(cfg.Config) < 1 { |
| 235 | return result, nil |
| 236 | } |
| 237 | o, err := i.monitorModule.RestChartOverview(ctx, serviceId, s, e) |
| 238 | if err != nil { |
| 239 | return nil, err |
| 240 | } |
| 241 | result.AvailableMonitor = true |
| 242 | result.ChartRestOverview = o |
| 243 | return result, nil |
| 244 | } |
| 245 | |
| 246 | func formatTime(start string, end string) (int64, int64, error) { |
| 247 | s, err := strconv.ParseInt(start, 10, 64) |
nothing calls this directly
no test coverage detected