Skip to content

Commit

Permalink
fix: ts declaration metrics option and getMetrics function
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyBerko authored and manast committed Apr 28, 2023
1 parent e1883f0 commit 11331b7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ declare namespace Bull {
limiter?: RateLimiter | undefined;

defaultJobOptions?: JobOptions | undefined;

metrics?: MetricsOpts; // Configure metrics
}

interface MetricsOpts {
maxDataPoints?: number; // Max number of data points to collect, granularity is fixed at one minute.
}

interface AdvancedSettings {
Expand Down Expand Up @@ -887,6 +893,27 @@ declare namespace Bull {
limit?: number
): Promise<Array<Job<T>>>;

/**
* Returns a promise that resolves to a Metrics object.
* @param type Job metric type either 'completed' or 'failed'
* @param start Start point of the metrics, where 0 is the newest point to be returned.
* @param end End point of the metrics, where -1 is the oldest point to be returned.
* @returns - Returns an object with queue metrics.
*/
getMetrics(
type: 'completed' | 'failed',
start?: number,
end?: number
) : Promise<{
meta: {
count: number;
prevTS: number;
prevCount: number;
};
data: number[];
count: number;
}>

/**
* Returns a promise that marks the start of a transaction block.
*/
Expand Down

0 comments on commit 11331b7

Please sign in to comment.