import { Router } from 'express';
import { MonitoringController } from '../controllers/MonitoringController';
import { Container } from 'typedi';

const router = Router();
const monitoringController = Container.get(MonitoringController);

// 获取当前监控指标
router.get('/metrics', (req, res, next) => {
  monitoringController.getMetrics()
    .then(result => res.json(result))
    .catch(next);
});

// 手动收集和记录指标
router.get('/collect', (req, res, next) => {
  monitoringController.collectMetrics()
    .then(result => res.json(result))
    .catch(next);
});

export default router;
