Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use io.meter() with anything other than default options #266

Open
nicholas-ochoa opened this issue Dec 12, 2019 · 3 comments
Open

Comments

@nicholas-ochoa
Copy link

It looks like the type definition for the io.meter() function is Metric (utils/metrics.d.ts) which does not have the properties needed for the io.meter() config object such as timeframe. As a result, this code doesn't work as expected:

import io from '@pm2/io';

export const metrics = {
  eventsPerHour: io.meter({
    name: 'events/hour',
    timeframe: 3600,
  }),
};

I'm getting a type error because the timeframe type doesn't exist on Metric.

[tsl] ERROR in F:\git\****\src\utils\metrics.ts(41,7)
      TS2345: Argument of type '{ name: string; timeframe: number; }' is not assignable to parameter of type 'Metric'.
  Object literal may only specify known properties, and 'timeframe' does not exist in type 'Metric'.

The documentation for io.meter() gives the following example however:

var meter = io.meter({
  name      : 'req/min',
  samples   : 1,
  timeframe : 60
})
@nicholas-ochoa
Copy link
Author

Any update?

@emaciel10
Copy link

Having the same issue. Have there been any updates here?

@nightwolfz
Copy link

This needs an update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants