Open darrenjennings opened 3 years ago
I did it this way:
import { Registry } from '@digikare/nestjs-prom';
import { Header } from '@nestjs/common';
import { Controller, Get } from '@nestjs/common/';
import * as client from 'prom-client';
@Controller('metrics')
export class PromController {
private readonly _registry: Registry;
constructor(
private readonly promService: PromService,
) {
this._registry = this.promService.getDefaultRegistry();
}
@Get()
@Header('Content-Type', client.register.contentType)
public async index() {
return this._registry.metrics();
}
}
import {ApiTags} from "@nestjs/swagger";
import {PromController, PromModule} from "@digikare/nestjs-prom";
ApiTags('example')(PromController);
...
@digikare/nestjs-prom
version:0.2.5
I am trying to remove the
/api/metrics
from the autogenerated swagger spec.and then PromController is a copy paste from source(but with
@ApiExcludeEndpoint
)When I hit
/api/metrics
,client.register.metrics();
always returns empty string.