Giter Club home page Giter Club logo

nestjs-prom's Introduction

nestjs-prom v1.x

A prometheus module for Nest.

BREAKING CHANGE

nestjs-prom v0.2.x has been moved to stable/0.2 branch.

To migrate from v0.2 to v1.x please see Migrate from 0.2.x to 1.x

Installation

$ npm install --save @digikare/nestjs-prom prom-client

How to use

Import PromModule into the root ApplicationModule

import { Module } from '@nestjs/common';
import { PromModule } from '@digikare/nestjs-prom';

@Module({
  imports: [
    PromModule.forRoot({
      defaultLabels: {
        app: 'my_app',
        version: 'x.y.z',
      }
    }),
  ]
})
export class ApplicationModule {}

PromModule.forRoot options

Here the options available for PromModule.forRoot:

Option Type Default Description
defaultLabels Object<string, string number> {}
metricPath string /metrics Path to use to service metrics
withDefaultsMetrics boolean true enable defaultMetrics provided by prom-client
withDefaultController boolean true add internal controller to expose /metrics endpoints
withHttpMiddleware object {} Tttp middleware options for http requests metrics
withHttpMiddleware.enable boolean false Enable the middleware for http requests
withHttpMiddleware.timeBuckets number[] [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 10] The time buckets wanted
withHttpMiddleware.pathNormalizationExtraMasks RegEx[] [] The regexp mask for normalization

Http requests

To track the http requests metrics, simply set withHttpMiddleware.enable = true

By default, this feature is disabled.

import { Module } from '@nestjs/common';
import { PromModule } from '@digikare/nestjs-prom';

@Module({
  imports: [
    PromModule.forRoot({
      withHttpMiddleware: {
        enable: true,
      }
    }),
  ]
})
export class ApplicationModule {}

Setup metric

To setup a metric, the module provide multiple ways to get a metric.

Using PromService and Dependency Injection

By using PromService service with DI to get a metric.

@Injectable()
export class MyService {

  private readonly _counter: CounterMetric;
  private readonly _gauge: GaugeMetric,
  private readonly _histogram: HistogramMetric,
  private readonly _summary: SummaryMetric,

  constructor(
    private readonly promService: PromService,
  ) {
    this._counter = this.promService.getCounter({ name: 'my_counter' });
  }

  doSomething() {
    this._counter.inc(1);
  }

  reset() {
    this._counter.reset();
  }
}

Using Param Decorator

You have the following decorators:

  • @PromCounter()
  • @PromGauge()
  • @PromHistogram()
  • @PromSummary()

Below how to use it

import { CounterMetric, PromCounter } from '@digikare/nest-prom';

@Controller()
export class AppController {

  @Get('/home')
  home(
    @PromCounter('app_counter_1_inc') counter1: CounterMetric,
    @PromCounter({ name: 'app_counter_2_inc', help: 'app_counter_2_help' }) counter2: CounterMetric,
  ) {
    counter1.inc(1);
    counter2.inc(2);
  }

  @Get('/home2')
  home2(
    @PromCounter({ name: 'app_counter_2_inc', help: 'app_counter_2_help' }) counter: CounterMetric,
  ) {
    counter.inc(2);
  }
}
import { GaugeMetric, PromGauge } from '@digikare/nest-prom';

@Controller()
export class AppController {

  @Get('/home')
  home(
    @PromGauge('app_gauge_1') gauge1: GaugeMetric,
  ) {
    gauge1.inc(); // 1
    gauge1.inc(5); // 6
    gauge1.dec(); // 5
    gauge1.dec(2); // 3
    gauge1.set(10); // 10
  }
}

Metric class instances

If you want to counthow many instance of a specific class has been created:

@PromInstanceCounter()
export class MyClass {

}

Will generate a counter called: app_MyClass_instances_total

Metric method calls

If you want to increment a counter on each call of a specific method:

@Injectable()
export class MyService {
  @PromMethodCounter()
  doMyStuff() {

  }
}

Will generate a counter called: app_MyService_doMyStuff_calls_total and auto increment on each call

You can use that to monitor an endpoint

@Controller()
export class AppController {
  @Get()
  @PromMethodCounter() // will generate `app_AppController_root_calls_total` counter
  root() {
    // do your stuff
  }

  @Get('/login')
  @PromMethodCounter({ name: 'app_login_endpoint_counter' })  // set the counter name
  login() {
    // do your stuff
  }
}

Metric endpoint

The default metrics endpoint is /metrics this can be changed with the metricPath option

@Module({
  imports: [
    PromModule.forRoot({
      defaultLabels: {
        app: 'my_app',
      },
      metricPath: 'custom/uri',
    }),
  ],
})
export class MyModule

Now your metrics can be found at /custom/uri.

PS: If you have a global prefix, the path will be {globalPrefix}/metrics for the moment.

API

PromModule.forRoot() options

Option Type Default Description
defaultLabels Object<string, string number> {}
metricPath string /metrics Path to use to service metrics
withDefaultsMetrics boolean true enable defaultMetrics provided by prom-client
withDefaultController boolean true add internal controller to expose /metrics endpoints
withHttpMiddleware object {} To enable the http middleware for http metrics
withHttpMiddleware.enable boolean false Enable http middleware
withHttpMiddleware.timeBuckets number[] [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 10] The time buckets wanted
withHttpMiddleware.pathNormalizationExtraMasks RegEx[] [] The regexp mask for normalization

Decorators

  • @PromInstanceCounter() Class decorator, create and increment on each instance created
  • @PromMethodCounter() Method decorator, create and increment each time the method is called
  • @PromCounter() Param decorator, create/find counter metric
  • @PromGauge() Param decorator, create/find gauge metric
  • @PromHistogram() Param decorator, create/find histogram metric
  • @PromSummary() Param decorator, create/find summary metric

Auth/security

I do not provide any auth/security for /metrics endpoints. This is not the aim of this module, but depending of the auth strategy, you can apply a middleware on /metrics to secure it.

License

MIT licensed

nestjs-prom's People

Contributors

aeronotix avatar blackkopcap avatar dependabot[bot] avatar dlukanin avatar jakubknejzlik avatar spike008t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nestjs-prom's Issues

Nest can't resolve dependencies of the TestService (?, ControlAndReportApiService). Please make sure that the argument at index [0] is available in the ControlAndReportModule context.

[Nest] 26184 - 01/14/2020, 3:24:49 PM [ExceptionHandler] Nest can't resolve dependencies of the TestService (ControlAndReportApiService, ?). Please make sure that the argument at index [1] is available in the ControlAndReportModule context. +2ms
Error: Nest can't resolve dependencies of the TestService (ControlAndReportApiService, ?). Please make sure that the argument at index [1] is available in the ControlAndReportModule context.
at Injector.lookupComponentInExports (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:183:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Injector.resolveComponentInstance (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:143:33)
at async resolveParam (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:96:38)
at async Promise.all (index 1)
at async Injector.resolveConstructorParams (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:112:27)
at async Injector.loadInstance (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:78:9)
at async Injector.loadProvider (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:35:9)
at async Promise.all (index 4)
at async InstanceLoader.createInstancesOfProviders (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\instance-loader.js:41:9)

Current behavior
Whenever I do npm run start it gives me the above error and I am using the below code.

I followed the ReadMe instructions to used the digikare/nestjs-prom library into our project.
I added the following:
In app.module.ts :
@module({
imports: [
PromModule.forRoot({
defaultLabels: {
app: 'provision_alerter',
},
customUrl: 'order/metrics'
}),]

In test.module.ts:

@module({
imports:[
PromModule.forMetrics([
{
type: MetricType.Counter,
configuration: {
name: 'index_counter',
help: 'get count of test orders',
}
}]),
],
providers:[TestService, ControlAndReportApiService],
controllers:[TestController]
})
export class TestModule{}

In test.service.ts:

constructor(private readonly controlAndReportApiService: ControlAndReportApiService,
@InjectCounterMetric('index_counter') private readonly _counterMetric: CounterMetric,
) { }

async findTestOrders(): Promise<Order[]> {

const testOrders: Order[] = await getTestOrders();

this._counterMetric.inc(testOrders.length, new Date());

return testOrders;

}

Can someone please help me with this issue and let me know in case I am missing out something here?

@PromMethodCounter() does not end up in /metrics

I've added the PromModule to my top level module and in a service like below. From the docs i assumed /metrics would return a line starting with app_classname_update_... but i only get process, nodejs and http metrics. Am I missing something in the setup? (i tried also to add the PromModule to the module the service is in without success)

top level module:

@Module({
  imports: [
    PromModule.forRoot({
      withHttpMiddleware: {
        enable: true,
      },
    }),
    ...

service:

  @PromMethodCounter()
  async update(
    entity: BlockchainNetwork,
    name?: string,
    type?: ClusterServiceType,
    size?: ClusterServiceSize,
    forceJob = false
  ): Promise<BlockchainNetwork> {
    return this.genericUpdate(entity, name, type, size, forceJob);
  }

Add to the docs what is the unit of measurement for the http_requests_bucket

responseTime() time param in callback in ms (according to response-time lib docs), and in histogram.observe the value is divided by 1000 So I guess the values are in seconds. I think this should be stated in the docs.

Also I think it might be a good idea to add to the docs a simple prom query & graph to show the values. This is sometimes a huge help for getting up and running quickly

Fix compatibility with NestJS >= 8.0.0

NestJS >= 8.0.0 is not compatible with @digikare/[email protected]

NPM says:

npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR!   @nestjs/common@"^8.2.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^6.0.0 || ^7.0.0" from @digikare/[email protected]
npm ERR! node_modules/@digikare/nestjs-prom
npm ERR!   @digikare/nestjs-prom@"^1.0.0" from the root project

PromMethodCounter decorator breaks swagger documentation

When using the PromMethodCounter decorator on a controller function it will break the API documentation beginning from the line where the decorator was added.

Example

The following code generates API documentation for ApiOperation, ApiResponse and Data.
But it will not generate documentation for the query parameters.

    @Get()
    @ApiOperation({ title: 'Get something by query string' })
    @ApiResponse({ status: 200, type: Data, description: 'List of Data objects' })
    @PromMethodCounter()
    public async getAllData(@Query() query: GetByQuery): Promise<Data[]> {
        this.logger.info(`GET / by query`);
        return await this.dataService.loadAllData().toPromise();
    }

When I switch the order of decorators, only the basic documentation for the GET function is generated. Everything else is missing (also the model for Data)

    @Get()
    @PromMethodCounter()
    @ApiOperation({ title: 'Get something by query string' })
    @ApiResponse({ status: 200, type: Data, description: 'List of Data objects' })
    public async getAllData(@Query() query: GetByQuery): Promise<Data[]> {
        this.logger.info(`GET / by query`);
        return await this.dataService.loadAllData().toPromise();
    }

When I remove PromMethodCounter the API documentation is working as expected.

how to dynamically name for each function

this work well thanks. however, I have a service that has multiple functions and I would like to split and track each separately. the easiest way is to name the stat with the function, even append the name when it's invoked in the function? just starting the conversation cause I am not completely clear on how you implemented yet

can't set labelNames when getCounterMetric

getCounterMetric only accept name as params, and inside it calls findOrCreateCounter with the name, but findOrCreateCounter can accept labelNames as well.
When I call counter.inc({ uri: '/abc' }, 1), it throws error:
Added label "uri" is not included in initial labelset: []

how to use custom controller when withDefaultController: false

@digikare/nestjs-prom version: 0.2.5

I am trying to remove the /api/metrics from the autogenerated swagger spec.

const MyPromModule = PromModule.forRoot({
  defaultLabels: {
    app: 'my-api'
  },
  withDefaultsMetrics: true,
  withDefaultController: false, // set to false so custom controller is used
  useHttpCounterMiddleware: true
})
MyPromModule.controllers = [PromController.forRoot('api/metrics')]

and then PromController is a copy paste from source(but with @ApiExcludeEndpoint)

import { Controller, Get, Header } from "@nestjs/common";
import * as client from 'prom-client';
import { PATH_METADATA } from '@nestjs/common/constants';
import { ApiExcludeEndpoint } from "@nestjs/swagger";

@Controller()
export class PromController {
  @Get()
  @ApiExcludeEndpoint()
  @Header('Content-Type', client.register.contentType)
  index() {
    console.log('test')

    return client.register.metrics();
  }

  public static forRoot(path = 'metrics') {
    Reflect.defineMetadata(PATH_METADATA, path, PromController);

    return PromController;
  }
}

When I hit /api/metrics, client.register.metrics(); always returns empty string.

Allow dynamic module registration

It is not possible (as far as I understand) to initialise PromModule as a dynamic module.
This is important in order to config the prom client dynamically using configurations given at runtime

How to access the register

hey so i am having an issue where HMR is re-registering metrics after a request to the server. From the documentation and cursory look through the source I haven't been able to figure out how to access the register

here is the open github issue i am trying to solve:

siimon/prom-client#196

if you guys let me know i can pr the docs, thank you.

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

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

RANDOMBYTESREQUEST when running a jest e2e test

All tests are passing, but I get the following output:

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        19.384 s, estimated 20 s
Ran all test suites.

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  โ—  RANDOMBYTESREQUEST

      at rng (node_modules/@nestjs/common/node_modules/uuid/dist/rng.js:18:21)
      at Object.v4 (node_modules/@nestjs/common/node_modules/uuid/dist/v4.js:17:63)
      at Object.createParamDecorator (node_modules/@nestjs/common/decorators/http/create-route-param-metadata.decorator.js:14:30)
      at Object.<anonymous> (node_modules/@digikare/nestjs-prom/dist/common/prom-counter.decorator.js:6:32)

I added a timeout of 1000ms to afterEach and afterAll to give the system more time but I still get the error. I am even more confused since I am not using the decorators but only the promService to interact with prometheus.

Compiler Type-Checking errors

Hi,

the compiler outputs some errors for this library, so it's not possible to use it when your CI/CD contains type checking.

> tsc --noEmit

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:10:7 - error TS2314: Generic type 'Metric' requires 1 type argument(s).

10 }) => client.Metric;
         ~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:15:7 - error TS2314: Generic type 'Counter<T>' requires 1 type argument(s).

15 }) => client.Counter;
         ~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:20:7 - error TS2314: Generic type 'Gauge<T>' requires 1 type argument(s).

20 }) => client.Gauge;
         ~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:25:7 - error TS2314: Generic type 'Histogram<T>' requires 1 type argument(s).

25 }) => client.Histogram;
         ~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:30:7 - error TS2314: Generic type 'Summary<T>' requires 1 type argument(s).

30 }) => client.Summary;
         ~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:4:44 - error TS2314: Generic type 'Counter<T>' requires 1 type argument(s).

4 export declare class CounterMetric extends PromClient.Counter {
                                             ~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:6:42 - error TS2314: Generic type 'Gauge<T>' requires 1 type argument(s).

6 export declare class GaugeMetric extends PromClient.Gauge {
                                           ~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:8:46 - error TS2314: Generic type 'Histogram<T>' requires 1 type argument(s).

8 export declare class HistogramMetric extends PromClient.Histogram {
                                               ~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:10:44 - error TS2314: Generic type 'Summary<T>' requires 1 type argument(s).

10 export declare class SummaryMetric extends PromClient.Summary {
                                              ~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:14:20 - error TS2314: Generic type 'CounterConfiguration<T>' requires 1 type argument(s).

14     configuration: PromClient.CounterConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:18:20 - error TS2314: Generic type 'GaugeConfiguration<T>' requires 1 type argument(s).

18     configuration: PromClient.GaugeConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:22:20 - error TS2314: Generic type 'HistogramConfiguration<T>' requires 1 type argument(s).

22     configuration: PromClient.HistogramConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:26:20 - error TS2314: Generic type 'SummaryConfiguration<T>' requires 1 type argument(s).

26     configuration: PromClient.SummaryConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:7:38 - error TS2314: Generic type 'CounterConfiguration<T>' requires 1 type argument(s).

7     static forCounter(configuration: client.CounterConfiguration): DynamicModule;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:8:36 - error TS2314: Generic type 'GaugeConfiguration<T>' requires 1 type argument(s).

8     static forGauge(configuration: client.GaugeConfiguration): DynamicModule;
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:9:40 - error TS2314: Generic type 'HistogramConfiguration<T>' requires 1 type argument(s).

9     static forHistogram(configuration: client.HistogramConfiguration): DynamicModule;
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:10:38 - error TS2314: Generic type 'SummaryConfiguration<T>' requires 1 type argument(s).

10     static forSummary(configuration: client.SummaryConfiguration): DynamicModule;
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 17 errors.

Add option for custom controller

Something controller: MyCustomController in the options should do.

The expected behavior is:

  • If withDefaultController = true + controller = MyCustomController Then MyCustomController should be load over defaultController.
  • if withDefaultController = false + controller = MyCustomController Then MyCustomController should be load over defaultController.
  • if withDefaultController = false + controller = null Then no controller should be loaded.

Property based injection for PromService doesn't work

Property based injections for PromService doesn't work, here is a minimal reproduction repo: https://github.com/snigdha920/nestjs-promservice-reproduction-repo

While starting the app, you will see that the property defined using the property injection is undefined but using the constructor injection is okay:

[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [NestFactory] Starting Nest application...
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [InstanceLoader] PromCoreModule dependencies initialized +19ms
promServiceProperyInjection inside AppService constructor -  undefined
promServiceConstructorInjection inside AppService constructor -  PromService {}
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [InstanceLoader] PromModule dependencies initialized +1ms
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [RoutesResolver] AppController {/}: +2ms
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [RoutesResolver] PromController {/metrics}: +0ms
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [RouterExplorer] Mapped {/metrics, GET} route +0ms
[Nest] 36696  - 11/07/2022, 12:05:45 PM     LOG [NestApplication] Nest application successfully started +1ms

can't use histogram without the labelNames and buckets

I have the following histogram


this.usersHistogram = this.promService.getHistogram({
			name: 'users_histogram',
			help: 'Request duration',
			buckets: [0.1, 0.3, 0.5],
			labelNames: ['a1'],
		});

but if I remove the labelNames param, I get this error when starting the application

TypeError: Cannot read property 'forEach' of undefined
    at validateInput (/home/matheus/node_modules/@digikare/nestjs-prom/node_modules/prom-client/lib/histogram.js:166:9)
    at new Histogram (/home/matheus/node_modules/@digikare/nestjs-prom/node_modules/prom-client/lib/histogram.js:44:3)
    at findOrCreateMetric (/home/matheus/node_modules/@digikare/nestjs-prom/dist/common/prom.utils.js:50:20)
    at Object.findOrCreateHistogram (/home/matheus/node_modules/@digikare/nestjs-prom/dist/common/prom.utils.js:87:12)
    at PromService.getHistogram (/home/matheus/node_modules/@digikare/nestjs-prom/dist/prom.service.js:26:29)

And if I remove the buckets param, I get this error


TypeError: Cannot read property 'reduce' of undefined
    at new Histogram (/home/matheus/node_modules/@digikare/nestjs-prom/node_modules/prom-client/lib/histogram.js:51:40)
    at findOrCreateMetric (/home/matheus/node_modules/@digikare/nestjs-prom/dist/common/prom.utils.js:50:20)
    at Object.findOrCreateHistogram (/home/matheus/node_modules/@digikare/nestjs-prom/dist/common/prom.utils.js:87:12)
    at PromService.getHistogram (/home/matheus/node_modules/@digikare/nestjs-prom/dist/prom.service.js:26:29)

I'm trying to remove these params because the IHistogramMetricArguments says they are not required.

export interface IHistogramMetricArguments extends IMetricArguments {
    buckets?: number[];
}

export interface IMetricArguments {
    name: string;
    help?: string;
    labelNames?: string[];
    registry?: PromClient.Registry;
}

I'm using version 1.0.0

Example project

Is there an example project to quickly get things started

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.