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

feat: allow specifying timeout for cluster metrics aggregation #645

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vitush93
Copy link

Adds ability to specify cluster metrics aggregation timeout.

Overriding hard-coded timeout as a workaround for #628 where scraping in larger projects end up in a timeout most of the time.

@@ -36,10 +36,11 @@ class AggregatorRegistry extends Registry {
/**
* Gets aggregated metrics for all workers. The optional callback and
* returned Promise resolve with the same value; either may be used.
* @param {ClusterMetricsOptions|undefined} options Additional options for cluster metrics aggregation.
Copy link

@BourgoisMickael BourgoisMickael Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {ClusterMetricsOptions|undefined} options Additional options for cluster metrics aggregation.
* @param {ClusterMetricsOptions|undefined} options Additional options for cluster metrics aggregation.
* @param {number} [options.timeoutMs=5000] Timeout to wait for all workers to respond before error.

You can document the timeoutMs field as well

@@ -136,10 +136,11 @@ export class AggregatorRegistry<
> extends Registry<T> {
/**
* Gets aggregated metrics for all workers.
* @param {ClusterMetricsOptions|undefined} options Additional options for cluster metrics aggregation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {ClusterMetricsOptions|undefined} options Additional options for cluster metrics aggregation
* @param {ClusterMetricsOptions|undefined} options Additional options for cluster metrics aggregation
* @param {number} [options.timeoutMs=5000] Timeout to wait for all workers to respond before error.

@@ -192,6 +193,10 @@ export enum MetricType {
Summary,
}

export type ClusterMetricsOptions = {
timeoutMs?: number;
Copy link

@BourgoisMickael BourgoisMickael Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
timeoutMs?: number;
/** Timeout to wait for all workers to respond before error. */
timeoutMs?: number;

This can be documented as well

Copy link

@BourgoisMickael BourgoisMickael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Yes please we need this !
I hope author @SimenB @siimon can merge this soon

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

Successfully merging this pull request may close these issues.

2 participants