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

Method RestChartOverview

controller/service/iml.go:212–244  ·  view source on GitHub ↗
(ctx *gin.Context, serviceId string, start string, end string)

Source from the content-addressed store, hash-verified

210}
211
212func (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
246func formatTime(start string, end string) (int64, int64, error) {
247 s, err := strconv.ParseInt(start, 10, 64)

Callers

nothing calls this directly

Calls 4

formatTimeFunction · 0.70
ServiceOverviewMethod · 0.65
GetMonitorConfigMethod · 0.65
RestChartOverviewMethod · 0.65

Tested by

no test coverage detected