import { Controller, Get } from '@nestjs/common';
import { MonitoringService } from '../../core/monitoring/MonitoringService';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';

@ApiTags('Monitoring')
@ApiBearerAuth()
@Controller('api/monitoring')
export class MonitoringController {
  constructor(private monitoringService: MonitoringService) {}

  /**
   * 获取当前监控指标
   */
  @Get('metrics')
  async getMetrics() {
    return this.monitoringService.getMetrics();
  }

  /**
   * 手动收集和记录指标
   */
  @Get('collect')
  async collectMetrics() {
    await this.monitoringService.collectAndRecordMetrics();
    return { success: true, message: '指标收集成功' };
  }
}
