You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

controllermetricslogic.go 969 B

12345678910111213141516171819202122232425262728293031323334
  1. package cloud
  2. import (
  3. "context"
  4. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  5. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/tracker"
  7. "time"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type ControllerMetricsLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewControllerMetricsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ControllerMetricsLogic {
  16. return &ControllerMetricsLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *ControllerMetricsLogic) ControllerMetrics(req *types.ControllerMetricsReq) (resp *types.ControllerMetricsResp, err error) {
  23. resp = &types.ControllerMetricsResp{}
  24. metrics := l.svcCtx.PromClient[req.ParticipantId].GetNamedMetricsByTime(req.Metrics, req.Start, req.End, 60*time.Minute, tracker.ControllerOption{
  25. PodsName: req.Pods,
  26. })
  27. resp.Data = metrics
  28. return resp, nil
  29. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.