digikare / nestjs-prom

A prometheus module for nestjs
160 stars 54 forks source link

FEAT: Programmatically hide Prometheus.metricPath from @nestjs/swagger output #51

Open hitmands opened 3 years ago

hitmands commented 3 years ago

I couldn't find a way of hiding the prom endpoint from our public swagger output.

PromModule.forRoot({
      metricPath: '/heartbeat/metrics',
});

image


Is there a way to pass the ApiExcludeEndpoint decorator to Prometheus?


import { ApiExcludeEndpoint } from '@nestjs/swagger';

@Controlle('hello-world')
class HelloWorld {

  @ApiExcludeEndpoint()
  @Get('/hide-from-swagger-json')
  privateEndpoint() {
    return { hidden: true };
  }
}
pragmaticivan commented 3 years ago

You might be able to do that with Reflect.defineMetadata(metakey, metadata, descriptor.value);?