managarten/services/mana-api-gateway/src/metrics/metrics.controller.ts
Till-JS fc0ed636fc feat(api-gateway): add Swagger, admin endpoints, and scheduler
- 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
2026-01-29 18:03:16 +01:00

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);
}
}