mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 06:49:40 +02:00
- Add Swagger/OpenAPI documentation at /docs endpoint - Add admin module for system-wide API key management - Add scheduler for monthly credit reset and usage cleanup - Add Docker Compose entry for Mac Mini deployment - Document all endpoints with descriptions and examples
26 lines
841 B
TypeScript
26 lines
841 B
TypeScript
import { Controller, Get, Res } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation, ApiResponse, ApiProduces } from '@nestjs/swagger';
|
|
import { Response } from 'express';
|
|
import { MetricsService } from './metrics.service';
|
|
|
|
@ApiTags('System')
|
|
@Controller('metrics')
|
|
export class MetricsController {
|
|
constructor(private readonly metricsService: MetricsService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({
|
|
summary: 'Prometheus metrics',
|
|
description: 'Returns Prometheus-formatted metrics for monitoring. No authentication required.',
|
|
})
|
|
@ApiProduces('text/plain')
|
|
@ApiResponse({
|
|
status: 200,
|
|
description: 'Prometheus metrics in text format',
|
|
})
|
|
async getMetrics(@Res() res: Response) {
|
|
const metrics = await this.metricsService.getMetrics();
|
|
res.setHeader('Content-Type', this.metricsService.getContentType());
|
|
res.send(metrics);
|
|
}
|
|
}
|